public ReturnResult <JobLevel> GetAllJobLevelWithPaging(BaseCondition <JobLevel> condition) { DbProvider provider = new DbProvider(); List <JobLevel> list = new List <JobLevel>(); string outCode = String.Empty; string outMessage = String.Empty; string totalRecords = String.Empty; var result = new ReturnResult <JobLevel>(); try { provider.SetQuery("JobLevel_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 <JobLevel>(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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }