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 void btnDeletePQRepo_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            if (this.FilesGridView.GetFocusedRow() is Files item)
            {
                ScannerHelper.DeleteFile(item.Id);

                this.Init();
            }
        }