public ActionResult Create(MAVoucher mavoucher) { if (ModelState.IsValid) { using (var db = new MvcApplication1.Models.VoucherEntities()) { setId(); mavoucher.VoucherID = this.id; mavoucher.SubmittedBy = RegistrationController.UserName; mavoucher.SubmitDate = DateTime.Now; db.MAVouchers.Add(mavoucher); var newVoucher = db.Vouchers.Create(); newVoucher.VoucherID = id; newVoucher.VoucherType = "MAV"; newVoucher.SubmittedBy = RegistrationController.UserName; newVoucher.SubmitDate = DateTime.Now; newVoucher.StatusByDM = "Unseen"; newVoucher.StatusByFSO = "Unseen"; newVoucher.EmployeeID = RegistrationController.EmpId; db.Vouchers.Add(newVoucher); try { db.SaveChanges(); } catch (DbUpdateException e) { } catch (UpdateException e) { } catch (SqlException e) { } return(RedirectToAction("Index", "Voucher")); } } return(View(mavoucher)); }
public void FSO_Update(String FSO_Status) { using (var db = new MvcApplication1.Models.VoucherEntities()) { var t = db.Vouchers.Where(u => u.VoucherID == voucherid).SingleOrDefault(); t.StatusByFSO = FSO_Status; db.Entry(t).State = EntityState.Modified; db.SaveChanges(); flag = true; } }
public void PBV_Update() { using (var db = new MvcApplication1.Models.VoucherEntities()) { var s = db.PBVouchers.Where(u => u.VoucherID == voucherid).SingleOrDefault(); var t = db.Vouchers.Where(u => u.VoucherID == voucherid).SingleOrDefault(); s.Amount = (decimal)this.amount; s.Description = this.description; s.SubmitDate = DateTime.Now; t.SubmitDate = DateTime.Now; db.Entry(s).State = EntityState.Modified; db.SaveChanges(); flag = true; } }
public void TAV_Update() { using (var db = new MvcApplication1.Models.VoucherEntities()) { var s = db.TAVouchers.Where(u => u.VoucherID == voucherid).SingleOrDefault(); var t = db.Vouchers.Where(u => u.VoucherID == voucherid).SingleOrDefault(); s.LeaveDuration = (int)this.leaveDuration; s.Destination = this.destination; s.SubmitDate = DateTime.Now; t.SubmitDate = DateTime.Now; db.Entry(s).State = EntityState.Modified; db.SaveChanges(); flag = true; } }