Beispiel #1
0
        /// <summary>
        /// 删除部门
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public string DelDepartment(HttpContext context)
        {
            var departmentBll = new DepartmentBLL();
            var employeeBll   = new EmployerBll();
            var id            = context.Request.Params["id"];
            var name          = context.Request.Params["name"];
            var employee      = new Employer
            {
                DeptId = id,
                Name   = name
            };

            try
            {
                var bdata = employeeBll.Exist(employee);

                switch (bdata)
                {
                case "1":
                    return("exist");

                case "0":
                    var bdata2 = departmentBll.Exist3(id);
                    switch (bdata2)
                    {
                    case "1":
                        return("exist2");
                    }
                    departmentBll.DelDepartment(id);
                    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");
        }