Exemplo n.º 1
0
        void btnNext_Click(object sender, EventArgs e)
        {
            if (this.ScannedFormId > 0)
            {
                Facade.Form facForm = new Facade.Form();
                this.DehireReceipt = facForm.GetForScannedFormId(this.ScannedFormId);
            }

            int scanFormId = -1;

            // With job POD scanning
            if (this.OrderId > 0)
            {
                Facade.Form           facForm          = new Facade.Form();
                Facade.IDeHireReceipt facDehireReceipt = new Facade.CollectDrop();

                string userID = ((Entities.CustomPrincipal)Page.User).UserName;

                if (this.DehireReceipt == null)
                {
                    this.DehireReceipt = new Entities.Scan();
                }

                this.DehireReceipt.ScannedDateTime = DateTime.Today;
                this.DehireReceipt.FormTypeId      = eFormTypeId.DehireReceipt;
                this.DehireReceipt.ScannedFormPDF  = this.FileName;

                // N = No document available
                if (this.AppendOrReplace.Contains("N"))
                {
                    if (this.DehireReceipt.ScannedFormId == 0)
                    {
                        this.DehireReceipt.ScannedFormPDF = Orchestrator.Globals.Constants.NO_DOCUMENT_AVAILABLE;
                    }
                }
                else
                {
                    this.DehireReceipt.ScannedFormPDF = this.FileName;
                }

                if (this.AppendOrReplace.Contains("A"))
                {
                    this.DehireReceipt.IsAppend = true;
                }
                else
                {
                    this.DehireReceipt.IsAppend = false;
                }

                // if this is not set then we don't know where to save the file locally so it must have been uploaded immediately.
                if (this.AppendOrReplace.Contains("U") || String.IsNullOrEmpty(Globals.Configuration.ScannedDocumentPath))
                {
                    this.DehireReceipt.IsUploaded = true;
                }
                else
                {
                    this.DehireReceipt.IsUploaded = false;
                }

                // Update the receipt number,
                facDehireReceipt.UpdateReceiptNumber(DehireReceiptId, txtDehireReceiptNumber.Text, userID);
                // Create the scanned form.
                scanFormId = facForm.Create(this.DehireReceipt, userID);

                if (scanFormId > 0)
                {
                    facDehireReceipt.UpdateScannedForm(DehireReceiptId, scanFormId, userID);
                }
            }

            this.Close(this.ScannedFormId.ToString());
        }