public ActionResult DeleteConfirmed(int id) { end_of_service end_of_service = db.end_of_service.Find(id); db.end_of_service.Remove(end_of_service); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,Employee_id,last_working_day,status")] end_of_service end_of_service) { if (ModelState.IsValid) { db.Entry(end_of_service).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Employee_id = new SelectList(db.master_file, "employee_id", "employee_name", end_of_service.Employee_id); return(View(end_of_service)); }
// GET: end_of_service/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } end_of_service end_of_service = db.end_of_service.Find(id); if (end_of_service == null) { return(HttpNotFound()); } return(View(end_of_service)); }
// GET: end_of_service/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } end_of_service end_of_service = db.end_of_service.Find(id); if (end_of_service == null) { return(HttpNotFound()); } ViewBag.Employee_id = new SelectList(db.master_file, "employee_id", "employee_name", end_of_service.Employee_id); return(View(end_of_service)); }
public ActionResult EOSB(end_of_service endOfService) { var EOSBvar = new end_of_service(); var emplist = this.db.master_file.ToList(); var conlist = this.db.contracts.ToList(); var leavcal = new LeavesController(); var alist = this.db.master_file.OrderBy(e => e.employee_no).ThenByDescending(x => x.date_changed).ToList(); var afinallist = new List <master_file>(); foreach (var file in alist) { if (afinallist.Count == 0) { afinallist.Add(file); } if (!afinallist.Exists(x => x.employee_no == file.employee_no)) { afinallist.Add(file); } } ViewBag.hasdata = false; ViewBag.status = new SelectList( new List <SelectListItem> { new SelectListItem { Selected = false, Text = "resign", Value = 1.ToString() }, new SelectListItem { Selected = false, Text = "terminate", Value = 2.ToString() }, new SelectListItem { Selected = false, Text = "transfer", Value = 3.ToString() }, }, "Value", "Text"); afinallist = afinallist.FindAll(x => x.contracts.Count != 0); ViewBag.Employee_id = new SelectList(afinallist.OrderBy(x => x.employee_no), "employee_id", "employee_no"); ViewBag.Employee_id1 = new SelectList(afinallist.OrderBy(x => x.employee_no), "employee_id", "employee_name"); if (endOfService.Employee_id != null && endOfService.last_working_day.HasValue && endOfService.status != null) { ViewBag.hasdata = true; var emp = emplist.Find(x => x.employee_id == endOfService.Employee_id); var con = conlist.Find(x => x.employee_no == emp.employee_id); EOSBvar.Employee_id = emp.employee_id; var abs = emp.leave_absence.ToList(); var q = 0d; foreach (var ab in abs) { q += ab.absence.Value; } EOSBvar.master_file = emp; if (con != null) { EOSBvar.con_id = con.employee_id; EOSBvar.contract = con; } EOSBvar.abstotal = q; leavcal.cal_bal(endOfService.last_working_day.Value, emp); var leavecallist = this.db.leavecals.ToList(); var leavecal = leavecallist.Find(x => x.Employee_id == emp.employee_id); EOSBvar.leavecal = leavecal; EOSBvar.leavedetails = leavecal.Id; EOSBvar.last_working_day = endOfService.last_working_day.Value; EOSBvar.status = endOfService.status; var eoslist = this.db.end_of_service.ToList(); if (endOfService.save) { if (ModelState.IsValid) { db.end_of_service.Add(endOfService); db.SaveChanges(); return(RedirectToAction("EOSB")); } } else { EOSBvar.pendingSalary = 0d; EOSBvar.noticePeriod = 0d; EOSBvar.nagativeBalance = 0d; EOSBvar.others = 0d; EOSBvar.cashAdvance = 0d; EOSBvar.pettyCash = 0d; EOSBvar.HRAdvances = 0d; EOSBvar.telecomDeductions = 0d; EOSBvar.trafficeFines = 0d; EOSBvar.save = true; } } return(this.View(EOSBvar)); }
public ActionResult Create(end_of_service end_of_service) { if (ModelState.IsValid) { db.end_of_service.Add(end_of_service); db.SaveChanges(); return(RedirectToAction("Create")); } var alist = db.master_file.OrderBy(e => e.employee_no).ThenByDescending(x => x.date_changed).ToList(); var afinallist = new List <master_file>(); foreach (var file in alist) { if (afinallist.Count == 0) { afinallist.Add(file); } if (!afinallist.Exists(x => x.employee_no == file.employee_no)) { afinallist.Add(file); } } var alistc = db.contracts.OrderBy(e => e.master_file.employee_no).ThenByDescending(x => x.date_changed) .ToList(); var afinallistc = new List <contract>(); foreach (var file in alistc) { if (afinallistc.Count == 0) { afinallistc.Add(file); } if (!afinallistc.Exists(x => x.employee_no == file.employee_no)) { afinallistc.Add(file); } } ViewBag.status = new SelectList( new List <SelectListItem> { new SelectListItem { Selected = true, Text = string.Empty, Value = "-1" }, new SelectListItem { Selected = false, Text = "resign", Value = 1.ToString() }, new SelectListItem { Selected = false, Text = "terminate", Value = 2.ToString() }, }, "Value", "Text"); ViewBag.Employee_id = new SelectList(afinallist.OrderBy(x => x.employee_no), "employee_id", "employee_no"); ViewBag.Employee_name = new SelectList( afinallist.OrderBy(x => x.employee_no), "employee_id", "employee_name"); ViewBag.joi = new SelectList(afinallist.OrderBy(x => x.employee_no), "employee_id", "joining_date"); ViewBag.dept = new SelectList( afinallistc.OrderBy(x => x.master_file.employee_no), "employee_id", "departmant_project"); ViewBag.pos = new SelectList( afinallistc.OrderBy(x => x.master_file.employee_no), "employee_id", "designation"); ViewBag.gra = new SelectList(afinallistc.OrderBy(x => x.master_file.employee_no), "employee_id", "grade"); ViewBag.bac = new SelectList(afinallistc.OrderBy(x => x.master_file.employee_no), "employee_id", "basic"); ViewBag.hou = new SelectList( afinallistc.OrderBy(x => x.master_file.employee_no), "employee_id", "housing_allowance"); ViewBag.gro = new SelectList( afinallistc.OrderBy(x => x.master_file.employee_no), "employee_id", "salary_details"); return(View(end_of_service)); }