public ActionResult AddInvoice(AddInvoiceViewModel viewModel) { prepcode = this.PrepCode; // Key this invoice. if (!KeyPegasysInvoice(viewModel)) { TempData["ErrorMessage"] = "Update failed for invoice " + viewModel.INV_KEY_ID; } // Write transhist entries. string memo = ""; string allProcess = ""; switch (viewModel.INVOICETYPE) { case DataEntry.TypeTops: memo = DataEntry.TopsMemo; allProcess = DataEntry.TopsAllProcess; break; case DataEntry.TypeNonTops: memo = (viewModel.GENE043S ? DataEntry.NonTopsMemoError : DataEntry.NonTopsMemo); allProcess = DataEntry.NonTopsAllProcess; break; case DataEntry.TypeConst: memo = (viewModel.GENE043S ? DataEntry.ConstMemoError : DataEntry.ConstMemo); allProcess = DataEntry.ConstAllProcess; break; case DataEntry.TypeNonConst: memo = DataEntry.NonConstMemo; allProcess = DataEntry.NonConstAllProcess; break; default: // Shouldn't get here. break; } var mgrTH = new TransHistManager(); TRANSHIST th = CreateTransHistForChange(viewModel, memo, allProcess); mgrTH.InsertTransHist(th); var mgrITH = new ImageTransHistManager(); IMAGETRANSHIST ith = CreateImageTransHistForChange(viewModel, memo); mgrITH.InsertImageTransHist(ith); // Reload the index page to move to the next invoice, if available. return(RedirectToAction("Index", new { InvoiceType = viewModel.INVOICETYPE })); }
private IMAGETRANSHIST CreateImageTransHistForChange(AddInvoiceViewModel inv, string memo) { var th = new IMAGETRANSHIST() { IMG_TH_ID = null, IMG_KEY_ID = "NONE", IMAGEBATCH = inv.IMAGEBATCH, BATCH_INDEX = "NO", STATUS = "K", QUEUE = "", VITAP_KEY_ID = inv.INV_KEY_ID, IMAGETYPE = "INV", PROCESS = DataEntry.Keyed, SOURCE = DataEntry.Keyed, PDOCNO = inv.PDOCNOPO, ACT = inv.ACT, PREPCODE = prepcode, IMAGEID = inv.IMAGEID, NOTES = memo }; return(th); }