//勾選退件 public JsonResult getFailString(string d) { string[] ids = d.Split('\\', '"', '[', ',', ']'); List <int> list = new List <int>(); foreach (var item in ids) { if (item != "") { list.Add(int.Parse(item)); } } foreach (var i in list) { dbMyCompanyContext db = new dbMyCompanyContext(); TTravelExpenseApplication travel = db.TTravelExpenseApplications.FirstOrDefault(c => c.CApplyNumber == i); if (travel != null) { if (travel.CCheckStatus == 1) { travel.CCheckStatus = 3; db.SaveChanges(); } } } return(Json(d)); }
public IActionResult Edit(int?id) { if (id.HasValue == false) { return(RedirectToAction("List")); } TTravelExpenseApplication et = db.TTravelExpenseApplications.Where(e => e.CApplyNumber == id).FirstOrDefault(); if (et == null) { return(RedirectToAction("List")); } var result = new CTravelViewModel { CAmont = et.CAmont, CApplyNumber = et.CApplyNumber, CCheckStatus = et.CCheckStatus, CDepartmentId = et.CDepartmentId, CEmployeeId = et.CEmployeeId, CReason = et.CReason, CTravelEndTime = et.CTravelEndTime, CTravelStartTime = et.CTravelStartTime }; ViewBag.Departments = db.TUserDepartments.ToList(); ViewBag.Status = db.TCheckStatuses.ToList(); return(View(result)); }
public IActionResult Delete(int?id) { if (id != null) { TTravelExpenseApplication d = db.TTravelExpenseApplications.FirstOrDefault(t => t.CApplyNumber == id); if (d != null) { db.TTravelExpenseApplications.Remove(d); db.SaveChanges(); } } return(RedirectToAction("List")); }
public IActionResult fail(int?id) { if (id != null) { dbMyCompanyContext db = new dbMyCompanyContext(); TTravelExpenseApplication travel = db.TTravelExpenseApplications.FirstOrDefault(t => t.CApplyNumber == id); if (travel != null) { if (travel.CCheckStatus == 1) { travel.CCheckStatus = 3; db.SaveChanges(); } } } return(RedirectToAction("List")); }
public Travel_Expense_ApplicationViewModel() { iv_travel = new TTravelExpenseApplication(); iv_User = new TUser(); }
public Travel_Expense_ApplicationViewModel(TTravelExpenseApplication t, TUser u) { iv_travel = t; iv_User = u; }