private void OnMenuClick(object sender, System.EventArgs e) { //Event handler fo menu item clicked try { ToolStripDropDownItem menu = (ToolStripDropDownItem)sender; switch (menu.Text) { case MNU_NEW: break; case MNU_OPEN: dlgContact dlg = new dlgContact(this.mContact); dlg.Font = this.Font; if (dlg.ShowDialog() == DialogResult.OK) { if (EnterpriseFactory.UpdateContact(this.mContact)) { this.ctxRefresh.PerformClick(); } } break; case MNU_REFRESH: this.Cursor = Cursors.WaitCursor; this.mContactDS.Clear(); this.mContactDS.Merge(EnterpriseFactory.GetContacts()); break; } } catch (Exception ex) { reportError(ex); } finally { setUserServices(); this.Cursor = Cursors.Default; } }
private void OnFormLoad(object sender, EventArgs e) { //Event handler for form laod event this.Cursor = Cursors.WaitCursor; try { this.mContactDS.Merge(EnterpriseFactory.GetContacts()); this.grdContacts.DataBind(); } catch (Exception ex) { reportError(ex); } finally { setUserServices(); this.Cursor = Cursors.Default; } }
private void OnFormLoad(object sender, EventArgs e) { //Event handler for form load event this.Cursor = Cursors.WaitCursor; try { //Set initial service states this.Visible = true; this.mEnterpriseDS.Merge(EnterpriseFactory.GetDeliveries(this.mCompanyID, this.mStoreNumber, this.mFrom, this.mTo)); } catch (Exception ex) { reportError(ex); } finally { OnValidateForm(null, EventArgs.Empty); this.Cursor = Cursors.Default; } }
private void OnGridSelectionChanged(object sender, Infragistics.Win.UltraWinGrid.AfterSelectChangeEventArgs e) { //Event handler for after selection changes this.Cursor = Cursors.WaitCursor; try { //Update the selected contact this.mContact = null; if (this.grdContacts.Selected.Rows.Count > 0) { this.mContact = EnterpriseFactory.GetContact(Convert.ToInt32(this.grdContacts.Selected.Rows[0].Cells["ID"].Value)); } } catch { } finally { setUserServices(); this.Cursor = Cursors.Default; } }
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)); } }
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); } }
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(); } } }
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); } }
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); } }