public ActionResult DetailDelivery(DetailDeliveryPOVendorViewModel model, HttpPostedFileBase postedFile)
 {
     try
     {
         if (postedFile != null)
         {
             string path = Server.MapPath("~/Uploads/");
             if (!Directory.Exists(path))
             {
                 Directory.CreateDirectory(path);
             }
             ITransaksiPOVendorService res = new TransaksiPOVendorService();
             var re = res.InsertUploadFile(model.PONumber, "Scan Copy PO", postedFile.FileName);
             postedFile.SaveAs(path + Path.GetFileName(model.PONumber.Trim() + "_" + postedFile.FileName.Trim()));
             this.AddNotification("Your Data Has Been Successfully Updated. ", NotificationType.SUCCESS);
             return(RedirectToAction("Index"));
         }
         ITransaksiPOVendorService svc = new TransaksiPOVendorService();
         var result = svc.UpdateDelivery(model);
         this.AddNotification("Your Data Has Been Successfully Updated. ", NotificationType.SUCCESS);
         return(RedirectToAction("Index"));
     }
     catch (Exception ex)
     {
         general.AddLogError("POVendor DetailDelivery", ex.Message, ex.StackTrace);
         return(View("~/Views/Transaksi/Vendor/Index.cshtml", model));
     }
 }
        public DetailDeliveryPOVendorViewModel UpdateDelivery(DetailDeliveryPOVendorViewModel model)
        {
            var dc     = new eprocdbDataContext();
            var result = (from custpo in dc.CUSTOMPOs where custpo.PONUMBER == model.PONumber select custpo).SingleOrDefault();

            result.HARGADPP_INPUT          = model.DPPByVendor;
            result.HARGAPPNUNIT_INPUT      = model.PPNByVendor;
            result.HARGABBN_INPUT          = model.BBNPriceByVendor;
            result.DODATE                  = model.FakturDODate;
            result.DONUMBER                = model.FakturDONumber;
            result.CARROSERIEVENDORNAME    = model.CarrosserieAccessoriesVendorName;
            result.ACCESORIESADDRESS       = model.CarrosserieAccessoriesAddress;
            result.REMARKSCARROSSERIE      = model.RemarksCarrosserieAccessories;
            result.TGLMASUKKAROSERI        = model.DateEntryCarrosserieAccessories;
            result.TGLSELESAIKAROSERI      = model.DateFinishCarrosserieAccessories;
            result.ACTUALDATEDELIVEREDUNIT = model.TanggalBSTB;
            result.REMARKS                 = model.RemarksPO;
            result.MODIFIED_DATE           = DateTime.Now;
            result.MODIFIED_BY             = System.Web.HttpContext.Current.Session["UserID"].ToString();

            var result2 = (from custbpkb in dc.CUSTOMBPKBs where custbpkb.PONUMBER == model.PONumber select custbpkb).SingleOrDefault();

            result2.NOPOLISI_INPUT = model.LicensePlateByVendor;
            result2.TGLSTNK_INPUT  = model.STNKDateByVendor;
            result2.STCKDATE       = model.STCKDate;
            result2.TGLSERAHBPKB   = model.TanggalBSTB;
            result.MODIFIED_DATE   = DateTime.Now;
            result.MODIFIED_BY     = System.Web.HttpContext.Current.Session["UserID"].ToString();

            var result3 = (from custgr in dc.CUSTOMGRs where custgr.PONUMBER == model.PONumber select custgr).SingleOrDefault();

            result3.NOCHASIS_INPUT = model.ChassisNumberByVendor;
            result3.NOENGINE_INPUT = model.MachineNumberByVendor;
            result.MODIFIED_DATE   = DateTime.Now;
            result.MODIFIED_BY     = System.Web.HttpContext.Current.Session["UserID"].ToString();

            dc.SubmitChanges();
            UpdateStatus(model.PONumber);
            UpdateInvoiceStatus(model.PONumber);
            return(model);
        }