void repPoints_NeedDataSource(object source, GridNeedDataSourceEventArgs e) { if (this.ucPoint.SelectedPoint != null || this.ucPoint.PointID > 0) { BusinessLogicLayer.IPoint busPoint = new BusinessLogicLayer.Point(); Entities.Point point = (this.ucPoint.SelectedPoint != null) ? this.ucPoint.SelectedPoint : null; if (point == null) { point = busPoint.GetPointForPointId(this.ucPoint.PointID); } if (point == null) { this.ucPoint.SelectedPoint = null; this.ucPoint.PointID = -1; this.repPoints.DataSource = new DataTable(); } else { this.repPoints.DataSource = new DataTable(); repPoints.DataSource = busPoint.GetFuzzyPointsToMerge(this.ucPoint.SelectedPoint.Description, float.Parse(this.pointDescriptionRadSlider.SelectedValue), String.Empty, 0, this.ucPoint.SelectedPoint.Address.AddressLine1, float.Parse(this.addressLine1RadSlider.SelectedValue), this.ucPoint.SelectedPoint.Address.PostTown, float.Parse(this.townRadSlider.SelectedValue), this.chkMatchOnPostCode.Checked ? this.ucPoint.SelectedPoint.Address.PostCode : String.Empty, 0); } } else { this.repPoints.DataSource = new DataTable(); } }
void lvDuplicateAddress_ItemCommand(object sender, ListViewCommandEventArgs e) { int pointId = Convert.ToInt32(e.CommandArgument); Facade.IPoint facPoint = new Facade.Point(); Entities.Point p = facPoint.GetPointForPointId(pointId); if (p != null) { if (p.PointStateId == ePointState.Deleted) { string userId = ((Orchestrator.Entities.CustomPrincipal)Page.User).UserName; p.PointStateId = ePointState.Approved; Entities.FacadeResult result = facPoint.Update(p, userId); } this.SelectedPoint = p; cboPoint.Text = p.Description; cboPoint.SelectedValue = p.IdentityId.ToString() + "," + p.PointId.ToString(); pnlNewPoint.Visible = false; pnlPoint.Visible = true; this.divDuplicateAddress.Visible = false; inpCreateNewPointSelected.Value = string.Empty; } }
private bool UpdatePoint() { Facade.IPoint facPoint = new Facade.Point(); string userName = ((Entities.CustomPrincipal)Page.User).UserName; // Ensure the latest traffic area id is reflected in the update. point.Address.TrafficArea.TrafficAreaId = Convert.ToInt32(cboTrafficArea.SelectedValue); Entities.FacadeResult retVal = facPoint.Update(point, userName); if (retVal.Success) { lblConfirmation.Text = "The point has been updated."; lblConfirmation.Visible = true; point = facPoint.GetPointForPointId(point.PointId); cboTrafficArea.SelectedValue = point.Address.TrafficArea.TrafficAreaId.ToString(); } else { infringementDisplay.Infringements = retVal.Infringements; infringementDisplay.DisplayInfringments(); } return(retVal.Success); }
private void PopulateControls() { Facade.IJobRate facJobRate = new Facade.Job(); Entities.JobRate jobRate = facJobRate.GetRateForRateId(m_rateId); if (jobRate != null) { // Delivery point Facade.IPoint facPoint = new Facade.Point(); Entities.Point point = facPoint.GetPointForPointId(jobRate.DeliveryPointId); cboDeliveryPoint.Text = point.Description; cboDeliveryPoint.SelectedValue = jobRate.DeliveryPointId.ToString(); cboDelivery.Text = point.OrganisationName; cboDelivery.SelectedValue = point.IdentityId.ToString(); // Collection point point = facPoint.GetPointForPointId(jobRate.CollectionPointId); cboCollectionPoint.Text = point.Description; cboCollectionPoint.SelectedValue = jobRate.CollectionPointId.ToString(); cboCollection.Text = point.OrganisationName; cboCollection.SelectedValue = point.IdentityId.ToString(); txtFullLoadRate.Text = jobRate.FullLoadRate.ToString("C"); txtMultiDropRate.Text = jobRate.MultiDropRate.ToString("C"); dteStartDate.SelectedDate = jobRate.StartDate; dteStartDate.Text = jobRate.StartDate.ToString(); if (!(jobRate.EndDate.ToString() == "01/01/1753 00:00:00")) { dteEndDate.SelectedDate = jobRate.EndDate; dteEndDate.Text = jobRate.EndDate.ToString(); } } }
void cboPoint_SelectedIndexChanged(object o, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e) { // Set the identity id to use for the point filtering switch ((eInstructionType)m_instruction.InstructionTypeId) { case eInstructionType.Load: m_identityId = m_job.IdentityId; break; case eInstructionType.Drop: m_identityId = m_instruction.ClientsCustomerIdentityID; break; } if (cboPoint.SelectedValue != String.Empty) { Facade.IPoint facPoint = new Facade.Point(); Entities.Point selectedPoint = facPoint.GetPointForPointId(Convert.ToInt32(cboPoint.SelectedValue)); m_identityId = selectedPoint.IdentityId; m_owner = selectedPoint.OrganisationName; m_pointId = selectedPoint.PointId; m_point = selectedPoint.Description; m_townId = selectedPoint.PostTown.TownId; m_town = selectedPoint.PostTown.TownName; cboTown.SelectedValue = selectedPoint.PostTown.TownId.ToString(); cboTown.Text = selectedPoint.PostTown.TownName; cboOwner.SelectedValue = selectedPoint.IdentityId.ToString(); cboOwner.Text = selectedPoint.OrganisationName; } }
public JsonResult GetPoint() { try { List <Entities.Point> points; var result = new Entities.Point(); var percentage = rnd.Next(1, 101); using (CarkifelekContext context = new CarkifelekContext()) { points = context.Points.OrderBy(x => x.PointID).ToList(); var counter = 0; points.ForEach(x => { if (percentage > counter && percentage <= (counter + x.ProbabilityPercentage)) { result = x; context.EarnedPoints.Add(new Entities.EarnedPoints() { PointID = x.PointID }); context.SaveChanges(); } counter += x.ProbabilityPercentage; }); } return(Json(new { success = true, data = result })); } catch (Exception ex) { return(Json(new { success = false, data = ex.Message })); } }
private void PrepareOrders() { if (!IsPostBack) { OrdersCSV = PreviousPage.Orders; } Facade.IOrder facOrder = new Facade.Order(); DataSet dsOrders = facOrder.GetOrdersForList(OrdersCSV, true, false); Facade.IOrganisation facOrg = new Facade.Organisation(); Entities.Organisation org = facOrg.GetForIdentityId(Globals.Configuration.IdentityId); Facade.IPoint facPoint = new Facade.Point(); Entities.Point deliveryRunCollectionPoint = null; if (org.Defaults[0].GroupageDeliveryRunCollectionPoint > 0) { deliveryRunCollectionPoint = facPoint.GetPointForPointId(org.Defaults[0].GroupageDeliveryRunCollectionPoint); } dsOrders.Tables[0].Columns.Add("CollectFromPointID", typeof(int)); dsOrders.Tables[0].Columns.Add("CollectFromPoint", typeof(string)); dsOrders.Tables[0].Columns.Add("CollectAtDateTime", typeof(DateTime)); dsOrders.Tables[0].Columns.Add("CollectAtAnyTime", typeof(bool)); dsOrders.Tables[0].Columns.Add("LoadOrder", typeof(string)); dsOrders.Tables[0].Columns.Add("DeliveryOrder", typeof(int)); int loadOrder = 1; foreach (DataRow row in dsOrders.Tables[0].Rows) { row["CollectFromPointID"] = (int)row["DeliveryRunCollectionPointID"]; row["CollectFromPoint"] = row["DeliveryRunCollectionPointDescription"].ToString(); row["CollectAtDateTime"] = (DateTime)row["DeliveryRunCollectionDateTime"]; row["CollectAtAnyTime"] = (bool)row["DeliveryRunCollectionIsAnyTime"]; if (loadOrder == dsOrders.Tables[0].Rows.Count) { row["LoadOrder"] = "L"; } else { row["LoadOrder"] = loadOrder.ToString(); } loadOrder++; // Set the default collection point to that specified by the organisation settings if (row["LastPlannedOrderActionID"] == DBNull.Value) { if (deliveryRunCollectionPoint != null) { row["CollectFromPointID"] = deliveryRunCollectionPoint.PointId; row["CollectFromPoint"] = deliveryRunCollectionPoint.Description; } } } dsOrders.AcceptChanges(); OrderData = dsOrders; grdOrders.Rebind(); }
private void IsValid(Grid grid, DecorativeColumn decorativeColumn) { Point point = new Entities.Point(decorativeColumn.UbicationPoint.X, decorativeColumn.UbicationPoint.Y); if (this.ObtainWallInPoint(grid, point) != null) { throw new ExceptionController(ExceptionMessage.DECORATIVECOLUMN_INVALID); } }
public override void DrawY(Graphics graphic, int height, int width) { for (int i = Grid.PixelConvertor; i < width; i += Grid.PixelConvertor) { Entities.Point startPoint = new Entities.Point(i, 0); Entities.Point endPoint = new Entities.Point(i, height); graphic.DrawLine(gridPen, new System.Drawing.Point(startPoint.X, startPoint.Y) , new System.Drawing.Point(endPoint.X, endPoint.Y)); } }
private void ConfigureDisplay() { int jobId, instructionId = 0; if (JobId == -1 && !string.IsNullOrEmpty(Request.QueryString["jId"])) { if (int.TryParse(Request.QueryString["jId"], out jobId)) { JobId = jobId; } } if (InstructionId == -1 && !string.IsNullOrEmpty(Request.QueryString["iId"])) { if (int.TryParse(Request.QueryString["iId"], out instructionId)) { InstructionId = instructionId; } } // Bind the options for redelivery reasons, collection options only. cboRedeliveryReason.DataSource = EF.DataContext.Current.RedeliveryReasonSet.Where(rr => rr.IsEnabled == true && rr.IsCollection == true).OrderBy(rr => rr.Description); cboRedeliveryReason.DataBind(); // Bind the extra types (remove any invalid options). Facade.ExtraType facExtraType = new Facade.ExtraType(); bool? getActiveExtraTypes = true; List <Entities.ExtraType> extraTypes = facExtraType.GetForIsEnabled(getActiveExtraTypes); extraTypes.RemoveAll(o => (eExtraType)(o.ExtraTypeId) == eExtraType.Custom || (eExtraType)(o.ExtraTypeId) == eExtraType.Demurrage || (eExtraType)(o.ExtraTypeId) == eExtraType.DemurrageExtra); cboExtraType.DataSource = extraTypes; cboExtraType.DataValueField = "ExtraTypeId"; cboExtraType.DataTextField = "Description"; cboExtraType.DataBind(); // Bind the extra states (remove any invalid options). List <string> extraStates = new List <string>(Utilities.UnCamelCase(Enum.GetNames(typeof(eExtraState)))); extraStates.Remove(Utilities.UnCamelCase(Enum.GetName(typeof(eExtraState), eExtraState.Invoiced))); cboExtraState.DataSource = extraStates; cboExtraState.DataBind(); // Get Instruction Details Facade.IInstruction facIns = new Facade.Instruction(); Facade.IPoint facPoint = new Facade.Point(); Entities.Instruction currentIns = facIns.GetInstruction(InstructionId); Entities.Point loadPoint = facPoint.GetPointForPointId(currentIns.PointID); txtExtraCustomReason.Text = string.Format("Attempted Collection from {0}", loadPoint.Description); }
private void UpdateControls(Entities.Point point) { //Reset the Depot this.Depot = string.Empty; this.CountryCode = string.Empty; lblDepot.Text = string.Empty; if (point == null) { cboPoint.Text = string.Empty; cboPoint.SelectedValue = string.Empty; lblFullAddress.Text = string.Empty; pnlFullAddress.Visible = false; this.lnkPointGeography.OnClientClick = String.Empty; } else { cboPoint.Text = point.Description; cboPoint.SelectedValue = point.IdentityId.ToString() + "," + point.PointId.ToString(); if (ShowFullAddress) { string fullAddress = point.Address.ToString(); fullAddress = fullAddress.Replace("\n", ""); fullAddress = fullAddress.Replace("\r", "<br>"); lblFullAddress.Text = fullAddress; pnlFullAddress.Visible = true; } if (point.Address != null) { if (!String.IsNullOrEmpty(point.Address.PostCode)) { //We have a postcode so try to lookup a depot var depot = EF.Depot.GetForPostCode(point.Address.PostCode).FirstOrDefault(); if (depot != null) { this.Depot = depot.Code; } } } if (this.IsDepotVisible) { lblDepot.Text = string.Format("Depot {0}", this.Depot); } this.lnkPointGeography.OnClientClick = "javascript:" + this.ClientID + "_UpdateGeography(" + point.PointId + "); return false;"; if (SelectedPointChanged != null) { SelectedPointChanged(this, new SelectedPointChangedEventArgs(point)); } } }
public string GetAddressForPoint(int pointID) { string address = string.Empty; Orchestrator.Facade.Point facPoint = new Orchestrator.Facade.Point(); Entities.Point point = facPoint.GetPointForPointId(pointID); address = point.Address.ToString(); address = address.Replace("\n", ""); address = address.Replace("\r", "<br>"); return(address); }
private void LoadPointAuditTrail() { pnlPoint.Visible = true; Facade.IPoint facPoint = new Facade.Point(); Entities.Point currentPoint = facPoint.GetPointForPointId(currentID); lblPalletBalanceType.Text = "Point Pallet Audit Trail : " + currentPoint.Description; Facade.IPalletBalance facPalletBalance = new Facade.Pallet(); lvPointAudit.DataSource = facPalletBalance.GetPointAuditTrail(currentID, int.Parse(rcbPalletType.SelectedValue), rdiStartDate.SelectedDate.Value, rdiEndDate.SelectedDate.Value); lvPointAudit.DataBind(); }
public override void Shoot(Entities.Point startPosition, Entities.Vector direction, Guid ownerId, long commandId = 0) { var dynamite = new DynamitBody( new ShapeCircle(_bulletSize, startPosition), direction, _mechanicEngine, _damage, _bulletSpeed, _dynamiteDetonationTime, _bangRadius, ownerId); _mechanicEngine.AddBody(dynamite); }
protected void grdDepots_ItemDataBound(object sender, GridItemEventArgs e) { //If the Grid Item is the EditForm and it is being shown if (e.Item.ItemType == GridItemType.EditFormItem && e.Item.IsInEditMode) { //Get the Point and Code controls from the EditForm Orchestrator.WebUI.Controls.Point ucPoint = (Orchestrator.WebUI.Controls.Point)e.Item.FindControl("ucPoint"); TextBox txtCode = (TextBox)e.Item.FindControl("txtCode"); TextBox txtHubIdentifier = (TextBox)e.Item.FindControl("txtHubIdentifier"); RadComboBox cboPrintOnLabel = (RadComboBox)e.Item.FindControl("cboPrintOnLabel"); //If the EditForm is being shown for a new Depot default the values if (e.Item.OwnerTableView.IsItemInserted) { //Set the default values for a new Depot txtCode.Text = string.Empty; txtHubIdentifier.Text = string.Empty; cboPrintOnLabel.SelectedIndex = 1; ucPoint.Reset(); } else { int depotId = (int)e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["DepotId"]; using (var uow = DIContainer.CreateUnitOfWork()) { var depotRepo = DIContainer.CreateRepository <Repositories.IDepotRepository>(uow); var depot = depotRepo.Find(depotId); Facade.Point facPoint = new Orchestrator.Facade.Point(); Entities.Point point = facPoint.GetPointForPointId(depot.PointID); ucPoint.SelectedPoint = point; txtCode.Text = depot.Code; txtHubIdentifier.Text = depot.HubIdentifier; if (depot.PrintOnLabel == null || depot.PrintOnLabel == false) { cboPrintOnLabel.SelectedIndex = 1; } else { cboPrintOnLabel.SelectedIndex = 0; } } } } }
private void GetQueryStringVariables() { m_PointId = int.Parse(Request.QueryString["PointId"]); if (Request.QueryString["InstructionId"] != "" && Request.QueryString["InstructionId"] != null) { m_instructionId = int.Parse(Request.QueryString["InstructionId"]); m_instructionType = (eInstructionType)(int.Parse(Request.QueryString["InstructionTypeId"])); m_bookedDateTime = DateTime.Parse(Request.QueryString["BookedTime"]); m_isAnyTime = (int.Parse(Request.QueryString["IsAnyTime"])) == 1 ? true : false; m_hasInstruction = true; } m_plannedStartDateTime = DateTime.Parse(Request.QueryString["LegPlannedStart"]); m_plannedEndDateTime = DateTime.Parse(Request.QueryString["LegPlannedEnd"]); Facade.IPoint facPoint = new Facade.Point(); m_point = facPoint.GetPointForPointId(m_PointId); string addressString = "<b>" + m_point.Description + "</b> <br/>"; addressString += m_point.Address.ToString().Replace(Environment.NewLine, "<br/>"); lblAddress.Text = addressString; string instructionType = string.Empty; string bookedTimes = string.Empty; string plannedTimes = string.Empty; if (m_hasInstruction) { instructionType = "<b>Instruction Type :: " + Utilities.UnCamelCase(m_instructionType.ToString()) + "</b>"; lblInstructionType.Text = instructionType; bookedTimes = "<b>Booked : </b>" + m_bookedDateTime.ToString("dd/MM HH:mm"); } else { instructionType = "<span style=\"color:blue;\">This is a Trunk Leg.</span>"; lblInstructionType.Text = instructionType; } plannedTimes = "<b>Planned Start : </b>" + m_plannedStartDateTime.ToString("dd/MM HH:mm") + "<br/>"; plannedTimes += "<b>Planned End : </b>" + m_plannedEndDateTime.ToString("dd/MM HH:mm") + "<br/>"; lblBookedDateTime.Text = bookedTimes; lblPlannedTimes.Text = plannedTimes; }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { int orderId = Convert.ToInt32(Request.QueryString["OrderId"].ToString()); int pointId = Convert.ToInt32(Request.QueryString["PointId"].ToString()); string pointType = Request.QueryString["PType"].ToString(); if (pointType.ToUpper() == "D") { pointType = "delivery"; } else if (pointType.ToUpper() == "C") { pointType = "collection"; } // Set the page title. this.Master.WizardTitle = string.Format("Approve {0} point for order {1}", pointType, orderId);; lblProposedPoint.Text = string.Format("Please approve the proposed {0} point for order {1}", pointType, orderId); lblProposedPoint.Font.Bold = true; lblAlternativePoint.Text = string.Format("... or choose an alternative {0} point for order {1}", pointType, orderId); lblAlternativePoint.Font.Bold = true; Facade.Point facPoint = new Orchestrator.Facade.Point(); this.Point = facPoint.GetPointForPointId(pointId); string fullAddress = this.Point.Address.ToString(); fullAddress = fullAddress.Replace("\n", ""); fullAddress = fullAddress.Replace("\r", "<br>"); lblFullAddress.Text = this.Point.OrganisationName + "<br />" + fullAddress; string jsInjection = @" try { resizeTo(630, 730); } catch (err) { } window.focus(); moveTo(30, 20);"; this.ClientScript.RegisterClientScriptBlock(this.GetType(), "ApproveOnly", jsInjection, true); } }
/// <summary> /// Creates a new point based on the separate parts of the point passed as arguements. /// </summary> /// <param name="organisationId">The identity id of the organisation this point is registered to.</param> /// <param name="organisationName">The name of the organisation this point is registered to.</param> /// <param name="closestTownId">The id of the town id that is closest to this point.</param> /// <param name="description">The description that should be given to this point.</param> /// <param name="addressLine1">The first line of the address.</param> /// <param name="addressLine2">The second line of the address.</param> /// <param name="addressLine3">The third line of the address.</param> /// <param name="postTown">The town.</param> /// <param name="county">The county the point is within.</param> /// <param name="postCode">The post code.</param> /// <param name="longitude">The longitude attached to this point.</param> /// <param name="latitude">The latitude attached to this point.</param> /// <param name="trafficAreaId">The traffic area for this point.</param> /// <param name="userId">The id of the user creating this point.</param> /// <returns>The id of the new point created, or 0 if there were infringments encountered.</returns> private int CreateNewPoint(int organisationId, string organisationName, int closestTownId, string description, string addressLine1, string addressLine2, string addressLine3, string postTown, string county, string postCode, decimal longitude, decimal latitude, int trafficAreaId, string userId) { Entities.FacadeResult retVal = null; Entities.Point point = new Entities.Point(); point.Address = new Entities.Address(); point.Address.AddressLine1 = addressLine1; point.Address.AddressLine2 = addressLine2; point.Address.AddressLine3 = addressLine3; point.Address.PostTown = postTown; point.Address.County = county; point.Address.PostCode = postCode; point.Address.Longitude = longitude; point.Address.Latitude = latitude; point.Address.TrafficArea = new Entities.TrafficArea(); point.Address.TrafficArea.TrafficAreaId = trafficAreaId; point.Address.AddressType = eAddressType.Point; point.Description = description; point.IdentityId = organisationId; point.Latitude = latitude; point.Longitude = longitude; point.OrganisationName = organisationName; Facade.IPostTown facPostTown = new Facade.Point(); point.PostTown = facPostTown.GetPostTownForTownId(closestTownId); Facade.IPoint facPoint = new Facade.Point(); retVal = facPoint.Create(point, userId); if (retVal.Success) { return(retVal.ObjectId); } else { infringementDisplay.Infringements = retVal.Infringements; infringementDisplay.DisplayInfringments(); return(0); } }
protected void Page_Load(object sender, EventArgs e) { int.TryParse(Request.QueryString["pointId"], out _pointID); int.TryParse(Request.QueryString["identityId"], out _identityID); _clientName = Request.QueryString["clientName"]; btnClose.Visible = allowclose; if (!IsPostBack) { Facade.IPoint facPoint = new Facade.Point(); _point = facPoint.GetPointForPointId(_pointID); ucPointCtl.SelectedPoint = _point; if (_identityID > 0) { ucPointCtl.NewPointOwnerIdentityID = _identityID; ucPointCtl.NewPointOwnerDescription = _clientName; } } }
private bool AddPoint() { Facade.IPoint facPoint = new Facade.Point(); string userName = ((Entities.CustomPrincipal)Page.User).UserName; Entities.FacadeResult retVal = facPoint.Create(point, userName); if (retVal.Success) { lblConfirmation.Text = "The point was added."; lblConfirmation.Visible = true; ViewState["pointId"] = retVal.ObjectId; point = facPoint.GetPointForPointId(retVal.ObjectId); ViewState["point"] = point; cboClient.Enabled = false; PopulateTrafficAreaControl(); cboTrafficArea.Visible = true; lblTrafficArea.Visible = true; cboTrafficArea.Items.FindByValue(point.Address.TrafficArea.TrafficAreaId.ToString()).Selected = true; btnAdd.Text = "Update"; m_isUpdate = true; PopulateTrafficAreaControl(); } else { infringementDisplay.Infringements = retVal.Infringements; infringementDisplay.DisplayInfringments(); } return(retVal.Success); }
protected void btnApprovePoint_Click(object sender, EventArgs e) { int orderId = Convert.ToInt32(Request.QueryString["OrderId"].ToString()); int pointId = Convert.ToInt32(Request.QueryString["PointId"].ToString()); Facade.Point facPoint = new Orchestrator.Facade.Point(); Entities.Point point = facPoint.GetPointForPointId(pointId); Facade.IOrganisation facOrg = new Facade.Organisation(); Entities.Organisation org = facOrg.GetForName(point.OrganisationName); Entities.FacadeResult res = null; using (TransactionScope ts = new TransactionScope()) { if (org.IdentityStatus == eIdentityStatus.Unapproved) { // Set the identityStatus to approved org.IdentityStatus = eIdentityStatus.Active; facOrg.Update(org, this.Page.User.Identity.Name); } point.PointStateId = ePointState.Approved; res = facPoint.Update(point, this.Page.User.Identity.Name); ts.Complete(); } if (res.Success) { this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "ApprovePoint", "window.opener.__doPostBack('','Refresh');window.close();", true); } else { idErrors.Infringements = res.Infringements; idErrors.DisplayInfringments(); idErrors.Visible = true; } }
/// <summary> /// Load Trailer /// </summary> private void LoadTrailer() { if (ViewState["trailer"] == null) { Facade.ITrailer facTrailer = new Facade.Resource(); trailer = facTrailer.GetForTrailerId(m_resourceId, true); ViewState["trailer"] = trailer; } else { trailer = (Entities.Trailer)ViewState["trailer"]; } if (trailer != null) { txtTrailerRef.Text = trailer.TrailerRef; cboTrailerType.Items.FindByValue(trailer.TrailerTypeId.ToString()).Selected = true; cboTrailerManufacturer.Items.FindByValue(trailer.TrailerManufacturerId.ToString()).Selected = true; Facade.IPoint facPoint = new Facade.Point(); Entities.Point point = facPoint.GetPointForPointId(trailer.HomePointId); cboOrganisation.Text = point.OrganisationName; cboOrganisation.SelectedValue = point.IdentityId.ToString(); m_organisationId = point.IdentityId; m_startTown = point.PostTown.TownName; m_startTownId = point.PostTown.TownId; if (trailer.VehicleResourceID.HasValue) { lblVehicle.Text = trailer.VehicleResource; } txtGPSUnitID.Text = trailer.GPSUnitID; cboPoint.Text = point.Description; cboPoint.SelectedValue = point.PointId.ToString(); m_pointId = point.PointId; cboTrailerDescription.SelectedIndex = trailer.TrailerDescriptionId + 1; if (trailer.ResourceStatus == eResourceStatus.Deleted) { chkDelete.Checked = true; } Entities.ControlArea ca = null; Entities.TrafficArea ta = null; using (Facade.IResource facResource = new Facade.Resource()) facResource.GetControllerForResourceId(trailer.ResourceId, ref ca, ref ta); if (ca != null && ta != null) { cboControlArea.ClearSelection(); cboControlArea.Items.FindByValue(ca.ControlAreaId.ToString()).Selected = true; cboTrafficArea.ClearSelection(); cboTrafficArea.Items.FindByValue(ta.TrafficAreaId.ToString()).Selected = true; } chkDelete.Visible = true; pnlTrailerDeleted.Visible = true; txtThirdPartyIntegrationID.Text = (trailer.ThirdPartyIntegrationID.HasValue) ? trailer.ThirdPartyIntegrationID.ToString() : string.Empty; } btnAdd.Text = "Update"; }
/// <summary> /// Populates the location object with the new information. /// </summary> private void PopulateLocation() { Entities.Point thisPoint; if (m_location == null) { // adding a new location, configure identity and a new address m_location = new Orchestrator.Entities.OrganisationLocation(); m_location.IdentityId = m_identityId; thisPoint = new Entities.Point(); m_location.Point = thisPoint; } else { thisPoint = m_location.Point; } if (_individual == null) { _individual = new Orchestrator.Entities.Individual(); _individual.IndividualType = eIndividualType.Contact; } //Set the indiviudal details; _individual.FirstNames = txtFirstNames.Text; _individual.LastName = txtLastName.Text; _individual.Title = (eTitle)Enum.Parse(typeof(eTitle), cboTitle.SelectedValue); if (_individual.Contacts == null) { _individual.Contacts = new Orchestrator.Entities.ContactCollection(); } _individual.Contacts.Add(new Orchestrator.Entities.Contact(eContactType.Email, txtEmailAddress.Text)); _individual.Contacts.Add(new Orchestrator.Entities.Contact(eContactType.Telephone, txtTelephone.Text)); _individual.Contacts.Add(new Orchestrator.Entities.Contact(eContactType.Fax, txtFax.Text)); // Update the location based on it's settings. // location information m_location.OrganisationLocationName = txtLocationName.Text; m_location.OrganisationLocationType = (eOrganisationLocationType)Enum.Parse(typeof(eOrganisationLocationType), cboType.SelectedValue.Replace(" ", ""), true); m_location.TelephoneNumber = txtTelephone.Text; m_location.FaxNumber = txtFax.Text; // address information thisPoint.Description = m_organisationName + " - " + txtPostTown.Text; Facade.IPostTown facPostTown = new Facade.Point(); thisPoint.PostTown = facPostTown.GetPostTownForTownId(Convert.ToInt32(cboClosestTown.SelectedValue)); if (thisPoint.Address == null) { thisPoint.Address = new Entities.Address(); } thisPoint.Address.AddressType = eAddressType.Correspondence; thisPoint.Address.AddressLine1 = txtAddressLine1.Text; thisPoint.Address.AddressLine2 = txtAddressLine2.Text; thisPoint.Address.AddressLine3 = txtAddressLine3.Text; thisPoint.Address.PostTown = txtPostTown.Text; thisPoint.Address.County = txtCounty.Text; thisPoint.Address.PostCode = txtPostCode.Text; thisPoint.Address.Longitude = Decimal.Parse(txtLongitude.Text); thisPoint.Address.Latitude = Decimal.Parse(txtLatitude.Text); if (thisPoint.Address.TrafficArea == null) { thisPoint.Address.TrafficArea = new Entities.TrafficArea(); } thisPoint.Address.CountryDescription = cboCountry.SelectedItem.Text; thisPoint.Address.CountryId = Convert.ToInt32(cboCountry.SelectedValue); thisPoint.Address.TrafficArea.TrafficAreaId = Convert.ToInt32(cboTrafficArea.SelectedValue); thisPoint.IdentityId = m_identityId; thisPoint.Latitude = thisPoint.Address.Latitude; thisPoint.Longitude = thisPoint.Address.Longitude; thisPoint.OrganisationName = m_organisationName; Facade.IOrganisation facOrganisation = new Facade.Organisation(); Orchestrator.Entities.Organisation organisation = facOrganisation.GetForIdentityId(thisPoint.IdentityId); // set the radius if the address was changed by addressLookup // if the org has a default, use it, if not, use the system default. if (!String.IsNullOrEmpty(this.hdnSetPointRadius.Value)) { if (organisation.Defaults[0].DefaultGeofenceRadius == null) { thisPoint.Radius = Globals.Configuration.GPSDefaultGeofenceRadius; } else { thisPoint.Radius = organisation.Defaults[0].DefaultGeofenceRadius; } } }
private void btnNext_Click(object sender, EventArgs e) { if (Page.IsValid) { if (cboPoint.SelectedValue == String.Empty) { int ownerID = 0; if (cboOwner.SelectedValue == string.Empty) { // Create a new client customer for the point owner (this can be upgraded to client in the future). Entities.Organisation organisation = new Entities.Organisation(); organisation.OrganisationName = cboOwner.Text; organisation.OrganisationType = eOrganisationType.ClientCustomer; Facade.IOrganisation facOrganisation = new Facade.Organisation(); Entities.FacadeResult result = facOrganisation.Create(organisation, ((Entities.CustomPrincipal)Page.User).UserName); if (result.Success) { ownerID = result.ObjectId; } else { // Organisation has already been created by someone else between validation and this call (unlikely) ownerID = facOrganisation.GetForName(cboOwner.Text).IdentityId; } } else { ownerID = int.Parse(cboOwner.SelectedValue); } // Set the point type, organisation, town, and name for the new point switch ((eInstructionType)m_instruction.InstructionTypeId) { case eInstructionType.Drop: Session[wizard.C_POINT_TYPE] = ePointType.Deliver; Session[wizard.C_POINT_FOR] = m_instruction.ClientsCustomerIdentityID; break; case eInstructionType.Load: Session[wizard.C_POINT_TYPE] = ePointType.Collect; Session[wizard.C_POINT_FOR] = ownerID; break; } Session[wizard.C_INSTRUCTION_INDEX] = m_instructionIndex; Session[wizard.C_POINT_NAME] = cboPoint.Text; Session[wizard.C_TOWN_ID] = Convert.ToInt32(cboTown.SelectedValue); // The point name must be unique for this client bool foundPointName = false; Facade.IPoint facPoint = new Facade.Point(); DataSet pointNames = facPoint.GetAllForOrganisation((int)Session[wizard.C_POINT_FOR], ePointType.Any, cboPoint.Text); foreach (DataRow row in pointNames.Tables[0].Rows) { if (((string)row["Description"]) == cboPoint.Text) { foundPointName = true; } } if (foundPointName) { pnlCreateNewPoint.Visible = true; } else { // Allow the user to create the new point GoToStep("CNP"); } } else { int pointId = Convert.ToInt32(cboPoint.SelectedValue); if (m_isUpdate) { if (m_instruction.InstructionID == 0) { // Adding a new instruction Facade.IPoint facPoint = new Facade.Point(); Entities.Point selectedPoint = facPoint.GetPointForPointId(pointId); // Add the collect drop point information m_instruction.Point = selectedPoint; m_instruction.PointID = selectedPoint.PointId; m_instruction.InstructionID = m_instruction.InstructionID; Session[wizard.C_INSTRUCTION] = m_instruction; } else { if (pointId != m_instruction.PointID) { Facade.IPoint facPoint = new Facade.Point(); Entities.Point selectedPoint = facPoint.GetPointForPointId(pointId); m_instruction.Point = selectedPoint; m_instruction.PointID = selectedPoint.PointId; } // Altering an existing instruction // Cause the first collectdrop to be displayed. if (m_instruction.CollectDrops.Count > 0) { Session[wizard.C_COLLECT_DROP] = m_instruction.CollectDrops[0]; Session[wizard.C_COLLECT_DROP_INDEX] = 0; } } } else { if (m_isAmendment) { if (pointId != m_instruction.PointID) { Facade.IPoint facPoint = new Facade.Point(); Entities.Point selectedPoint = facPoint.GetPointForPointId(pointId); m_instruction.Point = selectedPoint; m_instruction.PointID = selectedPoint.PointId; } // Cause the first point to be displayed. if (m_instruction.CollectDrops.Count > 0) { Session[wizard.C_COLLECT_DROP] = m_instruction.CollectDrops[0]; Session[wizard.C_COLLECT_DROP_INDEX] = 0; } Session[wizard.C_INSTRUCTION] = m_instruction; } else { Facade.IPoint facPoint = new Facade.Point(); Entities.Point selectedPoint = facPoint.GetPointForPointId(pointId); // Add the collect drop point information m_instruction.Point = selectedPoint; m_instruction.PointID = selectedPoint.PointId; m_instruction.InstructionID = m_instruction.InstructionID; Session[wizard.C_INSTRUCTION] = m_instruction; } } GoToStep("PD"); } } }
protected void Page_Load(object sender, System.EventArgs e) { m_jobId = Convert.ToInt32(Request.QueryString["jobId"]); if (m_jobId > 0) { m_isUpdate = true; } // Retrieve the job from the session variable m_job = (Entities.Job)Session[wizard.C_JOB]; if (Session[wizard.C_INSTRUCTION_INDEX] != null) { m_instructionIndex = (int)Session[wizard.C_INSTRUCTION_INDEX]; if (!m_isUpdate && m_instructionIndex != m_job.Instructions.Count) { m_isAmendment = true; } } if (!IsPostBack) { Facade.IOrganisation facOrganisation = new Facade.Organisation(); btnCancel.Attributes.Add("onClick", wizard.C_CONFIRM_MESSAGE); if (Session[wizard.C_INSTRUCTION] != null) { m_instruction = (Entities.Instruction)Session[wizard.C_INSTRUCTION]; switch ((eInstructionType)m_instruction.InstructionTypeId) { case eInstructionType.Load: // Allow the user to collect from any location if this is a stock movement job. if (m_job.IsStockMovement) { m_identityId = 0; } else { m_identityId = m_job.IdentityId; } lblCollection.Visible = true; lblCollectFrom.Visible = true; lblDelivery.Visible = false; lblDeliverTo.Visible = false; lblCollectDrop.Text = "Collection Details"; break; case eInstructionType.Drop: m_identityId = m_instruction.ClientsCustomerIdentityID; lblCollection.Visible = false; lblCollectFrom.Visible = false; lblDelivery.Visible = true; lblDeliverTo.Visible = true; lblCollectDrop.Text = "Delivery Details"; m_owner = facOrganisation.GetNameForIdentityId(m_identityId); cboOwner.Text = m_owner; cboOwner.SelectedValue = m_identityId.ToString(); cboOwner.Visible = false; lblOwner.Visible = true; lblOwner.Text = m_owner; break; } } else { m_instruction = new Entities.Instruction(); m_instruction.JobId = m_jobId; if (m_job.Instructions == null) { m_job.Instructions = new Entities.InstructionCollection(); } switch ((ePointType)Session[wizard.C_POINT_TYPE]) { case ePointType.Collect: // Allow the user to collect from any location if this is a stock movement job. if (m_job.IsStockMovement) { m_identityId = 0; } else { m_identityId = m_job.IdentityId; } m_owner = facOrganisation.GetNameForIdentityId(m_job.IdentityId); cboOwner.Text = m_owner; cboOwner.SelectedValue = m_identityId.ToString(); m_instruction.InstructionTypeId = (int)eInstructionType.Load; lblCollection.Visible = true; lblCollectFrom.Visible = true; lblDelivery.Visible = false; lblDeliverTo.Visible = false; lblCollectDrop.Text = "Collection Details"; #region Load the Default Collection Point try { Entities.Organisation client = facOrganisation.GetForIdentityId(m_job.IdentityId); Facade.IPoint facPoint = new Facade.Point(); Entities.Point defaultPoint = facPoint.GetPointForPointId(client.Defaults[0].DefaultCollectionPointId); cboTown.SelectedValue = defaultPoint.PostTown.TownId.ToString(); cboTown.Text = defaultPoint.PostTown.TownName; cboPoint.SelectedValue = defaultPoint.PointId.ToString(); cboPoint.Text = defaultPoint.Description; m_identityId = defaultPoint.IdentityId; m_owner = defaultPoint.OrganisationName; m_pointId = defaultPoint.PointId; m_point = defaultPoint.Description; m_townId = defaultPoint.PostTown.TownId; m_town = defaultPoint.PostTown.TownName; cboOwner.Text = m_owner; cboOwner.SelectedValue = m_identityId.ToString(); } catch { } #endregion break; } Session[wizard.C_INSTRUCTION] = m_instruction; if (!m_isUpdate) { Session[wizard.C_INSTRUCTION_INDEX] = m_job.Instructions.Count; } } if (m_instruction != null && m_instruction.Point != null) { cboOwner.SelectedValue = m_instruction.Point.IdentityId.ToString(); cboOwner.Text = m_instruction.Point.OrganisationName; cboPoint.SelectedValue = m_instruction.PointID.ToString(); cboPoint.Text = m_instruction.Point.Description; cboTown.SelectedValue = m_instruction.Point.PostTown.TownId.ToString(); cboTown.Text = m_instruction.Point.PostTown.TownName; } } else { m_instruction = (Entities.Instruction)Session[wizard.C_INSTRUCTION]; } pnlCreateNewPoint.Visible = false; }
public SelectedPointChangedEventArgs(Entities.Point selectedPoint) { _selectedPoint = selectedPoint; }
protected void Page_Load(object sender, System.EventArgs e) { int pointId = Convert.ToInt32(Request.QueryString["pointId"]); int instructionId = Convert.ToInt32(Request.QueryString["iID"]); Entities.Instruction instruction = null; Entities.Point point = null; if (instructionId > 0) { string cacheName = "_pointAddressWithNotes" + instructionId.ToString(); if (Cache[cacheName] == null) { Facade.IInstruction facInstruction = new Facade.Instruction(); instruction = facInstruction.GetInstruction(instructionId); if (instruction != null) { Cache.Add(cacheName, instruction, null, System.Web.Caching.Cache.NoAbsoluteExpiration, new TimeSpan(0, 20, 0), System.Web.Caching.CacheItemPriority.Normal, null); } } else { instruction = (Entities.Instruction)Cache[cacheName]; } if (instruction != null) { point = instruction.Point; } } if (pointId > 0) { string cacheName = "_pointAddress" + pointId.ToString(); if (Cache[cacheName] == null) { Facade.IPoint facPoint = new Facade.Point(); point = facPoint.GetPointForPointId(pointId); if (point != null) { Cache.Add(cacheName, point, null, System.Web.Caching.Cache.NoAbsoluteExpiration, new TimeSpan(0, 20, 0), System.Web.Caching.CacheItemPriority.Normal, null); } } else { point = (Entities.Point)Cache["_pointAddress" + pointId.ToString()]; } } if (point != null) { // A leg has been selected for viewing so display it. XslCompiledTransform transformer = new XslCompiledTransform(); transformer.Load(Server.MapPath(@"..\xsl\instructions.xsl")); XmlUrlResolver resolver = new XmlUrlResolver(); XPathNavigator navigator = point.ToXml().CreateNavigator(); // Populate the Point. StringWriter sw = new StringWriter(); transformer.Transform(navigator, null, sw); Response.Write(sw.GetStringBuilder().ToString()); // If instruction notes are present, attach them to the response. if (instruction != null && instruction.Note.Length > 0) { Response.Write("<br>" + instruction.Note); } Response.Write(string.Format("<br>tel: {0}", point.PhoneNumber)); if (point.PointNotes != string.Empty) { Response.Write("<br>" + point.PointNotes.Replace("\r\n", "</br>")); } if (Response.IsClientConnected) { Response.Flush(); Response.End(); } return; } }
private void btnNext_Click(object sender, EventArgs e) { if (Page.IsValid) { if (cboPoint.SelectedValue == String.Empty) { // Set the point type, organisation, town, and name for the new point switch ((eInstructionType)m_instruction.InstructionTypeId) { case eInstructionType.Drop: Session[wizard.C_POINT_TYPE] = ePointType.Deliver; Session[wizard.C_POINT_FOR] = m_instruction.ClientsCustomerIdentityID; break; case eInstructionType.Load: Session[wizard.C_POINT_TYPE] = ePointType.Collect; Session[wizard.C_POINT_FOR] = m_job.IdentityId; break; } Session[wizard.C_POINT_NAME] = cboPoint.Text; Session[wizard.C_TOWN_ID] = Convert.ToInt32(cboTown.SelectedValue); // The point name must be unique for this client bool foundPointName = false; Facade.IPoint facPoint = new Facade.Point(); DataSet pointNames = facPoint.GetAllForOrganisation((int)Session[wizard.C_POINT_FOR], ePointType.Any, cboPoint.Text); foreach (DataRow row in pointNames.Tables[0].Rows) { if (((string)row["Description"]) == cboPoint.Text) { foundPointName = true; } } if (foundPointName) { pnlCreateNewPoint.Visible = true; } else { // Allow the user to create the new point GoToStep("CNP"); } } else { int pointId = Convert.ToInt32(cboPoint.SelectedValue); if (m_isUpdate) { if (m_instruction.InstructionID == 0) { // Adding a new instruction Facade.IPoint facPoint = new Facade.Point(); Entities.Point selectedPoint = facPoint.GetPointForPointId(pointId); // Add the collect drop point information m_instruction.Point = selectedPoint; m_instruction.PointID = selectedPoint.PointId; m_instruction.InstructionID = m_instruction.InstructionID; Session[wizard.C_INSTRUCTION] = m_instruction; } else { // Altering an existing instruction // Cause the first collectdrop to be displayed. if (m_instruction.CollectDrops.Count > 0) { Session[wizard.C_COLLECT_DROP] = m_instruction.CollectDrops[0]; Session[wizard.C_COLLECT_DROP_INDEX] = 0; } } } else { if (m_isAmendment) { if (pointId != m_instruction.PointID) { Facade.IPoint facPoint = new Facade.Point(); Entities.Point selectedPoint = facPoint.GetPointForPointId(pointId); m_instruction.Point = selectedPoint; m_instruction.PointID = selectedPoint.PointId; } // Cause the first point to be displayed. if (m_instruction.CollectDrops.Count > 0) { Session[wizard.C_COLLECT_DROP] = m_instruction.CollectDrops[0]; Session[wizard.C_COLLECT_DROP_INDEX] = 0; } Session[wizard.C_INSTRUCTION] = m_instruction; } else { Facade.IPoint facPoint = new Facade.Point(); Entities.Point selectedPoint = facPoint.GetPointForPointId(pointId); // Add the collect drop point information m_instruction.Point = selectedPoint; m_instruction.PointID = selectedPoint.PointId; m_instruction.InstructionID = m_instruction.InstructionID; Session[wizard.C_INSTRUCTION] = m_instruction; } } GoToStep("PD"); } } }
private void PopulateEntities() { Entities.Job job = new Orchestrator.Entities.Job(); job.Instructions = new Orchestrator.Entities.InstructionCollection(); job.JobType = eJobType.Groupage; job.BusinessTypeID = int.Parse(cboBusinessType.SelectedValue); job.IdentityId = Globals.Configuration.IdentityId; job.LoadNumber = "GRP" + Environment.TickCount.ToString().Substring(0, 3); job.Charge = new Orchestrator.Entities.JobCharge(); job.Charge.JobChargeAmount = 0; job.Charge.JobChargeType = eJobChargeType.FreeOfCharge; Entities.InstructionCollection collections = new Orchestrator.Entities.InstructionCollection(); Entities.Instruction iCollect = null; Entities.CollectDrop cd = null; Entities.InstructionCollection drops = new Orchestrator.Entities.InstructionCollection(); Entities.Instruction iDrop = null; Facade.IPoint facPoint = new Facade.Point(); Facade.IOrder facOrder = new Facade.Order(); Entities.Point point = null; bool newcollection = false; foreach (DataRow row in OrderData.Tables[0].Rows) { #region Collections newcollection = false; int pointID = (int)row["CollectFromPointID"]; DateTime bookedDateTime = (DateTime)row["CollectAtDateTime"]; bool collectionIsAnytime = (bool)row["CollectAtAnyTime"]; // if this setting is true then we want to create a new instruction for the order. if (Globals.Configuration.OneDropAndLoadInstructionPerOrder) { iCollect = null; } else { iCollect = collections.GetForInstructionTypeAndPointID(eInstructionType.Load, pointID, bookedDateTime, collectionIsAnytime); } if (iCollect == null) { iCollect = new Orchestrator.Entities.Instruction(); iCollect.InstructionTypeId = (int)eInstructionType.Load; iCollect.BookedDateTime = bookedDateTime; if ((bool)row["CollectAtAnytime"]) { iCollect.IsAnyTime = true; } point = facPoint.GetPointForPointId(pointID); iCollect.PointID = pointID; iCollect.Point = point; iCollect.ClientsCustomerIdentityID = point.IdentityId; //Steve is this correct iCollect.CollectDrops = new Orchestrator.Entities.CollectDropCollection(); newcollection = true; } cd = new Orchestrator.Entities.CollectDrop(); cd.NoPallets = (int)row["NoPallets"]; cd.NoCases = (int)row["Cases"]; cd.GoodsTypeId = (int)row["GoodsTypeID"]; cd.OrderID = (int)row["OrderID"]; cd.Weight = (decimal)row["Weight"]; cd.ClientsCustomerReference = row["DeliveryOrderNumber"].ToString(); cd.Docket = row["OrderID"].ToString(); iCollect.CollectDrops.Add(cd); if (newcollection) { collections.Add(iCollect); } #endregion } // Add the Drops in the Order specified DataView dvDrops = OrderData.Tables[0].DefaultView; dvDrops.Sort = "DeliveryOrder ASC"; DataTable dtDrops = dvDrops.ToTable(); foreach (DataRow row in dtDrops.Rows) { #region Deliveries bool newdelivery = false; newdelivery = false; int deliveryPointID = (int)row["DeliveryPointID"]; DateTime deliveryDateTime = (DateTime)row["DeliveryDateTime"]; bool deliveryIsAnyTime = (bool)row["DeliveryIsAnyTime"]; // if this setting is true then we want to create a new instruction for the order. if (Globals.Configuration.OneDropAndLoadInstructionPerOrder) { iDrop = null; } else { iDrop = drops.GetForInstructionTypeAndPointID(eInstructionType.Drop, deliveryPointID, deliveryDateTime, deliveryIsAnyTime); } if (iDrop == null) { iDrop = new Orchestrator.Entities.Instruction(); iDrop.InstructionTypeId = (int)eInstructionType.Drop; iDrop.BookedDateTime = deliveryDateTime; if ((bool)row["DeliveryIsAnytime"]) { iDrop.IsAnyTime = true; } point = facPoint.GetPointForPointId(deliveryPointID); iDrop.ClientsCustomerIdentityID = point.IdentityId; iDrop.PointID = deliveryPointID; iDrop.Point = point; iDrop.CollectDrops = new Orchestrator.Entities.CollectDropCollection(); newdelivery = true; } cd = new Orchestrator.Entities.CollectDrop(); cd.NoPallets = (int)row["NoPallets"]; cd.NoCases = (int)row["Cases"]; cd.GoodsTypeId = (int)row["GoodsTypeID"]; cd.OrderID = (int)row["OrderID"]; cd.Weight = (decimal)row["Weight"]; cd.ClientsCustomerReference = row["DeliveryOrderNumber"].ToString(); cd.Docket = row["OrderID"].ToString(); iDrop.CollectDrops.Add(cd); if (newdelivery) { drops.Add(iDrop); //Stephen Newman 23/04/07 Changed to insert the drop to the front of the list as the sort processed later seems to swap objects if equal. } facOrder.UpdateForDeliveryRun(cd.OrderID, iCollect.PointID, iCollect.BookedDateTime, iCollect.IsAnyTime, Page.User.Identity.Name); #endregion } #region Add the Instructions to the job if (job.Instructions == null) { job.Instructions = new Entities.InstructionCollection(); } foreach (Entities.Instruction instruction in collections) { job.Instructions.Add(instruction); } // removed by t.lunken 23/08/07 as this is now manually done. //drops.Sort(eInstructionSortType.DropDateTime); foreach (Entities.Instruction instruction in drops) { job.Instructions.Add(instruction); } #endregion Facade.IJob facjob = new Facade.Job(); job.JobState = eJobState.Booked; int jobID = facjob.Create(job, Page.User.Identity.Name); _jobID = jobID; _openJob = true; }
private void dgGoods_ItemDataBound(object sender, DataGridItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { DataRowView row = (DataRowView)e.Item.DataItem; //////////////////////////////////////////////////////// int refusalId = (int)row["RefusalId"]; eGoodsRefusedType type = (eGoodsRefusedType)row["RefusalTypeId"]; HtmlAnchor hypRefusal = (HtmlAnchor)e.Item.FindControl("hypRefusal"); if (type == eGoodsRefusedType.Shorts || type == eGoodsRefusedType.OverAndAccepted) { hypRefusal.HRef = "shortage.aspx?wiz=true&jobId=" + m_jobId.ToString() + "&instructionId=" + m_instructionId.ToString() + "&refusalId=" + refusalId + "&t=2" + "&csid=" + this.CookieSessionID; hypRefusal.InnerText = refusalId.ToString(); } else { hypRefusal.HRef = "refusal.aspx?wiz=true&jobId=" + m_jobId.ToString() + "&instructionId=" + m_instructionId.ToString() + "&refusalId=" + refusalId + "&t=1" + this.CookieSessionID; hypRefusal.InnerText = refusalId.ToString(); } /////////////////////////////////////////////////////// int storePointId = 0; if (row["StorePointId"] != DBNull.Value) { storePointId = (int)row["StorePointId"]; } int returnPointId = 0; if (row["ReturnPointId"] != DBNull.Value) { returnPointId = (int)row["ReturnPointId"]; } if (storePointId != 0 || returnPointId != 0) { Facade.IPoint facPoint = new Facade.Point(); if (storePointId != 0) { Label lblStoreAt = (Label)e.Item.FindControl("lblStoreAt"); Entities.Point storePoint = facPoint.GetPointForPointId(storePointId); lblStoreAt.Text = storePoint.OrganisationName + ", " + storePoint.PostTown.TownName; Uri pointAddressUri = new Uri(Request.Url, Page.ResolveUrl("~/Point/GetPointAddressHtml.aspx")); lblStoreAt.Attributes.Add("onMouseOver", "ShowPoint('" + pointAddressUri.ToString() + "', '" + storePointId.ToString() + "')"); lblStoreAt.Attributes.Add("onMouseOut", "HidePoint()"); } if (returnPointId != 0) { Label lblReturnTo = (Label)e.Item.FindControl("lblReturnTo"); Entities.Point returnPoint = facPoint.GetPointForPointId(returnPointId); lblReturnTo.Text = returnPoint.OrganisationName + ", " + returnPoint.PostTown.TownName; Uri pointAddressUri = new Uri(Request.Url, Page.ResolveUrl("~/Point/GetPointAddressHtml.aspx")); lblReturnTo.Attributes.Add("onMouseOver", "ShowPoint('" + pointAddressUri.ToString() + "', '" + returnPointId.ToString() + "')"); lblReturnTo.Attributes.Add("onMouseOut", "HidePoint()"); } } // Only allow goods of status Outstanding to be edited or deleted (unless this is a return job). if (row["RefusalStatusId"] != DBNull.Value) { eGoodsRefusedStatus status = (eGoodsRefusedStatus)row["RefusalStatusId"]; //if ((status != eGoodsRefusedStatus.Outstanding && type != eGoodsRefusedType.Shorts && type != eGoodsRefusedType.OverAndAccepted) && m_job.JobType != eJobType.Return) //{ // // This has been commented out following a desire by Tony to be able to view the details - instead the Update Goods button is disabled. // //((Button) e.Item.Cells[8].Controls[0]).Enabled = false; // ((Button) e.Item.Cells[8].Controls[0]).Text = "View"; // ((Button) e.Item.Cells[10].Controls[0]).Enabled = false; //} } } }