public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string deptIdString = context.Request.Form["did"]; string empIdsString = context.Request.Form["eids"]; if (string.IsNullOrEmpty(deptIdString)) { context.Response.Write("必须选择部门"); context.Response.End(); } if (string.IsNullOrEmpty(empIdsString)) { context.Response.Write("必须选择员工"); context.Response.End(); } int deptId = 0; List<int> empIds = new List<int>(); if (!int.TryParse(deptIdString, out deptId) || deptId == 0) { context.Response.Write("选择部门出错"); context.Response.End(); } NFMT.User.Model.Department dept = new NFMT.User.Model.Department(); dept.DeptId = deptId; string[] strs = empIdsString.Split('|'); List<NFMT.User.Model.Employee> emps = new List<NFMT.User.Model.Employee>(); foreach (string s in strs) { int empId = 0; if (!int.TryParse(s, out empId) || empId == 0) { context.Response.Write("选择员工出错"); context.Response.End(); } NFMT.User.Model.Employee emp = new NFMT.User.Model.Employee(); emp.EmpId = empId; emps.Add(emp); empIds.Add(empId); } NFMT.User.BLL.DeptEmpBLL bll = new NFMT.User.BLL.DeptEmpBLL(); NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser; NFMT.Common.ResultModel result = new NFMT.Common.ResultModel();//bll.DeptEmpAllot(user, dept, emps); context.Response.Write(result.Message); }
public void ProcessRequest(HttpContext context) { NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser; context.Response.ContentType = "text/plain"; int id = 0; int operateId = 0; if (!int.TryParse(context.Request.Form["id"], out id) || id <= 0) { context.Response.Write("序号错误"); context.Response.End(); } if (!int.TryParse(context.Request.Form["oi"], out operateId) || operateId <= 0) { context.Response.Write("操作错误"); context.Response.End(); } NFMT.User.BLL.DepartmentBLL bll = new NFMT.User.BLL.DepartmentBLL(); NFMT.User.Model.Department dept = new NFMT.User.Model.Department() { DeptId = id, LastModifyId = user.EmpId }; NFMT.Common.OperateEnum operateEnum = (NFMT.Common.OperateEnum)operateId; NFMT.Common.ResultModel result = new NFMT.Common.ResultModel(); switch (operateEnum) { case NFMT.Common.OperateEnum.作废: result = bll.Invalid(user, dept); break; case NFMT.Common.OperateEnum.撤返: result = bll.GoBack(user, dept); break; case NFMT.Common.OperateEnum.冻结: result = bll.Freeze(user, dept); break; case NFMT.Common.OperateEnum.解除冻结: result = bll.UnFreeze(user, dept); break; } context.Response.Write(result.Message); }
public void ProcessRequest(HttpContext context) { NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser; context.Response.ContentType = "text/plain"; int corpId = 0; string deptCode = context.Request.Form["DeptCode"]; string deptName = context.Request.Form["DeptName"]; string deptFullName = context.Request.Form["DeptFullName"]; string deptShort = context.Request.Form["DeptShort"]; int deptType = 0; int parentLeve = 0; int deptLevel = 0; string resultStr = "添加失败"; if (string.IsNullOrEmpty(deptName)) { resultStr = "部门名称不能为空"; context.Response.Write(resultStr); context.Response.End(); } if (!string.IsNullOrEmpty(context.Request.Form["CorpId"])) { if (!int.TryParse(context.Request.Form["CorpId"], out corpId)) { resultStr = "所属公司转换错误"; context.Response.Write(resultStr); context.Response.End(); } } if (!string.IsNullOrEmpty(context.Request.Form["DeptType"])) { if (!int.TryParse(context.Request.Form["DeptType"], out deptType)) { resultStr = "部门类型转换错误"; context.Response.Write(resultStr); context.Response.End(); } } if (!string.IsNullOrEmpty(context.Request.Form["ParentLeve"])) { if (!int.TryParse(context.Request.Form["ParentLeve"], out parentLeve)) { resultStr = "上级部门转换错误"; context.Response.Write(resultStr); context.Response.End(); } } if (!string.IsNullOrEmpty(context.Request.Form["DeptLevel"])) { if (!int.TryParse(context.Request.Form["DeptLevel"], out deptLevel)) { resultStr = "部门级别转换错误"; context.Response.Write(resultStr); context.Response.End(); } } NFMT.User.Model.Department dept = new NFMT.User.Model.Department() { CorpId = corpId, DeptCode = deptCode, DeptName = deptName, DeptFullName = deptFullName, DeptShort = deptShort, DeptType = deptType, ParentLeve = parentLeve, DeptLevel = deptLevel }; NFMT.User.BLL.DepartmentBLL deptBLL = new NFMT.User.BLL.DepartmentBLL(); var result = deptBLL.Insert(user, dept); resultStr = result.Message; context.Response.Write(resultStr); }