public bool CheckReferencePersonNameExist(ReferencePerson referencePerson)
        {
            try
            {
                using (SqlConnection con = _databaseFactory.GetDBConnection())
                {
                    using (SqlCommand cmd = new SqlCommand())
                    {
                        if (con.State == ConnectionState.Closed)
                        {
                            con.Open();
                        }
                        cmd.Connection  = con;
                        cmd.CommandText = "[PSA].[CheckReferencePersonNameExist]";
                        cmd.Parameters.Add("@Code", SqlDbType.Int).Value      = referencePerson.Code;
                        cmd.Parameters.Add("@Name", SqlDbType.NVarChar).Value = referencePerson.Name;
                        cmd.CommandType = CommandType.StoredProcedure;
                        Object res = cmd.ExecuteScalar();
                        return(res.ToString() == "Exists" ? true : false);
                    }
                }
            }

            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemple #2
0
        public bool UpdateReferencePerson(ReferencePerson referencePerson, int profileID)
        {
            if (!String.IsNullOrEmpty(referencePerson.ReferencePersonName) &&
                !String.IsNullOrEmpty(referencePerson.ReferencePersonPosition) &&
                !String.IsNullOrEmpty(referencePerson.ReferencePersonCompany) &&
                !String.IsNullOrEmpty(referencePerson.EmailAddress))
            {
                if (referencePerson.ReferencePersonID == -2)
                {
                    return(false);
                }
                else if (referencePerson.ReferencePersonID == -1)
                {
                    // Add new
                    referencePerson.ProfileID = profileID;
                    referencePerson.IsDeleted = false;
                    this.ReferencePersonRepository.Insert(referencePerson);
                    this.Save();
                }
                else
                {
                    // Update
                    referencePerson.ProfileID = profileID;
                    referencePerson.IsDeleted = false;
                    this.ReferencePersonRepository.Update(referencePerson);
                    this.Save();
                }

                return(true);
            }

            return(false);
        }
Exemple #3
0
 public ActionResult Edit([Bind(Include = "Id,Name,PhoneNo,Address,Deleted")] ReferencePerson ReferencePerson)
 {
     if (ModelState.IsValid)
     {
         db.Update(ReferencePerson);
         return(RedirectToAction("Index"));
     }
     return(View(ReferencePerson));
 }
Exemple #4
0
        public ActionResult Delete(int id = 0)
        {
            ReferencePerson user = db.GetById(id);

            if (user == null)
            {
                return(HttpNotFound());
            }
            return(View(user));
        }
Exemple #5
0
        public ActionResult Details(int id = 0)
        {
            ReferencePerson ReferencePerson = db.GetById(id);

            if (ReferencePerson == null)
            {
                return(HttpNotFound());
            }
            return(View(ReferencePerson));
        }
        public ReferencePerson GetReferencePerson(int code)
        {
            ReferencePerson referencePerson = null;

            try
            {
                using (SqlConnection con = _databaseFactory.GetDBConnection())
                {
                    using (SqlCommand cmd = new SqlCommand())
                    {
                        if (con.State == ConnectionState.Closed)
                        {
                            con.Open();
                        }
                        cmd.Connection  = con;
                        cmd.CommandText = "[PSA].[GetReferencePerson]";
                        cmd.Parameters.Add("@Code", SqlDbType.Int).Value = code;
                        cmd.CommandType = CommandType.StoredProcedure;
                        using (SqlDataReader sdr = cmd.ExecuteReader())
                        {
                            if ((sdr != null) && (sdr.HasRows))
                            {
                                if (sdr.Read())
                                {
                                    referencePerson      = new ReferencePerson();
                                    referencePerson.Code = (sdr["Code"].ToString() != "" ? int.Parse(sdr["Code"].ToString()) : referencePerson.Code);
                                    referencePerson.Name = (sdr["Name"].ToString() != "" ? sdr["Name"].ToString() : referencePerson.Name);
                                    referencePerson.ReferenceTypeCode = (sdr["ReferenceTypeCode"].ToString() != "" ? int.Parse(sdr["ReferenceTypeCode"].ToString()) : referencePerson.ReferenceTypeCode);
                                    referencePerson.AreaCode          = (sdr["AreaCode"].ToString() != "" ? int.Parse(sdr["AreaCode"].ToString()) : referencePerson.AreaCode);
                                    referencePerson.Organization      = (sdr["Organization"].ToString() != "" ? (sdr["Organization"].ToString()) : referencePerson.Organization);
                                    referencePerson.Address           = (sdr["Address"].ToString() != "" ? (sdr["Address"].ToString()) : referencePerson.Address);
                                    referencePerson.Email             = (sdr["Email"].ToString() != "" ? (sdr["Email"].ToString()) : referencePerson.Email);
                                    referencePerson.PhoneNos          = (sdr["PhoneNos"].ToString() != "" ? (sdr["PhoneNos"].ToString()) : referencePerson.PhoneNos);
                                    referencePerson.FaxNos            = (sdr["FaxNos"].ToString() != "" ? (sdr["FaxNos"].ToString()) : referencePerson.FaxNos);
                                    referencePerson.GeneralNotes      = (sdr["GeneralNotes"].ToString() != "" ? (sdr["GeneralNotes"].ToString()) : referencePerson.GeneralNotes);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(referencePerson);
        }
        public List <ReferencePerson> GetReferencePersonSelectList()
        {
            List <ReferencePerson> referencePersonList = null;

            try
            {
                using (SqlConnection con = _databaseFactory.GetDBConnection())
                {
                    using (SqlCommand cmd = new SqlCommand())
                    {
                        if (con.State == ConnectionState.Closed)
                        {
                            con.Open();
                        }
                        cmd.Connection  = con;
                        cmd.CommandText = "[PSA].[GetReferencePersonForSelectList]";
                        cmd.CommandType = CommandType.StoredProcedure;
                        using (SqlDataReader sdr = cmd.ExecuteReader())
                        {
                            if ((sdr != null) && (sdr.HasRows))
                            {
                                referencePersonList = new List <ReferencePerson>();
                                while (sdr.Read())
                                {
                                    ReferencePerson referencePerson = new ReferencePerson();
                                    {
                                        referencePerson.Code = (sdr["Code"].ToString() != "" ? int.Parse(sdr["Code"].ToString()) : referencePerson.Code);
                                        referencePerson.Name = (sdr["Name"].ToString() != "" ? sdr["Name"].ToString() : referencePerson.Name);
                                    }
                                    referencePersonList.Add(referencePerson);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(referencePersonList);
        }
        public ActionResult Update([Bind(Include = "FullName, Gender, MaritalStatus, Nationality, Address, DateofBirth, PhoneNumber, CityID, District, IsVisible")]
                                   Contact contact,
                                   string skillList,
                                   [Bind(Include = "ProfileID, Name, YearOfExperience, HighestSchoolLevel_ID, LanguageID, Level_ID, MostRecentCompany, MostRecentPosition, CurrentJobLevel_ID, ExpectedPosition, ExpectedJobLevel_ID, ExpectedSalary, Objectives")]
                                   Profile profile, string expectedCity, string categoryID,
                                   [Bind(Include = "EmploymentHistoryID, Position, Company, WorkingTime, Description")] EmploymentHistory employmentHistory,
                                   [Bind(Include = "EducationHistoryID, Subject, School, SchoolLevel_ID, Achievement")] EducationHistory educationHistory,
                                   [Bind(Include = "ReferencePersonID, ReferencePersonName, ReferencePersonPosition, ReferencePersonCompany, EmailAddress, ReferencePersonPhoneNumber")] ReferencePerson referencePerson,
                                   string ButtonName)
        {
            AspNetUser jobseeker = profileUnitOfWork.AspNetUserRepository.Get(s => s.UserName == User.Identity.Name && s.IsActive == true).LastOrDefault();

            bool updateSkillResult = profileUnitOfWork.UpdateSkill(skillList, jobseeker.Id);

            bool contactResult = UpdateContact(contact);

            if ("Tạo mới".Equals(ButtonName))
            {
                if (jobseeker != null)
                {
                    Profile oldProfile = profileUnitOfWork.ProfileRepository.Get(s => s.Name == profile.Name && s.JobSeekerID == jobseeker.Id && s.IsDeleted == false).LastOrDefault();

                    if (oldProfile != null)
                    {
                        TempData["warningmessage"] = "Tên hồ sơ đã tồn tại, xin hãy tạo lại hồ sơ bằng tên khác!";
                        return(RedirectToAction("Update"));
                    }
                }
            }
            bool commonInfoResult        = UpdateCommonInfo(profile, expectedCity, categoryID);
            bool employmentHistoryResult = false;
            bool educationHistoryResult  = false;
            bool referencePersonResult   = false;

            if (commonInfoResult)
            {
                Profile updatedProfile = profileUnitOfWork.ProfileRepository.Get(s => s.Name == profile.Name).LastOrDefault();
                if (updatedProfile != null)
                {
                    int percentStatus = 25;

                    int profileID = updatedProfile.ProfileID;

                    employmentHistoryResult = profileUnitOfWork.UpdateEmploymentHistory(employmentHistory, profileID);
                    if (employmentHistoryResult)
                    {
                        percentStatus += 25;
                    }
                    educationHistoryResult = profileUnitOfWork.UpdateEducationHistory(educationHistory, profileID);
                    if (educationHistoryResult)
                    {
                        percentStatus += 25;
                    }
                    referencePersonResult = profileUnitOfWork.UpdateReferencePerson(referencePerson, profileID);
                    if (referencePersonResult)
                    {
                        percentStatus += 25;
                    }

                    updatedProfile.PercentStatus = percentStatus;
                    profileUnitOfWork.ProfileRepository.Update(updatedProfile);
                    profileUnitOfWork.Save();

                    if ("Tạo mới".Equals(ButtonName))
                    {
                        TempData["successmessage"] = "Tạo hồ sơ thành công.";
                    }
                    else
                    {
                        TempData["successmessage"] = "Cập nhật hồ sơ thành công.";
                    }

                    return(RedirectToAction("List"));
                }

                if ("Tạo mới".Equals(ButtonName))
                {
                    TempData["errormessage"] = "Tạo hồ sơ thất bại!";
                }
                else
                {
                    TempData["errormessage"] = "Cập nhật hồ sơ thất bại!";
                }

                return(RedirectToAction("Update"));
            }

            if ("Tạo mới".Equals(ButtonName))
            {
                TempData["errormessage"] = "Tạo hồ sơ thất bại!";
            }
            else
            {
                TempData["errormessage"] = "Cập nhật hồ sơ thất bại!";
            }

            return(RedirectToAction("Update", new { profileID = profile.ProfileID }));
        }
        public ActionResult Update(string profileID, string mode)
        {
            AspNetUser user = profileUnitOfWork.AspNetUserRepository.Get(s => s.UserName == User.Identity.Name).FirstOrDefault();

            if ("create".Equals(mode))
            {
                IEnumerable <Profile> profiles = profileUnitOfWork.ProfileRepository.Get(s => s.JobSeekerID == user.Id && s.IsDeleted == false).AsEnumerable();

                if (profiles.Count() >= 5)
                {
                    TempData["warningmessage"] = "Bạn chỉ được tạo tối đa 5 hồ sơ!";
                    return(RedirectToAction("List"));
                }
            }

            ProUpdateViewModel proUpdateViewModel = new ProUpdateViewModel();

            proUpdateViewModel.cities       = profileUnitOfWork.CityRepository.Get(filter: d => d.IsDeleted == false).OrderBy(d => d.Name).AsEnumerable();
            proUpdateViewModel.schoolLevels = profileUnitOfWork.SchoolLevelRepository.Get(filter: d => d.IsDeleted == false).OrderByDescending(d => d.LevelNum).AsEnumerable();
            proUpdateViewModel.languages    = profileUnitOfWork.LanguageRepository.Get(filter: d => d.IsDeleted == false).OrderBy(d => d.Name).AsEnumerable();
            proUpdateViewModel.levels       = profileUnitOfWork.LevelRepository.Get(filter: d => d.IsDeleted == false).OrderByDescending(d => d.LevelNum).AsEnumerable();
            proUpdateViewModel.jobLevels    = profileUnitOfWork.JobLevelRepository.Get(filter: d => d.IsDeleted == false).OrderByDescending(d => d.LevelNum).AsEnumerable();
            proUpdateViewModel.categories   = profileUnitOfWork.CategoryRepository.Get(filter: d => d.IsDeleted == false).OrderBy(d => d.Name).AsEnumerable();

            proUpdateViewModel.contact = profileUnitOfWork.ContactRepository.GetByID(profileUnitOfWork.AspNetUserRepository.Get(s => s.UserName == User.Identity.Name).FirstOrDefault().Id);
            if (proUpdateViewModel.contact == null)
            {
                proUpdateViewModel.contact             = new Contact();
                proUpdateViewModel.contact.DateofBirth = DateTime.Now;
            }

            IEnumerable <OwnSkill> ownSkillList = profileUnitOfWork.OwnSkillRepository.Get(s => s.JobSeekerID == user.Id).AsEnumerable();

            proUpdateViewModel.ownSkills = "";
            for (int i = 0; i < ownSkillList.Count(); i++)
            {
                if (i == 0)
                {
                    proUpdateViewModel.ownSkills = profileUnitOfWork.SkillRepository.GetByID(ownSkillList.ElementAt(i).Skill_ID).SkillTag;
                }
                else
                {
                    proUpdateViewModel.ownSkills += "," + profileUnitOfWork.SkillRepository.GetByID(ownSkillList.ElementAt(i).Skill_ID).SkillTag;
                }
            }

            proUpdateViewModel.commonInfoItem = new ProCommonInfoItem();
            if (!String.IsNullOrEmpty(profileID))
            {
                ViewBag.ButtonName = "Cập nhật";

                int profileIDNum = 0;
                try
                {
                    profileIDNum = Int32.Parse(profileID);
                }
                catch (Exception)
                {
                    TempData["warningmessage"] = "Lỗi dữ liệu!";
                    return(RedirectToAction("List"));
                }

                Profile profile = profileUnitOfWork.ProfileRepository.GetByID(profileIDNum);
                if (profile != null)
                {
                    if (profile.JobSeekerID != user.Id)
                    {
                        TempData["warningmessage"] = "Bạn không có quyền sửa hồ sơ này!";
                        return(RedirectToAction("List"));
                    }

                    ViewBag.ButtonName = "Cập nhật";

                    proUpdateViewModel.commonInfoItem.profile = profile;

                    ExpectedCity expectedCity = profileUnitOfWork.ExpectedCityRepository.Get(filter: d => d.ProfileID == profileIDNum && d.IsDeleted == false).FirstOrDefault();
                    if (expectedCity != null)
                    {
                        proUpdateViewModel.commonInfoItem.expectedCity = expectedCity.CityID;
                    }

                    ExpectedCategory expectedCategory = profileUnitOfWork.ExpectedCategoryRepository.Get(filter: d => d.ProfileID == profileIDNum && d.IsDeleted == false).FirstOrDefault();
                    if (expectedCategory != null)
                    {
                        proUpdateViewModel.commonInfoItem.categoryID = expectedCategory.CategoryID;
                    }

                    EmploymentHistory employmentHistory = profileUnitOfWork.EmploymentHistoryRepository.Get(s => s.ProfileID == profileIDNum && s.IsDeleted == false).FirstOrDefault();
                    if (employmentHistory != null)
                    {
                        proUpdateViewModel.employmentHistory = employmentHistory;
                    }
                    else
                    {
                        proUpdateViewModel.employmentHistory = new EmploymentHistory();
                        proUpdateViewModel.employmentHistory.EmploymentHistoryID = -1;
                    }

                    EducationHistory educationHistory = profileUnitOfWork.EducationHistoryRepository.Get(s => s.ProfileID == profileIDNum && s.IsDeleted == false).FirstOrDefault();
                    if (educationHistory != null)
                    {
                        proUpdateViewModel.educationHistory = educationHistory;
                    }
                    else
                    {
                        proUpdateViewModel.educationHistory = new EducationHistory();
                        proUpdateViewModel.educationHistory.EducationHistoryID = -1;
                    }

                    ReferencePerson referencePerson = profileUnitOfWork.ReferencePersonRepository.Get(s => s.ProfileID == profileIDNum && s.IsDeleted == false).FirstOrDefault();
                    if (referencePerson != null)
                    {
                        proUpdateViewModel.referencePerson = referencePerson;
                    }
                    else
                    {
                        proUpdateViewModel.referencePerson = new ReferencePerson();
                        proUpdateViewModel.referencePerson.ReferencePersonID = -1;
                    }
                }
                else
                {
                    ViewBag.ButtonName = "Tạo mới";

                    proUpdateViewModel.employmentHistory = new EmploymentHistory();
                    proUpdateViewModel.employmentHistory.EmploymentHistoryID = -1;
                    proUpdateViewModel.educationHistory = new EducationHistory();
                    proUpdateViewModel.educationHistory.EducationHistoryID = -1;
                    proUpdateViewModel.referencePerson = new ReferencePerson();
                    proUpdateViewModel.referencePerson.ReferencePersonID = -1;
                }
            }
            else
            {
                ViewBag.ButtonName = "Tạo mới";

                proUpdateViewModel.employmentHistory = new EmploymentHistory();
                proUpdateViewModel.employmentHistory.EmploymentHistoryID = -1;
                proUpdateViewModel.educationHistory = new EducationHistory();
                proUpdateViewModel.educationHistory.EducationHistoryID = -1;
                proUpdateViewModel.referencePerson = new ReferencePerson();
                proUpdateViewModel.referencePerson.ReferencePersonID = -1;
            }

            return(View(proUpdateViewModel));
        }
Exemple #10
0
 public void Update(ReferencePerson entity)
 {
     rep.Update(entity);
 }
Exemple #11
0
 public ReferencePerson Add(ReferencePerson entity)
 {
     return(rep.Add(entity));
 }
        public bool UpdateReferencePerson(ReferencePerson referencePerson, int profileID)
        {
            if (!String.IsNullOrEmpty(referencePerson.ReferencePersonName)
                && !String.IsNullOrEmpty(referencePerson.ReferencePersonPosition)
                && !String.IsNullOrEmpty(referencePerson.ReferencePersonCompany)
                && !String.IsNullOrEmpty(referencePerson.EmailAddress))
            {
                if (referencePerson.ReferencePersonID == -2)
                {
                    return false;
                }
                else if (referencePerson.ReferencePersonID == -1)
                {
                    // Add new
                    referencePerson.ProfileID = profileID;
                    referencePerson.IsDeleted = false;
                    this.ReferencePersonRepository.Insert(referencePerson);
                    this.Save();
                }
                else
                {
                    // Update
                    referencePerson.ProfileID = profileID;
                    referencePerson.IsDeleted = false;
                    this.ReferencePersonRepository.Update(referencePerson);
                    this.Save();
                }

                return true;
            }

            return false;
        }
 public bool CheckReferencePersonNameExist(ReferencePerson referencePerson)
 {
     return(_referencePersonRepository.CheckReferencePersonNameExist(referencePerson));
 }
 public object InsertUpdateReferencePerson(ReferencePerson referencePerson)
 {
     return(_referencePersonRepository.InsertUpdateReferencePerson(referencePerson));
 }
        public object InsertUpdateReferencePerson(ReferencePerson referencePerson)
        {
            SqlParameter outputStatus, outputCode = null;

            try
            {
                using (SqlConnection con = _databaseFactory.GetDBConnection())
                {
                    using (SqlCommand cmd = new SqlCommand())
                    {
                        if (con.State == ConnectionState.Closed)
                        {
                            con.Open();
                        }
                        cmd.Connection  = con;
                        cmd.CommandText = "[PSA].[InsertUpdateReferencePerson]";
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.Add("@IsUpdate", SqlDbType.Bit).Value = referencePerson.IsUpdate;
                        if (referencePerson.Code == 0)
                        {
                            cmd.Parameters.AddWithValue("@Code", DBNull.Value);
                        }

                        else
                        {
                            cmd.Parameters.Add("@Code", SqlDbType.Int).Value = referencePerson.Code;
                        }

                        cmd.Parameters.Add("@Name", SqlDbType.VarChar, 50).Value          = referencePerson.Name;
                        cmd.Parameters.Add("@ReferenceTypeCode", SqlDbType.Int).Value     = referencePerson.ReferenceTypeCode;
                        cmd.Parameters.Add("@AreaCode", SqlDbType.Int).Value              = referencePerson.AreaCode;
                        cmd.Parameters.Add("@Organization", SqlDbType.VarChar, 50).Value  = referencePerson.Organization;
                        cmd.Parameters.Add("@Address", SqlDbType.VarChar, 500).Value      = referencePerson.Address;
                        cmd.Parameters.Add("@Email", SqlDbType.VarChar, 150).Value        = referencePerson.Email;
                        cmd.Parameters.Add("@PhoneNos", SqlDbType.VarChar, 250).Value     = referencePerson.PhoneNos;
                        cmd.Parameters.Add("@FaxNos", SqlDbType.VarChar, 100).Value       = referencePerson.FaxNos;
                        cmd.Parameters.Add("@GeneralNotes", SqlDbType.NVarChar, -1).Value = referencePerson.GeneralNotes;
                        cmd.Parameters.Add("@CreatedBy", SqlDbType.NVarChar, 250).Value   = referencePerson.PSASysCommon.CreatedBy;
                        cmd.Parameters.Add("@CreatedDate", SqlDbType.DateTime).Value      = referencePerson.PSASysCommon.CreatedDate;
                        cmd.Parameters.Add("@UpdatedBy", SqlDbType.NVarChar, 250).Value   = referencePerson.PSASysCommon.UpdatedBy;
                        cmd.Parameters.Add("@UpdatedDate", SqlDbType.DateTime).Value      = referencePerson.PSASysCommon.UpdatedDate;
                        outputStatus           = cmd.Parameters.Add("@Status", SqlDbType.SmallInt);
                        outputStatus.Direction = ParameterDirection.Output;
                        outputCode             = cmd.Parameters.Add("@CodeOut", SqlDbType.Int);
                        outputCode.Direction   = ParameterDirection.Output;
                        cmd.ExecuteNonQuery();
                    }
                }
                switch (outputStatus.Value.ToString())
                {
                case "0":
                    throw new Exception(referencePerson.IsUpdate ? _appConst.UpdateFailure : _appConst.InsertFailure);

                case "1":
                    referencePerson.Code = int.Parse(outputCode.Value.ToString());
                    return(new
                    {
                        Code = outputCode.Value.ToString(),
                        Status = outputStatus.Value.ToString(),
                        Message = referencePerson.IsUpdate ? _appConst.UpdateSuccess : _appConst.InsertSuccess
                    });
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(new
            {
                Code = outputCode.Value.ToString(),
                Status = outputStatus.Value.ToString(),
                Message = referencePerson.IsUpdate ? _appConst.UpdateSuccess : _appConst.InsertSuccess
            });
        }
        public List <ReferencePerson> GetAllReferencePerson(ReferencePersonAdvanceSearch referencePersonAdvanceSearch)
        {
            List <ReferencePerson> referencePersonList = null;

            try
            {
                using (SqlConnection con = _databaseFactory.GetDBConnection())
                {
                    using (SqlCommand cmd = new SqlCommand())
                    {
                        if (con.State == ConnectionState.Closed)
                        {
                            con.Open();
                        }
                        cmd.Connection  = con;
                        cmd.CommandText = "[PSA].[GetAllReferencePerson]";
                        cmd.Parameters.Add("@SearchValue", SqlDbType.NVarChar, -1).Value = string.IsNullOrEmpty(referencePersonAdvanceSearch.SearchTerm) ? "" : referencePersonAdvanceSearch.SearchTerm.Trim();
                        cmd.Parameters.Add("@RowStart", SqlDbType.Int).Value             = referencePersonAdvanceSearch.DataTablePaging.Start;
                        if (referencePersonAdvanceSearch.DataTablePaging.Length == -1)
                        {
                            cmd.Parameters.AddWithValue("@Length", DBNull.Value);
                        }
                        else
                        {
                            cmd.Parameters.Add("@Length", SqlDbType.Int).Value = referencePersonAdvanceSearch.DataTablePaging.Length;
                        }
                        cmd.Parameters.Add("@ReferenceTypeCode", SqlDbType.Int).Value = referencePersonAdvanceSearch.AdvReferenceTypeCode;
                        cmd.Parameters.Add("@AreaCode", SqlDbType.Int).Value          = referencePersonAdvanceSearch.AdvAreaCode;
                        cmd.CommandType = CommandType.StoredProcedure;
                        using (SqlDataReader sdr = cmd.ExecuteReader())
                        {
                            if ((sdr != null) && (sdr.HasRows))
                            {
                                referencePersonList = new List <ReferencePerson>();
                                while (sdr.Read())
                                {
                                    ReferencePerson referencePerson = new ReferencePerson();
                                    {
                                        referencePerson.Code                      = (sdr["Code"].ToString() != "" ? int.Parse(sdr["Code"].ToString()) : referencePerson.Code);
                                        referencePerson.Name                      = (sdr["Name"].ToString() != "" ? sdr["Name"].ToString() : referencePerson.Name);
                                        referencePerson.ReferenceType             = new ReferenceType();
                                        referencePerson.ReferenceType.Description = (sdr["ReferenceType"].ToString() != "" ? (sdr["ReferenceType"].ToString()) : referencePerson.ReferenceType.Description);
                                        referencePerson.Area                      = new Area();
                                        referencePerson.Area.Description          = (sdr["Area"].ToString() != "" ? (sdr["Area"].ToString()) : referencePerson.Area.Description);
                                        referencePerson.Organization              = (sdr["Organization"].ToString() != "" ? sdr["Organization"].ToString() : referencePerson.Organization);
                                        referencePerson.Address                   = (sdr["Address"].ToString() != "" ? sdr["Address"].ToString() : referencePerson.Address);
                                        referencePerson.Email                     = (sdr["Email"].ToString() != "" ? sdr["Email"].ToString() : referencePerson.Email);
                                        referencePerson.PhoneNos                  = (sdr["PhoneNos"].ToString() != "" ? sdr["PhoneNos"].ToString() : referencePerson.PhoneNos);
                                        referencePerson.FaxNos                    = (sdr["FaxNos"].ToString() != "" ? sdr["FaxNos"].ToString() : referencePerson.FaxNos);
                                        referencePerson.GeneralNotes              = (sdr["GeneralNotes"].ToString() != "" ? sdr["GeneralNotes"].ToString() : referencePerson.GeneralNotes);
                                        // referencePerson.PSASysCommon = new PSASysCommon();
                                        // referencePerson.PSASysCommon.CreatedDateString = (sdr["CreatedDate"].ToString() != "" ? DateTime.Parse(sdr["CreatedDate"].ToString()).ToString(settings.DateFormat) : referencePerson.PSASysCommon.CreatedDateString);
                                        referencePerson.TotalCount    = (sdr["TotalCount"].ToString() != "" ? int.Parse(sdr["TotalCount"].ToString()) : referencePerson.TotalCount);
                                        referencePerson.FilteredCount = (sdr["FilteredCount"].ToString() != "" ? int.Parse(sdr["FilteredCount"].ToString()) : referencePerson.FilteredCount);
                                    }
                                    referencePersonList.Add(referencePerson);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(referencePersonList);
        }