Example #1
0
        private void btnPreviewRepo_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            if (DocActionGridView.GetFocusedRow() is DocumentActions item)
            {
                using (NetworkShareAccesser.Access("PLGUNV_NAS", @"", "pitd.is_user", "Apple_01"))
                {
                    StaticSettings staticSettings = new StaticSettings();
                    UnitOfWork     unitOfWork     = new UnitOfWork();
                    var            root           = $@"\\plgunv_nas\is_docs\ofmis\{staticSettings.Offices.OffcAcr}";
                    if (!Directory.Exists(root))
                    {
                        Directory.CreateDirectory(root);
                    }

                    var files = unitOfWork.FilesRepo.Find(x => x.RefId == item.Id && x.TableName == "Action");

                    if (files == null)
                    {
                        return;
                    }
                    var          path = Path.Combine(root, files.Path + ".png");
                    frmPreviewer frm  = new frmPreviewer(path);
                    frm.ShowDialog();
                }
            }
        }
Example #2
0
        private void btnDelete_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            if (DocActionGridView.GetFocusedRow() is DocumentActions item)
            {
                try
                {
                    if (!User.CheckOwner(item.CreatedBy))
                    {
                        return;
                    }


                    if (MessageBox.Show("Do you want to delete this?", "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                    {
                        return;
                    }
                    UnitOfWork unitOfWork = new UnitOfWork();
                    unitOfWork.DocumentActionsRepo.Delete(x => x.Id == item.Id);
                    unitOfWork.Save();
                    Init();
                }
                catch (Exception exception)
                {
                    MessageBox.Show(exception.Message, exception.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Example #3
0
 private void btnEdit_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
 {
     if (DocActionGridView.GetFocusedRow() is DocumentActions item)
     {
         if (!User.CheckOwner(item.CreatedBy))
         {
             return;
         }
         frmDocActions frm = new frmDocActions(MethodType.Edit, item);
         frm.ShowDialog();
         Init();
     }
 }