private string GenerateStatusApplication(Application application) { if (null != application) { if (application.FinalSelectionInd.HasValue) return application.FinalSelectionInd.Value ? "Lulus Temuduga/Pemilihan Akhir" : "Tidak Lulus Temuduga/Pemilihan Akhir"; if (application.FirstSelectionInd.HasValue) return application.FirstSelectionInd.Value ? "Dipanggil Temuduga/Pemilihan Akhir" : "Tidak Dipanggil Temuduga/Pemilihan Akhir"; if (application.InvitationFirstSel.HasValue) return application.InvitationFirstSel.Value ? "Terpilih ke Pemilihan Awal" : "Tidak Terpilih ke Pemilihan Awal"; } return "Permohonan Baru/Sedang diproses"; }
public ActionResult SubmitApplication(int acquisitionid) { var login = ObjectBuilder.GetObject<ILoginUserPersistance>("LoginUserPersistance").GetByUserName(User.Identity.Name); if (null != login) { if (login.ApplicantId.HasValue) { var applicant = ObjectBuilder.GetObject<IApplicantPersistence>("ApplicantPersistence").GetApplicant(login.ApplicantId.Value); var message = string.Empty; // check the criteria if (!AtmHelper.ValidateHeightWeightBmi(Convert.ToDouble(applicant.Height), Convert.ToDouble(applicant.Weight), acquisitionid, applicant.GenderCd, out message)) return Json(new { OK = false, message = "Permohonan anda tidak berjaya dihantar." + message }); if (acquisitionid != 0) { // check based on acquisition var acq = ObjectBuilder.GetObject<IAcquisitionPersistence>("AcquisitionPersistence").GetAcquisition(acquisitionid); if (null != acq) { var acqtype = ObjectBuilder.GetObject<IReferencePersistence>("ReferencePersistence").GetAcquisitionType(acq.AcquisitionTypeCd.Value); if (acqtype != null) { // perempuan if (acq.AcquisitionTypeCd == 3) if (applicant.GenderCd == "L") return Json(new { OK = false, message = "Permohonan anda tidak berjaya dihantar kerana pengambilan ini untuk " + acqtype.AcquisitionTypeNm }); // lelaki if (acq.AcquisitionTypeCd == 2) if (applicant.GenderCd == "P") return Json(new { OK = false, message = "Permohonan anda tidak berjaya dihantar kerana pengambilan ini untuk " + acqtype.AcquisitionTypeNm }); // Pegawai.. Check the selection indicator if (acqtype.ServiceCd == "10") { if (!applicant.SelectionTD.HasValue && !applicant.SelectionTL.HasValue && !applicant.SelectionTU.HasValue) return Json(new { OK = false, message = "Permohonan anda tidak berjaya dihantar. Sila pilih Keutamaan Perkhidmatan Pilihan" }); } } } // mandatory checking on profile photo var photo = ObjectBuilder.GetObject<IApplicantPersistence>("ApplicantPersistence").GetPhoto(applicant.ApplicantId); if (photo == null) return Json(new { OK = false, message = "Permohonan anda tidak berjaya dihantar. Sila muat naik gambar peribadi berukuran pasport (saiz tidak melebihi 500KB)." }); if (photo.Photo == null && string.IsNullOrWhiteSpace(photo.PhotoExt)) return Json(new { OK = false, message = "Permohonan anda tidak berjaya dihantar. Sila muat naik gambar peribadi berukuran pasport (saiz tidak melebihi 500KB)." }); // mandatory checking on basic information var peribadipoint = 0.0m; var edupoint = 0.0m; var spopoint = 0.0m; var saspoint = 0.0m; var chpoint = 0.0m; AtmHelper.Checklist(applicant.ApplicantId, acquisitionid, out peribadipoint, out edupoint, out spopoint, out saspoint, out chpoint); if (peribadipoint != 100m) return Json(new { OK = false, message = "Permohonan anda tidak berjaya dihantar. Maklumat peribadi tidak lengkap." }); if (edupoint != 100m) return Json(new { OK = false, message = "Permohonan anda tidak berjaya dihantar. Maklumat akademik tidak lengkap." }); if (chpoint != 100m) return Json(new { OK = false, message = "Permohonan anda tidak berjaya dihantar. Maklumat pengakuan tidak lengkap." }); // copy applicant to applicant submitted var app = new ApplicantSubmitted() { AcquisitionId = acquisitionid, Height = applicant.Height, Weight = applicant.Weight, FullName = applicant.FullName, BMI = applicant.BMI, BirthCertNo = applicant.BirthCertNo, BirthCityCd = applicant.BirthCityCd, BirthCountryCd = applicant.BirthCountryCd, BirthPlace = applicant.BirthPlace, BirthStateCd = applicant.BirthStateCd, BirthDt = applicant.BirthDt.HasValue ? applicant.BirthDt.Value : applicant.BirthDt, CreatedBy = User.Identity.Name, CreatedDt = DateTime.Now, CorresponAddr1 = applicant.CorresponAddr1, CorresponAddr2 = applicant.CorresponAddr2, CorresponAddr3 = applicant.CorresponAddr3, CorresponAddrCityCd = applicant.CorresponAddrCityCd, CorresponAddrCountryCd = applicant.CorresponAddrCountryCd, CorresponAddrPostCd = applicant.CorresponAddrPostCd, CorresponAddrStateCd = applicant.CorresponAddrStateCd, GenderCd = applicant.GenderCd, NationalityCd = applicant.NationalityCd, NationalityCertNo = applicant.NationalityCertNo, MobilePhoneNo = applicant.MobilePhoneNo, HomePhoneNo = applicant.HomePhoneNo, DadNationalityCd = applicant.DadNationalityCd, DadName = applicant.DadName, DadICNo = applicant.DadICNo, DadOccupation = applicant.DadOccupation, DadPhoneNo = applicant.DadPhoneNo, DadSalary = applicant.DadSalary, MomName = applicant.MomName, MomNationalityCd = applicant.NationalityCd, MomICNo = applicant.MomICNo, MomOccupation = applicant.MomOccupation, MomSalary = applicant.MomSalary, MomPhoneNo = applicant.MomPhoneNo, MrtlStatusCd = applicant.MrtlStatusCd, ChildNo = applicant.ChildNo, ColorBlindInd = applicant.ColorBlindInd, EthnicCd = applicant.EthnicCd, RaceCd = applicant.RaceCd, ReligionCd = applicant.ReligionCd, Email = applicant.Email, GuardianName = applicant.GuardianName, GuardianNationalityCd = applicant.GuardianNationalityCd, GuardianOccupation = applicant.GuardianOccupation, GuardianICNo = applicant.GuardianICNo, GuardianSalary = applicant.GuardianSalary, GuardianPhoneNo = applicant.GuardianPhoneNo, NewICNo = applicant.NewICNo, ScholarshipContractStDate = applicant.ScholarshipContractStDate, CurrentOccupation = applicant.CurrentOccupation, SelectionTD = applicant.SelectionTD, SelectionTL = applicant.SelectionTL, SelectionTU = applicant.SelectionTU, ArmyServiceInd = applicant.ArmyServiceInd, ArmyServiceYrOfServ = applicant.ArmyServiceYrOfServ, ArmyServiceResignRemark = applicant.ArmyServiceResignRemark, ArmySelectionInd = applicant.ArmySelectionInd, ArmySelectionDt = applicant.ArmySelectionDt, ArmySelectionVenue = applicant.ArmySelectionVenue, ComputerICT = applicant.ComputerICT, ComputerMSExcel = applicant.ComputerMSExcel, ComputerMSPwrPoint = applicant.ComputerMSPwrPoint, ComputerMSWord = applicant.ComputerMSWord, ComputerOthers = applicant.ComputerOthers, PalapesArmyNo = applicant.PalapesArmyNo, PalapesInd = applicant.PalapesInd, PalapesInstitution = applicant.PalapesInstitution, PalapesRemark = applicant.PalapesRemark, PalapesServices = applicant.PalapesServices, PalapesTauliahEndDt = applicant.PalapesTauliahEndDt, PalapesYear = applicant.PalapesYear, CurrentOrganisation = applicant.CurrentOrganisation, CurrentSalary = applicant.CurrentSalary, ScholarshipInd = applicant.ScholarshipInd, ScholarshipBody = applicant.ScholarshipBody, ScholarshipBodyAddr = applicant.ScholarshipBodyAddr, ScholarshipNoOfYrContract = applicant.ScholarshipNoOfYrContract, EmployeeAggreeInd = applicant.EmployeeAggreeInd, CronicIlnessInd = applicant.CronicIlnessInd, CrimeInvolvement = applicant.CrimeInvolvement, DrugCaseInvolvement = applicant.DrugCaseInvolvement, NoOfSibling = applicant.NoOfSibling, NoTentera = applicant.NoTentera, SpectaclesUserInd = applicant.SpectaclesUserInd, OriginalPelepasanDocument = applicant.OriginalPelepasanDocument, PelepasanDocument = applicant.PelepasanDocument, MomNotApplicable = applicant.MomNotApplicable, DadNotApplicable = applicant.DadNotApplicable, GuardianNotApplicable = applicant.GuardianNotApplicable }; var idsubmitted = app.Save(); if (idsubmitted != 0) { app.ApplicantId = idsubmitted; // get educations var education = ObjectBuilder.GetObject<IApplicantPersistence>("ApplicantPersistence").GetEducation(applicant.ApplicantId); if (null != education && education.Any()) { foreach (var edu in education) { if (!string.IsNullOrWhiteSpace(edu.OverallGrade) || edu.SKMLevel != 0 || edu.ConfermentYr != 0) { var subedu = new ApplicantEducationSubmitted { ApplicantId = app.ApplicantId, ConfermentYr = edu.ConfermentYr, EduCertTitle = edu.EduCertTitle, HighEduLevel = edu.HighEduLevel, HighEduLevelCd = edu.HighEduLevelCd, InstCd = edu.InstCd, InstitutionName = edu.InstitutionName, OverSeaInd = edu.OverSeaInd, MajorMinorCd = edu.MajorMinorCd, OverallGrade = edu.OverallGrade, SKMLevel = edu.SKMLevel, CreatedBy = User.Identity.Name, CreatedDt = DateTime.Now, }; var apeduid = subedu.Save(); foreach (var subject in edu.ApplicantEduSubjectCollection) { if (!string.IsNullOrWhiteSpace(subject.Grade) || !string.IsNullOrWhiteSpace(subject.GradeCd)) { var subsubject = new ApplicantEduSubjectSubmitted { GradeCd = !string.IsNullOrWhiteSpace(subject.GradeCd) ? subject.GradeCd.Trim() : subject.GradeCd, Grade = !string.IsNullOrWhiteSpace(subject.Grade) ? subject.Grade.Trim() : subject.Grade, ApplicantEduId = apeduid, CreatedBy = User.Identity.Name, CreatedDt = DateTime.Now, Subject = subject.Subject, SubjectCd = subject.SubjectCd, }; subsubject.Save(); } } } } } // get sports var sports = ObjectBuilder.GetObject<IApplicantPersistence>("ApplicantPersistence").GetSport(applicant.ApplicantId); if (null != sports && sports.Any()) { foreach (var sp in sports) { if ((sp.SportAssocId.HasValue && sp.SportAssocId != 0) || !string.IsNullOrWhiteSpace(sp.Others)) { var ssp = new ApplicantSportSubmitted { ApplicantId = app.ApplicantId, CreatedBy = User.Identity.Name, CreatedDt = DateTime.Now, AchievementCd = sp.AchievementCd, Year = sp.Year, Others = sp.Others, SportAssocId = sp.SportAssocId, }; ssp.Save(); } } } // get skills var skills = ObjectBuilder.GetObject<IApplicantPersistence>("ApplicantPersistence").GetSkill(applicant.ApplicantId); if (null != skills && skills.Any()) { foreach (var sp in skills) { var ssp = new ApplicantSkillSubmitted { ApplicantId = app.ApplicantId, CreatedBy = User.Identity.Name, CreatedDt = DateTime.Now, LanguageSkillSpeak = sp.LanguageSkillSpeak, LanguageSkillWrite = sp.LanguageSkillWrite, Skill = sp.Skill, AchievementCd = sp.AchievementCd, Others = sp.Others, SkillCatCd = sp.SkillCatCd, SkillCd = sp.SkillCd, }; ssp.Save(); } } // get photo if (photo.Photo != null && !string.IsNullOrWhiteSpace(photo.PhotoExt)) { var sphoto = new ApplicantSubmittedPhoto() { Photo = photo.Photo, PhotoExt = photo.PhotoExt, ApplicantId = app.ApplicantId, CreatedBy = User.Identity.Name, CreatedDate = DateTime.Now }; sphoto.Save(); } var application = new Application() { AcquisitionId = acquisitionid, CreatedBy = User.Identity.Name, CreatedDt = DateTime.Now, ApplicantId = app.ApplicantId }; var id = application.Save(); if (id != 0) return Json(new { OK = true, message = "Permohonan anda berjaya dihantar.", id = id }); } } } return Json(new { OK = false, message = "Permohonan anda tidak berjaya dihantar kerana maklumat tidak lengkap." }); } return Json(new { OK = false, message = "Permohonan anda tidak berjaya dihantar." }); }
public int Update(Application application) { if (application.AppId != 0) { using (var entities = new atmEntities()) { var exist = (from a in entities.tblApplications where a.AppId == application.AppId select a).SingleOrDefault(); if (null != exist) { exist.ApplicationStatus = application.ApplicationStatus; exist.ArmyNo = application.ArmyNo; exist.LastModifiedBy = application.CreatedBy; exist.LastModifiedDt = DateTime.Now; exist.DentalExamine = application.DentalExamine; exist.FinalSelectionInd = application.FinalSelectionInd; exist.FinalSelectionRemark = application.FinalSelectionRemark; exist.FinalShortlistedInd = application.FinalShortlistedInd; exist.FirstSelActualAcqLocationId = application.FirstSelActualAcqLocationId; exist.FirstSelectionAttdnInd = application.FirstSelectionAttdnInd; exist.FirstSelectionDate = application.FirstSelectionDate; exist.FirstSelectionInd = application.FirstSelectionInd; exist.FirstShortlistedInd = application.FirstShortlistedInd; exist.InvitationFirstSel = application.InvitationFirstSel; exist.MedicalExamine = application.MedicalExamine; exist.Panel1Score = application.Panel1Score; exist.Panel2Score = application.Panel2Score; exist.Panel3Score = application.Panel3Score; exist.PhysicalExamination = application.PhysicalExamination; exist.PhysicalTest = application.PhysicalTest; exist.ReportDuty = application.ReportDuty; exist.SecurityAADK = application.SecurityAADK; exist.SecurityAADKRemark = application.SecurityAADKRemark; exist.SecurityBSPP = application.SecurityBSPP; exist.SecurityBSPPRemark = application.SecurityBSPPRemark; exist.SecurityJPN = application.SecurityJPN; exist.SecurityJPNRemark = application.SecurityJPNRemark; exist.SecurityKPM = application.SecurityKPM; exist.SecurityKPMRemark = application.SecurityKPMRemark; exist.SecurityPDRM = application.SecurityPDRM; exist.SecurityPDRMRemark = application.SecurityPDRMRemark; exist.SecurityStatus = application.SecurityStatus; exist.SelectedAcqLocationId = application.SelectedAcqLocationId; exist.SelectionCenterId = application.SelectionCenterId; exist.SuppDocumentReview = application.SuppDocumentReview; exist.Urine = application.Urine; exist.WrittenTest = application.WrittenTest; exist.NoKawalan = application.NoKawalan; exist.FinalSelActualAcqLocationId = application.FinalSelActualAcqLocationId; exist.FinalSelectionEndDate = application.FinalSelectionEndDate; exist.FinalSelectionStartDate = application.FinalSelectionStartDate; exist.FinalServiceCd = application.FinalServiceCd; exist.FirstSelectionEndDate = application.FirstSelectionEndDate; exist.ReportDutyDate = application.ReportDutyDate; exist.ReportDutyLocId = application.ReportDutyLocId; entities.SaveChanges(); return exist.AppId; } } } return 0; }
private static Application BindingToClass(tblApplication exist) { var app = new Application { AppId = exist.AppId, AcquisitionId = exist.AcquisitionId ?? 0, ApplicantId = exist.ApplicantId ?? 0, ApplicationStatus = exist.ApplicationStatus, ArmyNo = exist.ArmyNo, CreatedBy = exist.CreatedBy, CreatedDt = exist.CreatedDt, LastModifiedBy = exist.LastModifiedBy, LastModifiedDt = exist.LastModifiedDt, DentalExamine = exist.DentalExamine, FinalSelectionInd = exist.FinalSelectionInd, FinalSelectionRemark = exist.FinalSelectionRemark, FinalShortlistedInd = exist.FinalShortlistedInd, FirstSelActualAcqLocationId = exist.FirstSelActualAcqLocationId, FirstSelectionAttdnInd = exist.FirstSelectionAttdnInd, FirstSelectionDate = exist.FirstSelectionDate, FirstSelectionInd = exist.FirstSelectionInd, FirstShortlistedInd = exist.FirstShortlistedInd, InvitationFirstSel = exist.InvitationFirstSel, MedicalExamine = exist.MedicalExamine, Panel1Score = exist.Panel1Score, Panel2Score = exist.Panel2Score, Panel3Score = exist.Panel3Score, PhysicalExamination = exist.PhysicalExamination, PhysicalTest = exist.PhysicalTest, ReportDuty = exist.ReportDuty, SecurityAADK = exist.SecurityAADK, SecurityAADKRemark = exist.SecurityAADKRemark, SecurityBSPP = exist.SecurityBSPP, SecurityBSPPRemark = exist.SecurityBSPPRemark, SecurityJPN = exist.SecurityJPN, SecurityJPNRemark = exist.SecurityJPNRemark, SecurityKPM = exist.SecurityKPM, SecurityKPMRemark = exist.SecurityKPMRemark, SecurityPDRM = exist.SecurityPDRM, SecurityPDRMRemark = exist.SecurityPDRMRemark, SecurityStatus = exist.SecurityStatus, SelectedAcqLocationId = exist.SelectedAcqLocationId, SelectionCenterId = exist.SelectionCenterId, SuppDocumentReview = exist.SuppDocumentReview, Urine = exist.Urine, WrittenTest = exist.WrittenTest, ReportDutyLocId = exist.ReportDutyLocId, ReportDutyDate = exist.ReportDutyDate, FinalSelectionEndDate = exist.FinalSelectionEndDate, FinalSelectionStartDate = exist.FinalSelectionStartDate, FinalSelActualAcqLocationId = exist.FinalSelActualAcqLocationId, NoKawalan = exist.NoKawalan, FinalServiceCd = exist.FinalServiceCd, FirstSelectionEndDate = exist.FirstSelectionEndDate, }; if (exist.AcquisitionId.HasValue) app.Acquisition = ObjectBuilder.GetObject<IAcquisitionPersistence>("AcquisitionPersistence") .GetAcquisition(exist.AcquisitionId.Value); if (exist.ApplicantId.HasValue && exist.AcquisitionId.HasValue) app.ApplicantSubmitted = ObjectBuilder.GetObject<IApplicantSubmittedPersistence>("ApplicantSubmittedPersistence") .GetApplicant(exist.ApplicantId.Value, exist.AcquisitionId.Value); if (exist.ReportDutyLocId.HasValue) if (exist.tblREFReportDutyLoc != null) app.ReportDutyLocation = new Location() { LocationId = exist.tblREFReportDutyLoc.ReportDutyLocId, LocationNm = exist.tblREFReportDutyLoc.ReportDutyLoc }; if (exist.FinalSelActualAcqLocationId.HasValue) app.FinalSelectionLocation = ObjectBuilder.GetObject<IAcquisitionPersistence>("AcquisitionPersistence").GetLocation(exist.FinalSelActualAcqLocationId.Value); if (exist.FirstSelActualAcqLocationId.HasValue) app.FirstSelectionLocation = ObjectBuilder.GetObject<IAcquisitionPersistence>("AcquisitionPersistence").GetLocation(exist.FirstSelActualAcqLocationId.Value); return app; }
public int AddNew(Application application) { using (var entities = new atmEntities()) { var exist = (from a in entities.tblApplications where a.ApplicantId == application.ApplicantId && a.AcquisitionId == application.AcquisitionId select a).SingleOrDefault(); if (null != exist) { application.AppId = exist.AppId; return Update(application); } var app = new tblApplication { AcquisitionId = application.AcquisitionId, ApplicantId = application.ApplicantId, ApplicationStatus = application.ApplicationStatus, ArmyNo = application.ArmyNo, CreatedBy = application.CreatedBy, CreatedDt = DateTime.Now, DentalExamine = application.DentalExamine, FinalSelectionInd = application.FinalSelectionInd, FinalSelectionRemark = application.FinalSelectionRemark, FinalShortlistedInd = application.FinalShortlistedInd, FirstSelActualAcqLocationId = application.FirstSelActualAcqLocationId, FirstSelectionAttdnInd = application.FirstSelectionAttdnInd, FirstSelectionDate = application.FirstSelectionDate, FirstSelectionInd = application.FirstSelectionInd, FirstShortlistedInd = application.FirstShortlistedInd, InvitationFirstSel = application.InvitationFirstSel, MedicalExamine = application.MedicalExamine, Panel1Score = application.Panel1Score, Panel2Score = application.Panel2Score, Panel3Score = application.Panel3Score, PhysicalExamination = application.PhysicalExamination, PhysicalTest = application.PhysicalTest, ReportDuty = application.ReportDuty, SecurityAADK = application.SecurityAADK, SecurityAADKRemark = application.SecurityAADKRemark, SecurityBSPP = application.SecurityBSPP, SecurityBSPPRemark = application.SecurityBSPPRemark, SecurityJPN = application.SecurityJPN, SecurityJPNRemark = application.SecurityJPNRemark, SecurityKPM = application.SecurityKPM, SecurityKPMRemark = application.SecurityKPMRemark, SecurityPDRM = application.SecurityPDRM, SecurityPDRMRemark = application.SecurityPDRMRemark, SecurityStatus = application.SecurityStatus, SelectedAcqLocationId = application.SelectedAcqLocationId, SelectionCenterId = application.SelectionCenterId, SuppDocumentReview = application.SuppDocumentReview, Urine = application.Urine, WrittenTest = application.WrittenTest, FinalSelActualAcqLocationId = application.FinalSelActualAcqLocationId, FinalSelectionEndDate = application.FinalSelectionEndDate, FinalSelectionStartDate = application.FinalSelectionStartDate, FinalServiceCd = application.FinalServiceCd, FirstSelectionEndDate = application.FirstSelectionEndDate, NoKawalan = application.NoKawalan, ReportDutyDate = application.ReportDutyDate, ReportDutyLocId = application.ReportDutyLocId, }; entities.tblApplications.Add(app); if (entities.SaveChanges() > 0) return app.AppId; } return 0; }