Exemple #1
0
 public void InitService(
     CompanyFile companyFile,
     CompanyFileCredentials credentials,
     ApiConfiguration myConfiguration,
     OAuthKeyService myOAuthKeyService)
 {
     myCompanyFile     = companyFile;
     myCredentials     = credentials;
     myService         = new ItemOrderService(myConfiguration, null, myOAuthKeyService);
     myCustomerService = new CustomerService(myConfiguration, null, myOAuthKeyService);
 }
 public ItemOrdersController(ComputerStoreDbContext context) : base(context)
 {
     service = new ItemOrderService(context);
 }
Exemple #3
0
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            var    salesDataService = new Sale();
            string filter           = string.Format("$filter=Date ge datetime'{0}' and Date le datetime'{1}'", txtFromDate.Text, txtToDate.Text);
            string pageFilter       = string.Empty;

            listPL.Clear();
            var service = new ItemOrderService(SessionManager.MyConfiguration, null, SessionManager.MyOAuthKeyService);

            int count = 1000;

            for (int currentPage = 1; count >= 1000; currentPage++)
            {
                pageFilter = string.Format("&$top={0}&$skip={1}&$orderby=Date desc", PageSize,
                                           PageSize * (currentPage - 1));

                var list = service.GetRange(SessionManager.SelectedCompanyFile, filter + pageFilter, SessionManager.MyCredentials, null);
                count = list.Items.Count();
                //var invoisvc = new ItemInvoiceService(SessionManager.MyConfiguration, null, SessionManager.MyOAuthKeyService);
                //var list = invoisvc.GetRange(SessionManager.SelectedCompanyFile, null, SessionManager.MyCredentials);
                //
                var invoices = list.Items;
                foreach (var inv in invoices)
                {
                    // var items = inv.Lines;
                    foreach (var item in inv.Lines)
                    {
                        listPL.Add(new SalesData
                        {
                            CustomerName      = inv.Customer != null ? inv.Customer.Name : "",
                            TransactionNumber = inv.Number,
                            TransactionDate   = inv.Date != null ? inv.Date.ToString("yyyy-MM-dd") : "",
                            TransactionType   = "Sales Order",
                            TransactionStatus = inv.Status.ToString(),
                            Itemumber         = item.Item != null ? item.Item.Number : "",
                            Product           = item.Item != null ? item.Item.Name : "",
                            //  AccountNumber=inv.ac,
                            LineMemo     = inv.JournalMemo,
                            EmployeeName = inv.Salesperson != null ? inv.Salesperson.Name : "",
                            Qty          = item.ShipQuantity,
                            // TaxExAmount = item.Total,
                            Total        = item.Total,
                            TaxCode      = item.TaxCode != null ? item.TaxCode.Code.ToString() : "",
                            PromisedDate = inv.PromisedDate,
                            ItemName     = item.Description
                        });
                    }
                }
            }

            var serviceItemInvoicService = new ItemInvoiceService(SessionManager.MyConfiguration, null, SessionManager.MyOAuthKeyService);

            count = 1000;
            for (int currentPage = 1; count >= 1000; currentPage++)
            {
                pageFilter = string.Format("&$top={0}&$skip={1}&$orderby=Date desc", PageSize,
                                           PageSize * (currentPage - 1));

                var list = serviceItemInvoicService.GetRange(SessionManager.SelectedCompanyFile, filter + pageFilter, SessionManager.MyCredentials, null);
                count = list.Items.Count();
                //var invoisvc = new ItemInvoiceService(SessionManager.MyConfiguration, null, SessionManager.MyOAuthKeyService);
                //var list = invoisvc.GetRange(SessionManager.SelectedCompanyFile, null, SessionManager.MyCredentials);
                //
                var invoices = list.Items;
                foreach (var inv in invoices)
                {
                    // var items = inv.Lines;
                    foreach (var item in inv.Lines)
                    {
                        listPL.Add(new SalesData
                        {
                            CustomerName      = inv.Customer != null?inv.Customer.Name:"",
                            TransactionNumber = inv.Number,
                            TransactionDate   = inv.Date != null?inv.Date.ToString("yyyy-MM-dd"):"",
                            TransactionType   = "Sales Order",
                            TransactionStatus = inv.Status.ToString(),
                            Itemumber         = item.Item != null ? item.Item.Number : "",
                            Product           = item.Item != null ? item.Item.Name : "",
                            //  AccountNumber=inv.ac,
                            LineMemo     = inv.JournalMemo,
                            EmployeeName = inv.Salesperson != null ? inv.Salesperson.Name : "",
                            Qty          = item.ShipQuantity,
                            // TaxExAmount = item.Total,
                            Total        = item.Total,
                            TaxCode      = item.TaxCode != null ? item.TaxCode.Code.ToString() : "",
                            PromisedDate = inv.PromisedDate,
                            ItemName     = item.Description
                        });
                    }
                }
            }

            ViewState["ListSalePurchase"] = listPL;
            GridView1.DataSource          = listPL.ToList();
            GridView1.DataBind();
            GridView1.Caption = "Sales";
        }