protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { int organisationID = Convert.ToInt32(Request.QueryString["OrganisationID"].ToString()); // Set the page title. this.Master.WizardTitle = string.Format("Approve Organisation"); lblUnnaprovedOrganisation.Text = string.Format("Please approve the Organisation"); lblUnnaprovedOrganisation.Font.Bold = true; Facade.Organisation facOrganisation = new Orchestrator.Facade.Organisation(); this.Organisation = facOrganisation.GetForIdentityId(organisationID); string organisationName = string.IsNullOrWhiteSpace(this.Organisation.OrganisationName) ? "Unnamed" : this.Organisation.OrganisationName; lblNameAndStatus.Text = "<b>Name:</b> " + organisationName; lblNameAndStatus.Text = lblNameAndStatus.Text + "<br /><br /><b>Status:</b> " + this.Organisation.IdentityStatus.ToString(); string jsInjection = @" try { resizeTo(630, 730); } catch (err) { } window.focus(); moveTo(30, 20);"; this.ClientScript.RegisterClientScriptBlock(this.GetType(), "ApproveOnly", jsInjection, true); } }
void cboClientsCustomer_ItemsRequested(object o, Telerik.Web.UI.RadComboBoxItemsRequestedEventArgs e) { cboClientsCustomer.Items.Clear(); int identityID = int.Parse(e.Context["IdentityID"].ToString()); //The Client IdentityId is passed in the combo's ClientDataString //If it is empty it means that a the combo selection hasn't changed //so check whether it was set to a client already (i.e. the Client User scenario) int clientId = 0; if (identityID == 0) { if (!string.IsNullOrEmpty(cboClient.SelectedValue)) { int.TryParse(cboClient.SelectedValue, out clientId); } } else { clientId = identityID; } //A client must be specified before their Customer's can be listed if (clientId == 0) { return; } //Restrict the Client Customers returned to the Client selected Orchestrator.Facade.IOrganisation facOrganisation = new Orchestrator.Facade.Organisation(); DataSet ds = facOrganisation.GetClientCustomersForClientFiltered( clientId, 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(); cboClientsCustomer.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 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()); } }
protected void btnMergeClientCustomers_Click(object sender, EventArgs e) { Facade.Organisation facOrg = new Orchestrator.Facade.Organisation(); List <Entities.Organisation> mergedClientCustomers = new List <Entities.Organisation>(); string userId = ((Entities.CustomPrincipal)Page.User).UserName; CheckBox chkBox = null; string mergeToClientCustomer = ""; StringBuilder mergeFromClientCustomers = new StringBuilder(); mergeToClientCustomer = this.cboOrganisation.SelectedValue; foreach (Telerik.Web.UI.GridItem gi in repClientCustomers.Items) { chkBox = (CheckBox)gi.FindControl("chkRow"); if (chkBox.Checked) { if (mergeFromClientCustomers.Length == 0) { mergeFromClientCustomers = mergeFromClientCustomers.Append(chkBox.Attributes["IdentityId"]); } else { mergeFromClientCustomers = mergeFromClientCustomers.Append("," + chkBox.Attributes["IdentityId"]); } } } if (mergeFromClientCustomers.Length > 0 && mergeToClientCustomer.Length > 0) { facOrg.MergeClientCustomers(Convert.ToInt32(mergeToClientCustomer), mergeFromClientCustomers.ToString(), userId); repClientCustomers.Rebind(); } this.lblMessage.Text = "Merge has succeeded."; this.repClientCustomers.Rebind(); }
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"); } }
private void PopulateInvoiceExtra() { Facade.IInvoiceExtra facInvoiceExtra = new Facade.Invoice(); if (m_invoiceExtra == null) { m_invoiceExtra = new Entities.InvoiceExtra(); } if (lblInvoiceNo.Text != Orchestrator.Globals.Constants.UNALLOCATED_INVOICE_ID) { m_invoiceExtra.InvoiceId = int.Parse(lblInvoiceNo.Text); m_invoiceExtra.CreatedDate = Convert.ToDateTime(lblDateCreated.Text); } else { m_invoiceExtra.CreatedDate = DateTime.Now; } // Set the account code. Entities.Organisation orgClient = null; Facade.Organisation facOrg = new Orchestrator.Facade.Organisation(); orgClient = facOrg.GetForIdentityId(m_identityId); m_invoiceExtra.AccountCode = orgClient.AccountCode; // m_invoiceExtra.InvoiceDate = this.rdiInvoiceDate.SelectedDate.Value; m_invoiceExtra.InvoiceType = eInvoiceType.Extra; m_invoiceExtra.ClientInvoiceAmount = Decimal.Parse(txtAmountNet.Text, NumberStyles.Currency); m_invoiceExtra.InvoiceDetails = txtInvoiceDetails.Text; m_invoiceExtra.CreatedDate = DateTime.Now; m_invoiceExtra.NominalCode = cboNominalCode.SelectedValue; if (chkOverrideAmount.Checked) { m_invoiceExtra.OverrideReason = txtReasonForOverride.Text; m_invoiceExtra.OverrideTotalAmountGross = Decimal.Parse(txtOverrideAmountGross.Text, NumberStyles.Currency); m_invoiceExtra.OverrideTotalAmountNet = Decimal.Parse(txtOverrideAmountNet.Text, NumberStyles.Currency); m_invoiceExtra.OverrideTotalAmountVAT = Decimal.Parse(txtOverrideAmountVAT.Text, NumberStyles.Currency); } else { m_invoiceExtra.OverrideReason = string.Empty; m_invoiceExtra.OverrideTotalAmountGross = 0; m_invoiceExtra.OverrideTotalAmountNet = 0; m_invoiceExtra.OverrideTotalAmountVAT = 0; } m_invoiceExtra.Extras = facInvoiceExtra.GetExtraCollectionForExtraIds(Convert.ToString(ViewState["ExtraIdCSV"])); int vatNo = 0, vatType; decimal vatRate = 0.00M; vatType = int.Parse(cboVATType.SelectedValue); // Vat Rate and Vat Type Facade.IInvoice facInv = new Facade.Invoice(); facInv.GetVatRateForVatType((eVATType)vatType, m_invoiceExtra.InvoiceDate, out vatNo, out vatRate); m_invoiceExtra.VatRate = vatRate; m_invoiceExtra.VatNo = vatNo; if (chkPostToExchequer.Checked) { m_invoiceExtra.Posted = true; } else { m_invoiceExtra.Posted = false; } if (chkDelete.Checked) { m_invoiceExtra.ForCancellation = true; } else { m_invoiceExtra.ForCancellation = false; } }
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); }