void btn_Click(object sender, EventArgs e) { // 组织维度数据源. BP.Pub.YFs ens1 = new BP.Pub.YFs(); ens1.RetrieveAll(); BP.Port.Emps ens2 = new BP.Port.Emps(); ens2.RetrieveAll(); //删除保存前的数据.(一定要按照条件删除.) BP.DA.DBAccess.RunSQL("DELETE FROM Demo_EmpCent WHERE 1=1 "); //创建一个空白的实体. EmpCent enData = new EmpCent(); foreach (BP.Port.Emp en2 in ens2) { foreach (BP.Pub.YF en1 in ens1) { float val = float.Parse(this.Pub1.GetTextBoxByID("TB_" + en1.No + "_" + en2.No).Text); enData.MyPK = en2.No + "_" + en1.No; enData.Cent = val; enData.FK_Emp = en2.No; enData.FK_NY = en1.No; enData.Insert(); //因为已经按照条件删除了,这里就直接执行insert. } } this.Response.Write("保存成功."); }
protected void Page_Load(object sender, EventArgs e) { // 演示矩阵输出. 也叫N宫格输出. BP.Port.Emps ens = new BP.Port.Emps(); ens.RetrieveAll(); int cols = 4; //定义显示列数 从0开始。 decimal widthCell = 100 / cols; this.Pub1.AddTable("width=100% border=0"); this.Pub1.AddCaption("矩阵输出,也叫n宫格输出,输出的列数可以变化."); int idx = -1; bool is1 = false; foreach (BP.Port.Emp en in ens) { idx++; if (idx == 0) { is1 = this.Pub1.AddTR(is1); } this.Pub1.AddTDBegin("width='" + widthCell + "%' border=0 valign=top"); #region 输出内容. this.Pub1.Add("<h2>姓名:" + en.Name + "</h2>"); this.Pub1.Add("部门:" + en.FK_DeptText); #endregion 输出内容. this.Pub1.AddTDEnd(); if (idx == cols - 1) { idx = -1; this.Pub1.AddTREnd(); } } while (idx != -1) { idx++; if (idx == cols - 1) { idx = -1; this.Pub1.AddTD(); this.Pub1.AddTREnd(); } else { this.Pub1.AddTD(); } } this.Pub1.AddTableEnd(); }
protected void Page_Load(object sender, EventArgs e) { #region 执行功能. switch (this.DoType) { case "Del": BP.Port.Emp en = new BP.Port.Emp(); en.No = this.RefNo; //en.Delete(); break; default: break; } #endregion 执行功能. this.Pub1.AddTable("width=100%"); this.Pub1.AddCaption("操作员列表"); this.Pub1.AddTR(); this.Pub1.AddTDTitle("序"); this.Pub1.AddTDTitle("编号"); this.Pub1.AddTDTitle("名称"); this.Pub1.AddTDTitle("部门"); this.Pub1.AddTDTitle("操作"); this.Pub1.AddTREnd(); BP.Port.Emps ens = new BP.Port.Emps(); ens.RetrieveAllFromDBSource(); int idx = 0; foreach (BP.Port.Emp en in ens) { idx++; this.Pub1.AddTR(); this.Pub1.AddTDIdx(idx); this.Pub1.AddTD(en.No); this.Pub1.AddTD(en.Name); this.Pub1.AddTD(en.FK_DeptText); this.Pub1.AddTD("<a href=\"javascript:Del('" + en.No + "')\" ><img src='/WF/Img/Btn/Delete.gif' border=0/>操作</a>"); this.Pub1.AddTREnd(); } this.Pub1.AddTableEnd(); }
public string Demo_HandlerEmps() { BP.Port.Emps emps = new BP.Port.Emps(); emps.RetrieveAll(); return(emps.ToJson()); }
/// <summary> /// 获取指定部门下一级子部门及人员列表 /// </summary> /// <returns></returns> public string Dot2DotTreeDeptEmpModel_GetSubDepts() { string parentid = this.GetRequestVal("parentid"); string nid = this.GetRequestVal("nodeid"); if (string.IsNullOrWhiteSpace(parentid)) { throw new Exception("参数parentid不能为空"); } if (string.IsNullOrWhiteSpace(nid)) { throw new Exception("参数nodeid不能为空"); } EasyuiTreeNode node = null; List <EasyuiTreeNode> d = new List <EasyuiTreeNode>(); BP.WF.Template.NodeEmps semps = new BP.WF.Template.NodeEmps(); semps.Retrieve(BP.WF.Template.NodeEmpAttr.FK_Node, int.Parse(nid)); if (BP.WF.Glo.OSModel == OSModel.OneOne) { BP.Port.Dept parentDept = new BP.Port.Dept(parentid); BP.Port.Depts depts = new BP.Port.Depts(); depts.Retrieve(BP.Port.DeptAttr.ParentNo, parentid, BP.Port.DeptAttr.Name); BP.Port.Emps emps = new BP.Port.Emps(); emps.Retrieve(BP.Port.EmpAttr.FK_Dept, parentid, BP.Port.EmpAttr.Name); //增加部门 foreach (BP.Port.Dept dept in depts) { node = new EasyuiTreeNode(); node.id = "DEPT_" + dept.No; node.text = dept.Name; node.iconCls = "icon-department"; node.attributes = new EasyuiTreeNodeAttributes(); node.attributes.No = dept.No; node.attributes.Name = dept.Name; node.attributes.ParentNo = dept.ParentNo; node.attributes.TType = "DEPT"; node.attributes.Code = BP.Tools.chs2py.ConvertStr2Code(dept.Name); node.state = "closed"; node.children = new List <EasyuiTreeNode>(); node.children.Add(new EasyuiTreeNode()); node.children[0].text = "loading..."; d.Add(node); } //增加人员 foreach (BP.Port.Emp emp in emps) { node = new EasyuiTreeNode(); node.id = "EMP_" + parentid + "_" + emp.No; node.text = emp.Name; node.iconCls = "icon-user"; node.@checked = semps.GetEntityByKey(BP.WF.Template.NodeEmpAttr.FK_Emp, emp.No) != null; node.attributes = new EasyuiTreeNodeAttributes(); node.attributes.No = emp.No; node.attributes.Name = emp.Name; node.attributes.ParentNo = parentDept.No; node.attributes.ParentName = parentDept.Name; node.attributes.TType = "EMP"; node.attributes.Code = BP.Tools.chs2py.ConvertStr2Code(emp.Name); d.Add(node); } } else { BP.GPM.Dept parentDept = new BP.GPM.Dept(parentid); BP.GPM.Depts depts = new BP.GPM.Depts(); depts.Retrieve(BP.GPM.DeptAttr.ParentNo, parentid, BP.GPM.DeptAttr.Name); BP.GPM.DeptEmps des = new BP.GPM.DeptEmps(); des.Retrieve(BP.GPM.DeptEmpAttr.FK_Dept, parentid); BP.GPM.Emps emps = new BP.GPM.Emps(); emps.RetrieveAll(BP.GPM.EmpAttr.Name); BP.GPM.Emp emp = null; //增加部门 foreach (BP.GPM.Dept dept in depts) { node = new EasyuiTreeNode(); node.id = "DEPT_" + dept.No; node.text = dept.Name; node.iconCls = "icon-department"; node.attributes = new EasyuiTreeNodeAttributes(); node.attributes.No = dept.No; node.attributes.Name = dept.Name; node.attributes.ParentNo = parentDept.No; node.attributes.ParentName = parentDept.Name; node.attributes.TType = "DEPT"; node.attributes.Code = BP.Tools.chs2py.ConvertStr2Code(dept.Name); node.state = "closed"; node.children = new List <EasyuiTreeNode>(); node.children.Add(new EasyuiTreeNode()); node.children[0].text = "loading..."; d.Add(node); } //增加人员 foreach (BP.GPM.DeptEmp de in des) { emp = emps.GetEntityByKey(BP.GPM.EmpAttr.No, de.FK_Emp) as BP.GPM.Emp; if (emp == null) { continue; } node = new EasyuiTreeNode(); node.id = "EMP_" + parentid + "_" + emp.No; node.text = emp.Name; node.iconCls = "icon-user"; node.@checked = semps.GetEntityByKey(BP.WF.Template.NodeEmpAttr.FK_Emp, emp.No) != null; node.attributes = new EasyuiTreeNodeAttributes(); node.attributes.No = emp.No; node.attributes.Name = emp.Name; node.attributes.ParentNo = parentDept.No; node.attributes.ParentName = parentDept.Name; node.attributes.TType = "EMP"; node.attributes.Code = BP.Tools.chs2py.ConvertStr2Code(emp.Name); d.Add(node); } } return(Newtonsoft.Json.JsonConvert.SerializeObject(d)); }
protected void Page_Load(object sender, EventArgs e) { #region 组织维度数据源. BP.Pub.YFs ens1 = new BP.Pub.YFs(); ens1.RetrieveAll(); BP.Port.Emps ens2 = new BP.Port.Emps(); ens2.RetrieveAll(); #endregion 组织维度数据源. // 组织数据源. EmpCents ensData = new EmpCents(); ensData.RetrieveAll(); //开始输出. this.Pub1.AddTable(); this.Pub1.AddCaption("员工月份考勤得分"); #region 输出维度1 this.Pub1.AddTR(); this.Pub1.AddTDTitle(); foreach (BP.Pub.YF en1 in ens1) { this.Pub1.AddTDTitle(en1.Name); } this.Pub1.AddTREnd(); #endregion 输出维度1 #region 输出表体 foreach (BP.Port.Emp en2 in ens2) { this.Pub1.AddTR(); this.Pub1.AddTD(en2.Name); foreach (BP.Pub.YF en1 in ens1) { TextBox tb = new TextBox(); tb.CssClass = "TBNum"; tb.ID = "TB_" + en1.No + "_" + en2.No; EmpCent enData = ensData.GetEntityByKey(EmpCentAttr.FK_Emp, en2.No, EmpCentAttr.FK_NY, en1.No) as EmpCent; if (enData == null) { tb.Text = "0"; this.Pub1.AddTD(tb); } else { tb.Text = enData.Cent.ToString(); this.Pub1.AddTD(tb); } } this.Pub1.AddTREnd(); } #endregion 输出表体 this.Pub1.AddTableEndWithHR(); Button btn = new Button(); btn.ID = "Btn_Save"; btn.Text = "保存"; btn.Click += new EventHandler(btn_Click); this.Pub1.Add(btn); }