Beispiel #1
0
    public EnterpriseDS GetClients()
    {
        //Return a list of all Argix clients
        EnterpriseDS clients = new EnterpriseDS();
        DataSet      ds      = fillDataset(USP_CLIENTS, TBL_CLIENTS, new object[] { null });

        if (ds.Tables["ClientTable"].Rows.Count > 0)
        {
            clients.Merge(ds.Tables["ClientTable"].Select("", "CompanyName ASC"));
        }
        return(clients);
    }
Beispiel #2
0
    public EnterpriseDS GetCustomers()
    {
        //Returns a list of clients and vendors used to identify a users 'customer' affiliation
        EnterpriseDS cutomers = new EnterpriseDS();
        DataSet      ds       = fillDataset(USP_CUSTOMERS, TBL_CUSTOMERS, new object[] { });
        EnterpriseDS c        = new EnterpriseDS();

        c.Merge(ds);

        cutomers.ClientTable.AddClientTableRow(ID_ARGIX, "", "Argix Direct Inc.", "client");
        cutomers.ClientTable.AddClientTableRow("", ID_ARGIX, "Argix Direct Inc.", "vendor");
        cutomers.Merge(c.ClientTable.Select("", "CompanyName ASC"));
        cutomers.AcceptChanges();
        return(cutomers);
    }
Beispiel #3
0
 public void View(int companyID, string subStore)
 {
     //View store detail
     try {
         this.mStoreDS = new EnterpriseDS();
         refreshView();
         EnterpriseDS ds = new EnterpriseDS();
         ds.Merge(EnterpriseFactory.GetStoreDetail(companyID, subStore));
         if (ds.StoreTable.Rows.Count > 0)
         {
             this.mStoreDS = ds;
         }
         refreshView();
     }
     catch (Exception ex) { reportError(new ControlException("Unexpected error while creating store detail view.", ex)); }
 }
Beispiel #4
0
        public static void RefreshCache()
        {
            //Refresh cached data
            DataSet ds = null;

            try {
                //Validate
                if (_Mediator == null)
                {
                    return;
                }
                if (!_Mediator.OnLine)
                {
                    return;
                }

                //Companies
                _Companies.Clear();
                ds = _Mediator.FillDataset(USP_COMPANIES, TBL_COMPANIES, null);
                if (ds.Tables[TBL_COMPANIES].Rows.Count > 0)
                {
                    EnterpriseDS _ds = new EnterpriseDS();
                    _ds.CompanyTable.AddCompanyTableRow(0, "All", "000", "");
                    _ds.Merge(ds.Tables[TBL_COMPANIES].Select("", "CompanyName ASC"));
                    _Companies.Merge(_ds);
                }

                //Agents
                _Agents.Clear();
                ds = _Mediator.FillDataset(USP_AGENTS, TBL_AGENTS, new object[] { });
                if (ds.Tables[TBL_AGENTS].Rows.Count > 0)
                {
                    EnterpriseDS _ds = new EnterpriseDS();
                    _ds.Merge(ds);
                    for (int i = 0; i < _ds.AgentTable.Rows.Count; i++)
                    {
                        _ds.AgentTable.Rows[i]["AgentSummary"] = (!_ds.AgentTable.Rows[i].IsNull("MainZone") ? _ds.AgentTable.Rows[i]["MainZone"].ToString().PadLeft(2, ' ') : "  ") + " - " +
                                                                 (!_ds.AgentTable.Rows[i].IsNull("AgentNumber") ? _ds.AgentTable.Rows[i]["AgentNumber"].ToString() : "    ") + " - " +
                                                                 (!_ds.AgentTable.Rows[i].IsNull("AgentName") ? _ds.AgentTable.Rows[i]["AgentName"].ToString().Trim() : "");
                    }
                    _Agents.Merge(_ds.AgentTable.Select("", "MainZone ASC"));
                    _Agents.AgentTable.AcceptChanges();
                }
            }
            catch (ApplicationException ex) { throw ex; }
            catch (Exception ex) { throw new ApplicationException("Unexpected error while caching EnterpriseFactory data.", ex); }
        }
