/// <summary> /// 保存 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void btn_Save_Click(object sender, EventArgs e) { DataTable dt = this.GetTable(); string emps = ""; foreach (Control ctl in this.Pub1.Controls) { CheckBox cb = ctl as CheckBox; if (cb == null || cb.ID == null || cb.ID.Contains("CBs_")) { continue; } if (cb.Checked == false) { continue; } emps += cb.ID.Replace("CB_", "") + ","; } if (emps.Length < 2) { this.Alert("您没有选择人员。"); return; } SelectAccpers ens = new SelectAccpers(); ens.Delete(SelectAccperAttr.FK_Node, this.FK_Node, SelectAccperAttr.WorkID, this.WorkID); string[] strs = emps.Split(','); foreach (string str in strs) { if (str == null || str == "") { continue; } SelectAccper en = new SelectAccper(); en.MyPK = this.FK_Node + "_" + this.WorkID + "_" + str; en.FK_Emp = str; en.FK_Node = this.FK_Node; en.WorkID = this.WorkID; en.Insert(); } #warning 刘文辉 保存收件人后调用发送按钮 BtnLab nd = new BtnLab(this.FK_Node); if (nd.SelectAccepterEnable == 1) { /*如果是1不说明直接关闭它.*/ ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "", "this.close();", true); } else { ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "", "send();", true); } }
public void BindByStation() { DataTable dt = this.GetTable(); //获取人员列表。 SelectAccpers accps = new SelectAccpers(); accps.Retrieve(SelectAccperAttr.FK_Node, this.FK_Node, SelectAccperAttr.WorkID, this.WorkID); Dept dept = new Dept(); string fk_dept = ""; this.Pub1.AddTable("width=100%"); string info = ""; if (WebUser.FK_Dept.Length > 2) { if (this.FK_Dept == WebUser.FK_Dept) { info = "<b><a href='Accepter.aspx?ToNode=" + this.ToNode + "&WorkID=" + this.WorkID + "&FK_Node=" + this.FK_Node + "&type=1&FK_Dept=" + WebUser.FK_Dept.Substring(0, WebUser.FK_Dept.Length - 2) + "'>上一级部门人员</b></a>|<b><a href='Accepter.aspx?ToNode=" + this.ToNode + "&WorkID=" + this.WorkID + "&FK_Node=" + this.FK_Node + "&type=1&FK_Dept=" + this.FK_Dept + "&IsNextDept=1' >下一级部门人员</b></a>"; } else { info = "<b><a href='Accepter.aspx?ToNode=" + this.ToNode + "&WorkID=" + this.WorkID + "&FK_Node=" + this.FK_Node + "&type=1&FK_Dept=" + WebUser.FK_Dept + "'>本部门人员</a></b>"; } } else { info = "<b><a href='Accepter.aspx?ToNode=" + this.ToNode + "&WorkID=" + this.WorkID + "&FK_Node=" + this.FK_Node + "&type=1&FK_Dept=" + WebUser.FK_Dept + "'>本部门人员</a> | <a href='Accepter.aspx?ToNode=" + this.ToNode + "&WorkID=" + this.WorkID + "&FK_Node=" + this.FK_Node + "&type=1&FK_Dept=" + this.FK_Dept + "&IsNextDept=1' >下一级部门人员</b></a>"; } BP.WF.Node toNode = new BP.WF.Node(this.MyToNode); this.Pub1.AddCaptionLeft("<span style='color:red'>选择 [" + toNode.Name + "]</span> 可选择范围:" + dt.Rows.Count + " 位。" + info); if (dt.Rows.Count > 50) { /*多于一定的数,就显示导航。*/ this.Pub1.AddTRSum(); this.Pub1.Add("<TD class=BigDoc colspan=5>"); foreach (DataRow dr in dt.Rows) { if (fk_dept != dr["FK_Dept"].ToString()) { fk_dept = dr["FK_Dept"].ToString(); dept = new Dept(fk_dept); dr["DeptName"] = dept.Name; this.Pub1.Add("<a href='#d" + dept.No + "' >" + dept.Name + "</a> "); } } this.Pub1.AddTDEnd(); this.Pub1.AddTREnd(); } int idx = -1; bool is1 = false; foreach (DataRow dr in dt.Rows) { idx++; if (fk_dept != dr["FK_Dept"].ToString()) { switch (idx) { case 0: break; case 1: this.Pub1.AddTD(); this.Pub1.AddTD(); this.Pub1.AddTD(); this.Pub1.AddTD(); this.Pub1.AddTREnd(); break; case 2: this.Pub1.AddTD(); this.Pub1.AddTD(); this.Pub1.AddTD(); this.Pub1.AddTREnd(); break; case 3: this.Pub1.AddTD(); this.Pub1.AddTD(); this.Pub1.AddTREnd(); break; case 4: this.Pub1.AddTD(); this.Pub1.AddTREnd(); break; default: throw new Exception("error"); } this.Pub1.AddTRSum(); fk_dept = dr["FK_Dept"].ToString(); string deptName = dr["DeptName"].ToString(); this.Pub1.AddTD("colspan=5 aligen=left class=FDesc ", "<a name='d" + dept.No + "'>" + deptName + "</a>"); this.Pub1.AddTREnd(); is1 = false; idx = 0; } string no = dr["No"].ToString(); string name = dr["Name"].ToString(); CheckBox cb = new CheckBox(); if (BP.WF.Glo.IsShowUserNoOnly) { cb.Text = no; } else { cb.Text = no + " " + name; } cb.ID = "CB_" + no; if (accps.Contains("FK_Emp", no)) { cb.Checked = true; } switch (idx) { case 0: is1 = this.Pub1.AddTR(is1); this.Pub1.AddTD(cb); break; case 1: case 2: case 3: this.Pub1.AddTD(cb); break; case 4: this.Pub1.AddTD(cb); this.Pub1.AddTREnd(); idx = -1; break; default: throw new Exception("error"); } this.Pub1.AddTREnd(); } this.Pub1.AddTableEnd(); this.Pub1.AddHR(); Button btn = new Button(); btn.Text = "保存"; btn.ID = "Btn_Save"; btn.CssClass = "Btn"; //btn.Width = 80; btn.Click += new EventHandler(btn_Save_Click); this.Pub1.Add(btn); }