void Save()
 {
     try
     {
         if (MessageBox.Show("Do you want to submit this?", "Submit", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
         {
             return;
         }
         UnitOfWork unitOfWork = new UnitOfWork(new DTSDb());
         var        item       = unitOfWork.DocumentsRepo.Find(x => x.Id == documents.Id);
         item.CommunicationType = cboCommType.EditValue?.ToString();
         item.DocumentType      = cboType.EditValue?.ToString();
         item.SourceOfficeId    = cboSourceOffice.EditValue?.ToInt();
         item.Signatory         = cboSignatories.EditValue?.ToInt();
         item.Subject           = txtSubjects.EditValue?.ToString();
         var image = ((byte[])pctScannedDocs.Image);
         if (image.Length == 0)
         {
             ScannerHelper.DeleteFile("Documents", item.Id);
         }
         else
         {
             ScannerHelper.SaveImage("DTS", new StaticSettings().Offices.OffcAcr, item.Id, "Documents", Image.FromStream(new MemoryStream((byte[])pctScannedDocs.Image)));
         }
         unitOfWork.Save();
         this.isClosed = true;
         Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
示例#2
0
        private async void btnScan_Click(object sender, EventArgs e)
        {
            WIAHelper wIAHelper = new WIAHelper();

            wIAHelper.GetDefaultDeviceID();
            SplashScreenManager.ShowForm(this, typeof(frmLoading), true, true, SplashFormStartPosition.Default, new Point(0, 0), ParentFormState.Locked);
            var res = await wIAHelper.ScanPages();

            SplashScreenManager.CloseForm();
            foreach (var i in res)
            {
                ScannerHelper.SaveImage("OFMIS", new StaticSettings().Offices.OffcAcr, this.refId, "Document-Files",
                                        fileName, User.UserId, i);
            }
            this.Init();
        }