Beispiel #5
0
        public static EnterpriseDS GetPODScans(long cProID)
        {
            //Get a list of store locations
            EnterpriseDS scans = null;

            try {
                scans = new EnterpriseDS();
                if (_Mediator.OnLine)
                {
                    DataSet ds = _Mediator.FillDataset(USP_PODSCANS, TBL_PODSCANS, new object[] { cProID });
                    if (ds.Tables[TBL_PODSCANS].Rows.Count > 0)
                    {
                        scans.Merge(ds);
                    }
                }
            }
            catch (Exception ex) { throw new ApplicationException("Unexpected error while reading POD scans.", ex); }
            return(scans);
        }
Beispiel #6
0
        public static EnterpriseDS GetDeliveries(int companyID, int storeNumber, DateTime from, DateTime to)
        {
            //Get a list of store locations
            EnterpriseDS deliveries = null;

            try {
                deliveries = new EnterpriseDS();
                if (_Mediator.OnLine)
                {
                    DataSet ds = _Mediator.FillDataset(USP_DELIVERY, TBL_DELIVERY, new object[] { companyID, storeNumber, from, to });
                    if (ds.Tables[TBL_DELIVERY].Rows.Count > 0)
                    {
                        deliveries.Merge(ds);
                    }
                }
            }
            catch (Exception ex) { throw new ApplicationException("Unexpected error while reading deliveries.", ex); }
            return(deliveries);
        }
Beispiel #7
0
        public static EnterpriseDS GetStoreDetail(int companyID, string subStore)
        {
            //Get a list of store locations
            EnterpriseDS stores = null;

            try {
                stores = new EnterpriseDS();
                if (_Mediator.OnLine)
                {
                    DataSet ds = _Mediator.FillDataset(USP_STORE, TBL_STORE, new object[] { companyID, null, subStore });
                    if (ds.Tables[TBL_STORE].Rows.Count > 0)
                    {
                        stores.Merge(ds);
                    }
                }
            }
            catch (Exception ex) { throw new ApplicationException("Unexpected error while reading store locations.", ex); }
            return(stores);
        }
Beispiel #8
0
        public static EnterpriseDS GetDelivery(int companyID, int storeNumber, DateTime from, DateTime to, long proID)
        {
            //Get a list of store locations
            EnterpriseDS delivery = null;

            try {
                delivery = new EnterpriseDS();
                if (_Mediator.OnLine)
                {
                    EnterpriseDS ds = new EnterpriseDS();
                    ds.Merge(_Mediator.FillDataset(USP_DELIVERY, TBL_DELIVERY, new object[] { companyID, storeNumber, from, to }));
                    if (ds.DeliveryTable.Rows.Count > 0)
                    {
                        delivery.Merge(ds.DeliveryTable.Select("CPROID=" + proID));
                    }
                }
            }
            catch (Exception ex) { throw new ApplicationException("Unexpected error while reading deliveries.", ex); }
            return(delivery);
        }
Beispiel #9
0
        public static EnterpriseDS GetRegions(string clientNumber)
        {
            //Get a list of client divisions
            EnterpriseDS regions = null;

            try {
                regions = new EnterpriseDS();
                if (_Mediator.OnLine)
                {
                    DataSet ds = _Mediator.FillDataset(USP_REGIONS_DISTRICTS, TBL_REGIONS, new object[] { clientNumber });
                    if (ds.Tables[TBL_REGIONS].Rows.Count != 0)
                    {
                        regions.Merge(ds);
                    }
                }
            }
            catch (ApplicationException ex) { throw ex; }
            catch (Exception ex) { throw new ApplicationException("Unexpected exception creating company regions list.", ex); }
            return(regions);
        }
