Beispiel #1
0
        public static EnterpriseDS GetAgents(string clientNumber)
        {
            //Get a list of agents for the specified client
            EnterpriseDS agents = null;

            try {
                agents = new EnterpriseDS();
                if (_Mediator.OnLine)
                {
                    DataSet ds = _Mediator.FillDataset(USP_AGENTS_BYCLIENT, TBL_AGENTS, new object[] { clientNumber });
                    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 exception creating agents list.", ex); }
            return(agents);
        }
Beispiel #2
0
    public EnterpriseDS GetSecureClients()
    {
        //Get a list of clients
        EnterpriseDS clients = new EnterpriseDS();

        //If user is:
        // Vendor: get list of all it's clients
        // Client: no need to get client's list - fill the drop-down with client's name
        //  Argix: get list of all clients
        MembershipServices membership = new MembershipServices();
        ProfileCommon      profile    = membership.MemberProfile;

        if (profile.ClientVendorID == TrackingServices.ID_ARGIX || membership.IsAdmin)
        {
            clients.Merge(GetClients(null));
        }
        else
        {
            if (profile.Type.ToLower() == "vendor")
            {
                clients.Merge(GetClients(profile.ClientVendorID));
            }
            else
            {
                clients.ClientTable.AddClientTableRow(profile.ClientVendorID, "", profile.Company, "");
            }
        }
        return(clients);
    }
Beispiel #3
0
        private void OnTabSelected(object sender, TabControlEventArgs e)
        {
            //Event handler for change in tab selection
            this.Cursor = Cursors.WaitCursor;
            try {
                if (this.mIssue == null)
                {
                    return;
                }
                switch (e.TabPage.Name)
                {
                case "tabDetail":
                    break;

                case "tabOSD":
                    EnterpriseDS osdscans = EnterpriseFactory.GetOSDScans(this.mIssue.PROID);
                    this.oSDScanTableBindingSource.DataSource = osdscans;
                    break;

                case "tabPOD":
                    EnterpriseDS podscans = EnterpriseFactory.GetPODScans(this.mIssue.PROID);
                    this.pODScanTableBindingSource.DataSource = podscans;
                    break;
                }
            }
            catch (Exception ex) { reportError(ex); }
            finally { setUserServices(); this.Cursor = Cursors.Default; }
        }
Beispiel #4
0
        //Interface
        public dlgEnterpriseTerminalDetail(ref EnterpriseDS terminal)
        {
            //Constructor
            try {
                //
                InitializeComponent();
                this.btnOk.Text            = CMD_OK;
                this.btnCancel.Text        = CMD_CANCEL;
                this.mnuAddressAdd.Text    = MNU_ADDRESS_ADD;
                this.mnuAddressEdit.Text   = MNU_ADDRESS_EDIT;
                this.mnuAddressRemove.Text = MNU_ADDRESS_REMOVE;

                //Set mediator service, data, and titlebar caption
                this.mTerminalDS = terminal;
                if (this.mTerminalDS.EntTerminalDetailTable.Count > 0)
                {
                    this.mTerminalID = this.mTerminalDS.EntTerminalDetailTable[0].LocationID;
                    this.Text        = (this.mTerminalID > 0) ? "Terminal (" + this.mTerminalID + ")" : "Terminal (New)";
                }
                else
                {
                    this.Text = "Terminal (Data Unavailable)";
                }
            }
            catch (Exception ex) { throw ex; }
        }
Beispiel #5
0
        public Terminals GetTerminals()
        {
            //Get Argix terminals
            Terminals terminals = null;

            try {
                terminals = new Terminals();
                DataSet ds = fillDataset(USP_TERMINALS, TBL_TERMINALS, new object[] { });
                if (ds != null && ds.Tables[TBL_TERMINALS].Rows.Count > 0)
                {
                    EnterpriseDS _ds = new EnterpriseDS();
                    _ds.Merge(ds);
                    for (int i = 0; i < _ds.TerminalTable.Rows.Count; i++)
                    {
                        Terminal t = new Terminal();
                        t.TerminalID  = Convert.ToInt32(ds.Tables[TBL_TERMINALS].Rows[i]["TerminalID"]);
                        t.Number      = ds.Tables[TBL_TERMINALS].Rows[i]["Number"].ToString().Trim();
                        t.Description = ds.Tables[TBL_TERMINALS].Rows[i]["Description"].ToString().Trim();
                        t.AgentID     = ds.Tables[TBL_TERMINALS].Rows[i]["AgentID"].ToString().Trim();
                        terminals.Add(t);
                    }
                }
            }
            catch (Exception ex) { throw new FaultException <EnterpriseFault>(new EnterpriseFault(new ApplicationException("Unexpected error while reading Argix terminals.", ex))); }
            return(terminals);
        }
Beispiel #6
0
        private void OnCompanyLocationChanged(object sender, EventArgs e)
        {
            //Event handler for change in location (i.e. cboLocation.SelectionChangeCommitted, txtStore.TextChanged)
            //Raise a CompanyLocationChanged event with the change in location
            try {
                string location = null;
                string scope    = this.cboScope.SelectedItem.ToString();
                switch (scope)
                {
                case SCOPE_DISTRICTS:
                case SCOPE_REGIONS:
                case SCOPE_AGENTS:
                    if (this.cboLocation.SelectedValue != null)
                    {
                        location = this.cboLocation.SelectedValue.ToString() == "All" ? "" : this.cboLocation.SelectedValue.ToString();
                    }
                    break;

                case SCOPE_STORES:
                case SCOPE_SUBSTORES:
                    this.mStoreDS = new EnterpriseDS();
                    this.txtStoreDetail.Clear();
                    break;
                }
                if (this.LocationChanged != null)
                {
                    this.LocationChanged(this, new LocationEventArgs(scope, location));
                }
            }
            catch (Exception ex) { reportError(new ControlException("Unexpected error when company location changed.", ex)); }
        }
Beispiel #7
0
 //Interface
 static EnterpriseFactory()
 {
     //Constructor
     try {
         _Companies = new EnterpriseDS();
         _Agents    = new EnterpriseDS();
     }
     catch (Exception ex) { throw new ApplicationException("Unexpected error while creating new EnterpriseFactory singleton.", ex); }
 }
Beispiel #8
0
    public EnterpriseDS GetCustomers(string companyType)
    {
        //Get customer list
        EnterpriseDS ds  = new EnterpriseDS();
        EnterpriseDS _ds = GetCustomers();

        ds.Merge(_ds.ClientTable.Select("CompanyType='" + companyType + "'"));
        return(ds);
    }
Beispiel #9
0
    public EnterpriseDS GetClients(string vendorID)
    {
        //Return a list of clients filtered by vendorID (vendorID=null returns all Argix clients)
        EnterpriseDS clients = new EnterpriseDS();
        DataSet      ds      = fillDataset(USP_CLIENTS, TBL_CLIENTS, new object[] { vendorID });

        if (ds.Tables["ClientTable"].Rows.Count > 0)
        {
            clients.Merge(ds.Tables["ClientTable"].Select("", "CompanyName ASC"));
        }
        return(clients);
    }
Beispiel #10
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 #11
0
    private EnterpriseDS getArgixStores(string subStoreNumber)
    {
        //Get a list of Argix-numbered stores for the specified sub-store number
        MembershipServices membership = new MembershipServices();
        ProfileCommon      profile    = membership.MemberProfile;
        string             vendorID   = (profile.Type.ToLower() == "vendor") ? profile.ClientVendorID : null;
        string             clientID   = this.cboClient.SelectedValue;

        TrackingServices svcs   = new TrackingServices();
        EnterpriseDS     stores = svcs.GetStoresForSubStore(subStoreNumber, clientID, vendorID);

        return(stores);
    }
Beispiel #12
0
 //Interface
 /// <summary>Creates a new instance of the Argix.Enterprise.CompanyLocation control.</summary>
 public CompanyLocation()
 {
     //Constructor
     try {
         InitializeComponent();
         this.mStoreDetail              = new ToolTip();
         this.mStoreDetail.IsBalloon    = false;
         this.mStoreDetail.InitialDelay = 50;
         this.mStoreDetail.ShowAlways   = true;
         this.mStoreDS = new EnterpriseDS();
     }
     catch (Exception ex) { throw new ControlException("Unexpected error while creating new CompanyLocation control instance.", ex); }
 }
Beispiel #13
0
    protected void OnCommand(object sender, CommandEventArgs e)
    {
        //Event handler for user requested to track one or more cartons
        switch (e.CommandName)
        {
        case "Track":
            if (Page.IsValid)
            {
                //Track by store or substore depending upon user profile specification
                MembershipServices membership = new MembershipServices();
                ProfileCommon      profile    = membership.MemberProfile;
                if (profile.StoreSearchType == "Sub" || this.chkSubSearch.Checked)
                {
                    //Get list of Argix store selections for the requested substore
                    EnterpriseDS stores = getArgixStores(this.txtStore.Text);
                    if (stores.StoreTable.Rows.Count == 0)
                    {
                        //No records; notify store not found
                        Master.ShowMsgBox("Store not found. Please try again.");
                    }
                    else if (stores.StoreTable.Rows.Count == 1)
                    {
                        //Single substore; process without prompting the user
                        track(stores.StoreTable[0].NUMBER.ToString(), true);
                    }
                    else
                    {
                        //Ambiguous substore selections; prompt user to select the desired substore
                        this.lstStores.DataSource     = stores;
                        this.lstStores.DataTextField  = "DESCRIPTION";
                        this.lstStores.DataValueField = "NUMBER";
                        this.lstStores.DataBind();
                        this.mvMain.SetActiveView(this.vwSelectStore);
                    }
                }
                else
                {
                    track(this.txtStore.Text, false);
                }
            }
            break;

        case "Continue":
            track(this.lstStores.SelectedValue, true);
            break;

        case "Cancel":
            this.mvMain.SetActiveView(this.vwSearchStore);
            break;
        }
    }
Beispiel #14
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 #15
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 #16
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 #17
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 #18
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 #19
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 #20
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 #21
0
 private void loadDistricts()
 {
     //Load a list of district selections
     try {
         this.mEnterpriseDS.DistrictTable.Clear();
         this.mEnterpriseDS.DistrictTable.AddDistrictTableRow("All", "All");
         int companyID = Convert.ToInt32(this.cboCompany.SelectedValue);
         EnterpriseDS.CompanyTableRow[] rows = (EnterpriseDS.CompanyTableRow[]) this.mEnterpriseDS.CompanyTable.Select("CompanyID=" + companyID);
         EnterpriseDS _ds = EnterpriseFactory.GetDistricts(rows[0].Number.Substring(3, 3));
         for (int i = 0; i < _ds.DistrictTable.Rows.Count; i++)
         {
             _ds.DistrictTable[i].District     = _ds.DistrictTable[i].District.ToString().Trim();
             _ds.DistrictTable[i].DistrictName = _ds.DistrictTable[i].DistrictName.ToString().Trim();
         }
         this.mEnterpriseDS.Merge(_ds);
         this.cboLocation.DisplayMember = EnterpriseFactory.TBL_DISTRICTS + ".DistrictName";
         this.cboLocation.ValueMember   = EnterpriseFactory.TBL_DISTRICTS + ".District";
     }
     catch (Exception ex) { throw new ControlException("Unexpected error while loading company districts.", ex); }
 }
Beispiel #22
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 #23
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 #24
0
 private void showDeliveryInfo(bool showCartons)
 {
     //Clear and validate
     this.grdDelivery.SelectedObject = null;
     if (this.mIssue != null)
     {
         //Display delivery info
         EnterpriseDS delivery = EnterpriseFactory.GetDelivery(this.mIssue.CompanyID, this.mIssue.StoreNumber, this.mIssue.OFD1FromDate, this.mIssue.OFD1ToDate, this.mIssue.PROID);
         if (delivery.DeliveryTable.Rows.Count > 0)
         {
             this.grdDelivery.SelectedObject = new DeliveryInfo(delivery.DeliveryTable[0]);
         }
         if (showCartons)
         {
             EnterpriseDS osdscans = EnterpriseFactory.GetOSDScans(this.mIssue.PROID);
             this.oSDScanTableBindingSource.DataSource = osdscans;
             EnterpriseDS podscans = EnterpriseFactory.GetPODScans(this.mIssue.PROID);
             this.pODScanTableBindingSource.DataSource = podscans;
         }
     }
 }
Beispiel #25
0
        private void showStoreDetail()
        {
            //
            this.mStoreDS = new EnterpriseDS();
            this.txtStoreDetail.Clear();
            if (this.cboCompany.SelectedValue != null && this.txtStore.Text.Length > 0)
            {
                EnterpriseDS ds = new EnterpriseDS();
                switch (this.cboScope.SelectedItem.ToString())
                {
                case SCOPE_STORES:      ds.Merge(EnterpriseFactory.GetStoreDetail(Convert.ToInt32(this.cboCompany.SelectedValue), Convert.ToInt32(this.txtStore.Text))); break;

                case SCOPE_SUBSTORES:   ds.Merge(EnterpriseFactory.GetStoreDetail(Convert.ToInt32(this.cboCompany.SelectedValue), this.txtStore.Text)); break;
                }
                if (ds.StoreTable.Rows.Count > 0)
                {
                    this.mStoreDS            = ds;
                    this.txtStoreDetail.Text = getStoreDetailString();
                }
            }
        }
Beispiel #26
0
 private void loadAgents()
 {
     //Load a list of agent selections
     try {
         this.mEnterpriseDS.AgentTable.Clear();
         this.mEnterpriseDS.AgentTable.AddAgentTableRow("All", "All", "", "", "All");
         string clientNum = null;
         int    companyID = Convert.ToInt32(this.cboCompany.SelectedValue);
         if (companyID != 0)
         {
             EnterpriseDS.CompanyTableRow[] rows = (EnterpriseDS.CompanyTableRow[]) this.mEnterpriseDS.CompanyTable.Select("CompanyID=" + companyID);
             if (rows.Length > 0)
             {
                 clientNum = rows[0].Number.Substring(3, 3);
             }
         }
         EnterpriseDS _ds = EnterpriseFactory.GetAgents(clientNum);
         this.mEnterpriseDS.Merge(_ds);
         this.cboLocation.DisplayMember = EnterpriseFactory.TBL_AGENTS + ".AgentSummary";
         this.cboLocation.ValueMember   = EnterpriseFactory.TBL_AGENTS + ".AgentNumber";
     }
     catch (Exception ex) { throw new ControlException("Unexpected error while loading company agents.", ex); }
 }
Beispiel #27
0
 private void loadRegions()
 {
     //Load a list of region sslections
     try {
         this.mEnterpriseDS.RegionTable.Clear();
         this.mEnterpriseDS.RegionTable.AddRegionTableRow("All", "All");
         int companyID = Convert.ToInt32(this.cboCompany.SelectedValue);
         EnterpriseDS.CompanyTableRow[] rows = (EnterpriseDS.CompanyTableRow[]) this.mEnterpriseDS.CompanyTable.Select("CompanyID=" + companyID);
         EnterpriseDS _ds = EnterpriseFactory.GetRegions(rows[0].Number.Substring(3, 3));
         System.Collections.Hashtable table = new System.Collections.Hashtable();
         for (int i = 0; i < _ds.RegionTable.Rows.Count; i++)
         {
             string region = _ds.RegionTable[i].Region.ToString().Trim();
             if (region.Length == 0)
             {
                 _ds.RegionTable[i].Delete();
             }
             else
             {
                 if (table.ContainsKey(region))
                 {
                     _ds.RegionTable[i].Delete();
                 }
                 else
                 {
                     table.Add(region, _ds.RegionTable[i].RegionName.ToString().Trim());
                     _ds.RegionTable[i].Region     = region;
                     _ds.RegionTable[i].RegionName = _ds.RegionTable[i].RegionName.ToString().Trim();
                 }
             }
         }
         this.mEnterpriseDS.Merge(_ds, true);
         this.cboLocation.DisplayMember = EnterpriseFactory.TBL_REGIONS + ".RegionName";
         this.cboLocation.ValueMember   = EnterpriseFactory.TBL_REGIONS + ".Region";
     }
     catch (Exception ex) { throw new ControlException("Unexpected error while loading company regions.", ex); }
 }
Beispiel #28
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; }
        }
Beispiel #29
0
 public void Clear()
 {
     this.txtDetail.Text = ""; this.mStoreDS = null;
 }