void btn_Click(object sender, EventArgs e) { var pm = new PushMsg(); pm.Retrieve(PushMsgAttr.FK_Event, this.Event, PushMsgAttr.FK_Node, this.NodeID); if (!string.IsNullOrWhiteSpace(pm.MyPK)) { pm.Delete(); } pm.FK_Event = this.Event; pm.FK_Node = int.Parse(this.NodeID); var ddl = Pub1.GetDDLByID("DDL_" + PushMsgAttr.PushWay); pm.PushWay = ddl.SelectedItemIntVal; pm.PushDoc = string.Empty; switch ((PushWay)pm.PushWay) { case PushWay.ByParas: #region 照系统指定参数 var rb = Pub1.GetRadioBtnByID("RB_0"); if (rb.Checked) { pm.PushDoc = "0"; pm.Tag = Pub1.GetTBByID("TB_" + PushMsgAttr.Tag).Text; } else { rb = Pub1.GetRadioBtnByID("RB_1"); if (rb.Checked) { pm.PushDoc = "1"; } pm.Tag = Pub1.GetDDLByID("DDL_" + PushMsgAttr.Tag).SelectedItemStringVal; } #endregion break; case PushWay.NodeWorker: #region 照指定结点的工作人员 CheckBox cb = null; foreach (var ctrl in Pub1.Controls) { cb = ctrl as CheckBox; if (cb == null || !cb.ID.StartsWith("CB_") || !cb.Checked) { continue; } pm.PushDoc += "@" + cb.ID.Substring(3) + "@"; } #endregion break; case PushWay.SpecDepts: #region 照指定的部门 foreach (var ctrl in Pub1.Controls) { cb = ctrl as CheckBox; if (cb == null || !cb.ID.StartsWith("CB_") || !cb.Checked) { continue; } pm.PushDoc += "@" + cb.ID.Substring(3) + "@"; } #endregion break; case PushWay.SpecEmps: #region 照指定的人员 var hid = Pub1.FindControl("HID_Users") as HiddenField; if (!string.IsNullOrWhiteSpace(hid.Value)) { pm.PushDoc = hid.Value.Split(',').Select(o => "@" + o + "@").Aggregate(string.Empty, (curr, next) => curr + next); } //foreach (var ctrl in Pub1.Controls) //{ // cb = ctrl as CheckBox; // if (cb == null || !cb.ID.StartsWith("CB_E_") || !cb.Checked) continue; // pm.PushDoc += "@" + cb.ID.Substring(5) + "@"; //} #endregion break; case PushWay.SpecSQL: #region 照指定的SQL查询语句 pm.PushDoc = Pub1.GetTBByID("TB_" + PushMsgAttr.PushDoc).Text; #endregion break; case PushWay.SpecStations: #region 照指定的岗位 foreach (var ctrl in Pub1.Controls) { cb = ctrl as CheckBox; if (cb == null || !cb.ID.StartsWith("CB_S_") || !cb.Checked) { continue; } pm.PushDoc += "@" + cb.ID.Substring(5) + "@"; } #endregion break; } pm.Save(); Response.Redirect(string.Format("ActionPush2Spec.aspx?NodeID={0}&MyPK={1}&Event={2}&FK_Flow={3}&tk={4}", NodeID, MyPK, Event, FK_Flow, new Random().NextDouble()), true); }