Exemplo n.º 1
0
        public async void Init()
        {
            try
            {
                DocActionGridView.ShowLoadingPanel();
                UnitOfWork             unitOfWork      = new UnitOfWork();
                List <DocumentActions> documentActions = new List <DocumentActions>();
                //    esms.QueryableSource = await Task.Run(() => unitOfWork.DocumentActionsRepo.Fetch(x => x.RefId == refId && x.TableName == tableName));
                documentActions = await unitOfWork.DocumentActionsRepo
                                  .Fetch(x => x.RefId == refId && x.TableName == tableName).ToListAsync();

                if (this.tableName == "PurchaseRequests")
                {
                    var po = await unitOfWork.PurchaseOrdersRepo.Fetch(x => x.PRId == refId).ToListAsync();

                    foreach (var i in po)
                    {
                        foreach (var obr in i.Obligations)
                        {
                            documentActions.AddRange(await unitOfWork.DocumentActionsRepo.Fetch(x =>
                                                                                                x.RefId == obr.Id && x.TableName == "Obligations").ToListAsync());
                        }
                    }
                }

                this.DocActionGridControl.DataSource = documentActions;
                DocActionGridView.HideLoadingPanel();
            }
            catch (Exception e)
            {
            }
        }
Exemplo n.º 2
0
 private void DocActionGridView_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e)
 {
     if (e.Column.Name == "colRoutedTo")
     {
         if (DocActionGridView.GetRow(e.RowHandle) is DocumentActions doc)
         {
             if (doc.IsSend == true)
             {
                 e.Appearance.BackColor = Color.Green;
                 e.Appearance.ForeColor = Color.White;
             }
         }
     }
     if (e.Column.Name == "colActionTaken" || e.Column.Name == "colSubActivityId" || e.Column.Name == "colActivityId")
     {
         if (DocActionGridView.GetRow(e.RowHandle) is DocumentActions doc)
         {
             UnitOfWork unitOfWork = new UnitOfWork();
             var        files      = unitOfWork.FilesRepo.Fetch(x => x.RefId == doc.Id && x.TableName == "Action");
             if (files.Any())
             {
                 e.Appearance.ForeColor = Color.Blue;
             }
         }
     }
 }
Exemplo n.º 3
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();
                }
            }
        }
Exemplo n.º 4
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);
                }
            }
        }
Exemplo n.º 5
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();
     }
 }