private StopWorksViewModel GetByStopWorkID(int id) { StopWorksBLL StopWorkBLL = new StopWorksBLL().GetByStopWorkID(id); StopWorksViewModel StopWorkVM = new StopWorksViewModel(); if (StopWorkBLL != null) { StopWorkVM.StopWorkID = StopWorkBLL.StopWorkID; StopWorkVM.StopWorkStartDate = StopWorkBLL.StopWorkStartDate.Date; StopWorkVM.StopWorkEndDate = StopWorkBLL.StopWorkEndDate; StopWorkVM.StartStopWorkDecisionNumber = StopWorkBLL.StartStopWorkDecisionNumber; StopWorkVM.StartStopWorkDecisionDate = StopWorkBLL.StartStopWorkDecisionDate; StopWorkVM.EndStopWorkDecisionNumber = StopWorkBLL.EndStopWorkDecisionNumber; StopWorkVM.EndStopWorkDecisionDate = StopWorkBLL.EndStopWorkDecisionDate; StopWorkVM.Note = StopWorkBLL.Note; //StopWorkVM.IsConvicted = StopWorkBLL.IsConvicted.HasValue ? StopWorkBLL.IsConvicted.Value : false; StopWorkVM.IsConvicted = StopWorkBLL.IsConvicted; StopWorkVM.StopPoint = StopWorkBLL.StopPoint; StopWorkVM.StopWorkCategory = StopWorkBLL.StopWorkType.StopWorkCategory; StopWorkVM.StopWorkType = StopWorkBLL.StopWorkType; StopWorkVM.CreatedDate = StopWorkBLL.CreatedDate; StopWorkVM.CreatedBy = StopWorkVM.GetCreatedByDisplayed(StopWorkBLL.CreatedBy); StopWorkVM.EmployeeCareerHistory = StopWorkBLL.EmployeeCareerHistory; StopWorkVM.Employee = new EmployeesViewModel() { EmployeeCodeID = StopWorkBLL.EmployeeCareerHistory.EmployeeCode.EmployeeCodeID, EmployeeCodeNo = StopWorkBLL.EmployeeCareerHistory.EmployeeCode.EmployeeCodeNo, EmployeeNameAr = StopWorkBLL.EmployeeCareerHistory.EmployeeCode.Employee.EmployeeNameAr }; } return(StopWorkVM); }
public ActionResult End(int id) { StopWorksViewModel StopWorkVM = this.GetByStopWorkID(id); StopWorkVM.IsConvicted = StopWorkVM.IsConvicted ?? false; return(View(StopWorkVM)); }
public ActionResult Delete(StopWorksViewModel StopWorkVM) { StopWorksBLL stopWorkBll = new StopWorksBLL(); stopWorkBll.StopWorkID = StopWorkVM.StopWorkID; stopWorkBll.Remove(); return(RedirectToAction("Index")); }
public JsonResult GetStopWorkByStopWorkID(int StopWorkID) { StopWorksViewModel vm = this.GetByStopWorkID(StopWorkID); if (vm == null) { vm = new StopWorksViewModel(); } return(Json(vm, JsonRequestBehavior.AllowGet)); }
public ActionResult EndStopWork(StopWorksViewModel StopWorkVM) { StopWorksBLL StopWork = new StopWorksBLL().GetByStopWorkID(StopWorkVM.StopWorkID); StopWork.IsConvicted = StopWorkVM.IsConvicted; StopWork.StopWorkEndDate = StopWorkVM.StopWorkEndDate; StopWork.Note = StopWorkVM.Note; StopWork.LoginIdentity = UserIdentity; StopWork.EmployeeCareerHistory = StopWork.EmployeeCareerHistory; Result result = StopWork.EndStopWork(); StopWorksBLL StopWorkEntity = (StopWorksBLL)result.Entity; if ((System.Type)result.EnumType == typeof(StopWorkValidationEnum)) { if (result.EnumMember == StopWorkValidationEnum.RejectedBecauseOfEndDateShouldBeMoreThanStartDate.ToString()) { throw new CustomException(Resources.Globalization.ValidationEndDateShouldBeMoreThanStartDateText); } } if ((System.Type)result.EnumType == typeof(NoConflictWithOtherProcessValidationEnum)) { Classes.Helpers.CommonHelper.ConflictValidationMessage(result); //else if (result.EnumMember == NoConflictWithOtherProcessValidationEnum.RejectedBecauseOfConflictWithStopWork.ToString()) //{ // //throw new CustomException(Resources.Globalization.ValidationConflictWithStopWorkText); // throw new CustomException(Resources.Globalization.ValidationConflictWithAssigningText); //} //else if (result.EnumMember == NoConflictWithOtherProcessValidationEnum.RejectedBecauseOfConflictWithVacation.ToString()) //{ // throw new CustomException(Resources.Globalization.ValidationConflictWithVacationText); //} //else if (result.EnumMember == NoConflictWithOtherProcessValidationEnum.RejectedBecauseOfConflictWithOverTime.ToString()) //{ // throw new CustomException(Resources.Globalization.ValidationConflictWithOverTimeText); //} //else if (result.EnumMember == NoConflictWithOtherProcessValidationEnum.RejectedBecauseOfConflictWithInternshipScholarship.ToString()) //{ // throw new CustomException(Resources.Globalization.ValidationConflictWithInternshipScholarshipText); //} //else if (result.EnumMember == NoConflictWithOtherProcessValidationEnum.RejectedBecauseOfConflictWithDelegation.ToString()) //{ // throw new CustomException(Resources.Globalization.ValidationConflictWithDelegationText); //} } return(View(GetByStopWorkID(StopWorkVM.StopWorkID))); }
public ActionResult Create(StopWorksViewModel stopWorkVM) { //--== StopWork Master DataBind === StopWorksBLL stopWork = new StopWorksBLL(); stopWork.StopWorkStartDate = stopWorkVM.StopWorkStartDate; stopWork.StopWorkEndDate = stopWorkVM.StopWorkEndDate; stopWork.StartStopWorkDecisionNumber = stopWorkVM.StartStopWorkDecisionNumber; stopWork.StartStopWorkDecisionDate = stopWorkVM.StartStopWorkDecisionDate; stopWork.EndStopWorkDecisionNumber = stopWorkVM.EndStopWorkDecisionNumber; stopWork.EndStopWorkDecisionDate = stopWorkVM.EndStopWorkDecisionDate; stopWork.Note = stopWorkVM.Note; stopWork.StopPoint = stopWorkVM.StopPoint; stopWork.StopWorkType = stopWorkVM.StopWorkType; stopWork.IsConvicted = stopWorkVM.IsConvicted; stopWork.EmployeeCareerHistory = new EmployeesCareersHistoryBLL().GetActiveByEmployeeCareerHistoryID(stopWorkVM.EmployeeCareerHistoryID); stopWork.LoginIdentity = UserIdentity; Result result = stopWork.Add(); Session["StopWorkID"] = stopWork.StopWorkID; if ((System.Type)result.EnumType == typeof(StopWorkValidationEnum)) { if (result.EnumMember == StopWorkValidationEnum.RejectedBecauseOfEndDateShouldBeMoreThanStartDate.ToString()) { throw new CustomException(Resources.Globalization.ValidationEndDateShouldBeMoreThanStartDateText); } } if ((System.Type)result.EnumType == typeof(StopWorkValidationEnum)) { if (result.EnumMember == StopWorkValidationEnum.RejectedBecauseOfThereIsAnotherStopWorkNotEnding.ToString()) { throw new CustomException(Resources.Globalization.ValidationThereIsAnotherStopWorkNotEndingText); } } if ((System.Type)result.EnumType == typeof(NoConflictWithOtherProcessValidationEnum)) { if (result.EnumMember == NoConflictWithOtherProcessValidationEnum.RejectedBecauseOfConflictWithStopWork.ToString()) { //throw new CustomException(Resources.Globalization.ValidationConflictWithStopWorkText); throw new CustomException(Resources.Globalization.ValidationConflictWithAssigningText); } Classes.Helpers.CommonHelper.ConflictValidationMessage(result); //else if (result.EnumMember == NoConflictWithOtherProcessValidationEnum.RejectedBecauseOfConflictWithVacation.ToString()) //{ // throw new CustomException(Resources.Globalization.ValidationConflictWithVacationText); //} //else if (result.EnumMember == NoConflictWithOtherProcessValidationEnum.RejectedBecauseOfConflictWithOverTime.ToString()) //{ // throw new CustomException(Resources.Globalization.ValidationConflictWithOverTimeText); //} //else if (result.EnumMember == NoConflictWithOtherProcessValidationEnum.RejectedBecauseOfConflictWithInternshipScholarship.ToString()) //{ // throw new CustomException(Resources.Globalization.ValidationConflictWithInternshipScholarshipText); //} //else if (result.EnumMember == NoConflictWithOtherProcessValidationEnum.RejectedBecauseOfConflictWithDelegation.ToString()) //{ // throw new CustomException(Resources.Globalization.ValidationConflictWithDelegationText); //} } //return View("Index"); return(Json(new { StopWorkID = stopWork.StopWorkID }, JsonRequestBehavior.AllowGet)); }