public void TestSubscriberForBatch() { EntityPersistentSubscribeManager.AddSubscriber(subject => { new EntitySubscriber().Accept(subject); }); using (var db = new DbContext()) { var list = new List <Depts>(); for (var i = 0; i < 3; i++) { var d = Depts.New(); d.DeptID = i + 50; d.DeptName = "a" + i; list.Add(d); } list[1].DeptCode = "test"; db.Depts.Batch(list, (u, s) => u.Update(s)); } }
public AddDebtorViewModel(Depts deptor) { Deptor = deptor; }
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); }
public override object Do() { string msg = ""; #region 检查数据文件是否完整. string path = "C:\\CCFlowTemplete"; if (System.IO.Directory.Exists(path) == false) { msg += "@错误:约定的目录不存在服务器" + path + ",请把从ccflow备份的文件放入" + path; } //PortTables. string file = path + "\\PortTables.xml"; if (System.IO.File.Exists(file) == false) { msg += "@错误:约定的文件不存在," + file; } //SysTables. file = path + "\\SysTables.xml"; if (System.IO.File.Exists(file) == false) { msg += "@错误:约定的文件不存在," + file; } //FlowTables. file = path + "\\FlowTables.xml"; if (System.IO.File.Exists(file) == false) { msg += "@错误:约定的文件不存在," + file; } #endregion 检查数据文件是否完整. #region 1 装载流程基础表数据. DataSet ds = new DataSet(); ds.ReadXml(path + "\\FlowTables.xml"); //流程类别. FlowSorts sorts = new FlowSorts(); sorts.ClearTable(); DataTable dt = ds.Tables["WF_FlowSort"]; // sorts = QueryObject.InitEntitiesByDataTable(sorts, dt, null) as FlowSorts; foreach (FlowSort item in sorts) { item.DirectInsert(); //插入数据. } #endregion 1 装载流程基础表数据. #region 2 组织结构. ds = new DataSet(); ds.ReadXml(path + "\\PortTables.xml"); //Port_Emp. Emps emps = new Emps(); emps.ClearTable(); dt = ds.Tables["Port_Emp"]; emps = QueryObject.InitEntitiesByDataTable(emps, dt, null) as Emps; foreach (Emp item in emps) { item.DirectInsert(); //插入数据. } //Depts. Depts depts = new Depts(); depts.ClearTable(); dt = ds.Tables["Port_Dept"]; depts = QueryObject.InitEntitiesByDataTable(depts, dt, null) as Depts; foreach (Dept item in depts) { item.DirectInsert(); //插入数据. } //Stations. Stations stas = new Stations(); stas.ClearTable(); dt = ds.Tables["Port_Station"]; stas = QueryObject.InitEntitiesByDataTable(stas, dt, null) as Stations; foreach (Station item in stas) { item.DirectInsert(); //插入数据. } //EmpDepts. EmpDepts eds = new EmpDepts(); eds.ClearTable(); dt = ds.Tables["Port_EmpDept"]; eds = QueryObject.InitEntitiesByDataTable(eds, dt, null) as EmpDepts; foreach (EmpDept item in eds) { item.DirectInsert(); //插入数据. } //EmpStations. EmpStations ess = new EmpStations(); ess.ClearTable(); dt = ds.Tables["Port_EmpStation"]; ess = QueryObject.InitEntitiesByDataTable(ess, dt, null) as EmpStations; foreach (EmpStation item in ess) { item.DirectInsert(); //插入数据. } #endregion 2 组织结构. #region 3 恢复系统数据. ds = new DataSet(); ds.ReadXml(path + "\\SysTables.xml"); //枚举Main. SysEnumMains sems = new SysEnumMains(); sems.ClearTable(); dt = ds.Tables["Sys_EnumMain"]; sems = QueryObject.InitEntitiesByDataTable(sems, dt, null) as SysEnumMains; foreach (SysEnumMain item in sems) { item.DirectInsert(); //插入数据. } //枚举. SysEnums ses = new SysEnums(); ses.ClearTable(); dt = ds.Tables["Sys_Enum"]; ses = QueryObject.InitEntitiesByDataTable(ses, dt, null) as SysEnums; foreach (SysEnum item in ses) { item.DirectInsert(); //插入数据. } ////Sys_FormTree. //BP.Sys.SysFormTrees sfts = new SysFormTrees(); //sfts.ClearTable(); //dt = ds.Tables["Sys_FormTree"]; //sfts = QueryObject.InitEntitiesByDataTable(sfts, dt, null) as SysFormTrees; //foreach (SysFormTree item in sfts) //{ // try // { // item.DirectInsert(); //插入数据. // } // catch // { // } //} #endregion 3 恢复系统数据. #region 4.备份表单相关数据. if (1 == 2) { string pathOfTables = path + "\\SFTables"; System.IO.Directory.CreateDirectory(pathOfTables); SFTables tabs = new SFTables(); tabs.RetrieveAll(); foreach (SFTable item in tabs) { if (item.No.Contains(".")) { continue; } string sql = "SELECT * FROM " + item.No; ds = new DataSet(); ds.Tables.Add(BP.DA.DBAccess.RunSQLReturnTable(sql)); ds.WriteXml(pathOfTables + "\\" + item.No + ".xml"); } } #endregion 4 备份表单相关数据. #region 5.恢复表单数据. //删除所有的流程数据. MapDatas mds = new MapDatas(); mds.RetrieveAll(); foreach (MapData fl in mds) { //if (fl.FK_FormTree.Length > 1 || fl.FK_FrmSort.Length > 1) // continue; fl.Delete(); //删除流程. } //清除数据. SysFormTrees fss = new SysFormTrees(); fss.ClearTable(); // 调度表单文件。 string frmPath = path + "\\Form"; DirectoryInfo dirInfo = new DirectoryInfo(frmPath); DirectoryInfo[] dirs = dirInfo.GetDirectories(); foreach (DirectoryInfo item in dirs) { if (item.FullName.Contains(".svn")) { continue; } string[] fls = System.IO.Directory.GetFiles(item.FullName); if (fls.Length == 0) { continue; } SysFormTree fs = new SysFormTree(); fs.No = item.Name.Substring(0, item.Name.IndexOf('.')); fs.Name = item.Name.Substring(item.Name.IndexOf('.')); fs.ParentNo = "0"; fs.Insert(); foreach (string f in fls) { try { msg += "@开始调度表单模板文件:" + f; System.IO.FileInfo info = new System.IO.FileInfo(f); if (info.Extension != ".xml") { continue; } ds = new DataSet(); ds.ReadXml(f); MapData md = MapData.ImpMapData(ds, false); md.FK_FrmSort = fs.No; md.Update(); } catch (Exception ex) { msg += "@调度失败,文件:" + f + ",异常信息:" + ex.Message; } } } #endregion 5.恢复表单数据. #region 6.恢复流程数据. //删除所有的流程数据. Flows flsEns = new Flows(); flsEns.RetrieveAll(); foreach (Flow fl in flsEns) { fl.DoDelete(); //删除流程. } dirInfo = new DirectoryInfo(path + "\\Flow\\"); dirs = dirInfo.GetDirectories(); //删除数据. FlowSorts fsRoots = new FlowSorts(); fsRoots.ClearTable(); //生成流程树. FlowSort fsRoot = new FlowSort(); fsRoot.No = "99"; fsRoot.Name = "流程树"; fsRoot.ParentNo = "0"; fsRoot.DirectInsert(); foreach (DirectoryInfo dir in dirs) { if (dir.FullName.Contains(".svn")) { continue; } string[] fls = System.IO.Directory.GetFiles(dir.FullName); if (fls.Length == 0) { continue; } FlowSort fs = new FlowSort(); fs.No = dir.Name.Substring(0, dir.Name.IndexOf('.')); fs.Name = dir.Name.Substring(3); fs.ParentNo = fsRoot.No; fs.Insert(); foreach (string filePath in fls) { msg += "@开始调度流程模板文件:" + filePath; Flow myflow = BP.WF.Flow.DoLoadFlowTemplate(fs.No, filePath, ImpFlowTempleteModel.AsTempleteFlowNo); msg += "@流程:" + myflow.Name + "装载成功。"; System.IO.FileInfo info = new System.IO.FileInfo(filePath); myflow.Name = info.Name.Replace(".xml", ""); if (myflow.Name.Substring(2, 1) == ".") { myflow.Name = myflow.Name.Substring(3); } myflow.DirectUpdate(); } } #endregion 6.恢复流程数据. BP.DA.Log.DefaultLogWriteLineInfo(msg); //删除多余的空格. BP.WF.DTS.DeleteBlankGroupField dts = new DeleteBlankGroupField(); dts.Do(); //执行生成签名. GenerSiganture gs = new GenerSiganture(); gs.Do(); return(msg); }
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); } }
public void BindPer() { if (WebUser.Auth != null) { this.AddFieldSet("提示"); this.AddBR(); this.Add("您的登陆是授权模式,您不能查看个人信息。"); this.AddUL(); this.AddLi("<a href=\"javascript:ExitAuth('" + WebUser.Auth + "')\">退出授权模式</a>"); this.AddLi("<a href=" + this.PageID + ".aspx >设置</a>"); if (WebUser.IsWap) { this.AddLi("<a href='Home.aspx'>返回主页</a>"); } this.AddULEnd(); this.AddFieldSetEnd(); return; } if (WebUser.IsWap) { this.AddFieldSet("<a href=Home.aspx ><img src='/WF/Img/Home.gif' border=0 >主页</a>-<a href='" + this.PageID + ".aspx'>设置</a>-" + "基本信息" + WebUser.Auth); } else { this.AddFieldSet("基本信息" + WebUser.Auth); } this.Add("<p class=BigDoc >"); this.Add("用户帐号: <font color=green>" + WebUser.No + "</font> "); this.Add("<br>用户名: <font color=green>" + WebUser.Name + "</font> "); this.AddHR(); this.AddB("电子签字:<img src='/DataUser/Siganture/" + WebUser.No + ".jpg' border=1 onerror=\"this.src='/DataUser/Siganture/UnName.jpg'\"/> ,<a href='" + this.PageID + ".aspx?RefNo=Siganture' >设置/修改</a>。"); this.AddBR(); this.AddBR(); this.Add("主部门 : <font color=green>" + WebUser.FK_DeptName + "</font>"); this.AddBR(); this.AddBR(); BP.WF.Port.WFEmp au = new BP.WF.Port.WFEmp(WebUser.No); // this.Add(au.AuthorIsOK.ToString()); if (au.AuthorIsOK == false) { this.Add("授权情况:未授权 - <a href='" + this.PageID + ".aspx?RefNo=Auto' >执行授权</a>。"); } else { string way = ""; if (au.AuthorWay == 1) { way = "全部授权"; } else { way = "指定流程范围授权"; } this.Add("授权情况:授权给:<font color=green>" + au.Author + "</font>,授权日期: <font color=green>" + au.AuthorDate + "</font>,收回授权日期:<font color=green>" + au.AuthorToDate + "</font>。<br>我要:<a href=\"javascript:TakeBack('" + au.Author + "')\" >取消授权</a>;授权方式:<font color=green>" + way + "</font>,<a href=\"" + this.PageID + ".aspx?RefNo=AutoDtl&FK_Emp=" + au.Author + "\">我要修改授权信息</a>。"); } this.Add(" 我要:<a href='" + this.PageID + ".aspx?RefNo=Pass'>修改密码</a>"); this.AddBR("<hr><b>信息提示:</b><a href='" + this.PageID + ".aspx?RefNo=Profile'>设置/修改</a>"); this.Add("<br><br>接受短消息提醒手机号 : <font color=green>" + au.TelHtml + "</font>"); this.Add("<br><br>接受E-mail提醒 : <font color=green>" + au.EmailHtml + "</font>"); this.AddHR(); Stations sts = WebUser.HisStations; this.AddB("岗位/部门-权限"); this.AddBR(); this.AddBR("岗位权限"); foreach (Station st in sts) { this.Add(" - <font color=green>" + st.Name + "</font>"); } Depts depts = WebUser.HisDepts; this.AddBR(); this.AddBR(); this.Add("部门权限"); foreach (Dept st in depts) { this.Add(" - <font color=green>" + st.Name + "</font>"); } this.Add("</p>"); this.AddFieldSetEnd(); }
void btn_Save_Click(object sender, EventArgs e) { Cond cond = new Cond(); cond.Delete(CondAttr.ToNodeID, this.ToNodeID, CondAttr.DataFrom, (int)ConnDataFrom.Depts); Button btn = sender as Button; if (btn.ID == "Btn_Del") { this.Response.Redirect(this.Request.RawUrl, true); return; } cond.MyPK = this.GenerMyPK; if (cond.RetrieveFromDBSources() == 0) { cond.HisDataFrom = ConnDataFrom.Depts; cond.NodeID = this.FK_MainNode; cond.FK_Flow = this.FK_Flow; cond.ToNodeID = this.ToNodeID; cond.Insert(); } string val = ""; Depts sts = new Depts(); sts.RetrieveAllFromDBSource(); foreach (Dept st in sts) { if (this.Pub1.IsExit("CB_" + st.No) == false) { continue; } if (this.Pub1.GetCBByID("CB_" + st.No).Checked) { val += "@" + st.No; } } if (val == "") { cond.Delete(); return; } val += "@"; cond.OperatorValue = val; cond.FK_Flow = this.FK_Flow; cond.HisCondType = this.HisCondType; cond.FK_Node = this.FK_Node; switch (this.HisCondType) { case CondType.Flow: case CondType.Node: cond.Update(); this.Response.Redirect("CondDept.aspx?MyPK=" + cond.MyPK + "&FK_Flow=" + cond.FK_Flow + "&FK_Node=" + cond.FK_Node + "&FK_MainNode=" + cond.NodeID + "&CondType=" + (int)cond.HisCondType + "&FK_Attr=" + cond.FK_Attr, true); return; case CondType.Dir: cond.ToNodeID = this.ToNodeID; cond.Update(); this.Response.Redirect("CondDept.aspx?MyPK=" + cond.MyPK + "&FK_Flow=" + cond.FK_Flow + "&FK_Node=" + cond.FK_Node + "&FK_MainNode=" + cond.NodeID + "&CondType=" + (int)cond.HisCondType + "&FK_Attr=" + cond.FK_Attr + "&ToNodeID=" + this.Request.QueryString["ToNodeID"], true); return; default: throw new Exception("未设计的情况。"); } }
public void BindCond() { Cond cond = new Cond(); cond.MyPK = this.GenerMyPK; cond.RetrieveFromDBSources(); BP.WF.Node nd = new BP.WF.Node(this.FK_MainNode); BP.WF.Node tond = new BP.WF.Node(this.ToNodeID); this.Pub1.AddTable(); this.Pub1.AddTR(); this.Pub1.AddTDTitle("colspan=4", "部门选择"); this.Pub1.AddTREnd(); Depts sts = new Depts(); sts.RetrieveAllFromDBSource(); int idx = -1; foreach (Dept st in sts) { idx++; if (idx == 0) { this.Pub1.AddTR(); } CheckBox cb = new CheckBox(); cb.ID = "CB_" + st.No; cb.Text = st.Name; if (cond.OperatorValue.ToString().Contains("@" + st.No + "@")) { cb.Checked = true; } this.Pub1.AddTD(cb); if (idx == 3) { idx = -1; this.Pub1.AddTREnd(); } } switch (idx) { case 0: this.Pub1.AddTD(); this.Pub1.AddTD(); this.Pub1.AddTD(); this.Pub1.AddTREnd(); break; case 1: this.Pub1.AddTD(); this.Pub1.AddTD(); this.Pub1.AddTREnd(); break; case 2: this.Pub1.AddTD(); this.Pub1.AddTREnd(); break; } this.Pub1.AddTRSum(); this.Pub1.Add("<TD class=TD colspan=4 align=center>"); Button btn = new Button(); btn.ID = "Btn_Save"; btn.CssClass = "Btn"; btn.Text = "Save"; btn.Click += new EventHandler(btn_Save_Click); this.Pub1.Add(btn); btn = new Button(); btn.ID = "Btn_Del"; btn.CssClass = "Btn"; btn.Text = "Delete"; btn.Attributes["onclick"] = " return confirm('您确定要删除吗?');"; btn.Click += new EventHandler(btn_Save_Click); this.Pub1.Add(btn); this.Pub1.Add("</TD>"); this.Pub1.AddTREnd(); this.Pub1.AddTableEnd(); }
public void BindCond() { Cond cond = new Cond(); cond.MyPK = this.GenerMyPK; cond.RetrieveFromDBSources(); BP.WF.Node nd = new BP.WF.Node(this.FK_MainNode); BP.WF.Node tond = new BP.WF.Node(this.ToNodeID); 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(); Depts sts = new Depts(); sts.RetrieveAllFromDBSource(); int i = 0; foreach (Dept st in sts) { i++; if (i == 4) { i = 1; } if (i == 1) { Pub1.AddTR(); } CheckBox cb = new CheckBox(); cb.ID = "CB_" + st.No; cb.Text = st.Name; if (cond.OperatorValue.ToString().Contains("@" + st.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.AddBR(); Pub1.AddSpace(1); var btn = new LinkBtn(false, NamesOfBtn.Save, "保存"); btn.Click += new EventHandler(btn_Save_Click); this.Pub1.Add(btn); Pub1.AddSpace(1); btn = new LinkBtn(false, NamesOfBtn.Delete, "删除"); btn.Attributes["onclick"] = " return confirm('您确定要删除吗?');"; btn.Click += new EventHandler(btn_Save_Click); this.Pub1.Add(btn); }
/// <summary> /// 增量同步组织结构 /// </summary> /// <returns></returns> public string AnsyIncrementOrgToGPM() { string access_token = getAccessToken(); string url = "https://oapi.dingtalk.com/department/list?access_token=" + access_token; try { StringBuilder append = new StringBuilder(); string str = new HttpWebResponseUtility().HttpResponseGet(url); DepartMent_List departMentList = FormatToJson.ParseFromJson <DepartMent_List>(str); if (departMentList == null || departMentList.department == null || departMentList.department.Count == 0) { return("钉钉获取部门出错。"); } #region 获取钉钉组织结构,进行更新与新增 //增加跟部门 int deptIdx = 0; bool doSomeThing = false; //部门信息 foreach (DepartMentDetailInfo deptMentInfo in departMentList.department) { deptIdx++; doSomeThing = false; //增加部门,排除根目录 if (deptMentInfo.id != "1") { Dept dept = new Dept(); if (dept.IsExit(DeptAttr.No, deptMentInfo.id) == true) { if (dept.No == deptMentInfo.id && !dept.Name.Equals(deptMentInfo.name)) { doSomeThing = true; append.Append("\r\n部门名称发生变化:" + dept.Name + " --> " + deptMentInfo.name); } if (!dept.ParentNo.Equals(deptMentInfo.parentid)) { doSomeThing = true; append.Append("\r\n部门父级发生变化:" + dept.ParentNo + " --> " + deptMentInfo.parentid); } //有变化,更新 if (doSomeThing == true) { dept.No = deptMentInfo.id; dept.Name = deptMentInfo.name; dept.ParentNo = deptMentInfo.parentid; dept.DirectUpdate(); } } else { //不存在则新增 dept.No = deptMentInfo.id; dept.Name = deptMentInfo.name; dept.ParentNo = deptMentInfo.parentid; dept.DirectInsert(); append.Append("\r\n新增部门:" + deptMentInfo.id + " - " + deptMentInfo.name); } } //部门人员 DepartMentUser_List userList = GenerDeptUser_List(access_token, deptMentInfo.id); if (userList != null) { foreach (DepartMentUserInfo userInfo in userList.userlist) { Emp emp = new Emp(); emp.No = userInfo.userid; DeptEmp deptEmp = new DeptEmp(); //如果账户存在则人员信息不添加,添加关联表 if (emp.RetrieveFromDBSources() > 0) { if (!emp.Name.Equals(userInfo.name)) { emp.Name = userInfo.name; emp.DirectUpdate(); append.Append("\r\n人员名称发生变化:" + emp.Name + " --> " + userInfo.name); } deptEmp.MyPK = deptMentInfo.id + "_" + emp.No; if (deptEmp.RetrieveFromDBSources() > 0) { continue; } //增加人员归属部门 deptEmp.FK_Dept = deptMentInfo.id; deptEmp.FK_Emp = emp.No; deptEmp.DirectInsert(); append.Append("\r\n增加人员归属部门:" + emp.Name + " - " + deptMentInfo.name); continue; } //增加人员 emp.No = userInfo.userid; emp.Name = userInfo.name; emp.FK_Dept = deptMentInfo.id; emp.Tel = userInfo.mobile; emp.Email = userInfo.email; //emp.Idx = DataType.IsNullOrEmpty(userInfo.order) == true ? 0 : Int32.Parse(userInfo.order); emp.DirectInsert(); append.Append("\r\n增加人员:" + emp.Name + " 所属部门:" + deptMentInfo.name); //增加人员与部门对应表 deptEmp.MyPK = deptMentInfo.id + "_" + emp.No; deptEmp.FK_Dept = deptMentInfo.id; deptEmp.FK_Emp = emp.No; deptEmp.DirectInsert(); } } } #endregion #region GPM组织结构,在钉钉不存在进行删除部门与人员关系表,人员表不进行删除,删除业务人员表WF_Emp Depts gpm_Depts = new Depts(); gpm_Depts.RetrieveAllFromDBSource(); foreach (Dept gpm_Dept in gpm_Depts) { bool isHave = false; foreach (DepartMentDetailInfo ding_Dept in departMentList.department) { if (gpm_Dept.No.Equals(ding_Dept.id)) { isHave = true; break; } } //部门在钉钉不存在则进行删除:部门表、部门人员、部门人员岗位、部门职位、部门岗位 if (isHave == false) { //部门岗位 DeptStation deptStation = new DeptStation(); int iDeptStation = deptStation.Delete(DeptStationAttr.FK_Dept, gpm_Dept.No); //部门人员岗位 DeptEmpStation deptEmpStation = new DeptEmpStation(); int iDeptEmpStation = deptEmpStation.Delete(DeptEmpStationAttr.FK_Dept, gpm_Dept.No); //部门人员 DeptEmp deptEmp = new DeptEmp(); int iDeptEmp = deptEmp.Delete(DeptEmpAttr.FK_Dept, gpm_Dept.No); //部门表 Dept dt = new Dept(gpm_Dept.No); dt.Delete(); append.Append("\r\n删除部门:" + gpm_Dept.Name + " 部门全路径:" + gpm_Dept.NameOfPath); append.Append("\r\n 部门岗位 " + iDeptStation + " 条记录"); append.Append("\r\n 部门人员岗位 " + iDeptEmpStation + " 条记录"); append.Append("\r\n 部门人员 " + iDeptEmp + " 条记录"); } else { //组织结构人员 DeptEmps deptEmps = new DeptEmps(); QueryObject obj = new QueryObject(deptEmps); obj.AddWhere(DeptEmpAttr.FK_Dept, gpm_Dept.No); obj.addAnd(); obj.AddWhereNotIn(DeptEmpAttr.FK_Emp, "'admin'"); obj.DoQuery(); //部门下没有人员不需要处理 if (deptEmps == null || deptEmps.Count == 0) { continue; } //钉钉部门人员 DepartMentUser_List userList = GenerDeptUser_List(access_token, gpm_Dept.No); //部门下没有人员,清除部门下的所有人员 if (userList == null || userList.userlist.Count == 0) { append.Append("\r\n删除部门下的人员,部门:" + gpm_Dept.Name + " 部门全路径:" + gpm_Dept.NameOfPath); foreach (DeptEmp dt in deptEmps) { dt.Delete(); Emp ep = new Emp(); ep.No = dt.FK_Emp; ep.RetrieveFromDBSources(); append.Append("\r\n 人员编号:" + dt.FK_Emp + " 姓名:" + ep.Name); } continue; } //判断部门下的人员是否存在 foreach (DeptEmp deptEmp in deptEmps) { isHave = false; foreach (DepartMentUserInfo userInfo in userList.userlist) { if (deptEmp.FK_Emp.Equals(userInfo.userid)) { isHave = true; break; } } //不存在,删除 if (isHave == false) { deptEmp.Delete(); Emp ep = new Emp(); ep.No = deptEmp.FK_Emp; ep.RetrieveFromDBSources(); append.Append("\r\n删除部门下的人员,部门:" + gpm_Dept.Name + " 部门全路径:" + gpm_Dept.NameOfPath); append.Append("\r\n 人员编号:" + deptEmp.FK_Emp + " 姓名:" + ep.Name); } } } } //删除没包含在部门的人员 #endregion #region 处理部门名称全程 //OrgInit_NameOfPath nameOfPath = new OrgInit_NameOfPath(); //if (nameOfPath.IsCanDo) // nameOfPath.Do(); #endregion return(append.ToString()); } catch (Exception ex) { BP.DA.Log.DefaultLogWriteLineError(ex.Message); } return(null); }
void btn_Save_Click(object sender, EventArgs e) { Cond cond = new Cond(); cond.Delete(CondAttr.NodeID, this.FK_MainNode, CondAttr.ToNodeID, this.ToNodeID, CondAttr.CondType, (int)this.HisCondType); var btn = sender as LinkBtn; if (btn.ID == NamesOfBtn.Delete) { this.Response.Redirect(this.Request.RawUrl, true); return; } cond.MyPK = this.GenerMyPK; if (cond.RetrieveFromDBSources() == 0) { cond.HisDataFrom = ConnDataFrom.Depts; cond.NodeID = this.FK_MainNode; cond.FK_Flow = this.FK_Flow; cond.ToNodeID = this.ToNodeID; cond.Insert(); } string val = ""; Depts sts = new Depts(); sts.RetrieveAllFromDBSource(); foreach (Dept st in sts) { if (this.Pub1.IsExit("CB_" + st.No) == false) { continue; } if (this.Pub1.GetCBByID("CB_" + st.No).Checked) { val += "@" + st.No; } } if (val == "") { cond.Delete(); return; } val += "@"; cond.OperatorValue = val; cond.FK_Flow = this.FK_Flow; cond.HisCondType = this.HisCondType; cond.FK_Node = this.FK_Node; cond.ToNodeID = this.ToNodeID; #region //获取“指定的操作员”设置,added by liuxc,2015-10-7 cond.SpecOperWay = (SpecOperWay)Pub1.GetDDLByID("DDL_" + CondAttr.SpecOperWay).SelectedItemIntVal; if (cond.SpecOperWay != SpecOperWay.CurrOper) { cond.SpecOperPara = Pub1.GetTBByID("TB_" + CondAttr.SpecOperPara).Text; } else { cond.SpecOperPara = string.Empty; } #endregion switch (this.HisCondType) { case CondType.Flow: case CondType.Node: cond.Update(); this.Response.Redirect("CondDept.aspx?MyPK=" + cond.MyPK + "&FK_Flow=" + cond.FK_Flow + "&FK_Node=" + cond.FK_Node + "&FK_MainNode=" + cond.NodeID + "&CondType=" + (int)cond.HisCondType + "&FK_Attr=" + cond.FK_Attr + "&ToNodeID=" + this.Request.QueryString["ToNodeID"], true); break; case CondType.Dir: cond.ToNodeID = this.ToNodeID; cond.Update(); this.Response.Redirect("CondDept.aspx?MyPK=" + cond.MyPK + "&FK_Flow=" + cond.FK_Flow + "&FK_Node=" + cond.FK_Node + "&FK_MainNode=" + cond.NodeID + "&CondType=" + (int)cond.HisCondType + "&FK_Attr=" + cond.FK_Attr + "&ToNodeID=" + this.Request.QueryString["ToNodeID"], true); break; case CondType.SubFlow: cond.ToNodeID = this.ToNodeID; cond.Update(); this.Response.Redirect("CondDept.aspx?MyPK=" + cond.MyPK + "&FK_Flow=" + cond.FK_Flow + "&FK_Node=" + cond.FK_Node + "&FK_MainNode=" + cond.NodeID + "&CondType=" + (int)cond.HisCondType + "&FK_Attr=" + cond.FK_Attr + "&ToNodeID=" + this.Request.QueryString["ToNodeID"], true); break; default: throw new Exception("未设计的情况。"); } EasyUiHelper.AddEasyUiMessager(this, "保存成功!"); }
public void BindCond() { Cond cond = new Cond(); cond.MyPK = this.GenerMyPK; cond.RetrieveFromDBSources(); BP.WF.Node nd = new BP.WF.Node(this.FK_MainNode); BP.WF.Node tond = new BP.WF.Node(this.ToNodeID); 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(); Depts sts = new Depts(); sts.RetrieveAllFromDBSource(); int i = 0; foreach (Dept st in sts) { i++; if (i == 4) { i = 1; } if (i == 1) { Pub1.AddTR(); } CheckBox cb = new CheckBox(); cb.ID = "CB_" + st.No; cb.Text = st.Name; if (cond.OperatorValue.ToString().Contains("@" + st.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.AddBR(); #region //增加“指定的操作员”选项,added by liuxc,2015-10-7 var ddl = new DDL(); ddl.ID = "DDL_" + CondAttr.SpecOperWay; ddl.Width = 200; ddl.Items.Add(new ListItem("当前操作员", "0")); ddl.Items.Add(new ListItem("指定节点的操作员", "1")); ddl.Items.Add(new ListItem("指定表单字段作为操作员", "2")); ddl.Items.Add(new ListItem("指定操作员编号", "3")); ddl.SetSelectItem((int)cond.SpecOperWay); ddl.AutoPostBack = true; ddl.SelectedIndexChanged += new EventHandler(ddl_SelectedIndexChanged); Pub1.Add("指定的操作员:"); Pub1.Add(ddl); Pub1.AddBR(); Pub1.AddBR(); var lbl = new Label(); lbl.ID = "LBL1"; switch (cond.SpecOperWay) { case SpecOperWay.SpecNodeOper: lbl.Text = "节点编号:"; break; case SpecOperWay.SpecSheetField: lbl.Text = "表单字段:"; break; case SpecOperWay.SpenEmpNo: lbl.Text = "操作员编号:"; break; case SpecOperWay.CurrOper: lbl.Text = "参数:"; break; } Pub1.Add(lbl); var tb = new TB(); tb.ID = "TB_" + CondAttr.SpecOperPara; tb.Width = 200; tb.Text = cond.SpecOperPara; tb.Enabled = cond.SpecOperWay != SpecOperWay.CurrOper; Pub1.Add(tb); Pub1.AddSpace(1); Pub1.Add("多个值请用英文“逗号”来分隔。"); Pub1.AddBR(); Pub1.AddBR(); #endregion Pub1.AddSpace(1); var btn = new LinkBtn(false, NamesOfBtn.Save, "保存"); btn.Click += new EventHandler(btn_Save_Click); this.Pub1.Add(btn); Pub1.AddSpace(1); btn = new LinkBtn(false, NamesOfBtn.Delete, "删除"); btn.Attributes["onclick"] = " return confirm('您确定要删除吗?');"; btn.Click += new EventHandler(btn_Save_Click); this.Pub1.Add(btn); }
public AddDeptsViewModel(Depts debtor) { CurrentDeptor = debtor; }
/// <summary> /// 部门添加修改方法 /// </summary> /// <param name="item"></param> /// <returns></returns> public bool AddOrUpdateDao(Depts item) { var dao = new DeptsDao(); return(dao.AddOrUpdae(item)); }
public bool AddOrUpdate(Depts item, bool isAdd) { var szServices = new DbHelperEfSql <Depts>(); return(isAdd = true ? szServices.Add(item) : szServices.Update(item, c => c.DeptID == item.DeptID)); }