public ActionResult Edit(Job_level_grade model, string command) { try { var record = dbcontext.Job_level_gradee.FirstOrDefault(m => m.ID == model.ID); record.Name = model.Name; record.Description = model.Description; record.Code = model.Code; record.max_annual_increase_percentage = model.max_annual_increase_percentage; record.max_basic_salary = model.max_basic_salary; record.max_incentive_amount = model.max_incentive_amount; record.max_incentive_percentage = model.max_incentive_percentage; record.max_monthly_allowance = model.max_monthly_allowance; record.mid_basic_salary = model.mid_basic_salary; record.min_basic_salary = model.min_basic_salary; record.min_working_years = model.min_working_years; record.representation_allowance_value = model.representation_allowance_value; record.dedicated_allowence = model.dedicated_allowence; dbcontext.SaveChanges(); //=================================check for alert================================== var get_result_check = HR.Controllers.check.check_alert("job level grade", HR.Models.user.Action.edit, HR.Models.user.type_field.form); if (get_result_check != null) { var inbox = new Models.user.Alert_inbox { send_from_user_id = User.Identity.Name, send_to_user_id = get_result_check.send_to_ID_user, title = get_result_check.Subject, Subject = get_result_check.Message }; if (get_result_check.until != null) { if (get_result_check.until.Value.Year != 0001) { inbox.until = get_result_check.until; } } ApplicationDbContext dbcontext = new ApplicationDbContext(); dbcontext.Alert_inbox.Add(inbox); dbcontext.SaveChanges(); } //=================================================================================== var spe = dbcontext.Special_Allwonce_History.FirstOrDefault(m => m.selectedID == record.ID && m.type_allowance == type_allowance.job_levle_grade); if (command == "Submit") { return(RedirectToAction("allowance", "Job_level_class", new { id = record.ID, type = type_allowance.job_levle_grade })); } ; return(RedirectToAction("index")); } catch (DbUpdateException) { TempData["Message"] = HR.Resource.Basic.thiscodeIsalreadyexists; return(View(model)); } catch (Exception e) { return(View(model)); } }
public ActionResult Create() { ////// var modell = new Job_level_grade(); var stru = dbcontext.StructureModels.FirstOrDefault(m => m.All_Models == ChModels.Organization).Structure_Code; var model = dbcontext.Job_level_gradee.ToList(); if (model.Count() == 0) { modell.Code = stru + "1"; } else { modell.Code = stru + (model.LastOrDefault().ID + 1).ToString(); } ///// return(View(modell)); }
public ActionResult Details(Job_level_grade model, string command) { if (command == "edit") { return(RedirectToAction("Edit", new { id = model.ID })); } else if (command == "delete") { return(RedirectToAction("Delete", new { id = model.ID })); } else if (command == "back") { return(RedirectToAction("index")); } if (command == "Submit") { return(RedirectToAction("allowance", "Job_level_class", new { id = model.ID, type = type_allowance.job_levle_grade })); } else { return(View()); } }