Beispiel #10
0
    public EnterpriseDS GetStoresForSubStore(string subStoreNumber, string clientID, string vendorID)
    {
        //Get a list of client\vendor stores for the specified sub-store number
        EnterpriseDS stores = new EnterpriseDS();
        DataSet      ds     = fillDataset(USP_STORESFORSUBSTORE, TBL_STORESFORSUBSTORE, new object[] { subStoreNumber, clientID, vendorID });

        if (ds != null)
        {
            stores.Merge(ds);
            for (int i = 0; i < stores.StoreTable.Rows.Count; i++)
            {
                stores.StoreTable[i].DESCRIPTION = stores.StoreTable[i].NAME + " " +
                                                   stores.StoreTable[i].ADDRESSLINE1 + ", " +
                                                   stores.StoreTable[i].ADDRESS_LINE2 + " " +
                                                   stores.StoreTable[i].CITY + ", " +
                                                   stores.StoreTable[i].STATE + " " +
                                                   stores.StoreTable[i].ZIP;
            }
        }
        return(stores);
    }
Beispiel #11
0
        private void OnMenuClick(object sender, System.EventArgs e)
        {
            //Menu item clicked-apply selected service
            AddressDS addressDS;

            AddressDS.AddressViewTableRow rowAddress;
            EnterpriseDS dsAdd;

            EnterpriseDS.AddressDetailTableRow rowAdd;
            dlgAddressDetail dlgAddress;
            int          addressID = 0;
            DialogResult res       = DialogResult.Cancel;

            try  {
                MenuItem menu = (MenuItem)sender;
                switch (menu.Text)
                {
                case MNU_ADDRESS_ADD:
                    //Add a new mailing address
                    addressID                  = 0;
                    addressDS                  = new AddressDS();
                    rowAddress                 = addressDS.AddressViewTable.NewAddressViewTableRow();
                    rowAddress.AddressID       = 0;
                    rowAddress.LocationID      = this.mTerminalDS.EntTerminalDetailTable[0].LocationID;
                    rowAddress.AddressType     = "Mailing";
                    rowAddress.AddressLine1    = "";
                    rowAddress.AddressLine2    = "";
                    rowAddress.City            = "";
                    rowAddress.StateOrProvince = "NJ";
                    rowAddress.PostalCode      = "";
                    rowAddress.CountryID       = 1;
                    rowAddress.IsActive        = true;
                    rowAddress.LastUpdated     = DateTime.Now;
                    rowAddress.UserID          = System.Environment.UserName;
                    rowAddress.RowVersion      = "";
                    addressDS.AddressViewTable.AddAddressViewTableRow(rowAddress);
                    dlgAddress = new dlgAddressDetail(ref addressDS);
                    res        = dlgAddress.ShowDialog();
                    if (res == DialogResult.OK)
                    {
                        //Update listview
                        rowAdd              = this.mTerminalDS.AddressDetailTable.NewAddressDetailTableRow();
                        rowAdd.AddressID    = addressDS.AddressViewTable[0].AddressID;
                        rowAdd.LocationID   = addressDS.AddressViewTable[0].LocationID;
                        rowAdd.AddressType  = addressDS.AddressViewTable[0].AddressType;
                        rowAdd.AddressLine1 = addressDS.AddressViewTable[0].AddressLine1;
                        rowAdd.AddressLine2 = addressDS.AddressViewTable[0].AddressLine2;
                        rowAdd.City         = addressDS.AddressViewTable[0].City;
                        if (!addressDS.AddressViewTable[0].IsStateOrProvinceNull())
                        {
                            rowAdd.StateOrProvince = addressDS.AddressViewTable[0].StateOrProvince;
                        }
                        rowAdd.PostalCode  = addressDS.AddressViewTable[0].PostalCode;
                        rowAdd.CountryID   = addressDS.AddressViewTable[0].CountryID;
                        rowAdd.IsActive    = addressDS.AddressViewTable[0].IsActive;
                        rowAdd.LastUpdated = addressDS.AddressViewTable[0].LastUpdated;
                        rowAdd.UserID      = addressDS.AddressViewTable[0].UserID;
                        rowAdd.RowVersion  = addressDS.AddressViewTable[0].RowVersion;
                        this.mTerminalDS.AddressDetailTable.AddAddressDetailTableRow(rowAdd);
                        this.mTerminalDS.AcceptChanges();
                        this.showAddressList();
                        this.mnuAddressAdd.Enabled = (this.lsvAddress.Items.Count < 2);
                    }
                    break;

                case MNU_ADDRESS_EDIT:
                    //Read existing terminal details, forward to dlgTerminal for update
                    addressID = Convert.ToInt32(this.lsvAddress.SelectedItems[0].SubItems[0].Text);
                    dsAdd     = new EnterpriseDS();
                    dsAdd.Merge(this.mTerminalDS.AddressDetailTable.Select("AddressID=" + addressID));
                    addressDS                  = new AddressDS();
                    rowAddress                 = addressDS.AddressViewTable.NewAddressViewTableRow();
                    rowAddress.AddressID       = dsAdd.AddressDetailTable[0].AddressID;
                    rowAddress.LocationID      = dsAdd.AddressDetailTable[0].LocationID;
                    rowAddress.AddressType     = dsAdd.AddressDetailTable[0].AddressType;
                    rowAddress.AddressLine1    = dsAdd.AddressDetailTable[0].AddressLine1;
                    rowAddress.AddressLine2    = dsAdd.AddressDetailTable[0].AddressLine2;
                    rowAddress.City            = dsAdd.AddressDetailTable[0].City;
                    rowAddress.StateOrProvince = dsAdd.AddressDetailTable[0].StateOrProvince;
                    rowAddress.PostalCode      = dsAdd.AddressDetailTable[0].PostalCode;
                    rowAddress.CountryID       = dsAdd.AddressDetailTable[0].CountryID;
                    rowAddress.IsActive        = dsAdd.AddressDetailTable[0].IsActive;
                    rowAddress.LastUpdated     = DateTime.Now;
                    rowAddress.UserID          = System.Environment.UserName;
                    rowAddress.RowVersion      = dsAdd.AddressDetailTable[0].RowVersion;
                    addressDS.AddressViewTable.AddAddressViewTableRow(rowAddress);
                    dlgAddress = new dlgAddressDetail(ref addressDS);
                    res        = dlgAddress.ShowDialog();
                    if (res == DialogResult.OK)
                    {
                        //Update listview
                        rowAdd              = this.mTerminalDS.AddressDetailTable[this.lsvAddress.SelectedItems[0].Index];
                        rowAdd.AddressID    = addressDS.AddressViewTable[0].AddressID;
                        rowAdd.LocationID   = addressDS.AddressViewTable[0].LocationID;
                        rowAdd.AddressType  = addressDS.AddressViewTable[0].AddressType;
                        rowAdd.AddressLine1 = addressDS.AddressViewTable[0].AddressLine1;
                        rowAdd.AddressLine2 = addressDS.AddressViewTable[0].AddressLine2;
                        rowAdd.City         = addressDS.AddressViewTable[0].City;
                        if (!addressDS.AddressViewTable[0].IsStateOrProvinceNull())
                        {
                            rowAdd.StateOrProvince = addressDS.AddressViewTable[0].StateOrProvince;
                        }
                        rowAdd.PostalCode  = addressDS.AddressViewTable[0].PostalCode;
                        rowAdd.CountryID   = addressDS.AddressViewTable[0].CountryID;
                        rowAdd.IsActive    = addressDS.AddressViewTable[0].IsActive;
                        rowAdd.LastUpdated = addressDS.AddressViewTable[0].LastUpdated;
                        rowAdd.UserID      = addressDS.AddressViewTable[0].UserID;
                        rowAdd.RowVersion  = addressDS.AddressViewTable[0].RowVersion;
                        this.mTerminalDS.AcceptChanges();
                        this.showAddressList();
                    }
                    break;

                case MNU_ADDRESS_REMOVE:
                    addressID = Convert.ToInt32(this.lsvAddress.SelectedItems[0].SubItems[0].Text);
                    break;

                default: Debug.Write("Need handler for " + menu.Text + "\n"); break;
                }
            }
            catch (Exception ex) { reportError(ex); }
            finally  { this.Cursor = Cursors.Default; }
        }