public DetailBPKBPOVendorViewModel UpdateBPKB(DetailBPKBPOVendorViewModel model) { var dc = new eprocdbDataContext(); var prnumber = (from custpo in dc.CUSTOMPOs where custpo.PONUMBER == model.PONumber select custpo).SingleOrDefault(); prnumber.ACTUALRECEIVEDBPKBHOFROMBRANCH = model.ActualReceivedBPKBHOFromBranch; string strPrNumber = prnumber.PRNUMBERSAP; var result = (from custbpkb in dc.CUSTOMBPKBs where custbpkb.PONUMBER == model.PONumber select custbpkb).SingleOrDefault(); result.ACTUALDELIVERYBPKBTOFINANCE = model.ActualDeliveryBPKBDateHO; result.ACTUALRECEIVEDBPKBDICAB = model.ActualDeliveredBPKBDateCabang; result.KETBPKB = model.RemarksBPKB; result.NOBPKB = model.BPKBNumber; result.KETSURATUBAHBENTUK = model.KeteranganSuratUbahBentuk; result.KETERANGANSURATRUBAHWARNA = model.KeteranganSuratUbahWarna; result.NOFAKTUR = model.NoFakturKendaraan; result.TGLFAKTUR = model.TanggalFakturKendaraan; result.NOSERTIFIKAT = model.NoSertifikat; result.TGLSERTIFIKAT = model.TanggalSertifikat; result.NOFORMULIRA = model.NoFormulirA; result.TGLFORMULIRA = model.TanggalFormulirA; result.NOSURATUBAHBENTUK = model.NoSuratUbahBentuk; result.TGLSURATUBAHBENTUK = model.TanggalSuratUbahBentuk; result.NOSURATRUBAHWARNA = model.NoSuratUbahWarna; result.TANGGALSURATRUBAHWARNA = model.TanggalSuratUbahWarna; result.NOSERTIFIKATREGUJITIPE = model.NoSertifikatRegistrasiUjiTipe; result.ACTUALRECEIVEDBPKBDIHO = model.ActualDeliveryBPKBDateHO; result.ACTUALDELIVERYBPKBTOFINANCE = model.ActualDeliveredDateBPKBToFinance; result.ACTUALRECEIVEDBPKBHOBACK = model.BPKBDateSentBack; result.ACTUALRECEIVEDBPKBHOBACK = model.ActualReceivedBPKBHOBack; result.DATEDELIVERYTOBRANCHORVENDOR = model.DateDeliveryToBranchVendor; result.REMARKSDETAILPROBLEM = model.RemarksDetailProblem; result.POSISIBPKB = model.BPKBPosition; result.MODIFIED_DATE = DateTime.Now; result.MODIFIED_BY = System.Web.HttpContext.Current.Session["UserID"].ToString(); var result2 = (from custpr in dc.CUSTOMPRs where custpr.PRSAP == strPrNumber select custpr.YEAR).FirstOrDefault(); result2 = model.Year; dc.SubmitChanges(); UpdateStatus(model.PONumber); UpdateInvoiceStatus(model.PONumber); return(model); }
public ActionResult DetailBPKB(DetailBPKBPOVendorViewModel model, HttpPostedFileBase postedFile) { try { if (postedFile != null) { string path = Server.MapPath("~/Uploads/"); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } postedFile.SaveAs(path + Path.GetFileName(postedFile.FileName)); this.AddNotification("Your Data Has Been Successfully Updated. ", NotificationType.SUCCESS); } ITransaksiPOVendorService svc = new TransaksiPOVendorService(); //if (model.strClearingDate != "" && model.strClearingDate != null) //{ // model.ClearingDate = DateTime.Parse(model.strClearingDate); //}else //{ // model.ClearingDate = null; //} //if (model.strActualReceivedUnit != "" && model.strActualReceivedUnit != null) //{ // model.ActualReceivedUnit = DateTime.Parse(model.strActualReceivedUnit); //}else //{ // model.ActualReceivedUnit = null; //} //if (model.strActualReceivedBPKBHOBack != "" && model.strActualReceivedBPKBHOBack != null) //{ // model.ActualReceivedBPKBHOBack = DateTime.Parse(model.strActualReceivedBPKBHOBack); //}else //{ // model.ActualReceivedBPKBHOBack = null; //} //if (model.strActualDeliveredBPKBDateCabang != "" && model.strActualDeliveredBPKBDateCabang != null) //{ // model.ActualDeliveredBPKBDateCabang = DateTime.Parse(model.strActualDeliveredBPKBDateCabang); //} //else //{ // model.ActualDeliveredBPKBDateCabang = null; //} //if (model.strPoDate != "" && model.strPoDate != null) //{ // model.PODate = DateTime.Parse(model.strPoDate); //}else //{ // model.PODate = null; //} //if (model.strActualDeliveryBPKBDateHO != "" && model.strActualDeliveryBPKBDateHO != null) //{ // model.ActualDeliveryBPKBDateHO = DateTime.Parse(model.strActualDeliveryBPKBDateHO); //}else //{ // model.ActualDeliveryBPKBDateHO = null; //} //if (model.strTanggalSertifikat != "" && model.strTanggalSertifikat != null) //{ // model.TanggalSertifikat = DateTime.Parse(model.strTanggalSertifikat); //}else //{ // model.TanggalSertifikat = null; //} //if (model.strTanggalFormulirA != "" && model.strTanggalFormulirA != null) //{ // model.TanggalFormulirA = DateTime.Parse(model.strTanggalFormulirA); //}else //{ // model.TanggalFormulirA = null; //} //if (model.strTanggalSuratUbahBentuk != "" && model.strTanggalSuratUbahBentuk != null) //{ // model.TanggalSuratUbahBentuk = DateTime.Parse(model.strTanggalSuratUbahBentuk); //}else //{ // model.TanggalSuratUbahBentuk = null; //} //if (model.strTanggalSuratUbahWarna != "" && model.strTanggalSuratUbahWarna != null) //{ // model.TanggalSuratUbahWarna = DateTime.Parse(model.strTanggalSuratUbahWarna); //}else //{ // model.TanggalSuratUbahWarna = null; //} //if (model.strActualDeliveredDateBPKBToFinance != "" && model.strActualDeliveredDateBPKBToFinance != null) //{ // model.ActualDeliveredDateBPKBToFinance = DateTime.Parse(model.strActualDeliveredDateBPKBToFinance); //} //else //{ // model.ActualDeliveredDateBPKBToFinance = null; //} //if (model.strBPKBDateSentBack != "" && model.strBPKBDateSentBack != null) //{ // model.BPKBDateSentBack = DateTime.Parse(model.strBPKBDateSentBack); //}else //{ // model.BPKBDateSentBack = null; //} var result = svc.UpdateBPKB(model); this.AddNotification("Your Data Has Been Successfully Updated. ", NotificationType.SUCCESS); return(RedirectToAction("Index")); } catch (Exception ex) { general.AddLogError("POVendor DetailBPKB", ex.Message, ex.StackTrace); return(View("~/Views/Transaksi/Vendor/Index.cshtml", model)); } }