public async Task <string> SaveAssessmentOnline(ApplicantAssessmentDTO data, string name) { try { ApplicantAssetment assetment = new ApplicantAssetment(); assetment.Empid = data.Empid; assetment.Per01 = data.Per_01; assetment.Per02 = data.Per_02; assetment.Per03 = data.Per_03; assetment.Per04 = data.Per_04; assetment.Edu01 = data.Edu_01; assetment.Edu02 = data.Edu_02; assetment.Edu03 = data.Edu_03; assetment.Edu04 = data.Edu_04; assetment.Oth01 = data.Oth_01; assetment.Oth02 = data.Oth_02; assetment.Recomment = data.Recomment; assetment.SummAss = data.Summ_Ass; assetment.CrBy = name; assetment.CrDate = DateTime.Today; Context.ApplicantAssetment.Add(assetment); Context.SaveChanges(); return("Success"); } catch (Exception ex) { throw ex; } }
public string AddDatatoAgreement(ApplicantAgreement data) { try { ApplicantAgreement agreement = new ApplicantAgreement(); agreement.Empid = data.Empid; agreement.Company = data.Company; agreement.StartDate = data.StartDate; agreement.Salary = data.Salary; agreement.Other = data.Other; agreement.CrBy = data.UpdBy; agreement.CrDate = DateTime.Now; agreement.UpdBy = data.UpdBy; agreement.UpdDate = DateTime.Now; Context.ApplicantAgreement.Add(agreement); Context.SaveChanges(); ApplicantProfile profile = new ApplicantProfile(); profile = Context.ApplicantProfile.Where(x => x.Empid == data.Empid).FirstOrDefault(); profile.StatusApplicant = "Agreemented"; profile.UpdBy = data.UpdBy; profile.UpdDate = DateTime.Now; Context.ApplicantProfile.Update(profile); Context.SaveChanges(); return("success"); } catch (Exception e) { throw e; } }
public string addQuestionvalues(DbExam value) { DbExam data = new DbExam(); int Seq; try { Seq = Context.DbExam.Where(i => i.ExamType == value.ExamType).Max(i => i.Seq) + 1; } catch { Seq = 1; } data.Seq = Seq; data.ExamType = value.ExamType; data.QuestionType = value.QuestionType; data.Question = value.Question; data.QuestionImage = value.QuestionImage; data.CorrectAnswer = value.CorrectAnswer; data.ChoiceType = value.ChoiceType; data.Choice1 = value.Choice1; data.Choice2 = value.Choice2; data.Choice3 = value.Choice3; data.Choice4 = value.Choice4; data.Choice5 = value.Choice5; data.Choice6 = value.Choice6; data.Active = value.Active; Context.DbExam.Add(data); Context.SaveChanges(); return("success"); }
public string addProduct(Product[] values) { Product ProValues = new Product(); ProValues.ProductId = values[0].ProductId; ProValues.ProductName = values[0].ProductName; ProValues.ProductAmount = values[0].ProductAmount; ProValues.ProductPrice = values[0].ProductPrice; ProValues.ProductDetail = values[0].ProductDetail; ProValues.CostPrice = values[0].CostPrice; ProValues.ProductReference = values[0].ProductReference; ProValues.TypeName = values[0].TypeName; Context.Product.Add(ProValues); Context.SaveChanges(); return("success"); }
public string Deletecode(string code) { string result; TmTaskManagement DeleteTaskCode = Context.TmTaskManagement.Where(x => x.TaskCode == code).FirstOrDefault(); if (DeleteTaskCode != null) { Context.TmTaskManagement.Remove(DeleteTaskCode); Context.SaveChanges(); result = "Delete Success!!"; } else { result = "Error!!"; } return(result); }
public string AddListOfValue(ListOfValueDTO value) { RegisterManange.API.Models.ListOfValue ListOfValue = new RegisterManange.API.Models.ListOfValue(); ListOfValue.GroupCode = value.GroupCode; ListOfValue.SeqNo = value.SeqNo.GetValueOrDefault(); ListOfValue.Value = value.Value; ListOfValue.Description = value.Description; ListOfValue.CrBy = value.CrBy; ListOfValue.CrDate = DateTime.Now; ListOfValue.UpdBy = value.CrBy; ListOfValue.UpdDate = DateTime.Now; ListOfValue.Active = value.Active; Context.ListOfValue.Add(ListOfValue); Context.SaveChanges(); return("success"); }
public async Task <string> SaveApplicant(ApplicantDTO data) { try { ApplicantProfile applicant = new ApplicantProfile(); applicant.FirstnameTh = data.ApplicantProfile.FirstnameTh; applicant.LastnameTh = data.ApplicantProfile.LastnameTh; applicant.FirstnameEn = data.ApplicantProfile.FirstnameEn; applicant.LastnameEn = data.ApplicantProfile.LastnameEn; applicant.Birthday = data.ApplicantProfile.Birthday; applicant.Age = data.ApplicantProfile.Age; applicant.IdCard = data.ApplicantProfile.IdCard; applicant.Gender = data.ApplicantProfile.Gender; applicant.Status = data.ApplicantProfile.Status; applicant.Height = data.ApplicantProfile.Height; applicant.Weight = data.ApplicantProfile.Weight; applicant.Nationality = data.ApplicantProfile.Nationality; applicant.Tel = data.ApplicantProfile.Tel; applicant.Email = data.ApplicantProfile.Email; applicant.Address = data.ApplicantProfile.Address; applicant.Province = data.ApplicantProfile.Province; applicant.District = data.ApplicantProfile.District; applicant.SubDistrict = data.ApplicantProfile.SubDistrict; applicant.PostalCode = data.ApplicantProfile.PostalCode.ToString(); applicant.ImgPath = data.ApplicantProfile.ImgPath; applicant.Position = data.ApplicantProfile.Position; applicant.Salary = data.ApplicantProfile.Salary; applicant.CrBy = data.ApplicantProfile.CrBy; applicant.CrDate = data.ApplicantProfile.CrDate; applicant.UpdBy = data.ApplicantProfile.UpdBy; applicant.UpdDate = data.ApplicantProfile.UpdDate; applicant.StatusApplicant = "SSSS"; Context.ApplicantProfile.Add(applicant); Context.SaveChanges(); return("Success"); } catch (Exception ex) { throw ex; } }
public string UpdateStatusInteresting(int[] id, string status) { try { foreach (int empID in id) { ApplicantProfile applicantProfile = new ApplicantProfile(); applicantProfile = Context.ApplicantProfile.Where(x => x.Empid == empID).FirstOrDefault(); applicantProfile.StatusApplicant = status; applicantProfile.UpdDate = DateTime.Now; Context.ApplicantProfile.Update(applicantProfile); Context.SaveChanges(); } return("Success"); } catch (Exception ex) { return("Fail"); } }
public async Task <string> SaveinterviewDate(ApplicantAppointmentDateDTO data, string team) { try { DateTime dateTime = DateTime.Now; ApplicantAppointmentDate saveinterviewdate = new ApplicantAppointmentDate(); saveinterviewdate.Username = data.Username; saveinterviewdate.Empid = data.Empid; saveinterviewdate.Datetime1 = data.Datetime1; saveinterviewdate.Datetime2 = data.Datetime2; //saveinterviewdate.AppointmentDate = data.AppointmentDate; //saveinterviewdate.AppointmentStatus = data.AppointmentStatus; saveinterviewdate.CrBy = data.Username; saveinterviewdate.CrDate = DateTime.Now; Context.ApplicantAppointmentDate.Add(saveinterviewdate); Context.SaveChanges(); ApplicantProfile applicantProfile = new ApplicantProfile(); applicantProfile = Context.ApplicantProfile.Where(x => x.Empid == data.Empid).FirstOrDefault(); applicantProfile.StatusApplicant = "Pass_PM"; applicantProfile.Team = team; applicantProfile.UpdDate = dateTime; Context.ApplicantProfile.Update(applicantProfile); Context.SaveChanges(); return("Success"); } catch (Exception ex) { throw ex; } }
public string AddRegisterPosition(PositionDTO position) { try { List <PositionDTO> data = ( from typeEmployee in Context.ManageRegisterPosition where typeEmployee.PositionId == position.PositionId select new PositionDTO { Type_Employee = typeEmployee.TypeEmployee }).ToList(); for (int i = 0; i < data.Count; i++) { if (data[i].Type_Employee == position.Type_Employee) { return("warning"); } } ManageRegisterPosition MRegisterPosition = new ManageRegisterPosition(); MRegisterPosition.PositionId = position.PositionId; MRegisterPosition.NumberOfPosition = position.NumberOfPosition; MRegisterPosition.ActiveStatus = position.Active; MRegisterPosition.CrBy = position.Username; MRegisterPosition.CrDate = DateTime.Now; MRegisterPosition.UpdBy = position.Username; MRegisterPosition.UpdDate = DateTime.Now; MRegisterPosition.TypeEmployee = position.Type_Employee; Context.ManageRegisterPosition.Add(MRegisterPosition); Context.SaveChanges(); return("success"); } catch (Exception e) { throw e; } }
public string AddSubmitAnswer(ApplicantExamAnswerHistoryDTO[] questions, int Empid) { using (var dbContextTransaction = Context.Database.BeginTransaction()) { try { int Seq = 0; foreach (ApplicantExamAnswerHistoryDTO AppExam in questions) { ApplicantExamAnswerHistory examAnswer = new ApplicantExamAnswerHistory(); Seq++; examAnswer.Seq = Seq; examAnswer.Empid = Empid; examAnswer.ExamType = AppExam.ExamType; examAnswer.Question = AppExam.Question; examAnswer.QuestionImage = AppExam.QuestionImage; examAnswer.QuestionType = AppExam.QuestionType; examAnswer.ChoiceType = AppExam.ChoiceType; examAnswer.Choice1 = AppExam.Choice1; examAnswer.Choice2 = AppExam.Choice2; examAnswer.Choice3 = AppExam.Choice3; examAnswer.Choice4 = AppExam.Choice4; examAnswer.Choice5 = AppExam.Choice5; examAnswer.Choice6 = AppExam.Choice6; examAnswer.ApplicantAnswer = AppExam.ApplicantAnswer; examAnswer.CorrectAnswer = AppExam.CorrectAnswer; examAnswer.CrBy = AppExam.CrBy; examAnswer.CrDate = DateTime.Now; examAnswer.UdBy = AppExam.UdBy; examAnswer.UdDate = AppExam.UdDate; Context.ApplicantExamAnswerHistory.Add(examAnswer); } Context.SaveChanges(); dbContextTransaction.Commit(); return("success"); } catch (Exception ex) { dbContextTransaction.Rollback(); return("error"); } } }
//เพิ่ม employee ลง DB public void CreateEmployee(List <EmployeeDTO> users, string projectCode) { foreach (EmployeeDTO team in users) { PjEmployee employee = new PjEmployee(); employee.ProjectCode = projectCode; employee.SystemCode = team.SystemCode; employee.Firstname = team.Firstname; employee.Lastname = team.Lastname; employee.Leader = "SQL"; employee.Role = "SA"; employee.Department = ".NET"; employee.CreatedBy = "SQL"; employee.CreatedDate = DateTime.Now; employee.UpdatedBy = "SQL"; employee.UpdatedDate = DateTime.Now; Context.PjEmployee.Add(employee); Context.SaveChanges(); } }
public async Task <string> SaveApplicant(ApplicantDTO data) { using (var dbContextTransaction = Context.Database.BeginTransaction()) { try { int empID = Context.ApplicantProfile.Max(i => i.Empid) + 1; // EMDID DateTime dateTime = DateTime.Now; #region // ########## Table APPLICANT_PROFILE ########## // ApplicantProfile applicant = new ApplicantProfile(); // EMDID applicant.Empid = empID; // รูปโปรไฟล์ applicant.ImgPath = data.ApplicantProfile.ImgPath; // ลักษณะงานที่ต้องการ applicant.Position = data.ApplicantProfile.Position; applicant.Salary = data.ApplicantProfile.Salary; applicant.TypeEmployee = data.ApplicantProfile.TypeEmployee; // ข้อมูลส่วนตัว applicant.TitlenameTh = data.ApplicantProfile.TitelnameTh; applicant.FirstnameTh = data.ApplicantProfile.FirstnameTh; applicant.LastnameTh = data.ApplicantProfile.LastnameTh; applicant.TitlenameEn = data.ApplicantProfile.TitelnameEn; applicant.FirstnameEn = data.ApplicantProfile.FirstnameEn; applicant.LastnameEn = data.ApplicantProfile.LastnameEn; applicant.Birthday = data.ApplicantProfile.Birthday; applicant.Age = data.ApplicantProfile.Age; applicant.Gender = data.ApplicantProfile.Gender; applicant.Status = data.ApplicantProfile.Status; applicant.IdCard = data.ApplicantProfile.IdCard; applicant.Religion = data.ApplicantProfile.Religion; applicant.Nationality = data.ApplicantProfile.Nationality; applicant.Height = data.ApplicantProfile.Height; applicant.Weight = data.ApplicantProfile.Weight; // ข้อมูลการติดต่อ applicant.Tel = data.ApplicantProfile.Tel; applicant.Email = data.ApplicantProfile.Email; applicant.Lineid = data.ApplicantProfile.LineID; // ข้อมูลที่อยู่ปัจจุบัน applicant.Address = data.ApplicantProfile.Address; applicant.Province = data.ApplicantProfile.Province; applicant.District = data.ApplicantProfile.District; applicant.SubDistrict = data.ApplicantProfile.SubDistrict; applicant.PostalCode = data.ApplicantProfile.PostalCode.ToString(); // Status applicant.StatusApplicant = "New"; applicant.CrBy = "Coop";; applicant.CrDate = dateTime; applicant.UpdBy = "Coop"; applicant.UpdDate = dateTime; Context.ApplicantProfile.Add(applicant); #endregion #region // ########## Table APPLICANT_EDU_HISTORY ########## // int eduNo = 0; foreach (ApplicantEduHistoryDTO edu in data.ApplicantEduHistories) { ApplicantEduHistory applicantEdu = new ApplicantEduHistory(); eduNo++; // EMPID applicantEdu.Empid = empID; // ประวัติการศึกษา applicantEdu.No = eduNo; applicantEdu.Education = edu.Education; applicantEdu.SchoolName = edu.SchoolName; applicantEdu.Faculty = edu.Faculty; applicantEdu.Major = edu.Major; applicantEdu.GradYear = edu.GradYear.Year.ToString(); applicantEdu.Gpa = edu.Gpa; applicantEdu.CrBy = "Coop"; applicantEdu.CrDate = dateTime; applicantEdu.UpdBy = "Coop"; applicantEdu.UpdDate = dateTime; Context.ApplicantEduHistory.Add(applicantEdu); } #endregion #region // ########## Table APPLICANT_WORKING_HISTORY ########## // int workNo = 0; foreach (ApplicantWorkingHistoryDTO work in data.ApplicantWorkingHistories) { ApplicantWorkingHistory applicantWork = new ApplicantWorkingHistory(); workNo++; // EMPID applicantWork.Empid = empID; // ประวัติการทำงาน/ฝึกงาน applicantWork.No = workNo; applicantWork.StartDate = work.StartDate; applicantWork.EndDate = work.EndDate; applicantWork.CompanyName = work.CompanyName; applicantWork.CompanyAddress = work.CompanyAddress; applicantWork.Position = work.Position; applicantWork.Salary = work.Salary; applicantWork.CrBy = "Coop"; applicantWork.CrDate = dateTime; applicantWork.UpdBy = "Coop"; applicantWork.UpdDate = dateTime; Context.ApplicantWorkingHistory.Add(applicantWork); } #endregion #region // ########## Table APPLICANT_TRAINING_HISTORY ########## // int trainingNo = 0; foreach (ApplicantTrainingHistoryDTO training in data.ApplicantTrainingHistories) { ApplicantTrainingHistory applicantTraining = new ApplicantTrainingHistory(); trainingNo++; // EMPID applicantTraining.Empid = empID; // ประวัติการฝึกอบรม/ประกาศนียบัตร applicantTraining.No = trainingNo; applicantTraining.StartDate = training.StartDate; applicantTraining.EndDate = training.EndDate; applicantTraining.TrainingName = training.TrainingName; applicantTraining.CourseName = training.CourseName; applicantTraining.Certificate = training.Certificate; applicantTraining.CrBy = "Coop"; applicantTraining.CrDate = dateTime; applicantTraining.UpdBy = "Coop"; applicantTraining.UpdDate = dateTime; Context.ApplicantTrainingHistory.Add(applicantTraining); } #endregion #region // ########## Table APPLICANT_SKILL_LANGUAGE ########## // int languageNo = 0; foreach (ApplicantSkillLanguageDTO language in data.ApplicantSkillLanguages) { ApplicantSkillLanguage applicantLanguage = new ApplicantSkillLanguage(); languageNo++; // EMPID applicantLanguage.Empid = empID; // ความสามารถทางภาษา applicantLanguage.No = languageNo; applicantLanguage.Language = language.Language; applicantLanguage.LanguageSpeak = language.LanguageSpeak; applicantLanguage.LanguageRead = language.LanguageRead; applicantLanguage.LanguageWrite = language.LanguageWrite; applicantLanguage.CrBy = "Coop"; applicantLanguage.CrDate = dateTime; applicantLanguage.UpdBy = "Coop"; applicantLanguage.UpdDate = dateTime; Context.ApplicantSkillLanguage.Add(applicantLanguage); } #endregion #region // ########## Table APPLICANT_SKILL ########## // ApplicantSkill applicantSkill = new ApplicantSkill(); // EMPID applicantSkill.Empid = empID; // พิมพ์ดีด applicantSkill.TypingTh = data.ApplicantSkill.TypingTh; applicantSkill.TypingEn = data.ApplicantSkill.TypingEn; // กรุณาเรียงลำดับความสามารถด้านคอมพิวเตอร์ (เช่นภาษา/โปรแกรม/ระบบปฏิบัติการอื่นๆ) applicantSkill.Special1 = data.ApplicantSkill.Special1; applicantSkill.Special2 = data.ApplicantSkill.Special2; applicantSkill.Special3 = data.ApplicantSkill.Special3; applicantSkill.Special4 = data.ApplicantSkill.Special4; applicantSkill.CrBy = "Coop"; applicantSkill.CrDate = dateTime; applicantSkill.UpdBy = "Coop"; applicantSkill.UpdDate = dateTime; Context.ApplicantSkill.Add(applicantSkill); #endregion #region // ########## Table APPLICANT_REF ########## // int refNo = 0; foreach (ApplicantRefDTO refs in data.ApplicantRef) { ApplicantRef applicantRef = new ApplicantRef(); refNo++; // EMPID applicantRef.Empid = empID; // รายชื่อบุคคลอ้างอิง ซึ่งมิใช่ญาติหรือผู้ว่าจ้าง ซึ่งบริษัทฯ สามารถสอบประวัติท่านได้ applicantRef.No = refNo; applicantRef.RefName = refs.RefName; applicantRef.RefPosition = refs.RefPosition; applicantRef.RefTel = refs.RefTel; applicantRef.CrBy = "Coop"; applicantRef.CrDate = dateTime; applicantRef.UpdBy = "Coop"; applicantRef.UpdDate = dateTime; Context.ApplicantRef.Add(applicantRef); } #endregion Context.SaveChanges(); dbContextTransaction.Commit(); return(empID.ToString()); } catch (Exception ex) { dbContextTransaction.Rollback(); return("error"); } } }
public async Task <string> saveEmployeeProfile(EmployeeDTO data) { using (var dbContextTransaction = Context.Database.BeginTransaction()) { try { #region // ########## Table APPLICANT_PROFILE ########## // EmployeeProfile employeeProfile = new EmployeeProfile(); employeeProfile = Context.EmployeeProfile.Where(x => x.Empcode == data.EmployeeProfile.Empcode).FirstOrDefault(); // รูปโปรไฟล์ employeeProfile.ImgPath = data.EmployeeProfile.ImgPath; // ข้อมูล employeeProfile.Empcode = data.EmployeeProfile.Empcode; //employeeProfile.Username = data.EmployeeProfile.Username; //employeeProfile.Password = data.EmployeeProfile.Password; //employeeProfile.Passwordsalt = data.EmployeeProfile.Passwordsalt; employeeProfile.Position = data.EmployeeProfile.Position; employeeProfile.Company = data.EmployeeProfile.Company; employeeProfile.Department = data.EmployeeProfile.Department; //employeeProfile.Team = data.EmployeeProfile.Team; employeeProfile.Salary = data.EmployeeProfile.Salary; employeeProfile.Active = data.EmployeeProfile.Active; // ข้อมูลส่วนตัว employeeProfile.FirstnameTh = data.EmployeeProfile.FirstnameTh; employeeProfile.LastnameTh = data.EmployeeProfile.LastnameTh; employeeProfile.FirstnameEn = data.EmployeeProfile.FirstnameEn; employeeProfile.LastnameEn = data.EmployeeProfile.LastnameEn; employeeProfile.Birthday = data.EmployeeProfile.Birthday; employeeProfile.Age = data.EmployeeProfile.Age; employeeProfile.Birthday = data.EmployeeProfile.Birthday; employeeProfile.IdCard = data.EmployeeProfile.IdCard; employeeProfile.Gender = data.EmployeeProfile.Gender; employeeProfile.Status = data.EmployeeProfile.Status; employeeProfile.Nationality = data.EmployeeProfile.Nationality; employeeProfile.Religion = data.EmployeeProfile.Religion; // ข้อมูลการติดต่อ employeeProfile.Tel = data.EmployeeProfile.Tel; employeeProfile.Email = data.EmployeeProfile.Email; // ข้อมูลที่อยู่ employeeProfile.Address = data.EmployeeProfile.Address; employeeProfile.Province = data.EmployeeProfile.Province; employeeProfile.District = data.EmployeeProfile.District; employeeProfile.SubDistrict = data.EmployeeProfile.SubDistrict; employeeProfile.PostalCode = data.EmployeeProfile.PostalCode; employeeProfile.UpdBy = data.EmployeeProfile.FirstnameEn; employeeProfile.UpdDate = DateTime.Now; Context.EmployeeProfile.Update(employeeProfile); Context.SaveChanges(); dbContextTransaction.Commit(); #endregion return("Save Success"); } catch (Exception ex) { dbContextTransaction.Rollback(); return("error"); } } }