public ActionResult getRateAndCurrencies(int activityId) { EmployeeEmploymentViewModel emodel = new EmployeeEmploymentViewModel(); if (activityId != 0 && activityId != null) { var activityInfo = _db.ActivityTypes.Where(x => x.Id == activityId && x.Archived == false).FirstOrDefault(); emodel.WorkerRate = activityInfo.WorkerRate; var currunciesInfo = _db.SystemListValues.Where(x => x.Id == activityInfo.CurrencyID && x.Archived == false).FirstOrDefault(); emodel.CurruncyName = currunciesInfo.Value; } return(Json(emodel, JsonRequestBehavior.AllowGet)); }
//public ActionResult CalculateHoliday(HelpmecalculateviewModel hmodel) //{ // EmployeeEmploymentViewModel model = new EmployeeEmploymentViewModel(); // int enti = Convert.ToInt32(hmodel.FullTimeEntitlement); // if (hmodel.IncludePublicHolidays == "on") // { // model.includeThisYear = HolidayIncludeContractDays(hmodel.EmployeeID, enti); // } // else if(hmodel.IncludePublicHolidays=="off") // { // model.notincludeThisYear = HolidayNotIncludeContractDays(hmodel.EmployeeID,enti); // } // return Json(model,JsonRequestBehavior.AllowGet); //} public ActionResult getAllActivityType() { var ActivityData = _db.ActivityTypes.Where(x => x.Archived == false).ToList(); EmployeeEmploymentViewModel model = new EmployeeEmploymentViewModel(); foreach (var item in ActivityData) { model.ActivityTypeList.Add(new SelectListItem() { Text = item.Name, Value = item.Id.ToString() }); } return(Json(model.ActivityTypeList, JsonRequestBehavior.AllowGet)); }
public ActionResult HelpMeCalculate(HelpmecalculateviewModel model) { EmployeeEmploymentViewModel emodel = new EmployeeEmploymentViewModel(); var userinfo = _db.AspNetUsers.Where(x => x.Id == model.EmployeeID).FirstOrDefault(); model.StartDate = String.Format("{0:dd-MM-yyyy}", userinfo.StartDate); if (userinfo.JobContryID == null) { userinfo.JobContryID = 1; } model.CountryId = (int)userinfo.JobContryID; List <SelectListItem> data = new List <SelectListItem>(); HelpmeCalculeteModel Details = new HelpmeCalculeteModel(); int totalDays = 0; int enti = Convert.ToInt32(model.FullTimeEntitlement); Details = _employeeMethod.GetPublicHolidayByContryId(model.StartDate, model.CountryId); if (model.IncludePublicHolidays == "on") { emodel.includeThisYear = HolidayIncludeContractDays(model.EmployeeID, enti); data.Add(new SelectListItem { Text = emodel.includeThisYear.ToString(), Value = "holidaysThisYear" }); } else { emodel.notincludeThisYear = HolidayNotIncludeContractDays(model.EmployeeID, enti); data.Add(new SelectListItem { Text = emodel.notincludeThisYear.ToString(), Value = "holidaysThisYear" }); } if (enti != null && enti != 0) { double totalHoliday = HolidayIncludeContractDays(model.EmployeeID, enti); var edata = _db.Employee_Salary.Where(x => x.Archived == false && x.EmployeeID == model.EmployeeID).FirstOrDefault(); if (edata != null) { double rate = Convert.ToDouble(edata.TotalSalary) / totalHoliday; data.Add(new SelectListItem { Text = emodel.rate.ToString(), Value = "recovryRate" }); } } data.Add(new SelectListItem { Text = enti.ToString(), Value = "holidaysNextYear" }); return(Json(data, JsonRequestBehavior.AllowGet)); }
public ActionResult Index(int EmployeeId) { EmployeeEmploymentViewModel model = new EmployeeEmploymentViewModel(); model.EmployeeId = EmployeeId; model.NoticePeriodList.Add(new SelectListItem() { Text = "-- Select Notice Period --", Value = "0" }); foreach (var item in _otherSettingMethod.getAllSystemValueListByKeyName("Notice Period List")) { model.NoticePeriodList.Add(new SelectListItem() { Text = item.Value, Value = item.Id.ToString() }); } var employeeData = _employeeMethod.getEmployeeById(EmployeeId); model.ProbationEndDate = String.Format("{0:dd-MM-yyy}", employeeData.ProbationEndDate); model.NextProbationReviewDate = String.Format("{0:dd-MM-yyy}", employeeData.NextProbationReviewDate); if (employeeData.NoticePeriod != null) { model.NoticePeriod = (int)employeeData.NoticePeriod; } model.FixedTermEndDate = String.Format("{0:dd-MM-yyy}", employeeData.FixedTermEndDate); model.MethodofRecruitmentSetup = employeeData.MethodofRecruitmentSetup; if (employeeData.RecruitmentCost != null) { model.RecruitmentCost = employeeData.RecruitmentCost; } if (employeeData.Thisyear != null) { model.ThisYearHolidays = (int)employeeData.Thisyear; } if (employeeData.Nextyear != null) { model.NextYearHolidays = (int)employeeData.Nextyear; } return(View(model)); }
public void UpdateEmploymentDetail(EmployeeEmploymentViewModel model) { AspNetUser employeeData = _db.AspNetUsers.Where(x => x.Id == model.EmployeeId).FirstOrDefault(); if (!string.IsNullOrEmpty(model.ProbationEndDate)) { var ProbationEndDateToString = DateTime.ParseExact(model.ProbationEndDate, inputFormat, CultureInfo.InvariantCulture); employeeData.ProbationEndDate = Convert.ToDateTime(ProbationEndDateToString.ToString(outputFormat)); } if (!string.IsNullOrEmpty(model.NextProbationReviewDate)) { var NextProbationReviewDateToString = DateTime.ParseExact(model.NextProbationReviewDate, inputFormat, CultureInfo.InvariantCulture); employeeData.NextProbationReviewDate = Convert.ToDateTime(NextProbationReviewDateToString.ToString(outputFormat)); } employeeData.NoticePeriod = model.NoticePeriod; if (!string.IsNullOrEmpty(model.FixedTermEndDate)) { var FixedTermEndDateToString = DateTime.ParseExact(model.FixedTermEndDate, inputFormat, CultureInfo.InvariantCulture); employeeData.FixedTermEndDate = Convert.ToDateTime(FixedTermEndDateToString.ToString(outputFormat)); } employeeData.MethodofRecruitmentSetup = model.MethodofRecruitmentSetup; employeeData.RecruitmentCost = model.RecruitmentCost; if (model.HolidayEnti != 0 && model.HolidayEnti != null) { employeeData.HolidayEntitlement = model.HolidayEnti; } if (model.ActivityTypeId != null && model.ActivityTypeId != 0) { employeeData.ActivityType = model.ActivityTypeId; } employeeData.Thisyear = model.ThisYearHolidays; employeeData.Nextyear = model.NextYearHolidays; if (model.rate != 0 && model.rate != null) { employeeData.RecovryRate = Convert.ToDecimal(model.rate); } _db.SaveChanges(); }
public ActionResult UpdateEmployment(EmployeeEmploymentViewModel model) { _employeeEmploymentMethod.UpdateEmploymentDetail(model); return(Json("success", JsonRequestBehavior.AllowGet)); }
public ActionResult Index(int EmployeeId) { EmployeeEmploymentViewModel model = new EmployeeEmploymentViewModel(); model.EmployeeId = EmployeeId; model.NoticePeriodList.Add(new SelectListItem() { Text = "-- Select Notice Period --", Value = "0" }); foreach (var item in _otherSettingMethod.getAllSystemValueListByKeyName("Notice Period List")) { model.NoticePeriodList.Add(new SelectListItem() { Text = item.Value, Value = item.Id.ToString() }); } var employeeData = _employeeMethod.getEmployeeById(EmployeeId); model.ProbationEndDate = String.Format("{0:dd-MM-yyy}", employeeData.ProbationEndDate); model.NextProbationReviewDate = String.Format("{0:dd-MM-yyy}", employeeData.NextProbationReviewDate); if (employeeData.NoticePeriod != null) { model.NoticePeriod = (int)employeeData.NoticePeriod; } model.FixedTermEndDate = String.Format("{0:dd-MM-yyy}", employeeData.FixedTermEndDate); model.MethodofRecruitmentSetup = employeeData.MethodofRecruitmentSetup; if (employeeData.RecruitmentCost != null) { model.RecruitmentCost = employeeData.RecruitmentCost; } if (employeeData.Thisyear != null) { model.ThisYearHolidays = (int)employeeData.Thisyear; } if (employeeData.Nextyear != null) { model.NextYearHolidays = (int)employeeData.Nextyear; } if (employeeData.HolidayEntitlement != null) { double totalHoliday = HolidayIncludeContractDays(model.EmployeeId, Convert.ToInt32(employeeData.HolidayEntitlement)); var data = _db.Employee_Salary.Where(x => x.Archived == false && x.EmployeeID == model.EmployeeId).FirstOrDefault(); if (data != null) { model.rate = Convert.ToDouble(data.TotalSalary) / totalHoliday; } } if (employeeData.ActivityType != null && employeeData.ActivityType != 0) { var activityInfo = _db.ActivityTypes.Where(x => x.Id == employeeData.ActivityType && x.Archived == false).FirstOrDefault(); model.ActivityTypeId = activityInfo.Id; model.ActivityTypeName = activityInfo.Name; model.WorkerRate = activityInfo.WorkerRate; var currunciesInfo = _db.SystemListValues.Where(x => x.Id == activityInfo.CurrencyID && x.Archived == false).FirstOrDefault(); model.CurruncyName = currunciesInfo.Value; } var ActivityData = _db.ActivityTypes.Where(x => x.Archived == false).ToList(); foreach (var item in ActivityData) { model.ActivityTypeList.Add(new SelectListItem() { Text = item.Name, Value = item.Id.ToString() }); } // model.includeThisYear = HolidayIncludeContractDays(EmployeeId); // model.notincludeThisYear = HolidayNotIncludeContractDays(EmployeeId); return(View(model)); }