📄 3.aspx.cs
字号:
foreach(DataGridItem dgi in DataGrid0.Items)
{
CheckBox cb = (CheckBox)dgi.FindControl("CheckBox2");
if(cb.Checked)
{
i.x=dgi.Cells[0].Text.Trim();//约定大表格的第零colunm为不显示的colunm,为文件名
i.y="0";//预留别用
sItemp.add(i);
}
else
{
i.x=dgi.Cells[0].Text.Trim();
i.y="0";//预留别用
sItemp.delete(i);
}
}
sItemp.makeup();
}
//确定整笔
private void LinkButton3_Click(object sender, System.EventArgs e)
{
//Response.Write(this.DropDownList2.SelectedValue.ToString());
//开启和关闭功能键
LinkButton2.Enabled=true;
LinkButton3.Enabled=false;
LinkButton6.Enabled=false;
//得到首次批准人
string pz1=DropDownList2.SelectedValue.ToString();
//得到下载选择缓冲区
sItem sItemp=(sItem)Session["temp1"];
Item ii;
string strSql;
string downID=Session["downID"].ToString();
//有记录就先写申请记录
if(sItemp.count >0)
{
strSql="insert into bpdown(downID,sq,sqTime,sqNum,pz1,Flag) values";
strSql+="('"+downID+"','";
strSql+=Session["user"].ToString().Trim()+"','";
strSql+=DateTime.Now.Date.ToString().Trim();//"1999-9-9";
//对第一第二类用户 需要经过两道审批
if(Session["uA"].ToString()=="2" || Session["uA"].ToString()=="1")
strSql+="',"+sItemp.count+",'"+pz1+"','s')";
else //对第三第四类用户 直接让他下载
strSql+="',"+sItemp.count+",'"+"XXX"+"','b')";
c.ExecuteSql(strSql);
}
//没有就把序号释放掉
else
{
Response.Write("你什么也没哟选呀!");
//调用序号减
Application.Lock();
int count=c.ExecuteSql2("select downID from bpxInf");
count-=1;
c.ExecuteSql("update bpxInf set downID ="+count);
Application.UnLock();
}
//如果有记录 那末 下面写选择对应的文件记录
for(int i=0;i<sItemp.count;i++)
{
ii =(Item) sItemp[i];
strSql = "insert into bpdown_bp(downID,fID) values ("+downID +","+ii.x.Trim()+")" ;//sItem.x应该在前面保存了图纸名称!
c.ExecuteSql(strSql);
}
//申请提交完毕之后才必须清除缓存!!!
sItemp.clear();
displayDGD();
}
/// <summary>
/// 查询
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
//查询功能
private void LinkButton1_Click(object sender, System.EventArgs e)
{
string strQ,str,str2,strTemp;
str=DropDownList1.SelectedValue.ToString();
Response.Write(str);
str=str.Trim();
str2=TextBox1.Text.ToString();
str2=str2.Trim();
//如果为专业 那末要把 str2中的专业 专业还是让人来选吧!
if (str=="zy")
{
str2=DropDownList4.SelectedValue.ToString();
}
if(!CB5.Checked)
{
strTemp=str+" like '%"+str2+"%' ";
Session["strTemp"]=strTemp;
}
else
{
strTemp=str+" like '%"+str2+"%' ";
if(Session["strTemp"].ToString().Trim()=="")
strTemp=Session["strTemp"].ToString() +strTemp;
else
strTemp=Session["strTemp"].ToString()+" and "+strTemp;
Session["strTemp"]=strTemp;
}//if(CB5.Checked)
strQ=sqlA; // bpName like '%%')";//
strQ+="and fID in (select fID from bp where ";
strQ+=strTemp;
strQ+="and Flag<>'s' and Flag<>'b')";//and bp.Flag<>'s' and bp.Flag<>'b'order by "+str;
Session["dataQueryStr"]=strQ;
//执页为1
DataGrid0.CurrentPageIndex = 0;
//邦定数据
DisplyQuery();
}
private void DropDownList1_SelectedIndexChanged(object sender, System.EventArgs e)
{
string str;
str=DropDownList1.SelectedValue.ToString();
str=str.Trim();//去掉空格
if (str=="zy")//处理字符串
{
TextBox1.Visible=false;
DropDownList4.Visible=true;
Load_dd(DropDownList4,"select * from bpzy ",c.conSTR,"chinese","dz");
}
else
{
DropDownList4.Visible=false;
TextBox1.Visible=true;
}
}
/// <summary>
/// 绑定显示用 三个
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void displayDGD()
{
//显示需要自己批示的东东 这条语句针对 3 类 别人这里没有任何显示
//DataGrid1.CurrentPageIndex=0;
Load_dgd(DataGrid1,sqlB+" where (Flag='s'and pz1='"+Session["user"].ToString().Trim()+"') or (Flag='a' and pz2='"+Session["user"].ToString().Trim()+"')",c.conSTR);
//Load_dgd(DataGrid1,sqlB+" where (Flag='s'or Flag='a')and ( pz1='"+Session["user"].ToString().Trim()+"'or pz2='"+Session["user"].ToString().Trim()+"')",c.conSTR);
//显示需要自己批示的东东 这条语句针对 2 类
//Load_dgd(DataGrid1,sqlB+" where Flag='s'and ( pz1='"+Session["user"].ToString().Trim()+"')",c.conSTR);
//显示自己所提出的东东 n y 不显示
//DataGrid2.CurrentPageIndex=0;
//Load_dgd(DataGrid2,sqlB+" where (Flag='a' or Flag='b' or Flag='z'or Flag='s' ) and sq='"+Session["user"].ToString().Trim()+"'",c.conSTR);
Load_dgd(DataGrid2,sqlB+" where (Flag='a' or Flag='b' or Flag='s' ) and sq='"+Session["user"].ToString().Trim()+"'",c.conSTR);
//除非为z 那末才不显示
}
private void DisplyQuery()
{
Load_dgd(DataGrid0,Session["dataQueryStr"].ToString(),c.conSTR);
}
//....
private void dislpayDGD3()
{
Load_dgd(DataGrid3,Session["sqlDisplay3"].ToString(),c.conSTR);;
}
/// <summary>
/// 审批
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
///
//确认本页
private void LinkButton4_Click(object sender, System.EventArgs e)
{
//写入缓冲
Item i;
//得到缓存
sItem sItemp=(sItem)Session["temp2"];
//千万不能在这里清理缓冲!!!
foreach(DataGridItem dgi in DataGrid3.Items)
{
CheckBox cb = (CheckBox)dgi.FindControl("CheckBox4");
if(cb.Checked)
{
i.x=dgi.Cells[0].Text.Trim();//约定大表格的第零colunm为不显示的colunm,为文件名
i.y="0";//预留别用
sItemp.add(i);
}
else
{
i.x=dgi.Cells[0].Text.Trim();
i.y="0";//预留别用
sItemp.delete(i);
}
}
sItemp.makeup();
}
//确认审批
private void LinkButton5_Click(object sender, System.EventArgs e)
{
//页面控制
this.LinkButton4.Enabled=true;
this.LinkButton5.Enabled=true;
//更新数据库
//displayDGD();
//复审者
string pz2=DropDownList3.SelectedValue.ToString();
//得到批准选择缓冲区
sItem sItemp=(sItem)Session["temp2"];
Item ii;
string strSql;
//当前选择!
string downID=Session["downID1"].ToString().Trim();
//有记录就先写申请记录
if(sItemp.count >0)
{
//如果数量大于0 那末这样
strSql="select Flag from bpdown where downID="+downID;
string F=c.ExecuteSql3(strSql);
//update bpdown set
// if flag==s
//pz2 =..... ,
//pz1Time=.... pz1Num=.... flag=a
// if flag==a
//pz2Time=.... pz2Num=.... flag=b
//where downID=Item (Session["downID1"])
if (F=="s")//一审
{
strSql ="update bpdown set pz2='"+pz2.Trim()+"' ,";
strSql+=" pz1Time= '"+DateTime.Now.Date.ToString().Trim()+"' ,";
strSql+=" pz1Num="+ sItemp.count+",";
strSql+=" Flag='a'";
}
else if(F=="a")//二审
{
strSql ="update bpdown set ";
strSql+=" pz2Time= '"+DateTime.Now.Date.ToString().Trim()+"' ,";
strSql+=" pz2Num="+ sItemp.count+",";
strSql+=" Flag='b'";
}
else
{
//如果执行到这那末准有问题!
}
c.ExecuteSql(strSql+"where downID='"+downID.Trim()+"'");
}
else
{
//如果数量==0 那末这样
//update bpdown set
// if flag==s
//pz2 =..... ,
//pz1Time=.... pz1Num=0 flag=z
// if flag==a
//pz2Time=.... pz2Num=0 flag=z
//where downID=Item (Session["downID1"])
strSql="select Flag from bpdown where downID="+downID;
string F=c.ExecuteSql3(strSql);
if (F=="s")//一审
{
strSql ="update bpdown set ";
strSql+=" pz1Time= '"+DateTime.Now.Date.ToString().Trim()+"' ,";
strSql+=" pz1Num="+ sItemp.count+",";//==0
strSql+=" Flag='b'";
}
else if(F=="a")//二审
{
strSql ="update bpdown set ";
strSql+=" pz2Time= '"+DateTime.Now.Date.ToString().Trim()+"' ,";
strSql+=" pz2Num="+ sItemp.count+",";
strSql+=" Flag='b'";
}
else
{
//如果执行到这那末准有问题!
}
c.ExecuteSql(strSql+"where downID='"+downID.Trim()+"'");
}
//删除所有的下载记录
strSql = "delete from bpdown_bp where downID='"+downID.Trim()+"'" ;//sItem.x应该在前面保存了图纸名称!
c.ExecuteSql(strSql);
//如果有被批准的记录 那末 下面写选择对应的文件记录
for(int i=0;i<sItemp.count;i++)
{
//重新插入一遍
ii =(Item) sItemp[i];
strSql = "insert into bpdown_bp(downID,fID) values ("+downID.Trim()+","+ii.x.Trim()+")" ;//sItem.x应该在前面保存了图纸名称!
c.ExecuteSql(strSql);
}
//申请提交完毕之后才必须清除缓存!!!
sItemp.clear();
DataGrid1.CurrentPageIndex=0;
DataGrid2.CurrentPageIndex=0;
displayDGD();
DataGrid3.CurrentPageIndex=0;
dislpayDGD3();
}
//不同颜色代表不同意义
private void DataGrid1_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
string str=e.Item.Cells[8].Text;//
switch(str)
{
case "s": e.Item.Cells[0].BackColor=Color.Yellow;
break;
case "a": e.Item.Cells[0].BackColor=Color.Green;
break;
}
}
private void DataGrid2_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
string str=e.Item.Cells[6].Text;//
switch(str)
{
case "s": e.Item.Cells[0].BackColor=Color.Yellow;
break;
case "a": e.Item.Cells[0].BackColor=Color.Green;
break;
case "b": e.Item.Cells[0].BackColor=Color.SkyBlue;
break;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -