public ReturnResult <JobPosition> UpdateStatusJobPosition(JobPosition JobPosition)
        {
            ReturnResult <JobPosition> result = new ReturnResult <JobPosition>();;
            DbProvider db;

            try
            {
                db = new DbProvider();
                db.SetQuery("JobPosition_UpdateStatus", CommandType.StoredProcedure);
                db.SetParameter("Status", SqlDbType.TinyInt, JobPosition.Status);
                db.SetParameter("ErrorCode", SqlDbType.Int, DBNull.Value, ParameterDirection.Output);
                db.SetParameter("ErrorMessage", SqlDbType.NVarChar, DBNull.Value, 4000, ParameterDirection.Output);
                db.ExcuteNonQuery();
                db.Complete();
                db.GetOutValue("ErrorCode", out string errorCode);
                db.GetOutValue("ErrorMessage", out string errorMessage);
                if (errorCode.ToString() == "0")
                {
                    result.ErrorCode    = "0";
                    result.ErrorMessage = "";
                }
                else
                {
                    result.Failed(errorCode, errorMessage);
                }
            }
            catch (Exception ex)
            {
                result.Failed("-1", ex.Message);
            }
            return(result);
        }
Example #2
0
        public ReturnResult <BranchContact> GetAllBranchContact()
        {
            ReturnResult <BranchContact> result = new ReturnResult <BranchContact>();
            DbProvider db = new DbProvider();
            var        lstBranchContact = new List <BranchContact>();

            try
            {
                db.SetQuery("BranchContact_GetAll", System.Data.CommandType.StoredProcedure)
                .GetList <BranchContact>(out lstBranchContact)
                .Complete();

                if (lstBranchContact.Count > 0)
                {
                    result.ItemList     = lstBranchContact;
                    result.ErrorMessage = "";
                    result.ErrorCode    = "0";
                }
            }
            catch (Exception ex)
            {
                result.Failed("-1", ex.Message);
            }

            return(result);
        }
Example #3
0
        public ReturnResult <Skills> GetAllSkills()
        {
            ReturnResult <Skills> result = new ReturnResult <Skills>();
            DbProvider            db     = new DbProvider();
            var lstSkills = new List <Skills>();

            try
            {
                db.SetQuery("Skills_GetAll", System.Data.CommandType.StoredProcedure)
                .GetList <Skills>(out lstSkills)
                .Complete();

                if (lstSkills.Count > 0)
                {
                    result.ItemList     = lstSkills;
                    result.ErrorMessage = "";
                    result.ErrorCode    = "0";
                }
            }
            catch (Exception ex)
            {
                result.Failed("-1", ex.Message);
            }

            return(result);
        }
        public ReturnResult <RecruitmentNewsModel> GetRecruitmentNewPaging(BaseCondition <RecruitmentNewsModel> condition)
        {
            DbProvider provider = new DbProvider();
            List <RecruitmentNewsModel> list = new List <RecruitmentNewsModel>();
            string outCode    = String.Empty;
            string outMessage = String.Empty;
            string totalCount = String.Empty;
            var    result     = new ReturnResult <RecruitmentNewsModel>();

            try
            {
                provider.SetQuery("Inside_RecruitmentNews_GetAllPaging", System.Data.CommandType.StoredProcedure)
                //.SetParameter("Contain", condition.Contain, SqlDbType.NVarChar)
                .SetParameter("InWhere", SqlDbType.NVarChar, condition.IN_WHERE ?? String.Empty)
                .SetParameter("InSort", SqlDbType.NVarChar, condition.IN_SORT ?? String.Empty)
                .SetParameter("PageIndex", SqlDbType.Int, condition.PageIndex)
                .SetParameter("PageSize", SqlDbType.Int, condition.PageSize)
                .SetParameter("TotalCount", SqlDbType.Int, DBNull.Value, ParameterDirection.Output)
                .SetParameter("ErrorCode", SqlDbType.NVarChar, DBNull.Value, 100, ParameterDirection.Output)
                .SetParameter("ReturnMessage", SqlDbType.NVarChar, DBNull.Value, 4000, ParameterDirection.Output).GetList <RecruitmentNewsModel>(out list).Complete();

                if (list.Count > 0)
                {
                    result.ItemList = list;
                }
                provider.GetOutValue("ErrorCode", out outCode)
                .GetOutValue("ReturnMessage", out outMessage)
                .GetOutValue("TotalCount", out string totalRows);

                if (outCode != "0")
                {
                    result.ErrorCode    = outCode;
                    result.ErrorMessage = outMessage;
                }
                else
                {
                    result.ErrorCode    = "";
                    result.ErrorMessage = "";
                    result.TotalRows    = int.Parse(totalRows);
                }
            }
            catch (Exception ex)
            {
                result.Failed("-1", ex.Message);
            }
            return(result);
        }
        public ReturnResult <JobPosition> GetAllJobPositionWithSearchPaging(BaseCondition <JobPosition> condition)
        {
            DbProvider         provider     = new DbProvider();
            List <JobPosition> list         = new List <JobPosition>();
            string             outCode      = String.Empty;
            string             outMessage   = String.Empty;
            string             totalRecords = String.Empty;
            var result = new ReturnResult <JobPosition>();

            try
            {
                provider.SetQuery("JobPosition_GetAllWithSearchPaging", System.Data.CommandType.StoredProcedure)
                .SetParameter("InWhere", SqlDbType.NVarChar, condition.IN_WHERE ?? String.Empty)
                .SetParameter("InSort", SqlDbType.NVarChar, condition.IN_SORT ?? String.Empty)
                .SetParameter("StartRow", SqlDbType.Int, condition.PageIndex)
                .SetParameter("PageSize", SqlDbType.Int, condition.PageSize)
                .SetParameter("TotalRecords", SqlDbType.Int, DBNull.Value, ParameterDirection.Output)
                .SetParameter("ErrorCode", SqlDbType.NVarChar, DBNull.Value, 100, ParameterDirection.Output)
                .SetParameter("ErrorMessage", SqlDbType.NVarChar, DBNull.Value, 4000, ParameterDirection.Output).GetList <JobPosition>(out list).Complete();

                if (list.Count > 0)
                {
                    result.ItemList = list;
                }
                provider.GetOutValue("ErrorCode", out outCode)
                .GetOutValue("ErrorMessage", out outMessage)
                .GetOutValue("TotalRecords", out string totalRows);

                if (outCode != "0")
                {
                    result.ErrorCode    = outCode;
                    result.ErrorMessage = outMessage;
                }
                else
                {
                    result.ErrorCode    = "";
                    result.ErrorMessage = "";
                    result.TotalRows    = int.Parse(totalRows);
                }
            }
            catch (Exception ex)
            {
                result.Failed("-1", ex.Message);
            }
            return(result);
        }
Example #6
0
        public ReturnResult <CoQuan> InsertCoQuan(CoQuan coQuan)
        {
            DbProvider provider     = new DbProvider();
            var        result       = new ReturnResult <CoQuan>();
            string     outCode      = String.Empty;
            string     outMessage   = String.Empty;
            string     totalRecords = String.Empty;

            try
            {
                provider.SetQuery("[Organ_INSERT]", CommandType.StoredProcedure)
                .SetParameter("OrganCode", SqlDbType.NVarChar, coQuan.OrganCode)
                .SetParameter("TenCoQuan", SqlDbType.NVarChar, coQuan.TenCoQuan)
                .SetParameter("TinhID", SqlDbType.Int, coQuan.TinhID, ParameterDirection.Input)
                .SetParameter("HuyenID", SqlDbType.Int, coQuan.HuyenID, ParameterDirection.Input)
                .SetParameter("XaPhuongID", SqlDbType.Int, coQuan.XaPhuongID, ParameterDirection.Input)
                .SetParameter("LoaiCoQuan", SqlDbType.Int, coQuan.LoaiCoQuanID, ParameterDirection.Input)
                .SetParameter("CreateBy", SqlDbType.VarChar, coQuan.CreateBy, 50)
                .SetParameter("Description", SqlDbType.NVarChar, coQuan.Description, 1000)
                .SetParameter("Notes", SqlDbType.NVarChar, coQuan.Notes, 1000)
                .SetParameter("AddressDetail", SqlDbType.NVarChar, coQuan.AddressDetail, 500)
                .SetParameter("ErrorCode", SqlDbType.NVarChar, DBNull.Value, 100, ParameterDirection.Output)
                .SetParameter("ErrorMessage", SqlDbType.NVarChar, DBNull.Value, 4000, ParameterDirection.Output)
                .ExcuteNonQuery()
                .Complete();

                provider.GetOutValue("ErrorCode", out outCode)
                .GetOutValue("ErrorMessage", out outMessage);
                if (outCode != "0" || outCode == "")
                {
                    result.Failed(outCode, outMessage);
                }
                else
                {
                    result.Item         = coQuan;
                    result.ErrorCode    = "0";
                    result.ErrorMessage = "";
                }
            }
            catch (Exception ex)
            {
                result.Failed("-1", ex.Message);
            }
            return(result);
        }
Example #7
0
        public ReturnResult <BranchContact> AddNewBranchContact(BranchContact BranchContact)
        {
            var        result       = new ReturnResult <BranchContact>();
            DbProvider db           = new DbProvider();
            string     outCode      = String.Empty;
            string     outMessage   = String.Empty;
            string     totalRecords = String.Empty;

            try
            {
                // Set tên stored procedure
                db.SetQuery("BranchContact_AddNew", CommandType.StoredProcedure)
                .SetParameter("BranchContactCode", SqlDbType.NVarChar, BranchContact.BranchContactCode)
                .SetParameter("BranchContactName", SqlDbType.NVarChar, BranchContact.BranchContactName)
                .SetParameter("ContactName", SqlDbType.NVarChar, BranchContact.ContactName)
                .SetParameter("Email", SqlDbType.NVarChar, BranchContact.Email)
                .SetParameter("Hotline", SqlDbType.NVarChar, BranchContact.Hotline)
                .SetParameter("IPPhone", SqlDbType.NVarChar, BranchContact.IPPhone)
                .SetParameter("OperateStatus", SqlDbType.Int, BranchContact.OperateStatus)
                .SetParameter("InsertedId", SqlDbType.Int, 1)
                .SetParameter("ErrorCode", SqlDbType.NVarChar, DBNull.Value, 100, ParameterDirection.Output)
                .SetParameter("ErrorMessage", SqlDbType.NVarChar, DBNull.Value, 4000, ParameterDirection.Output)
                .ExcuteNonQuery()
                .Complete();


                db.GetOutValue("ErrorCode", out outCode)
                .GetOutValue("ErrorMessage", out outMessage);
                if (outCode != "0" || outCode == "")
                {
                    result.Failed(outCode, outMessage);
                }
                else
                {
                    result.Item         = BranchContact;
                    result.ErrorCode    = "0";
                    result.ErrorMessage = "";
                }
            }
            catch (Exception ex)
            {
                result.Failed("-1", ex.Message);
            }
            return(result);
        }
Example #8
0
        /// <summary>
        /// cập nhật cơ quan
        /// </summary>
        /// <param name="coQuan"></param>
        /// <returns></returns>
        public ReturnResult <CoQuan> UpdateCoQuan(CoQuan coQuan)
        {
            ReturnResult <CoQuan> result = new ReturnResult <CoQuan>();;
            DbProvider            db;

            try
            {
                db = new DbProvider();
                db.SetQuery("Organ_EDIT", CommandType.StoredProcedure);
                db.SetParameter("CoQuanID", SqlDbType.Int, coQuan.CoQuanID);
                db.SetParameter("OrganCode", SqlDbType.NVarChar, coQuan.OrganCode);
                db.SetParameter("DiaChiID", SqlDbType.Int, coQuan.DiaChiID);
                db.SetParameter("TenCoQuan", SqlDbType.NVarChar, coQuan.TenCoQuan, 500);
                db.SetParameter("LoaiCoQuan", SqlDbType.Int, coQuan.LoaiCoQuanID);
                db.SetParameter("AddressDetail", SqlDbType.NVarChar, coQuan.AddressDetail, 500);
                db.SetParameter("TinhID", SqlDbType.Int, coQuan.TinhID);
                db.SetParameter("HuyenID", SqlDbType.Int, coQuan.HuyenID);
                db.SetParameter("XaPhuongID", SqlDbType.Int, coQuan.XaPhuongID);
                db.SetParameter("UpdatedBy", SqlDbType.NVarChar, coQuan.UpdatedBy, 50);
                db.SetParameter("Description", SqlDbType.NVarChar, coQuan.Description, 1000);
                db.SetParameter("Notes", SqlDbType.NVarChar, coQuan.Notes, 1000);
                db.SetParameter("ErrorCode", SqlDbType.Int, DBNull.Value, ParameterDirection.Output);
                db.SetParameter("ErrorMessage", SqlDbType.NVarChar, DBNull.Value, 4000, ParameterDirection.Output);
                db.ExcuteNonQuery();
                db.Complete();
                db.GetOutValue("ErrorCode", out string errorCode);
                db.GetOutValue("ErrorMessage", out string errorMessage);
                if (errorCode.ToString() == "0")
                {
                    result.ErrorCode    = "0";
                    result.ErrorMessage = "";
                }
                else
                {
                    result.Failed(errorCode, errorMessage);
                }
            }
            catch (Exception ex)
            {
                result.Failed("-1", ex.Message);
            }
            return(result);
        }
        public ReturnResult <JobPosition> AddNewJobPosition(JobPosition JobPosition)
        {
            var        result       = new ReturnResult <JobPosition>();
            DbProvider db           = new DbProvider();
            string     outCode      = String.Empty;
            string     outMessage   = String.Empty;
            string     totalRecords = String.Empty;

            try
            {
                // Set tên stored procedure
                db.SetQuery("JobPosition_AddNew", CommandType.StoredProcedure)
                .SetParameter("PositionName", SqlDbType.NVarChar, JobPosition.PositionName)
                .SetParameter("Description", SqlDbType.NVarChar, JobPosition.Description)
                .SetParameter("CreatedUser", SqlDbType.NVarChar, JobPosition.CreatedUser)
                .SetParameter("Manager", SqlDbType.TinyInt, JobPosition.Manager)
                .SetParameter("ModeifiedUser", SqlDbType.NVarChar, JobPosition.ModifiedUser)
                .SetParameter("Status", SqlDbType.TinyInt, JobPosition.Status)
                .SetParameter("ErrorCode", SqlDbType.NVarChar, DBNull.Value, 100, ParameterDirection.Output)
                .SetParameter("ErrorMessage", SqlDbType.NVarChar, DBNull.Value, 4000, ParameterDirection.Output)
                .ExcuteNonQuery()
                .Complete();


                db.GetOutValue("ErrorCode", out outCode)
                .GetOutValue("ErrorMessage", out outMessage);
                if (outCode != "0" || outCode == "")
                {
                    result.Failed(outCode, outMessage);
                }
                else
                {
                    result.Item         = JobPosition;
                    result.ErrorCode    = "0";
                    result.ErrorMessage = "";
                }
            }
            catch (Exception ex)
            {
                result.Failed("-1", ex.Message);
            }
            return(result);
        }
Example #10
0
        public ReturnResult <Vacancy> AddNewVacancy(Vacancy Vacancy)
        {
            var        result       = new ReturnResult <Vacancy>();
            DbProvider db           = new DbProvider();
            string     outCode      = String.Empty;
            string     outMessage   = String.Empty;
            string     totalRecords = String.Empty;

            try
            {
                // Set tên stored procedure
                db.SetQuery("Vacancy_AddNew", CommandType.StoredProcedure)
                .SetParameter("VacancyName", SqlDbType.NVarChar, Vacancy.VacancyName)
                .SetParameter("IsActivated", SqlDbType.Int, Vacancy.IsActivated)
                .SetParameter("VacancyCode", SqlDbType.NVarChar, Vacancy.VacancyCode)
                .SetParameter("DescriptionVN", SqlDbType.NVarChar, Vacancy.DescriptionVN)
                .SetParameter("CreatedBy", SqlDbType.NVarChar, Vacancy.CreatedBy)
                .SetParameter("ErrorCode", SqlDbType.NVarChar, DBNull.Value, 100, ParameterDirection.Output)
                .SetParameter("ErrorMessage", SqlDbType.NVarChar, DBNull.Value, 4000, ParameterDirection.Output)
                .ExcuteNonQuery()
                .Complete();


                db.GetOutValue("ErrorCode", out outCode)
                .GetOutValue("ErrorMessage", out outMessage);
                if (outCode != "0" || outCode == "")
                {
                    result.Failed(outCode, outMessage);
                }
                else
                {
                    result.Item         = Vacancy;
                    result.ErrorCode    = "0";
                    result.ErrorMessage = "";
                }
            }
            catch (Exception ex)
            {
                result.Failed("-1", ex.Message);
            }
            return(result);
        }
Example #11
0
        public ReturnResult <Skills> GetSkillsById(int id)
        {
            DbProvider provider     = new DbProvider();
            var        result       = new ReturnResult <Skills>();
            string     outCode      = String.Empty;
            string     outMessage   = String.Empty;
            string     totalRecords = String.Empty;
            Skills     item         = new Skills();

            try
            {
                provider.SetQuery("Skills_GetById", CommandType.StoredProcedure)
                .SetParameter("SkillId", SqlDbType.Int, id, ParameterDirection.Input)
                .SetParameter("ErrorCode", SqlDbType.NVarChar, DBNull.Value, 100, ParameterDirection.Output)
                .SetParameter("ErrorMessage", SqlDbType.NVarChar, DBNull.Value, 4000, ParameterDirection.Output)
                .GetSingle <Skills>(out item).Complete();

                provider.GetOutValue("ErrorCode", out outCode)
                .GetOutValue("ErrorMessage", out outMessage);

                if (outCode != "0" || outCode == "")
                {
                    result.ErrorCode    = outCode;
                    result.ErrorMessage = outMessage;
                }
                else
                {
                    result.Item         = item;
                    result.ErrorCode    = outCode;
                    result.ErrorMessage = outMessage;
                }
            }
            catch (Exception ex)
            {
                result.Failed("-1", ex.Message);
            }

            return(result);
        }
Example #12
0
        public ReturnResult <BranchContact> UpdateBranchContact(BranchContact BranchContact)
        {
            ReturnResult <BranchContact> result = new ReturnResult <BranchContact>();;
            DbProvider db;

            try
            {
                db = new DbProvider();
                db.SetQuery("BranchContact_Update", CommandType.StoredProcedure);
                db.SetParameter("BranchContactId", SqlDbType.Int, BranchContact.BranchContactId);
                db.SetParameter("BranchContactCode", SqlDbType.NVarChar, BranchContact.BranchContactCode);
                db.SetParameter("BranchContactName", SqlDbType.NVarChar, BranchContact.BranchContactName);
                db.SetParameter("ContactName", SqlDbType.NVarChar, BranchContact.ContactName);
                db.SetParameter("Email", SqlDbType.NVarChar, BranchContact.Email);
                db.SetParameter("Hotline", SqlDbType.NVarChar, BranchContact.Hotline);
                db.SetParameter("IPPhone", SqlDbType.NVarChar, BranchContact.IPPhone);
                db.SetParameter("OperateStatus", SqlDbType.Int, BranchContact.OperateStatus);
                db.SetParameter("ErrorCode", SqlDbType.Int, DBNull.Value, ParameterDirection.Output);
                db.SetParameter("ErrorMessage", SqlDbType.NVarChar, DBNull.Value, 4000, ParameterDirection.Output);
                db.ExcuteNonQuery();
                db.Complete();
                db.GetOutValue("ErrorCode", out string errorCode);
                db.GetOutValue("ErrorMessage", out string errorMessage);
                if (errorCode.ToString() == "0")
                {
                    result.ErrorCode    = "0";
                    result.ErrorMessage = "";
                }
                else
                {
                    result.Failed(errorCode, errorMessage);
                }
            }
            catch (Exception ex)
            {
                result.Failed("-1", ex.Message);
            }
            return(result);
        }
        public ReturnResult <JobCategory> GetAllJobCategory()
        {
            List <JobCategory> jobCategories = new List <JobCategory>();
            DbProvider         dbProvider    = new DbProvider();
            var result = new ReturnResult <JobCategory>();

            try
            {
                string outCode    = String.Empty;
                string outMessage = String.Empty;
                dbProvider.SetQuery("JobCategory_GetAllData", CommandType.StoredProcedure)
                .GetList <JobCategory>(out jobCategories)
                .Complete();

                result.ItemList = jobCategories;
            }
            catch (Exception ex)
            {
                result.Failed("-1", ex.Message);
            }
            return(result);
        }
