protected void lnkbtnSetupRecycling_Click(object sender, EventArgs e) { if (_account != null) { // create service location _recycleServiceLocation = new ServiceLocationEntity(); _recycleServiceLocation.Account = _account; _recycleServiceLocation.Name = "Primary Dock"; _recycleServiceLocation.Address1 = _account.Address1; _recycleServiceLocation.Address2 = _account.Address2; _recycleServiceLocation.City = _account.City; _recycleServiceLocation.ZipCode = _account.ZipCode; _recycleServiceLocation.MainContact = _account.MainContact; _recycleServiceLocation.Notes = _account.Notes; _recycleServiceLocation.Phone = _account.Phone; _recycleServiceLocation.ServiceTypeId = (int)ServiceTypeEntity.ServiceTypes.RecycleOnly; _recycleServiceLocation.Save(); _account.Save(); populate(); recyclingTypes.Visible = true; } else { messages.AddInfoDiv("After you save the account will you be able to setup the asset reclamation"); } }
protected void Page_Load(object sender, EventArgs e) { int acctId = 0; int.TryParse(Request.QueryString["acctId"], out acctId); if (acctId > 0) { _account = new AccountEntity(acctId); instructions.Visible = false; var serviceLocations = from sl in _db.ServiceLocation where sl.AccountId == _account.AccountId orderby sl.Name select sl; _serviceLocation = serviceLocations.First(); } else { _account = new AccountEntity(); //_account.AccountType = "Recycling"; } if (!Page.IsPostBack) { populate(); } }
public void ServiceRevisionEntitiesHaveAUprn() { var entity = new ServiceLocationEntity(); var uprn = "100054225"; entity.Uprn = uprn; entity.Uprn.Should().Be(uprn); }
public void ServiceRevisionEntitiesHaveAStateProvince() { var entity = new ServiceLocationEntity(); var stateProvince = "Test"; entity.StateProvince = stateProvince; entity.StateProvince.Should().BeSameAs(stateProvince); }
public void ServiceRevisionEntitiesHaveAPostalCode() { var entity = new ServiceLocationEntity(); var postalCode = "Test"; entity.PostalCode = postalCode; entity.PostalCode.Should().BeSameAs(postalCode); }
public void ServiceRevisionEntitiesHaveALongitude() { var entity = new ServiceLocationEntity(); var longitude = 5225; entity.Longitude = longitude; entity.Longitude.Should().Be(longitude); }
public void ServiceRevisionEntitiesHaveALatitude() { var entity = new ServiceLocationEntity(); var latitude = 0; entity.Latitude = latitude; entity.Latitude.Should().Be(latitude); }
public void ServiceRevisionEntitiesHaveACountry() { var entity = new ServiceLocationEntity(); var country = "Test"; entity.Country = country; entity.Country.Should().BeSameAs(country); }
public void ServiceRevisionEntitiesHaveACity() { var entity = new ServiceLocationEntity(); var city = "Test"; entity.City = city; entity.City.Should().BeSameAs(city); }
public void ServiceRevisionEntitiesHaveAnAddress1() { var entity = new ServiceLocationEntity(); var address1 = "Test"; entity.Address1 = address1; entity.Address1.Should().BeSameAs(address1); }
public void ServiceEntitiesHaveACreatedAt() { var entity = new ServiceLocationEntity(); var date = new DateTime(2019, 02, 21); entity.CreatedAt = date; entity.CreatedAt.Should().BeSameDateAs(date); }
/// <summary> setups the sync logic for member _serviceLocation</summary> /// <param name="relatedEntity">Instance to set as the related entity of type entityType</param> private void SetupSyncServiceLocation(IEntity2 relatedEntity) { if (_serviceLocation != relatedEntity) { DesetupSyncServiceLocation(true, true); _serviceLocation = (ServiceLocationEntity)relatedEntity; base.PerformSetupSyncRelatedEntity(_serviceLocation, new PropertyChangedEventHandler(OnServiceLocationPropertyChanged), "ServiceLocation", ServiceLocationRecycleTypeEntity.Relations.ServiceLocationEntityUsingServiceLocationId, true, new string[] { }); } }
/// <summary> Initializes the class members</summary> protected virtual void InitClassMembers() { _recycleType = null; _serviceLocation = null; PerformDependencyInjection(); // __LLBLGENPRO_USER_CODE_REGION_START InitClassMembers // __LLBLGENPRO_USER_CODE_REGION_END OnInitClassMembersComplete(); }
protected void btnSaveRecyclingDock_Click(object sender, EventArgs e) { if (txtRecylingDockName.Text.Trim().Length > 0) { var dock = new ServiceLocationEntity(Convert.ToInt32(hdnRecyclingDockId.Value)); dock.Name = txtRecylingDockName.Text; dock.AccountId = _account.AccountId; dock.ServiceTypeId = (int)ServiceTypeEntity.ServiceTypes.RecycleOnly; dock.Save(); rgRecyclingDocks.Rebind(); divRecyclingDockDetails.Visible = false; } }
protected void rptServiceLocations_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.IsDataItem()) { ServiceLocationEntity serviceLocation = e.Item.DataItem as ServiceLocationEntity; LinkButton lnkBtnEditServiceLocation = e.Item.FindControl("lnkBtnEditServiceLocation") as LinkButton; //Label lblAddress = e.Item.FindControl("lblAddress") as Label; //Label lblPhone = e.Item.FindControl("lblPhone") as Label; //Label lblNumOfFryers = e.Item.FindControl("lblNumOfFryers") as Label; //Label lblAssetRecovery = e.Item.FindControl("lblAssetRecovery") as Label; //Label lblRecycleService = e.Item.FindControl("lblRecycleService") as Label; lnkBtnEditServiceLocation.Text = serviceLocation.Name; //string address = ""; //if (serviceLocation.Address1 != null && serviceLocation.Address1.Length > 0) //{ // address = serviceLocation.Address1; //} //if (serviceLocation.Address2 != null && serviceLocation.Address2.Length > 0) // address += ", " + serviceLocation.Address2; //if (serviceLocation.City != null && serviceLocation.City.Length > 0) // address += " " + serviceLocation.City; //if (serviceLocation.State != null && serviceLocation.State.Length > 0) // address += ", " + serviceLocation.State; //else if (serviceLocation.IntlState != null && serviceLocation.IntlState.Length > 0) // address += ", " + serviceLocation.IntlState; //if (serviceLocation.ZipCode != null && serviceLocation.ZipCode.Length > 0) // address += " " + serviceLocation.ZipCode; //lblAddress.Text = address; ////if (serviceLocation.Phone != null) //// lblPhone.Text = serviceLocation.Phone; //int numOfFryers = _db.DeepFryer.Where(x => x.ServiceLocationId == serviceLocation.ServiceLocationId).ToList().Count(); //if (numOfFryers >= 0 && serviceLocation.FryerService == true) // lblNumOfFryers.Text = numOfFryers.ToString(); //else // lblNumOfFryers.Text = "N/A"; //lblAssetRecovery.Text = _account.ServiceLocation.Where(x => x.AssetReclamationService == true).Count() > 0 ? "Yes" : "No"; //lblRecycleService.Text = _account.ServiceLocation.Where(x => x.RecycleService == true).Count() > 0 ? "Yes" : "No"; } }
protected void btnSaveRecyclingDocks_Click(object sender, EventArgs e) { foreach (GridDataItem item in rgRecyclingDocks.Items) { TextBox txtRecylingDockName = item.FindControl("txtRecyclingDockName") as TextBox; HiddenField dockId = item.FindControl("hdnRecyclingDockId") as HiddenField; if (dockId != null) { ServiceLocationEntity dock = new ServiceLocationEntity(Convert.ToInt32(dockId.Value)); dock.Name = txtRecylingDockName.Text; dock.Save(); } } Response.Redirect("~/EditAccount.aspx?acctId=" + _account.AccountId.ToString()); }
protected void btnSaveAccount_Click(object sender, EventArgs e) { string errorMessage = validate(); if (errorMessage.Length == 0) { _account.Name = txtAcctName.Text.Trim(); _account.AccountNo = txtAcctNo.Text.Trim().Length > 0 ? txtAcctNo.Text.Trim() : null; _account.Address1 = txtAddress1.Text.Trim().Length > 0 ? txtAddress1.Text.Trim() : null; _account.Address2 = txtAddress2.Text.Trim().Length > 0 ? txtAddress2.Text.Trim() : null; _account.City = txtCity.Text.Trim().Length > 0 ? txtCity.Text.Trim() : null; _account.State = ddlState.SelectedValue.Length > 0 ? ddlState.SelectedValue : null;; _account.ZipCode = txtZip.Text.Trim().Length > 0 ? txtZip.Text.Trim() : null; _account.Phone = txtPhone.Text.Trim().GetNumbers().Length > 0 ? txtPhone.Text.Trim().GetNumbers() : null; _account.IsActive = true; _account.MainContact = txtMainContact.Text.Trim().Length > 0 ? txtMainContact.Text.Trim() : null; _account.Notes = txtNotes.Text.Trim().Length > 0 ? txtNotes.Text.Trim() : null; if (_account.IsNew) { _serviceLocation = new ServiceLocationEntity(); _serviceLocation.Account = _account; } _serviceLocation.Name = _account.Name; _serviceLocation.Address1 = _account.Address1; _serviceLocation.Address2 = _account.Address2; _serviceLocation.City = _account.City; _serviceLocation.ZipCode = _account.ZipCode; _serviceLocation.MainContact = _account.MainContact; _serviceLocation.Notes = _account.Notes; _serviceLocation.Phone = _account.Phone; _serviceLocation.ServiceTypeId = (int)ServiceTypeEntity.ServiceTypes.RecycleOnly; _account.Save(); _serviceLocation.Save(); Response.Redirect("~/EditRecyclingAccount.aspx?acctId=" + _account.AccountId.ToString()); } else { messages.Controls.Add(HtmlHelper.Div("error", errorMessage)); } }
protected void rgAssetDocks_OnItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e) { switch (e.CommandName) { case "delete": HiddenField hdnAssetDockId = e.Item.FindControl("hdnAssetDockId") as HiddenField; if (hdnAssetDockId != null) { ServiceLocationEntity dock = new ServiceLocationEntity(Convert.ToInt32(hdnAssetDockId.Value)); dock.IsActive = false; dock.Save(); } break; default: break; } }
private static ServiceLocation CreateServiceLocationFrom(ServiceLocationEntity serviceLocationEntity) { // TODO: Reuse domain factory classes when created. return(new ServiceLocation { Id = serviceLocationEntity.Id, Address1 = serviceLocationEntity.Address1, City = serviceLocationEntity.City, Country = serviceLocationEntity.Country, Latitude = serviceLocationEntity.Latitude, Longitude = serviceLocationEntity.Longitude, PostalCode = serviceLocationEntity.PostalCode, // #database_ef_changes_v2-17-09-2020: (service revisions removed) //RevisionId = serviceLocationEntity.RevisionId, StateProvince = serviceLocationEntity.StateProvince, Uprn = serviceLocationEntity.Uprn, CreatedAt = serviceLocationEntity.CreatedAt }); }
protected ServiceLocationRecycleTypeEntity(SerializationInfo info, StreamingContext context) : base(info, context) { if (SerializationHelper.Optimization != SerializationOptimization.Fast) { _recycleType = (RecycleTypeEntity)info.GetValue("_recycleType", typeof(RecycleTypeEntity)); if (_recycleType != null) { _recycleType.AfterSave += new EventHandler(OnEntityAfterSave); } _serviceLocation = (ServiceLocationEntity)info.GetValue("_serviceLocation", typeof(ServiceLocationEntity)); if (_serviceLocation != null) { _serviceLocation.AfterSave += new EventHandler(OnEntityAfterSave); } base.FixupDeserialization(FieldInfoProviderSingleton.GetInstance()); } // __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor // __LLBLGENPRO_USER_CODE_REGION_END }
protected void Page_Init(object sender, EventArgs e) { if (sm.AuthenticatedUser == null) { Response.Redirect("~/Default.aspx"); } int serviceLocationId = 0; int.TryParse(Request.QueryString["id"], out serviceLocationId); int acctId = 0; int.TryParse(Request.QueryString["acctId"], out acctId); int serviceTypeId = 0; int.TryParse(Request.QueryString["type"], out serviceTypeId); if (serviceLocationId > 0) { _serviceLocation = new ServiceLocationEntity(serviceLocationId); _account = _serviceLocation.Account; instructions.Visible = false; fryersDiv.Visible = true; revisionDiv.Visible = true; btnDeleteServiceLocation.Visible = true; } else if (acctId > 0) { _serviceLocation = new ServiceLocationEntity(); _serviceLocation.AccountId = acctId; _serviceLocation.ServiceTypeId = serviceTypeId; _serviceLocation.IsActive = true; _account = new AccountEntity(acctId); } else { Response.Redirect("~/Default.aspx"); } }
protected void btnSaveAccount_Click(object sender, EventArgs e) { string errorMessage = validate(); if (errorMessage.Length == 0) { bool isNew = _account.IsNew; _account.Name = txtAcctName.Text.Trim(); _account.AccountNo = txtAcctNo.Text.Trim().Length > 0 ? txtAcctNo.Text.Trim() : null; _account.Address1 = txtAddress1.Text.Trim().Length > 0 ? txtAddress1.Text.Trim() : null; _account.Address2 = txtAddress2.Text.Trim().Length > 0 ? txtAddress2.Text.Trim() : null; _account.City = txtCity.Text.Trim().Length > 0 ? txtCity.Text.Trim() : null; _account.State = ddlState.SelectedValue.Length > 0 ? ddlState.SelectedValue : null;; _account.ZipCode = txtZip.Text.Trim().Length > 0 ? txtZip.Text.Trim() : null; _account.Phone = txtPhone.Text.Trim().GetNumbers().Length > 0 ? txtPhone.Text.Trim().GetNumbers() : null; _account.IsActive = true; _account.MainContact = txtMainContact.Text.Trim().Length > 0 ? txtMainContact.Text.Trim() : null; _account.Notes = txtNotes.Text.Trim().Length > 0 ? txtNotes.Text.Trim() : null; _account.Save(); var i = 0; foreach (var item in ((IEnumerable <ServiceLocationEntity>)rgServiceLocations.DataSource)) { item.Ordinal = i++; item.Save(); } if (isNew) { _assetReclamationServiceLocation = new ServiceLocationEntity(); _assetReclamationServiceLocation.Account = _account; //_assetReclamationServiceLocation.Name = "Primary Dock"; _assetReclamationServiceLocation.Name = _account.Name; _assetReclamationServiceLocation.Address1 = _account.Address1; _assetReclamationServiceLocation.Address2 = _account.Address2; _assetReclamationServiceLocation.City = _account.City; _assetReclamationServiceLocation.ZipCode = _account.ZipCode; _assetReclamationServiceLocation.MainContact = _account.MainContact; _assetReclamationServiceLocation.Notes = _account.Notes; _assetReclamationServiceLocation.Phone = _account.Phone; _assetReclamationServiceLocation.ServiceTypeId = (int)ServiceTypeEntity.ServiceTypes.AssetReclamationOnly; _assetReclamationServiceLocation.Save(); // create service location _recycleServiceLocation = new ServiceLocationEntity(); _recycleServiceLocation.Account = _account; _recycleServiceLocation.Name = "Primary Dock"; _recycleServiceLocation.Address1 = _account.Address1; _recycleServiceLocation.Address2 = _account.Address2; _recycleServiceLocation.City = _account.City; _recycleServiceLocation.ZipCode = _account.ZipCode; _recycleServiceLocation.MainContact = _account.MainContact; _recycleServiceLocation.Notes = _account.Notes; _recycleServiceLocation.Phone = _account.Phone; _recycleServiceLocation.ServiceTypeId = (int)ServiceTypeEntity.ServiceTypes.RecycleOnly; _recycleServiceLocation.Save(); } Response.Redirect("~/EditAccount.aspx?acctId=" + _account.AccountId.ToString()); } else { messages.Controls.Add(HtmlHelper.Div("error", errorMessage)); } }
/// <summary> Removes the sync logic for member _serviceLocation</summary> /// <param name="signalRelatedEntity">If set to true, it will call the related entity's UnsetRelatedEntity method</param> /// <param name="resetFKFields">if set to true it will also reset the FK fields pointing to the related entity</param> private void DesetupSyncServiceLocation(bool signalRelatedEntity, bool resetFKFields) { base.PerformDesetupSyncRelatedEntity(_serviceLocation, new PropertyChangedEventHandler(OnServiceLocationPropertyChanged), "ServiceLocation", ServiceLocationRecycleTypeEntity.Relations.ServiceLocationEntityUsingServiceLocationId, true, signalRelatedEntity, "ServiceLocationRecycleType", resetFKFields, new int[] { (int)ServiceLocationRecycleTypeFieldIndex.ServiceLocationId }); _serviceLocation = null; }
public void ServiceEntitiesHaveAnId() { var entity = new ServiceLocationEntity(); entity.Id.Should().BeGreaterOrEqualTo(0); }