Esempio n. 1
0
        private void btnProcessStatements_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            using (ProcessStatementsDialogue dlg = new ProcessStatementsDialogue())
            {
                LayoutControlGrid.Validate();


                using (var uow = new DevExpress.Xpo.Session())
                {
                    XDB.ORG_Company company = null;
                    foreach (XDB.GLX_Account account in this.XPCollection)
                    {
                        switch (IsCustomer)
                        {
                        case true: company = uow.Query <XDB.ORG_Company>().SingleOrDefault(n => n.TypeId.Id == (byte)BL.ORG.ORG_Type.Customer && n.EntityId.EntityId.CodeSub == account.EntityId.CodeSub);
                            break;

                        case false: company = uow.Query <XDB.ORG_Company>().SingleOrDefault(n => n.TypeId.Id == (byte)BL.ORG.ORG_Type.Supplier && n.EntityId.EntityId.CodeSub == account.EntityId.CodeSub);
                            break;
                        }

                        if (account.PrintStatement || account.EmailStatement)
                        {
                            dlg.Statements.Add(new CDS.Client.DataAccessLayer.Types.Statement()
                            {
                                EntityId    = account.EntityId.Id,
                                Code        = account.EntityId.CodeSub,
                                Name        = account.EntityId.Name,
                                Contact     = company.AccountsContactName,
                                Email       = company.AccountsContactEmail,
                                ShouldPrint = account.PrintStatement,
                                ShouldEmail = account.EmailStatement
                            });
                        }
                    }
                }
                dlg.ShowDialog();
            }

            if (StatementTask != null && StatementTask.Status != System.Threading.Tasks.TaskStatus.RanToCompletion)
            {
                Essential.BaseAlert.ShowAlert("Processing statements", "Statements will now be processed in the background.\nClick on \"View Active Processing\" to check progress.", Essential.BaseAlert.Buttons.Ok, Essential.BaseAlert.Icons.Information);
                btnViewActiveProcessing.Visibility = DevExpress.XtraBars.BarItemVisibility.Always;
                btnProcessStatements.Visibility    = DevExpress.XtraBars.BarItemVisibility.Never;
                UpdateTimer.Start();
            }
        }
 public void GetTotalSummaries(DevExpress.Mvvm.Xpf.GetSummariesAsyncArgs args)
 {
     args.Result = Task.Run(() =>
     {
         using (var session = new DevExpress.Xpo.Session()) {
             return(session.Query <XPOIssues.Issues.Issue>().Where(MakeFilterExpression((DevExpress.Data.Filtering.CriteriaOperator)args.Filter)).GetSummaries(args.Summaries));
         }
     });
 }
Esempio n. 3
0
 void OnGetTotalSummaries(System.Object sender, DevExpress.Xpf.Data.GetSummariesAsyncEventArgs e)
 {
     e.Result = Task.Run(() =>
     {
         using (var session = new DevExpress.Xpo.Session()) {
             return(session.Query <XPOIssues.Issues.Issue>().Where(MakeFilterExpression(e.Filter)).GetSummaries(e.Summaries));
         }
     });
 }
 public void FetchRows(DevExpress.Mvvm.Xpf.FetchRowsAsyncArgs args)
 {
     args.Result = Task.Run <DevExpress.Xpf.Data.FetchRowsResult>(() =>
     {
         using (var session = new DevExpress.Xpo.Session()) {
             var queryable = session.Query <XPOIssues.Issues.Issue>().SortBy(args.SortOrder, defaultUniqueSortPropertyName: nameof(XPOIssues.Issues.Issue.Oid)).Where(MakeFilterExpression((DevExpress.Data.Filtering.CriteriaOperator)args.Filter));
             var items     = queryable.Skip(args.Skip).Take(args.Take ?? 100).ToArray();
             return(DetachedObjectsHelper.ConvertToDetachedObjects(items));
         }
     });
 }
 void OnFetchRows(System.Object sender, DevExpress.Xpf.Data.FetchRowsAsyncEventArgs e)
 {
     e.Result = Task.Run <DevExpress.Xpf.Data.FetchRowsResult>(() =>
     {
         using (var session = new DevExpress.Xpo.Session()) {
             var queryable = session.Query <XPOIssues.Issues.Issue>().SortBy(e.SortOrder, defaultUniqueSortPropertyName: nameof(XPOIssues.Issues.Issue.Oid)).Where(MakeFilterExpression(e.Filter));
             var items     = queryable.Skip(e.Skip).Take(e.Take ?? 100).ToArray();
             return(_DetachedObjectsHelper.ConvertToDetachedObjects(items));
         }
     });
 }