Example #14
0
        public ReturnResult <Vacancy> DeleteVacancy(int id)
        {
            DbProvider provider     = new DbProvider();
            var        result       = new ReturnResult <Vacancy>();
            string     outCode      = String.Empty;
            string     outMessage   = String.Empty;
            string     totalRecords = String.Empty;
            Vacancy    item         = new Vacancy();

            try
            {
                provider.SetQuery("Vacancy_Delete", CommandType.StoredProcedure)
                .SetParameter("Id", SqlDbType.Int, id, System.Data.ParameterDirection.Input)
                .SetParameter("DeletedBy ", SqlDbType.NVarChar, "", System.Data.ParameterDirection.Input)
                .SetParameter("ErrorCode", SqlDbType.NVarChar, DBNull.Value, 100, System.Data.ParameterDirection.Output)
                .SetParameter("ErrorMessage", SqlDbType.NVarChar, DBNull.Value, 4000, System.Data.ParameterDirection.Output)
                .ExcuteNonQuery().Complete();

                provider.GetOutValue("ErrorCode", out outCode)
                .GetOutValue("ErrorMessage", out outMessage);

                if (outCode != "0")
                {
                    result.Failed(outCode, outMessage);
                }
                else
                {
                    result.ErrorCode    = "0";
                    result.ErrorMessage = "";
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(result);
        }
Example #15
0
        public ReturnResult <Vacancy> UpdateVacancy(Vacancy Vacancy)
        {
            ReturnResult <Vacancy> result = new ReturnResult <Vacancy>();;
            DbProvider             db;

            try
            {
                db = new DbProvider();
                db.SetQuery("Vacancy_Update", CommandType.StoredProcedure);
                db.SetParameter("Id", SqlDbType.Int, Vacancy.ID);
                db.SetParameter("VacancyName", SqlDbType.NVarChar, Vacancy.VacancyName);
                db.SetParameter("IsActivated", SqlDbType.Int, Vacancy.IsActivated);
                db.SetParameter("VacancyCode", SqlDbType.NVarChar, Vacancy.VacancyCode);
                db.SetParameter("DescriptionVN", SqlDbType.NVarChar, Vacancy.DescriptionVN);
                db.SetParameter("UpdatedBy", SqlDbType.NVarChar, Vacancy.UpdatedBy);
                db.SetParameter("ErrorCode", SqlDbType.Int, DBNull.Value, ParameterDirection.Output);
                db.SetParameter("ErrorMessage", SqlDbType.NVarChar, DBNull.Value, 4000, ParameterDirection.Output);
                db.ExcuteNonQuery();
                db.Complete();
                db.GetOutValue("ErrorCode", out string errorCode);
                db.GetOutValue("ErrorMessage", out string errorMessage);
                if (errorCode.ToString() == "0")
                {
                    result.ErrorCode    = "0";
                    result.ErrorMessage = "";
                }
                else
                {
                    result.Failed(errorCode, errorMessage);
                }
            }
            catch (Exception ex)
            {
                result.Failed("-1", ex.Message);
            }
            return(result);
        }
Example #16
0
        public ReturnResult <CoQuan> GetAllCoQuan()
        {
            var           result = new ReturnResult <CoQuan>();
            DbProvider    db;
            List <CoQuan> lst;

            try
            {
                result = new ReturnResult <CoQuan>();
                db     = new DbProvider();
                lst    = new List <CoQuan>();
                db.SetQuery("Organ_GET_ALL", CommandType.StoredProcedure)
                .SetParameter("ErrorCode", SqlDbType.NVarChar, DBNull.Value, 400, ParameterDirection.Output)
                .SetParameter("ErrorMessage", SqlDbType.NVarChar, DBNull.Value, 4000, ParameterDirection.Output)
                .GetList <CoQuan>(out lst)
                .Complete();
                db.GetOutValue("ErrorCode", out string outCode)
                .GetOutValue("ErrorMessage", out string outMessage);
                // get out value
                if (outCode.ToString() != "0")
                {
                    result.Failed(outCode, outMessage);
                    return(result);
                }
                else
                {
                    result.ItemList     = lst;
                    result.ErrorCode    = "0";
                    result.ErrorMessage = "";
                }
            }
            catch (Exception ex)
            {
                result.Failed("-1", ex.Message);
            }
            return(result);
        }
Example #17
0
        public ReturnResult <Skills> UpdateSkills(Skills Skills)
        {
            ReturnResult <Skills> result = new ReturnResult <Skills>();;
            DbProvider            db;

            try
            {
                db = new DbProvider();
                db.SetQuery("Skills_Update", CommandType.StoredProcedure);
                db.SetParameter("SkillId", SqlDbType.Int, Skills.SkillId);
                db.SetParameter("SkillName", SqlDbType.NVarChar, Skills.SkillName);
                db.SetParameter("Description", SqlDbType.NVarChar, Skills.Description);
                db.SetParameter("ModifiedUser", SqlDbType.NVarChar, Skills.ModifiedDate);
                db.SetParameter("Status", SqlDbType.TinyInt, Skills.Status);
                db.SetParameter("ErrorCode", SqlDbType.Int, DBNull.Value, ParameterDirection.Output);
                db.SetParameter("ErrorMessage", SqlDbType.NVarChar, DBNull.Value, 4000, ParameterDirection.Output);
                db.ExcuteNonQuery();
                db.Complete();
                db.GetOutValue("ErrorCode", out string errorCode);
                db.GetOutValue("ErrorMessage", out string errorMessage);
                if (errorCode.ToString() == "0")
                {
                    result.ErrorCode    = "0";
                    result.ErrorMessage = "";
                }
                else
                {
                    result.Failed(errorCode, errorMessage);
                }
            }
            catch (Exception ex)
            {
                result.Failed("-1", ex.Message);
            }
            return(result);
        }
        public ReturnResult <RecruitmentNewsModel> InsertRecruitmentNews(RecruitmentNewsModel recruitmentNews)
        {
            var        result       = new ReturnResult <RecruitmentNewsModel>();
            DbProvider db           = new DbProvider();
            string     outCode      = String.Empty;
            string     outMessage   = String.Empty;
            string     totalRecords = String.Empty;
            int        outNewId     = 0;

            try
            {
                // Set tên stored procedure
                db.SetQuery("Inside_RecruitmentNews_Insert", CommandType.StoredProcedure)
                .SetParameter("BranchId", SqlDbType.Int, recruitmentNews.BranchId)
                .SetParameter("JobCode", SqlDbType.NVarChar, recruitmentNews.JobCode)
                .SetParameter("AreaId", SqlDbType.Int, recruitmentNews.AreaId)
                .SetParameter("JobTypeId", SqlDbType.Int, recruitmentNews.JobTypeId)
                .SetParameter("Title", SqlDbType.NVarChar, recruitmentNews.Title)
                .SetParameter("NumberPositions", SqlDbType.SmallInt, recruitmentNews.NumberPositions)
                .SetParameter("JobPositionId", SqlDbType.Int, recruitmentNews.JobPositionId)
                .SetParameter("JobLevelId", SqlDbType.Int, recruitmentNews.JobLevelId)
                .SetParameter("MinSalary", SqlDbType.NVarChar, recruitmentNews.MinSalary)
                .SetParameter("MaxSalary", SqlDbType.NVarChar, recruitmentNews.MaxSalary)
                .SetParameter("CurrentUnit", SqlDbType.NVarChar, recruitmentNews.CurrentUnit)
                .SetParameter("ShowSalary", SqlDbType.TinyInt, recruitmentNews.ShowSalary)
                .SetParameter("JobDescription", SqlDbType.NVarChar, recruitmentNews.JobDescription)
                .SetParameter("JobRequirement", SqlDbType.NVarChar, recruitmentNews.JobRequirement)
                .SetParameter("JobFullDescription", SqlDbType.NVarChar, recruitmentNews.JobFullDescription)
                .SetParameter("JobRequest", SqlDbType.NVarChar, recruitmentNews.JobRequest)
                .SetParameter("JobBenefit", SqlDbType.NVarChar, recruitmentNews.JobBenefit)
                .SetParameter("JobInfomation", SqlDbType.NVarChar, recruitmentNews.JobInfomation)
                .SetParameter("company_name", SqlDbType.NVarChar, recruitmentNews.company_name)
                .SetParameter("company_info", SqlDbType.NVarChar, recruitmentNews.company_info)
                .SetParameter("company_logo", SqlDbType.NVarChar, recruitmentNews.company_logo)
                .SetParameter("company_size", SqlDbType.NVarChar, recruitmentNews.company_size)
                .SetParameter("JobType", SqlDbType.TinyInt, recruitmentNews.JobType)
                .SetParameter("Gender", SqlDbType.TinyInt, recruitmentNews.Gender)
                .SetParameter("AgeFrom", SqlDbType.TinyInt, recruitmentNews.AgeFrom)
                .SetParameter("AgeTo", SqlDbType.TinyInt, recruitmentNews.AgeTo)
                .SetParameter("ExamType", SqlDbType.TinyInt, recruitmentNews.ExamType)
                .SetParameter("StartDate", SqlDbType.DateTime, recruitmentNews.StartDate.ToString())
                .SetParameter("EndDate", SqlDbType.DateTime, recruitmentNews.EndDate.ToString())
                .SetParameter("Hot", SqlDbType.TinyInt, recruitmentNews.Hot)
                .SetParameter("ProcessStatus", SqlDbType.TinyInt, recruitmentNews.ProcessStatus)
                .SetParameter("CreatedUser", SqlDbType.NVarChar, recruitmentNews.CreatedUser)
                //.SetParameter("CreatedDate", SqlDbType.DateTime, recruitmentNews.CreatedDate)
                .SetParameter("YearExpMax", SqlDbType.SmallInt, recruitmentNews.YearExpMax)
                .SetParameter("YearExpMin", SqlDbType.SmallInt, recruitmentNews.YearExpMin)
                .SetParameter("FK_VacancyId", SqlDbType.Int, recruitmentNews.FK_VacancyId)
                //.SetParameter("FullTitle", SqlDbType.NVarChar, recruitmentNews.FullTitle)
                .SetParameter("BranchAddressId", SqlDbType.Int, recruitmentNews.BranchAddressId)
                .SetParameter("SkillId", SqlDbType.Int, recruitmentNews.SkillId)
                .SetParameter("JobCategoryId", SqlDbType.Int, recruitmentNews.JobCategoryId)
                // Output parameter
                .SetParameter("OUT_NewId", SqlDbType.Int, DBNull.Value, ParameterDirection.Output)
                .SetParameter("OUT_ErrorCode", SqlDbType.NVarChar, DBNull.Value, 255, ParameterDirection.Output)
                .SetParameter("OUT_ReturnMessage", SqlDbType.NVarChar, DBNull.Value, 255, ParameterDirection.Output)

                // Xử lý thủ tục và kết quả trả về từ DB
                .ExcuteNonQuery()
                .Complete();
                // Xử lý Logs

                db.GetOutValue("OUT_ErrorCode", out outCode)
                .GetOutValue("OUT_ReturnMessage", out outMessage)
                .GetOutValue("OUT_NewId", out outNewId);
                if (outCode != "0" || outCode == "")
                {
                    result.Failed(outCode, outMessage);
                }
                else
                {
                    recruitmentNews.RecruitmentId = outNewId;
                    result.Item = recruitmentNews;
                }
                return(result);
            }
            catch (Exception ex)
            {
                result.Failed("-1", ex.Message);
            }
            return(result);
        }