private string getStoreDetailString(CRMDataset.StoreTableRow store) { //Return a string of store detail StringBuilder detail = new StringBuilder(); detail.AppendLine(store.StoreName.Trim() + " (store #" + store.StoreNumber.ToString() + "; substore #" + store.SubStoreNumber.Trim() + ")"); detail.AppendLine((!store.IsStoreAddressline1Null() ? store.StoreAddressline1.Trim() : "")); detail.AppendLine((!store.IsStoreAddressline2Null() ? store.StoreAddressline2.Trim() : "")); detail.AppendLine((!store.IsStoreCityNull() ? store.StoreCity.Trim() : "") + ", " + (!store.IsStoreStateNull() ? store.StoreState.Trim() : "") + " " + (!store.IsStoreZipNull() ? store.StoreZip.Trim() : "")); detail.AppendLine((!store.IsContactNameNull() ? store.ContactName.Trim() : "") + ", " + (!store.IsPhoneNumberNull() ? store.PhoneNumber.Trim() : "")); detail.AppendLine((!store.IsRegionDescriptionNull() ? store.RegionDescription.Trim() : "") + " (" + (!store.IsRegionNull() ? store.Region.Trim() : "") + "), " + (!store.IsDistrictNameNull() ? store.DistrictName.Trim() : "") + " (" + (!store.IsDistrictNull() ? store.District.Trim() : "") + ")"); detail.AppendLine("Zone " + (!store.IsZoneNull() ? store.Zone.Trim() : "") + ", " + "Agent " + (!store.IsAgentNumberNull() ? store.AgentNumber.Trim() : "") + " " + (!store.IsAgentNameNull() ? store.AgentName.Trim() : "")); detail.AppendLine("Window " + (!store.IsWindowTimeStartNull() ? store.WindowTimeStart.ToString("HH:mm") : "") + " - " + (!store.IsWindowTimeEndNull() ? store.WindowTimeEnd.ToString("HH:mm") : "") + ", " + "Del Days " + getDeliveryDays(store) + ", " + (!store.IsScanStatusDescrptionNull() ? store.ScanStatusDescrption.Trim() : "")); detail.AppendLine("JA Transit " + (!store.IsStandardTransitNull() ? store.StandardTransit.ToString() : "") + ", " + "OFD " + getOFD(store)); //detail.AppendLine("Special Inst: " + (!store.IsSpecialInstructionsNull() ? store.SpecialInstructions.Trim() : "")); return(detail.ToString()); }
private void OnStoreKeyUp(object sender, KeyEventArgs e) { //Event handler for store textbox key up event try { if (e.KeyCode == Keys.Enter) { this.txtStoreName.Text = this.txtStoreAddress.Text = this.txtStoreDetail.Text = ""; if (this.cboClient.SelectedValue != null && this.mskStore.Text.Trim().Length > 0) { CRMDataset ds = new CRMDataset(); ds.Merge(CRMGateway.GetStoreDetail(int.Parse(this.cboClient.SelectedValue.ToString()), int.Parse(this.mskStore.Text))); if (ds.StoreTable.Rows.Count > 0) { CRMDataset.StoreTableRow store = ds.StoreTable[0]; this.txtStoreName.Text = store.StoreName.Trim() + " (store #" + store.StoreNumber.ToString() + "; substore #" + store.SubStoreNumber.Trim() + ")"; StringBuilder address = new StringBuilder(); address.AppendLine((!store.IsStoreAddressline1Null() ? store.StoreAddressline1.Trim() : "")); address.AppendLine((!store.IsStoreAddressline2Null() ? store.StoreAddressline2.Trim() : "")); address.AppendLine((!store.IsStoreCityNull() ? store.StoreCity.Trim() : "") + ", " + (!store.IsStoreStateNull() ? store.StoreState.Trim() : "") + " " + (!store.IsStoreZipNull() ? store.StoreZip.Trim() : "")); this.txtStoreAddress.Text = address.ToString(); StringBuilder detail = new StringBuilder(); detail.AppendLine((!store.IsRegionDescriptionNull() ? store.RegionDescription.Trim() : "") + " (" + (!store.IsRegionNull() ? store.Region.Trim() : "") + "), " + (!store.IsDistrictNameNull() ? store.DistrictName.Trim() : "") + " (" + (!store.IsDistrictNull() ? store.District.Trim() : "") + ")"); detail.AppendLine("Zone " + (!store.IsZoneNull() ? store.Zone.Trim() : "") + ", " + "Agent " + (!store.IsAgentNumberNull() ? store.AgentNumber.Trim() : "") + " " + (!store.IsAgentNameNull() ? store.AgentName.Trim() : "")); detail.AppendLine("Window " + (!store.IsWindowTimeStartNull() ? store.WindowTimeStart.ToString("HH:mm") : "") + " - " + (!store.IsWindowTimeEndNull() ? store.WindowTimeEnd.ToString("HH:mm") : "") + ", " + "Del Days " + getDeliveryDays(store) + ", " + (!store.IsScanStatusDescrptionNull() ? store.ScanStatusDescrption.Trim() : "")); detail.AppendLine("JA Transit " + (!store.IsStandardTransitNull() ? store.StandardTransit.ToString() : "") + ", " + "OFD " + getOFD(store)); detail.AppendLine("Special Inst: " + (!store.IsSpecialInstructionsNull() ? store.SpecialInstructions.Trim() : "")); this.txtStoreDetail.Text = detail.ToString(); } } refreshReports(); } } catch (Exception ex) { App.ReportError(new ApplicationException("Unexpected error when store keyed in.", ex)); } }