예제 #1
0
        public string CheckDuplicateRelatives(Guid? ID, string name)
        {
            // Kiểm tra có check trùng dữ liệu hay không
            var hre_profileservices = new Hre_ProfileServices();
            Boolean ischeck = hre_profileservices.IsCheckDuplidateRelatives();

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

            if (ID == null)
            {
                ID = Guid.Empty;
            }
            string result = null;
            bool isduplicate = false;
            string status = string.Empty;
            var actionService = new ActionService(UserLogin);
            var objsRelative = new List<object>();
            objsRelative.Add(ID);
            objsRelative.Add(name);
            var lstRelativeName = actionService.GetData<Hre_RelativesEntity>(objsRelative, ConstantSql.hrm_hr_sp_get_Relativebyname, ref status).Select(s => new { s.RelativeName }).ToList();
            if (lstRelativeName != null && lstRelativeName.Count > 0)
            {
                foreach (var item in lstRelativeName)
                {
                    result += item.RelativeName + ", ";
                }
                result = result.Substring(0, result.Length - 2);
            }
            var objsProfile = new List<object>();
            objsProfile.Add(name);
            var lstProfileName = actionService.GetData<Hre_ProfileEntity>(objsProfile, ConstantSql.hrm_hr_sp_get_profilebyname, ref status).Select(s => new { s.CodeEmp, s.ProfileName }).ToList();

            if (lstProfileName != null && lstProfileName.Count > 0)
            {
                foreach (var item in lstProfileName)
                {
                    if (item.CodeEmp == null)
                    {
                        result += item.ProfileName + ", ";
                    }
                    result += item.ProfileName + " - " + item.CodeEmp + ", ";
                }
                result = result.Substring(0, result.Length - 2);
            }

            return result;
        }