public List <Orchestrator.WebUI.Services.PostTown> GetTownsForCountry(string filter, int countryId, int maxCount) { List <Orchestrator.WebUI.Services.PostTown> towns = new List <Orchestrator.WebUI.Services.PostTown>(); try { Orchestrator.Facade.IReferenceData facRefData = new Orchestrator.Facade.ReferenceData(); DataSet ds = facRefData.GetTownForTownNameAndCountry(filter, countryId);; DataTable dt = ds.Tables[0]; foreach (DataRow dr in dt.Rows) { if (towns.Count == maxCount) { break; } else { towns.Add(new PostTown() { ID = Convert.ToInt32(dr["TownId"].ToString()), TownName = dr["Description"].ToString() }); } } } catch (Exception ex) { throw ex; } return(towns); }
void cboClient_ItemsRequested(object o, Telerik.Web.UI.RadComboBoxItemsRequestedEventArgs e) { cboClient.Items.Clear(); Orchestrator.Facade.IReferenceData facRefData = new Orchestrator.Facade.ReferenceData(); DataSet ds = facRefData.GetAllClientsFiltered(e.Text); int itemsPerRequest = 20; int itemOffset = e.NumberOfItems; int endOffset = itemOffset + itemsPerRequest; if (endOffset > ds.Tables[0].Rows.Count) { endOffset = ds.Tables[0].Rows.Count; } DataTable dt = ds.Tables[0]; Telerik.Web.UI.RadComboBoxItem rcItem = null; for (int i = itemOffset; i < endOffset; i++) { rcItem = new Telerik.Web.UI.RadComboBoxItem(); rcItem.Text = dt.Rows[i]["OrganisationName"].ToString(); rcItem.Value = dt.Rows[i]["IdentityId"].ToString(); cboClient.Items.Add(rcItem); } if (dt.Rows.Count > 0) { e.Message = string.Format("Items <b>1</b>-<b>{0}</b> out of <b>{1}</b>", endOffset.ToString(), dt.Rows.Count.ToString()); } }
void rcbDeHireOrganisation_ItemsRequested(object o, RadComboBoxItemsRequestedEventArgs e) { Orchestrator.Facade.IReferenceData facRefData = new Orchestrator.Facade.ReferenceData(); DataSet ds = facRefData.GetAllClientsFiltered(e.Text); DataTable dt = ds.Tables[0]; DataTable boundResults = dt.Clone(); int itemsPerRequest = 20; int itemOffset = e.NumberOfItems; int endOffset = itemOffset + itemsPerRequest; if (endOffset > ds.Tables[0].Rows.Count) { endOffset = ds.Tables[0].Rows.Count; } for (int i = itemOffset; i < endOffset; i++) { boundResults.ImportRow(dt.Rows[i]); } rcbDeHireOrganisation.Items.Clear(); rcbDeHireOrganisation.DataSource = boundResults; rcbDeHireOrganisation.DataBind(); if (dt.Rows.Count > 0) { e.Message = string.Format("Items <b>1</b>-<b>{0}</b> out of <b>{1}</b>", endOffset.ToString(), dt.Rows.Count.ToString()); } }
public RadComboBoxItemData[] GetClosestTownNoCountry(RadComboBoxContext context) { List <RadComboBoxItemData> result = new List <RadComboBoxItemData>(); try { Orchestrator.Facade.IReferenceData facRefData = new Orchestrator.Facade.ReferenceData(); DataSet ds = facRefData.GetTownForTownName(context.Text); int itemsPerRequest = 20; int itemOffset = context.NumberOfItems; int endOffset = itemOffset + itemsPerRequest; if (endOffset > ds.Tables[0].Rows.Count) { endOffset = ds.Tables[0].Rows.Count; } DataTable dt = ds.Tables[0]; RadComboBoxItemData rcItem = null; for (int i = itemOffset; i < endOffset; i++) { rcItem = new RadComboBoxItemData(); rcItem.Text = dt.Rows[i]["Description"].ToString(); rcItem.Value = dt.Rows[i]["TownId"].ToString(); result.Add(rcItem); } } catch (Exception ex) { throw ex; } return(result.ToArray()); }
public RadComboBoxItemData[] GetOrganisations(RadComboBoxContext context) { List <RadComboBoxItemData> result = new List <RadComboBoxItemData>(); Orchestrator.Facade.IReferenceData facRefData = new Orchestrator.Facade.ReferenceData(); DataSet ds = facRefData.GetAllOrganisationsFiltered(context.Text, false); int itemsPerRequest = 20; int itemOffset = context.NumberOfItems; int endOffset = itemOffset + itemsPerRequest; if (endOffset > ds.Tables[0].Rows.Count) { endOffset = ds.Tables[0].Rows.Count; } DataTable dt = ds.Tables[0]; Telerik.Web.UI.RadComboBoxItemData rcItem = null; for (int i = itemOffset; i < endOffset; i++) { rcItem = new Telerik.Web.UI.RadComboBoxItemData(); rcItem.Text = dt.Rows[i]["OrganisationName"].ToString(); rcItem.Value = dt.Rows[i]["IdentityId"].ToString(); result.Add(rcItem); } return(result.ToArray()); }
void cboSubContractor_ItemsRequested(object o, Telerik.Web.UI.RadComboBoxItemsRequestedEventArgs e) { cboSubContractor.Items.Clear(); Orchestrator.Facade.IReferenceData facRefData = new Orchestrator.Facade.ReferenceData(); DataSet ds = facRefData.GetAllSubContractorsFiltered("%" + e.Text); DataTable dt = ds.Tables[0]; DataTable boundResults = dt.Clone(); int itemsPerRequest = 20; int itemOffset = e.NumberOfItems; int endOffset = itemOffset + itemsPerRequest; if (endOffset > dt.Rows.Count) { endOffset = dt.Rows.Count; } for (int i = itemOffset; i < endOffset; i++) { boundResults.ImportRow(dt.Rows[i]); } cboSubContractor.DataSource = boundResults; cboSubContractor.DataBind(); if (dt.Rows.Count > 0) { e.Message = string.Format("Items <b>1</b>-<b>{0}</b> out of <b>{1}</b>", endOffset.ToString(), dt.Rows.Count.ToString()); } }
private void btnNext_Click(object sender, System.EventArgs e) { string nextPage = String.Empty; string appendOrReplace = String.Empty; bool PODReceived = false; if (this.rblOperation.SelectedValue == "0") { appendOrReplace = "S"; nextPage = IsNewDynamicWebTwainLicensed ? "scanDocumentNew.aspx" : "scanDocument.aspx"; } else if (this.rblOperation.SelectedValue == "1") { appendOrReplace = "U"; nextPage = "uploadDocument.aspx"; } else if (this.rblOperation.SelectedValue == "2") { // Skip the scanning page Orchestrator.Facade.ReferenceData facForm = new Orchestrator.Facade.ReferenceData(); Entities.FormType formType = facForm.GetForFormTypeId(this.ScannedFormTypeId); nextPage = formType.FormTypePage; appendOrReplace = "N"; } if (this.rblAppandOReplace.SelectedValue == "0") { appendOrReplace += "R"; } else if (this.rblAppandOReplace.SelectedValue == "1") { appendOrReplace += "A"; } nextPage += "?ScannedFormId=" + this.ScannedFormId.ToString(); nextPage += "&ScannedFormTypeId=" + this.ScannedFormTypeId.ToString(); nextPage += "&JobId=" + this.JobId.ToString();; nextPage += "&OrderId=" + this.OrderId.ToString();; nextPage += "&OrgId=" + this.OrganisationIdentityId.ToString(); nextPage += "&OrgDocId=" + this.OrganisationDocumentId.ToString(); nextPage += "&CollectDropId=" + this.CollectDropId.ToString(); nextPage += "&PointId=" + this.PointId.ToString(); nextPage += "&ManifestId=" + this.ManifestId.ToString(); nextPage += "&DeHireReceiptId=" + this.DehireReceiptId.ToString(); nextPage += "&DHNo=" + this.DehireReceiptNumber.ToString(); nextPage += "&AppendOrReplace=" + appendOrReplace; nextPage += "&PODReceived=" + PODReceived; if (this.Request.QueryString["dcb"] != null) { nextPage += "&dcb=" + this.Request.QueryString["dcb"].ToString(); } nextPage += "&WizardBackUrl=" + HttpUtility.UrlEncode(Request.Url.PathAndQuery); Response.Redirect(nextPage); }
private void PopulateCountryCombo() { this.cboCountry.Items.Clear(); Orchestrator.Facade.IReferenceData facRef = new Orchestrator.Facade.ReferenceData(); DataSet countries = facRef.GetAllCountries(); foreach (DataRow row in countries.Tables[0].Rows) { Telerik.Web.UI.RadComboBoxItem rcItem = new Telerik.Web.UI.RadComboBoxItem(); rcItem.Text = row["CountryDescription"].ToString(); rcItem.Value = row["CountryId"].ToString(); this.cboCountry.Items.Add(rcItem); } }
public RadComboBoxItemData[] GetClients(RadComboBoxContext context) { List <RadComboBoxItemData> result = new List <RadComboBoxItemData>(); // If the context contains a "TopItemText" key then add to a the top of the result list an item containing this text (for example "- all -" or "- select -") var topItemText = context.ContainsKey("TopItemText") ? context["TopItemText"].ToString() : string.Empty; if (!string.IsNullOrWhiteSpace(topItemText)) { result.Add(new Telerik.Web.UI.RadComboBoxItemData { Text = topItemText }); } bool includeSuspended = false; if (context.ContainsKey("DisplaySuspended")) { includeSuspended = context["DisplaySuspended"] == null ? false : context["DisplaySuspended"].ToString() == "False" ? false : true; } var query = (context.ContainsKey("Text") && context.Text != topItemText) ? context.Text : string.Empty; Orchestrator.Facade.IReferenceData facRefData = new Orchestrator.Facade.ReferenceData(); DataSet ds = facRefData.GetAllClientsFiltered(query, includeSuspended); int itemsPerRequest = 20; int itemOffset = context.NumberOfItems; int endOffset = itemOffset + itemsPerRequest; if (endOffset > ds.Tables[0].Rows.Count) { endOffset = ds.Tables[0].Rows.Count; } DataTable dt = ds.Tables[0]; Telerik.Web.UI.RadComboBoxItemData rcItem = null; for (int i = itemOffset; i < endOffset; i++) { rcItem = new Telerik.Web.UI.RadComboBoxItemData(); rcItem.Text = dt.Rows[i]["OrganisationName"].ToString(); rcItem.Value = dt.Rows[i]["IdentityId"].ToString(); result.Add(rcItem); } return(result.ToArray()); }
void cboPointOwner_ItemsRequested(object o, Telerik.Web.UI.RadComboBoxItemsRequestedEventArgs e) { //cboDeliveryPointOwner.Items.Clear(); // if this is being called by a client they can only access clients of their own for now. DataSet ds = null; if (this.ClientUserOrganisationIdentityID > 0) { Orchestrator.Facade.IOrganisation facOrganisation = new Orchestrator.Facade.Organisation(); ds = facOrganisation.GetClientsForIdentityIdFiltered(this.ClientUserOrganisationIdentityID, e.Text); } else { Orchestrator.Facade.IReferenceData facReferenceData = new Orchestrator.Facade.ReferenceData(); ds = facReferenceData.GetAllOrganisationsFiltered("%" + e.Text, false); } DataTable dt = ds.Tables[0]; int itemsPerRequest = 20; int itemOffset = e.NumberOfItems; int endOffset = itemOffset + itemsPerRequest; if (endOffset > dt.Rows.Count) { endOffset = dt.Rows.Count; } Telerik.Web.UI.RadComboBoxItem rcItem = null; for (int i = itemOffset; i < endOffset; i++) { rcItem = new Telerik.Web.UI.RadComboBoxItem(); rcItem.Text = dt.Rows[i]["OrganisationName"].ToString(); rcItem.Value = dt.Rows[i]["IdentityId"].ToString(); cboPointOwner.Items.Add(rcItem); } if (dt.Rows.Count > 0) { e.Message = string.Format("Items <b>1</b>-<b>{0}</b> out of <b>{1}</b>", endOffset.ToString(), dt.Rows.Count.ToString()); } }
//-------------------------------------------------------------------------- private void btnNext_Click(object sender, System.EventArgs e) { if (!String.IsNullOrEmpty(this.FileName)) { if (this.ScannerId == -1) { if (!String.IsNullOrEmpty(this.hidSelectedScannerID.Value)) { HttpCookie scannerCookie = new HttpCookie(cookieScanner, this.hidSelectedScannerID.Value); scannerCookie.Expires = DateTime.Today.AddYears(50); Response.Cookies.Add(scannerCookie); } } Orchestrator.Facade.ReferenceData facForm = new Orchestrator.Facade.ReferenceData(); Entities.FormType formType = facForm.GetForFormTypeId(this.ScannedFormTypeId); string nextPage = formType.FormTypePage; nextPage += "?ScannedFormId=" + this.ScannedFormId.ToString(); nextPage += "&ScannedFormTypeId=" + this.ScannedFormTypeId.ToString(); nextPage += "&JobId=" + this.JobId; nextPage += "&OrderId=" + this.OrderId; nextPage += "&OrgId=" + this.OrganisationIdentityId; nextPage += "&OrgDocId=" + this.OrganisationDocumentId; nextPage += "&CollectDropId=" + this.CollectDropId; nextPage += "&PointId=" + this.PointId; nextPage += "&ManifestId=" + this.ManifestId; nextPage += "&DeHireReceiptId=" + this.DehireReceiptId; nextPage += "&DHNo=" + this.DehireReceiptNumber; nextPage += "&AppendOrReplace=" + this.AppendOrReplace; nextPage += "&FileName=" + this.FileName; if (this.Request.QueryString["dcb"] != null) { nextPage += "&dcb=" + this.Request.QueryString["dcb"].ToString(); } nextPage += "&WizardBackUrl=" + HttpUtility.UrlEncode(Request.Url.PathAndQuery); Response.Redirect(nextPage); } }
void cboTown_ItemsRequested(object o, Telerik.Web.UI.RadComboBoxItemsRequestedEventArgs e) { cboTown.Items.Clear(); int countryId = 1; //UK if (e.Context["FilterString"] != null && e.Context["FilterString"].ToString().ToLower().IndexOf("countryid=") > -1) { string countryIdString = e.Context["FilterString"].ToString().ToLower().Replace("countryid=", ""); countryIdString = countryIdString.Substring(0, countryIdString.IndexOf(';')); countryId = Convert.ToInt32(countryIdString); } Orchestrator.Facade.IReferenceData facRefData = new Orchestrator.Facade.ReferenceData(); DataSet ds = facRefData.GetTownForTownNameAndCountry(e.Text, countryId); int itemsPerRequest = 20; int itemOffset = e.NumberOfItems; int endOffset = itemOffset + itemsPerRequest; if (endOffset > ds.Tables[0].Rows.Count) { endOffset = ds.Tables[0].Rows.Count; } DataTable dt = ds.Tables[0]; Telerik.Web.UI.RadComboBoxItem rcItem = null; for (int i = itemOffset; i < endOffset; i++) { rcItem = new Telerik.Web.UI.RadComboBoxItem(); rcItem.Text = dt.Rows[i]["Description"].ToString(); rcItem.Value = dt.Rows[i]["TownId"].ToString(); cboTown.Items.Add(rcItem); } if (dt.Rows.Count > 0) { e.Message = string.Format("Items <b>1</b>-<b>{0}</b> out of <b>{1}</b>", endOffset.ToString(), dt.Rows.Count.ToString()); } else { this.cboTown.Text = String.Empty; } }
public RadComboBoxItemData[] GetCountries(RadComboBoxContext context) { Orchestrator.Facade.IReferenceData facRef = new Orchestrator.Facade.ReferenceData(); DataSet ds = facRef.GetAllCountries(); DataTable dt = ds.Tables[0]; Telerik.Web.UI.RadComboBoxItemData rcItem = null; List <RadComboBoxItemData> result = new List <RadComboBoxItemData>(); foreach (DataRow dr in dt.Rows) { rcItem = new RadComboBoxItemData(); rcItem.Text = dr["CountryDescription"].ToString(); rcItem.Value = dr["CountryId"].ToString(); result.Add(rcItem); } return(result.ToArray()); }
//-------------------------------------------------------------------------- private void btnNext_Click(object sender, EventArgs e) { if (!String.IsNullOrEmpty(this.FileName)) { Orchestrator.Facade.ReferenceData facForm = new Orchestrator.Facade.ReferenceData(); Entities.FormType formType = facForm.GetForFormTypeId(this.ScannedFormTypeId); string nextPage = formType.FormTypePage; nextPage += "?ScannedFormId=" + this.ScannedFormId.ToString() + "&"; nextPage += "&ScannedFormTypeId=" + this.ScannedFormTypeId.ToString(); nextPage += "&JobId=" + this.JobId; nextPage += "&OrderId=" + this.OrderId; nextPage += "&OrgId=" + this.OrganisationIdentityId; nextPage += "&OrgDocId=" + this.OrganisationDocumentId; nextPage += "&CollectDropId=" + this.CollectDropId; nextPage += "&PointId=" + this.PointId; nextPage += "&ManifestId=" + this.ManifestId; nextPage += "&DeHireReceiptId=" + this.DehireReceiptId; nextPage += "&DHNo=" + this.DehireReceiptNumber; nextPage += "&AppendOrReplace=" + this.AppendOrReplace; nextPage += "&FileName=" + this.FileName; if (this.Request.QueryString["dcb"] != null) { nextPage += "&dcb=" + this.Request.QueryString["dcb"].ToString(); } nextPage += "&WizardBackUrl=" + HttpUtility.UrlEncode(Request.Url.PathAndQuery); Response.Redirect(nextPage); } else { this.lblError.Text = "No upload file path found."; } }
public List <Orchestrator.WebUI.Services.Country> GetCountries(string filter) { List <Orchestrator.WebUI.Services.Country> countries = new List <Orchestrator.WebUI.Services.Country>(); try { Orchestrator.Facade.IReferenceData facRef = new Orchestrator.Facade.ReferenceData(); DataSet dsCountries = facRef.GetAllCountries(); foreach (DataRow dr in dsCountries.Tables[0].Rows) { countries.Add(new Country() { ID = Convert.ToInt32(dr["CountryId"].ToString()), CountryName = dr["CountryDescription"].ToString() }); } } catch (Exception ex) { throw ex; } return(countries); }
private void DisplayOrder(Orchestrator.Entities.Order order) { Orchestrator.Facade.IOrganisation facOrg = new Orchestrator.Facade.Organisation(); Orchestrator.Facade.IPoint facPoint = new Orchestrator.Facade.Point(); Orchestrator.Facade.IReferenceData facRefData = new Orchestrator.Facade.ReferenceData(); Orchestrator.Facade.IPOD facPOD = new Orchestrator.Facade.POD(); Orchestrator.Facade.IOrder facOrd = new Orchestrator.Facade.Order(); order.ClientInvoiceID = facOrd.ClientInvoiceID(OrderID); Orchestrator.Facade.Organisation facOrgD = new Orchestrator.Facade.Organisation(); Orchestrator.Entities.Point collectionPoint = facPoint.GetPointForPointId(order.CollectionPointID); Orchestrator.Entities.Point deliveryPoint = facPoint.GetPointForPointId(order.DeliveryPointID); Orchestrator.Entities.POD scannedPOD = facPOD.GetForOrderID(order.OrderID); Orchestrator.Entities.Scan scannedBookingForm = null; CurrentCulture = new CultureInfo(order.LCID); ExchangeRateID = order.ExchangeRateID; lblOrderHeading.Text = string.Format("Order {0}", order.OrderID); this.lblOrderStatus.Text = order.OrderStatus.ToString(); if (((Entities.CustomPrincipal) this.Page.User).IsInRole(((int)eUserRole.SubConPortal).ToString())) { this.btnPIL.Visible = false; this.btnCreateDeliveryNote.Visible = false; this.btnCreateDeliveryNote2.Visible = false; this.btnPIL2.Visible = false; plcBooking.Visible = false; plcPOD.Visible = false; // get cost for subby and display as rate. (The rate the subby is being paid) Facade.IJobSubContractor jobSubContractor = new Facade.Job(); if (order != null && order.JobSubContractID > 0) { Entities.JobSubContractor js = jobSubContractor.GetSubContractorForJobSubContractId(order.JobSubContractID); CultureInfo subbyCulture = new CultureInfo(js.LCID); if (Orchestrator.Globals.Configuration.MultiCurrency) { this.lblRate.Text = string.Format(rateTemplate, js.ForeignRate.ToString("C", subbyCulture), js.Rate.ToString("C")); } else { this.lblRate.Text = js.Rate.ToString("C", subbyCulture); } } this.tblSubbyRate.Visible = true; this.trRate.Visible = false; this.trInvoiceId.Visible = false; } else { this.tblSubbyRate.Visible = false; //If the order has a scanned Booking Form get it so that //a link to it can be displayed if (order.BookingFormScannedFormId != null) { Orchestrator.Facade.Form facBF = new Orchestrator.Facade.Form(); scannedBookingForm = facBF.GetForScannedFormId(order.BookingFormScannedFormId.Value); } //this.lblOrderID.Text = order.OrderID.ToString(); this.lblOrderStatus.Text = order.OrderStatus.ToString().Replace("_", " "); if (scannedBookingForm != null) { hlBookingFormLink.Visible = true; hlBookingFormLink.NavigateUrl = scannedBookingForm.ScannedFormPDF.Trim(); aScanBookingForm.InnerHtml = "| Re-Scan"; aScanBookingForm.HRef = @"javascript:ReDoBookingForm(" + scannedBookingForm.ScannedFormId + "," + order.OrderID.ToString() + ");"; } else { hlBookingFormLink.Visible = false; aScanBookingForm.InnerHtml = "Scan"; aScanBookingForm.HRef = @"javascript:NewBookingForm(" + order.OrderID.ToString() + ");"; } plcPOD.Visible = false; if (Orchestrator.Globals.Configuration.MultiCurrency) { this.lblRate.Text = string.Format(rateTemplate, order.ForeignRate.ToString("C", CurrentCulture), order.Rate.ToString("C")); } else { this.lblRate.Text = order.ForeignRate.ToString("C", CurrentCulture); } trRate.Visible = !order.IsInGroup; if (order.ClientInvoiceID <= 0) { lblInvoiceNumber.Text = "None Assigned"; } else { lblInvoiceNumber.Text = order.ClientInvoiceID.ToString(); string PDFLink = order.PDFLocation.ToString(); lblInvoiceNumber.NavigateUrl = Orchestrator.Globals.Configuration.WebServer + PDFLink; } } this.lblLoadNumber.Text = order.CustomerOrderNumber; this.lblDeliveryOrderNo.Text = order.DeliveryOrderNumber; this.lblCollectionPoint.Text = collectionPoint.Address.ToString(); this.lblDeliverTo.Text = deliveryPoint.Address.ToString(); this.lblCollectDateTime.Text = (order.CollectionIsAnytime == true ? (order.CollectionDateTime.ToString("dd/MM/yy") + " AnyTime") : (order.CollectionDateTime.ToString("dd/MM/yy HH:mm"))); this.lblDeliveryDateTime.Text = (order.DeliveryIsAnytime == true ? (order.DeliveryDateTime.ToString("dd/MM/yy") + " AnyTime") : (order.DeliveryDateTime.ToString("dd/MM/yy HH:mm"))) + order.DeliveryAnnotation; this.lblPallets.Text = order.NoPallets.ToString() + " " + Orchestrator.Facade.PalletType.GetForPalletTypeId(order.PalletTypeID).Description; this.lblPalletSpaces.Text = order.PalletSpaces.ToString("0.##"); this.lblGoodsType.Text = Orchestrator.Facade.GoodsType.GetForGoodsTypeId(order.GoodsTypeID).Description; this.lblWeight.Text = Convert.ToInt32(order.Weight).ToString() + " " + Orchestrator.Facade.WeightType.GetForWeightTypeId(order.WeightTypeID).ShortCode; this.repReferences.DataSource = order.OrderReferences; this.repReferences.DataBind(); this.lblCartons.Text = order.Cases.ToString(); if (order.Notes == null || order.Notes.Length == 0) { this.lblNotes.Text = " "; } else { this.lblNotes.Text = order.Notes; } if (order.CreateDateTime != DateTime.MinValue) { lblCreated.Text = order.CreatedBy + " on " + order.CreateDateTime.ToString("dd/MM/yy HH:mm"); } lblOrderServiceLevel.Text = order.OrderServiceLevel; if (order.BusinessTypeID > 0) { Orchestrator.Facade.IBusinessType facBusinessType = new Orchestrator.Facade.BusinessType(); Orchestrator.Entities.BusinessType businessType = facBusinessType.GetForBusinessTypeID(order.BusinessTypeID); lblBusinessType.Text = businessType.Description; } else { lblBusinessType.Text = "Not Set"; } plcCancellation.Visible = order.OrderStatus == eOrderStatus.Cancelled; if (order.OrderStatus == eOrderStatus.Cancelled) { lblCancellationReason.Text = order.CancellationReason; lblCancelledBy.Text = order.CancelledBy; lblCancelledAt.Text = order.CancelledAt.ToString("dd/MM/yy HH:mm"); } }
public bool ImportCustomers(DataSet ds) { DataTable dt = ds.Tables[0]; Orchestrator.Entities.Organisation organisation; Orchestrator.Entities.OrganisationLocation ol; Orchestrator.Entities.Individual i; Orchestrator.Entities.Point point; Orchestrator.Entities.Address address; Orchestrator.Facade.Organisation facOrganisation = new Orchestrator.Facade.Organisation(); foreach (DataRow row in dt.Rows) { organisation = new Orchestrator.Entities.Organisation(); organisation.OrganisationName = row["NAME"].ToString(); organisation.OrganisationDisplayName = row["NAME"].ToString(); organisation.OrganisationType = Orchestrator.eOrganisationType.Client; organisation.AccountCode = row["ACCOUNT_REF"].ToString(); address = new Orchestrator.Entities.Address(); address.AddressType = Orchestrator.eAddressType.Correspondence; address.AddressLine1 = row["ADDRESS_1"].ToString(); address.AddressLine2 = row["ADDRESS_2"].ToString(); address.PostTown = row["ADDRESS_3"].ToString(); address.County = row["ADDRESS_4"].ToString(); address.PostCode = row["ADDRESS_5"].ToString(); address.TrafficArea = new Orchestrator.Entities.TrafficArea(); address.TrafficArea.TrafficAreaId = 0; //Resolve The post Town if possible. string defaultPostTown = "Glasgow"; int defaultPostTownId = 9063; string postTown = (row["ADDRESS_4"].ToString() == "" ? null : row["ADDRESS_4"].ToString()) ?? (row["ADDRESS_3"].ToString() == "" ? null : row["ADDRESS_3"].ToString()) ?? (row["ADDRESS_2"].ToString() == "" ? null : row["ADDRESS_2"].ToString()) ?? defaultPostTown; if (address.PostTown == string.Empty) { address.PostTown = postTown; } int?postTownID = null; Orchestrator.Facade.ReferenceData facRef = new Orchestrator.Facade.ReferenceData(); DataSet dsTown = facRef.GetTownForTownName(postTown); if (dsTown.Tables[0].Rows.Count > 0) { postTownID = int.Parse(dsTown.Tables[0].Rows[0]["TownId"].ToString()); } ol = new Orchestrator.Entities.OrganisationLocation(); ol.OrganisationLocationName = "Head Office"; ol.OrganisationLocationType = Orchestrator.eOrganisationLocationType.HeadOffice; point = new Orchestrator.Entities.Point(); point.Description = "Head Office"; point.Collect = false; point.Deliver = false; point.Address = address; point.PostTown = new Orchestrator.Entities.PostTown(); point.PostTown.TownName = postTown; point.PostTown.TownId = postTownID ?? defaultPostTownId; ol.Point = point; if (organisation.Locations == null) { organisation.Locations = new Orchestrator.Entities.OrganisationLocationCollection(); } organisation.Locations.Add(ol); i = new Orchestrator.Entities.Individual(); i.Contacts = new Orchestrator.Entities.ContactCollection(); i.IndividualType = Orchestrator.eIndividualType.Contact; i.Title = Orchestrator.eTitle.Mr; if (row["CONTACT_NAME"] != string.Empty) { if (row["CONTACT_NAME"].ToString().IndexOf(' ') > 0) { i.FirstNames = row["CONTACT_NAME"].ToString().Split(' ')[0]; i.LastName = row["CONTACT_NAME"].ToString().Split(' ')[1]; } else { i.FirstNames = row["CONTACT_NAME"].ToString(); i.LastName = string.Empty; } } if (row["TELEPHONE"].ToString() != string.Empty) { i.Contacts.Add(new Orchestrator.Entities.Contact(Orchestrator.eContactType.Telephone, row["TELEPHONE"].ToString())); ol.TelephoneNumber = row["TELEPHONE"].ToString(); } if (row["FAX"].ToString() != string.Empty) { i.Contacts.Add(new Orchestrator.Entities.Contact(Orchestrator.eContactType.Fax, row["FAX"].ToString())); ol.FaxNumber = row["FAX"].ToString(); } if (row["E_MAIL"].ToString() != string.Empty) { i.Contacts.Add(new Orchestrator.Entities.Contact(Orchestrator.eContactType.Email, row["E_MAIL"].ToString())); } if (row["CONTACT_NAME"] != string.Empty) { organisation.IndividualContacts.Add(i); } Orchestrator.Entities.FacadeResult ret = facOrganisation.Create(organisation, "Orchestrator_Import"); if (!ret.Success) { return(false); } } return(true); }