예제 #1
0
        /// <summary>
        /// 修改部门
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public string EditDepartment(HttpContext context)
        {
            var departmentBll = new DepartmentBLL();
            var depid         = context.Request.Params["depid"];
            var depname       = context.Request.Params["depName"];
            var parId         = context.Request.Params["pId"];
            var department    = new Department {
                Id = depid, Name = depname, ParentDept = parId
            };

            try
            {
                var bdata = departmentBll.Exist2(department);
                switch (bdata)
                {
                case "1":
                    return("exist");

                case "0":
                    departmentBll.UpdateDepartment(department);
                    break;
                }
            }
            catch (Exception e)
            {
                Log.Error(e);
                return("false");
            }
            //操作日志
            if (null == context.Session[Constant.LoginUser])
            {
                return("2");
            }
            var oprlog = new OprLog
            {
                Operator   = ((Employer)(context.Session[Constant.LoginUser])).Name,
                OperResult = "成功",
                OprSrc     = "编辑部门",
                LogDate    = DateTime.Now
            };

            _oprLogBll.Add(oprlog);
            return("true");
        }