Esempio n. 1
0
 private void MarkImageListAsRejected(IMAGELIST image, string reason)
 {
     image.STATUS   = "X";
     image.PREPCODE = prepcode;
     image.SOURCE   = DataEntry.ImgReject;
     image.REASON   = reason;
 }
Esempio n. 2
0
        public ActionResult RejectInvoice(AddInvoiceViewModel viewModel)
        {
            string errorMessage = "";

            prepcode = this.PrepCode;

            // Format reason string.
            string reason = DateTime.Now.ToString() + " " + prepcode;

            reason += " - " + viewModel.REJECTOPTION + " / " + viewModel.REJECTDESCRIPTION;

            // Mark invoice as rejected.
            if (!RejectPegasysInvoice(viewModel))
            {
                errorMessage = "Reject invoice failed. ";
            }

            // Write transhist entry.
            string    memo  = "Image Rejected from data entry - " + reason;
            var       mgrTH = new TransHistManager();
            TRANSHIST th    = CreateTransHistForChange(viewModel, memo, DataEntry.ImgReject);

            mgrTH.InsertTransHist(th);

            // Update imagelist.
            var       mgrIL = new ImageListManager();
            IMAGELIST il    = mgrIL.GetImageListByImageId(viewModel.IMAGEID);

            if (il != null)
            {
                // Mark as rejected and update.
                mgrIL.RejectImageList(viewModel.IMAGEID, prepcode, reason);
            }
            else
            {
                var           mgrILH = new ImageListHistManager();
                IMAGELISTHIST ilh    = mgrILH.GetImageListHistByImageId(viewModel.IMAGEID);
                if (ilh != null)
                {
                    // Convert to ImageList and mark as rejected.
                    il = mgrIL.MapToImageList(ilh);
                    MarkImageListAsRejected(il, reason);
                    // Add to ImageList.
                    mgrIL.InsertImageList(il);
                    // Remove from ImageListHist.
                    mgrILH.DeleteImageListHist(ilh);
                }
                else
                {
                    // Uh oh. No imagelisthist entry.
                    errorMessage += viewModel.IMAGEID + " does not exist in the ImageListHist table.";
                }
            }

            // Reload the index page to move to the next invoice, if available.
            TempData["ErrorMessage"] = errorMessage;
            return(RedirectToAction("Index", new { InvoiceType = viewModel.INVOICETYPE }));
        }