Ejemplo n.º 1
0
        public string CheckDuplicateProfileName(Guid? ID, string profileName)
        {
            // Kiểm tra có check trùng dữ liệu hay không
            var hre_profileservices = new Hre_ProfileServices();
            Boolean ischeck = hre_profileservices.IsCheckDuplidateProfileName(UserLogin);

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

            if (ID == null)
            {
                ID = Guid.Empty;
            }
            string profile = null;
            string status = string.Empty;
            var actionService = new ActionService(UserLogin);
            var objs = new List<object>();
            objs.Add(ID);
            objs.Add(profileName);
            objs.Add(1);
            objs.Add(10000000);
            var profilename = actionService.GetData<Hre_ProfileEntity>(objs, ConstantSql.hrm_hr_sp_get_ProfileByProfileName, ref status).Select(s => new { s.ProfileName, s.CodeEmp }).ToList();
            var relativeNameByprofilename = actionService.GetData<Hre_RelativesEntity>(objs, ConstantSql.hrm_hr_sp_get_RelativeByProfileName, ref status).Select(s => new { s.CodeEmp, s.RelativeName }).ToList();
            if (profilename != null && profilename.Count >= 1)
            {
                foreach (var item in profilename)
                {
                    //if (item.CodeEmp == null)
                    //{
                    //    profile += item.ProfileName + ", ";
                    //}
                    profile += item.ProfileName + " - " + item.CodeEmp + ", ";
                }


            }

            if (relativeNameByprofilename != null && relativeNameByprofilename.Count >= 1)
            {

                string codeemp = "";
                foreach (var item in relativeNameByprofilename)
                {
                    //if (item.CodeEmp == null )
                    //{
                    //    profile += item.RelativeName + ", ";
                    //}
                    if (item.CodeEmp != codeemp)
                        profile += item.RelativeName + "(" + item.CodeEmp + "), ";
                    if (item.CodeEmp != null)
                        codeemp = item.CodeEmp.ToString();
                }

            }
            if (profile != null)
                profile = profile.Substring(0, profile.Length - 2);
            return profile;
        }