void btn_Save_Click(object sender, EventArgs e) { BP.WF.Port.DeptFlowSearch dfs = new BP.WF.Port.DeptFlowSearch(); dfs.CheckPhysicsTable(); Depts ens = new Depts(); ens.RetrieveAll(); //删除已经有的数据。 string[] empStrs = this.Emps.Split(','); foreach (string s in empStrs) { if (string.IsNullOrEmpty(s)) { continue; } DBAccess.RunSQL("DELETE WF_DeptFlowSearch WHERE FK_Flow='" + this.FK_Flow + "' AND FK_Emp='" + s + "'"); } string depts = ""; dfs.FK_Flow = this.FK_Flow; foreach (Dept en in ens) { CheckBox cb = this.Pub1.GetCBByID("CB_" + en.No); if (cb == null) { continue; } if (cb.Checked == false) { continue; } dfs.FK_Dept = en.No; foreach (string s in empStrs) { if (string.IsNullOrEmpty(s)) { continue; } dfs.MyPK = en.No + "_" + s + "_" + this.FK_Flow; dfs.FK_Emp = s; dfs.Insert(); } } Button btn = sender as Button; if (btn.ID == "Btn_SaveAndClose") { this.WinCloseWithMsg("保存成功"); } else { this.Alert("保存成功!!"); } }
public void BindEmps() { this.Pub1.AddTable("width='100%'"); this.Pub1.AddCaptionLeft("<a href='DeptPower.aspx?FK_Flow=" + this.FK_Flow + "&IsSave=1' >返回</a> =》 第二步:部门查询权限设置"); Depts depts = new Depts(); depts.RetrieveAll(); string ctlIDs = ""; this.Pub1.AddTR(); this.Pub1.AddTDBegin(); foreach (Dept dept in depts) { CheckBox cb = new CheckBox(); cb.ID = "CB_" + dept.No; cb.Text = dept.No + " - " + dept.Name; this.Pub1.AddBR(); this.Pub1.Add(DataType.GenerSpace(dept.No.Length)); this.Pub1.Add(cb); ctlIDs += cb.ID + ","; } this.Pub1.AddTDEnd(); this.Pub1.AddTREnd(); this.Pub1.AddTableEnd(); CheckBox cball = new CheckBox(); cball.Text = "CB_All_S"; cball.Text = "<b>选择全部</b> "; cball.Attributes["onclick"] = "SetSelected(this,'" + ctlIDs + "')"; this.Pub1.Add(cball); Button btn = new Button(); btn.Text = "保存"; btn.ID = "Btn_Save"; btn.CssClass = "Btn"; this.Pub1.Add(btn); btn.Click += new EventHandler(btn_Save_Click); btn = new Button(); btn.Text = "保存并关闭"; btn.ID = "Btn_SaveAndClose"; btn.CssClass = "Btn"; btn.Click += new EventHandler(btn_Save_Click); this.Pub1.Add(btn); }
/// <summary> /// 执行 /// </summary> /// <returns>返回执行结果</returns> public override object Do() { try { Depts depts = new Depts(); depts.RetrieveAll(); foreach (Dept dept in depts) { dept.GenerNameOfPath(); } return("执行成功..."); } catch (Exception ex) { return("执行失败:" + ex.Message); } }
public void BindDept() { this.Pub1.AddTable("width='90%'"); this.Pub1.AddCaptionLeft("第一步:选择要设置的人员"); Depts depts = new Depts(); depts.RetrieveAll(); Emps emps = new Emps(); emps.RetrieveAll(); string ctlIDs = ""; foreach (Dept dept in depts) { CheckBox cbDept = new CheckBox(); cbDept.Text = "<b>" + dept.Name + "</b>"; cbDept.ID = "CB_S_all" + dept.No; this.Pub1.AddTR(); this.Pub1.AddTDTitle(cbDept); this.Pub1.AddTREnd(); this.Pub1.AddTR(); this.Pub1.AddTDBegin(); string ctlDeptIDs = ""; int idx = 0; foreach (Emp emp in emps) { if (emp.FK_Dept != dept.No) { continue; } idx++; CheckBox cb = new CheckBox(); cb.ID = "CB_" + emp.No; cb.Text = emp.Name; this.Pub1.Add(cb); ctlIDs += cb.ID + ","; ctlDeptIDs += cb.ID + ","; if (idx == 5) { this.Pub1.AddHR(); idx = 0; } } cbDept.Attributes["onclick"] = "SetSelected(this,'" + ctlDeptIDs + "')"; this.Pub1.AddTDEnd(); this.Pub1.AddTREnd(); } this.Pub1.AddTableEnd(); CheckBox cball = new CheckBox(); cball.Text = "CB_All_S"; cball.Text = "<b>选择全部</b> "; cball.Attributes["onclick"] = "SetSelected(this,'" + ctlIDs + "')"; this.Pub1.Add(cball); Button btn = new Button(); btn.Text = "选择要设置的权限人员后:下一步"; btn.ID = "Btn_Next"; btn.CssClass = "Btn"; btn.Click += new EventHandler(btn_Next_Click); this.Pub1.Add(btn); }
protected void Page_Load(object sender, EventArgs e) { PushMsgs msgs = new PushMsgs(this.FK_Flow); var msg = msgs.GetEntityByKey(PushMsgAttr.FK_Event, this.Event, PushMsgAttr.FK_Node, int.Parse(this.NodeID)) as PushMsg; if (msg == null) { msg = new PushMsg(); msg.FK_Event = this.Event; msg.FK_Node = int.Parse(this.NodeID); } if (!string.IsNullOrWhiteSpace(this.ThePushWay)) { if (this.ThePushWay != msg.PushWay.ToString()) { msg.PushDoc = string.Empty; msg.Tag = string.Empty; } msg.PushWay = int.Parse(this.ThePushWay); } this.Pub1.AddTable("class='Table' cellspacing='1' cellpadding='1' border='1' style='width:100%'"); this.Pub1.AddTR(); this.Pub1.AddTD("style='width:100px'", "推送设置方式:"); var ddl = new DDL(); ddl.BindSysEnum(PushMsgAttr.PushWay); ddl.ID = "DDL_" + PushMsgAttr.PushWay; ddl.SetSelectItem((int)msg.PushWay); ddl.AutoPostBack = true; ddl.SelectedIndexChanged += new EventHandler(ddl_SelectedIndexChanged); this.Pub1.AddTD(ddl); this.Pub1.AddTREnd(); switch ((PushWay)msg.PushWay) { case PushWay.ByParas: #region 照系统指定参数 Pub1.AddTR(); Pub1.AddTD("输入参数名:"); Pub1.AddTDBegin(); var rad = new RadioBtn(); rad.GroupName = "Para"; rad.ID = "RB_0"; rad.Text = "系统参数"; rad.Checked = msg.PushDoc == "0"; Pub1.Add(rad); var tb = new TB(); tb.ID = "TB_" + PushMsgAttr.Tag; if (msg.PushDoc == "0") { tb.Text = msg.Tag; } else { tb.Text = "NoticeTo"; } Pub1.Add(tb); Pub1.Add(" 默认为NoticeTo"); Pub1.AddBR(); rad = new RadioBtn(); rad.GroupName = "Para"; rad.ID = "RB_1"; rad.Text = "表单字段参数"; rad.Checked = msg.PushDoc == "1"; Pub1.Add(rad); MapAttrs attrs = new MapAttrs(); attrs.Retrieve(MapAttrAttr.FK_MapData, "ND" + this.NodeID); MapAttrs attrNs = new MapAttrs(); foreach (MapAttr attr in attrs) { if (attr.IsBigDoc) { continue; } switch (attr.KeyOfEn) { case "Title": case "FK_Emp": case "MyNum": case "FK_NY": case WorkAttr.Emps: case WorkAttr.OID: case StartWorkAttr.Rec: case StartWorkAttr.FID: continue; default: break; } attrNs.AddEntity(attr); } ddl = new DDL(); ddl.ID = "DDL_" + PushMsgAttr.Tag; ddl.BindEntities(attrNs, MapAttrAttr.MyPK, MapAttrAttr.Name); ddl.AutoPostBack = false; if (msg.PushDoc == "1") { ddl.SetSelectItem(msg.Tag); } Pub1.Add(ddl); Pub1.AddTREnd(); #endregion break; case PushWay.NodeWorker: #region 照指定结点的工作人员 Pub1.AddTR(); Pub1.AddTDBegin("colspan='2'"); Pub1.Add("请选择要推送到的节点工作人员:<br />"); Nodes nds = new Nodes(this.FK_Flow); CheckBox cb = null; foreach (BP.WF.Node nd in nds) { if (nd.NodeID == int.Parse(this.NodeID)) { continue; } cb = new CheckBox(); cb.ID = "CB_" + nd.NodeID; cb.Text = nd.NodeID + " " + nd.Name; cb.Checked = msg.PushDoc.Contains("@" + nd.NodeID + "@"); Pub1.Add(cb); Pub1.AddBR(); } Pub1.AddTDEnd(); Pub1.AddTREnd(); #endregion break; case PushWay.SpecDepts: #region 照指定的部门 Pub1.AddTR(); Pub1.AddTDBegin("colspan='2'"); this.Pub1.AddTable("class='Table' cellSpacing='1' cellPadding='1' border='1' style='width:100%'"); this.Pub1.AddTR(); this.Pub1.AddTD("colspan='3' class='GroupTitle'", "部门选择"); this.Pub1.AddTREnd(); //NodeDepts ndepts = new NodeDepts(int.Parse(this.NodeID)); Depts depts = new Depts(); depts.RetrieveAll(); int i = 0; //foreach (NodeDept dept in ndepts) foreach (Dept dept in depts) { i++; if (i == 4) { i = 1; } if (i == 1) { Pub1.AddTR(); } cb = new CheckBox(); //cb.ID = "CB_" + dept.FK_Dept; //cb.Text = (depts.GetEntityByKey(dept.FK_Dept) as Dept).Name; cb.ID = "CB_" + dept.No; cb.Text = dept.Name; //if (msg.PushDoc.Contains("@" + dept.FK_Dept + "@")) if (msg.PushDoc.Contains("@" + dept.No + "@")) { cb.Checked = true; } this.Pub1.AddTD(cb); if (i == 3) { Pub1.AddTREnd(); } } switch (i) { case 1: Pub1.AddTD(); Pub1.AddTD(); Pub1.AddTREnd(); break; case 2: Pub1.AddTD(); Pub1.AddTREnd(); break; default: break; } this.Pub1.AddTableEnd(); Pub1.AddTDEnd(); Pub1.AddTREnd(); #endregion break; case PushWay.SpecEmps: #region 照指定的人员 Pub1.AddTR(); //Pub1.AddTDBegin("colspan='2'"); Pub1.AddTD("选择人员:"); Pub1.AddTDBegin(); tb = new TB(); tb.ID = "TB_Users"; tb.TextMode = TextBoxMode.MultiLine; tb.Style.Add("width", "99%"); tb.Rows = 4; tb.ReadOnly = true; var hf = new HiddenField(); hf.ID = "HID_Users"; //加载已经选择的人员 if (!string.IsNullOrWhiteSpace(msg.PushDoc)) { hf.Value = msg.PushDoc.Replace("@@", ",").Trim('@'); var emps = new Emps(); emps.RetrieveAll(); tb.Text = hf.Value.Split(',').Select(o => (emps.GetEntityByKey(o) as Emp).Name).Aggregate( string.Empty, (curr, next) => curr + next + ",").TrimEnd(','); } Pub1.Add(tb); Pub1.Add(hf); Pub1.AddBR(); Pub1.AddBR(); Pub1.Add( "<a class='easyui-linkbutton' data-options=\"iconCls:'icon-user'\" href='javascript:void(0)' onclick=\"showWin('../Comm/Port/SelectUser_Jq.aspx','" + tb.ClientID + "','" + hf.ClientID + "');\">选择人员...</a>"); Pub1.AddTDEnd(); //Pub1.AddTable("class='Table' cellSpacing='1' cellPadding='1' border='1' style='width:100%'"); //depts = new Depts(); //depts.RetrieveAll(); //var emps = new Emps(); //emps.RetrieveAll(); //var empDepts = new EmpDepts(); //empDepts.RetrieveAll(); //var nemps = new NodeEmps(int.Parse(this.NodeID)); //Emp emp = null; //foreach (Dept dept in depts) //{ // this.Pub1.AddTR(); // var mycb = new CheckBox(); // mycb.Text = dept.Name; // mycb.ID = "CB_D_" + dept.No; // this.Pub1.AddTD("colspan='3' class='GroupTitle'", mycb); // this.Pub1.AddTREnd(); // i = 0; // string ctlIDs = ""; // foreach (EmpDept ed in empDepts) // { // if (ed.FK_Dept != dept.No) // continue; // //排除非当前结点绑定的人员 // if (nemps.GetEntityByKey(NodeEmpAttr.FK_Emp, ed.FK_Emp) == null) // continue; // i++; // if (i == 4) // i = 1; // if (i == 1) // Pub1.AddTR(); // emp = emps.GetEntityByKey(ed.FK_Emp) as Emp; // cb = new CheckBox(); // cb.ID = "CB_E_" + emp.No; // ctlIDs += cb.ID + ","; // cb.Text = emp.Name; // if (msg.PushDoc.Contains("@" + emp.No + "@")) // cb.Checked = true; // Pub1.AddTD(cb); // if (i == 3) // Pub1.AddTREnd(); // } // mycb.Attributes["onclick"] = "SetSelected(this,'" + ctlIDs + "')"; // switch (i) // { // case 1: // Pub1.AddTD(); // Pub1.AddTD(); // Pub1.AddTREnd(); // break; // case 2: // Pub1.AddTD(); // Pub1.AddTREnd(); // break; // default: // break; // } //} //Pub1.AddTableEnd(); //Pub1.AddTDEnd(); Pub1.AddTREnd(); #endregion break; case PushWay.SpecSQL: #region 照指定的SQL查询语句 Pub1.AddTR(); this.Pub1.AddTDBegin("colspan='2'"); this.Pub1.Add("SQL查询语句:<br />"); tb = new TB(); tb.ID = "TB_" + PushMsgAttr.PushDoc; tb.Columns = 50; tb.Style.Add("width", "99%"); tb.TextMode = TextBoxMode.MultiLine; tb.Rows = 4; tb.Text = msg.PushDoc; this.Pub1.Add(tb); this.Pub1.AddTDEnd(); Pub1.AddTREnd(); #endregion break; case PushWay.SpecStations: #region 照指定的岗位 Pub1.AddTR(); Pub1.AddTDBegin("colspan='2'"); if (BP.WF.Glo.OSModel == OSModel.WorkFlow) { SysEnums ses = new SysEnums("StaGrade"); Stations sts = new Stations(); sts.RetrieveAll(); string sql = "SELECT No,Name FROM Port_Station WHERE StaGrade NOT IN (SELECT IntKey FROM Sys_Enum WHERE EnumKey='StaGrade')"; DataTable dt = DBAccess.RunSQLReturnTable(sql); if (dt.Rows.Count != 0) { if (ses.Count == 0) { SysEnum se = new SysEnum(); se.EnumKey = "StaGrade"; se.Lab = "普通岗"; se.IntKey = 0; se.Insert(); ses.AddEntity(se); } foreach (Station st in sts) { st.StaGrade = 0; st.Save(); } } this.Pub1.AddTable("class='Table' cellSpacing='0' cellPadding='0' border='0' style='width:100%'"); foreach (SysEnum se in ses) { this.Pub1.AddTR(); CheckBox mycb = new CheckBox(); mycb.Text = se.Lab; mycb.ID = "CB_SG_" + se.IntKey; this.Pub1.AddTD("colspan='3' class='GroupTitle'", mycb); this.Pub1.AddTREnd(); i = 0; string ctlIDs = ""; foreach (Station st in sts) { if (st.StaGrade != se.IntKey) { continue; } i++; if (i == 4) { i = 1; } if (i == 1) { Pub1.AddTR(); } cb = new CheckBox(); cb.ID = "CB_S_" + st.No; ctlIDs += cb.ID + ","; cb.Text = st.Name; if (msg.PushDoc.Contains("@" + st.No + "@")) { cb.Checked = true; } Pub1.AddTD(cb); if (i == 3) { Pub1.AddTREnd(); } } mycb.Attributes["onclick"] = "SetSelected(this,'" + ctlIDs + "')"; switch (i) { case 1: Pub1.AddTD(); Pub1.AddTD(); Pub1.AddTREnd(); break; case 2: Pub1.AddTD(); Pub1.AddTREnd(); break; default: break; } } this.Pub1.AddTableEnd(); } else { /*BPM 模式*/ BP.GPM.StationTypes tps = new BP.GPM.StationTypes(); tps.RetrieveAll(); BP.GPM.Stations sts = new BP.GPM.Stations(); sts.RetrieveAll(); string sql = "SELECT No,Name FROM Port_Station WHERE FK_StationType NOT IN (SELECT No FROM Port_StationType)"; DataTable dt = DBAccess.RunSQLReturnTable(sql); if (dt.Rows.Count != 0) { if (tps.Count == 0) { var stp = new BP.GPM.StationType { No = "01", Name = "普通岗" }; stp.Save(); tps.AddEntity(stp); } //更新所有对不上岗位类型的岗位,岗位类型为01或第一个 foreach (BP.GPM.Station st in sts) { st.FK_StationType = tps[0].No; st.Update(); } } this.Pub1.AddTable("class='Table' cellSpacing='0' cellPadding='0' border='0' style='width:100%'"); foreach (BP.GPM.StationType tp in tps) { this.Pub1.AddTR(); CheckBox mycb = new CheckBox(); mycb.Text = tp.Name; mycb.ID = "CB_ST_" + tp.No; this.Pub1.AddTD("colspan='3' class='GroupTitle'", mycb); this.Pub1.AddTREnd(); i = 0; string ctlIDs = ""; foreach (BP.GPM.Station st in sts) { if (st.FK_StationType != tp.No) { continue; } i++; if (i == 4) { i = 1; } if (i == 1) { Pub1.AddTR(); } cb = new CheckBox(); cb.ID = "CB_S_" + st.No; ctlIDs += cb.ID + ","; cb.Text = st.Name; if (msg.PushDoc.Contains("@" + st.No + "@")) { cb.Checked = true; } this.Pub1.AddTD(cb); if (i == 3) { Pub1.AddTREnd(); } } mycb.Attributes["onclick"] = "SetSelected(this,'" + ctlIDs + "')"; switch (i) { case 1: Pub1.AddTD(); Pub1.AddTD(); Pub1.AddTREnd(); break; case 2: Pub1.AddTD(); Pub1.AddTREnd(); break; default: break; } } this.Pub1.AddTableEnd(); } #region 原逻辑,只考虑了一种模式,停用 //Pub1.AddTable("class='Table' cellSpacing='1' cellPadding='1' border='1' style='width:100%'"); //SysEnums ses = new SysEnums("StaGrade"); //Stations sts = new Stations(); //NodeStations nsts = new NodeStations(int.Parse(this.NodeID)); //sts.RetrieveAll(); //foreach (SysEnum se in ses) //{ // this.Pub1.AddTR(); // var mycb = new CheckBox(); // mycb.Text = se.Lab; // mycb.ID = "CB_SG_" + se.IntKey; // this.Pub1.AddTD("colspan=3 class='GroupTitle'", mycb); // this.Pub1.AddTREnd(); // i = 0; // string ctlIDs = ""; // foreach (Station st in sts) // { // if (st.StaGrade != se.IntKey) // continue; // //排除非当前结点的岗位 // if (nsts.GetEntityByKey(NodeStationAttr.FK_Station, st.No) == null) // continue; // i++; // if (i == 4) // i = 1; // if (i == 1) // Pub1.AddTR(); // cb = new CheckBox(); // cb.ID = "CB_S_" + st.No; // ctlIDs += cb.ID + ","; // cb.Text = st.Name; // if (msg.PushDoc.Contains("@" + st.No + "@")) // cb.Checked = true; // Pub1.AddTD(cb); // if (i == 3) // Pub1.AddTREnd(); // } // mycb.Attributes["onclick"] = "SetSelected(this,'" + ctlIDs + "')"; // switch (i) // { // case 1: // Pub1.AddTD(); // Pub1.AddTD(); // Pub1.AddTREnd(); // break; // case 2: // Pub1.AddTD(); // Pub1.AddTREnd(); // break; // default: // break; // } //} //Pub1.AddTableEnd(); #endregion Pub1.AddTDEnd(); Pub1.AddTREnd(); #endregion break; } Pub1.AddTableEnd(); Pub1.AddBR(); Pub1.AddSpace(1); var btn = new LinkBtn(false, NamesOfBtn.Save, "保存"); btn.Click += new EventHandler(btn_Click); Pub1.Add(btn); if (!string.IsNullOrWhiteSpace(msg.MyPK)) { Pub1.AddSpace(1); btn = new LinkBtn(false, NamesOfBtn.Delete, "删除"); btn.Click += new EventHandler(btn_Delete_Click); btn.Attributes["onclick"] = "return confirm('你确定要删除此消息推送设置吗?');"; Pub1.Add(btn); } }