示例#1
0
        /// <summary>
        /// 删除员工部门
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public bool DeleteDepartment(long id)
        {
            sys_resource_department_dal dptDal = new sys_resource_department_dal();
            var dpt = dptDal.FindById(id);

            if (dpt == null)
            {
                return(false);
            }

            dptDal.Delete(dpt);
            return(true);
        }
示例#2
0
        public bool DeleteResource(long id, long userId)
        {
            sys_resource_department_dal srdDal = new sys_resource_department_dal();
            var oldResDep = srdDal.FindById(id);

            if (oldResDep == null)
            {
                return(true);
            }
            srdDal.Delete(oldResDep);
            OperLogBLL.OperLogDelete <sys_resource_department>(oldResDep, oldResDep.id, userId, OPER_LOG_OBJ_CATE.SYS_RESOURCE_DEPARTMENT, "");
            return(true);
        }
示例#3
0
        /// <summary>
        /// 编辑队列员工
        /// </summary>
        public bool EditQueueResource(sys_resource_department resDep, long userId, ref string faileReason)
        {
            sys_resource_department_dal srdDal = new sys_resource_department_dal();

            if (!CheckResourceRole(resDep))
            {
                faileReason = "已存在该员工角色"; return(false);
            }
            var oldResDep = srdDal.FindById(resDep.id);

            if (oldResDep == null)
            {
                faileReason = "原数据已经删除"; return(false);
            }
            if (resDep.is_lead == 1 && oldResDep.is_lead != 1)  // && resDep.is_active ==1
            {
                ClearLeadResource(resDep.department_id, userId);
            }
            srdDal.Update(resDep);
            OperLogBLL.OperLogUpdate <sys_resource_department>(resDep, oldResDep, resDep.id, userId, OPER_LOG_OBJ_CATE.SYS_RESOURCE_DEPARTMENT, "");
            return(true);
        }
示例#4
0
        /// <summary>
        ///  检查是否有重复的员工存在(主负责人查找带回时使用,有重复员工直接移除)
        /// </summary>
        /// <param name="context"></param>
        private void CheckResInResDepIds(HttpContext context)
        {
            var isRepeatRes = false;
            var depResId    = context.Request.QueryString["resDepIds"];
            var priDepResId = context.Request.QueryString["resDepId"];

            if (!string.IsNullOrEmpty(depResId))
            {
                depResId = ClearRepeatRes(depResId);
            }
            var  isDelete = !string.IsNullOrEmpty(context.Request.QueryString["isDelete"]);
            long?priResId = null;
            var  srdDal   = new sys_resource_department_dal();

            if (!string.IsNullOrEmpty(priDepResId))
            {
                var priDepRes = srdDal.FindById(long.Parse(priDepResId));
                if (priDepRes != null)
                {
                    priResId = priDepRes.resource_id;
                }
            }
            var priRes = context.Request.QueryString["priRes"];

            if (!string.IsNullOrEmpty(priRes))
            {
                priResId = long.Parse(priRes);
            }
            if (!string.IsNullOrEmpty(depResId) && priResId != null)
            {
                var resDepList = srdDal.GetListByIds(depResId);
                if (resDepList != null && resDepList.Count > 0)
                {
                    var repeatResList = resDepList.Where(_ => _.resource_id == priResId).ToList();
                    if (repeatResList != null && repeatResList.Count > 0)
                    {
                        isRepeatRes = true;
                        if (isDelete)
                        {
                            foreach (var item in repeatResList)
                            {
                                resDepList.Remove(item);
                            }
                            string newDepResIds = "";
                            if (resDepList != null && resDepList.Count > 0)
                            {
                                resDepList.ForEach(_ => {
                                    newDepResIds += _.id.ToString() + ',';
                                });
                                if (newDepResIds != "")
                                {
                                    newDepResIds = newDepResIds.Substring(0, newDepResIds.Length - 1);
                                }
                            }
                            depResId = newDepResIds;
                        }
                    }
                }
            }
            context.Response.Write(new Tools.Serialize().SerializeJson(new { isRepeat = isRepeatRes, newDepResIds = depResId }));
        }