コード例 #1
0
ファイル: ResourceAjax.ashx.cs プロジェクト: evelh/Done
        /// <summary>
        /// 校验员工id是否在关系表中出现
        /// </summary>
        private void CheckPriResInTeam(HttpContext context, string ids, long priResId)
        {
            var result = false;
            var sdrDal = new sys_resource_department_dal();

            if (!string.IsNullOrEmpty(ids))
            {
                var resList = sdrDal.GetListByIds(ids);
                if (resList != null && resList.Count > 0)
                {
                    var thisResList = resList.Where(_ => _.resource_id == priResId).ToList();
                    if (thisResList != null && thisResList.Count > 0)
                    {
                        result = true;
                    }
                }
            }

            context.Response.Write(result);
        }
コード例 #2
0
ファイル: ResourceAjax.ashx.cs プロジェクト: evelh/Done
        /// <summary>
        /// 校验是否有重复员工
        /// </summary>
        private void CheckTeamRes(HttpContext context, string ids)
        {
            var result = false;
            var sdrDal = new sys_resource_department_dal();

            if (!string.IsNullOrEmpty(ids))
            {
                var resList = sdrDal.GetListByIds(ids);
                if (resList != null && resList.Count > 0)
                {
                    var resArr = resList.Select(_ => _.resource_id).ToList();
                    if (resArr != null && resArr.Count > 0)
                    {
                        if (resArr.Count != resList.Count)
                        {
                            result = false;
                        }
                    }
                }
            }
            context.Response.Write(result);
        }
コード例 #3
0
ファイル: ResourceAjax.ashx.cs プロジェクト: evelh/Done
        /// <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 }));
        }