Esempio n. 6
0
        void LoadLookupData()
        {
            var session = new DevExpress.Xpo.Session();

            usersLookup.ItemsSource = session.Query <XPOIssues.Issues.User>().OrderBy(user => user.Oid).Select(user => new { Id = user.Oid, Name = user.FirstName + " " + user.LastName }).ToArray();
        }
Esempio n. 7
0
        private void GridView_MouseDown(object sender, MouseEventArgs e)
        {
            GridView    view = sender as GridView;
            Point       p    = view.GridControl.PointToClient(MousePosition);
            GridHitInfo info = view.CalcHitInfo(p);

            if (info.HitTest == GridHitTest.Column)
            {
                LayoutControlGrid.Validate();
                var statements = this.XPCollection.Cast <CDS.Client.DataAccessLayer.XDB.GLX_Account>();

                bool clearEmail = false, clearPrint = false;
                if (info.Column == colEmailStatement && statements.Count(n => n.EmailStatement) > 0)
                {
                    clearEmail = true;
                }
                else
                if (info.Column == colPrintStatement && statements.Count(n => n.PrintStatement) > 0)
                {
                    clearPrint = true;
                }

                using (var uow = new DevExpress.Xpo.Session())
                {
                    XDB.ORG_Company company = null;

                    foreach (CDS.Client.DataAccessLayer.XDB.GLX_Account account in XPCollection)
                    {
                        if (account.EntityId.AccountBalance == 0.00M)
                        {
                            continue;
                        }

                        switch (IsCustomer)
                        {
                        case true: company = uow.Query <XDB.ORG_Company>().SingleOrDefault(n => n.TypeId.Id == (byte)BL.ORG.ORG_Type.Customer && n.EntityId.EntityId.CodeSub == account.EntityId.CodeSub);
                            break;

                        case false: company = uow.Query <XDB.ORG_Company>().SingleOrDefault(n => n.TypeId.Id == (byte)BL.ORG.ORG_Type.Supplier && n.EntityId.EntityId.CodeSub == account.EntityId.CodeSub);
                            break;
                        }

                        if (clearEmail)
                        {
                            account.EmailStatement = false;
                        }
                        else if (info.Column == colEmailStatement)
                        {
                            if (company.StatementPreference == "Email" || (company.StatementPreference == "Email, Print" || company.StatementPreference == "Print, Email"))
                            {
                                account.EmailStatement = true;
                            }

                            if (account.EntityId.AccountBalance != 0)
                            {
                                account.EmailStatement = true;
                            }
                        }

                        if (clearPrint)
                        {
                            account.PrintStatement = false;
                        }
                        else if (info.Column == colPrintStatement)
                        {
                            if (company.StatementPreference == "Print" || (company.StatementPreference == "Email, Print" || company.StatementPreference == "Print, Email"))
                            {
                                account.PrintStatement = true;
                            }

                            if (account.EntityId.AccountBalance != 0)
                            {
                                account.PrintStatement = true;
                            }
                        }
                    }
                }

                clearEmail = false;
                clearPrint = false;

                if (statements.Count(n => n.EmailStatement) > 0 || statements.Count(n => n.PrintStatement) > 0)
                {
                    btnProcessStatements.Visibility = DevExpress.XtraBars.BarItemVisibility.Always;
                }
                else
                {
                    btnProcessStatements.Visibility = DevExpress.XtraBars.BarItemVisibility.Never;
                }

                GridView.RefreshData();
            }
        }