예제 #1
0
        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));
        }
예제 #2
0
 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;
     }
 }
예제 #3
0
 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;
     }
 }
예제 #4
0
 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;
     }
 }