private void ProcessForm() { ServiceEntityType.EntityTypeDTO itemToSave = new ServiceEntityType.EntityTypeDTO(); itemToSave.EntityId = EntityList.SelectedValue.ToInt(); itemToSave.EntityTypeValue = EntityValueFeild.Text.Trim(); //check hidden Value to see if we need to update or insert if (HiddenEntityTypeId.Value.ToInt() > 0) itemToSave.EntityTypeId = HiddenEntityTypeId.Value.ToInt(); //call service to save using (ServiceEntityType.EntityLookupServiceClient entityLookupService = new ServiceEntityType.EntityLookupServiceClient()) { try { entityLookupService.SaveEntityType(itemToSave); //redirect with EntityId in Query string this.ReloadPage(EntityList.SelectedValue.ToInt()); } catch (FaultException<ServiceEntityType.EntityLookupServiceFault> ex) { this.DisplayLocalMessage(ex.Message + " " + ex.Detail.ErrorMessage); } } }
private void DeleteItem(int entityTypeId) { using (ServiceEntityType.EntityLookupServiceClient entityLookupService = new ServiceEntityType.EntityLookupServiceClient()) { try { //call service method to delete item entityLookupService.DeleteEntityType(entityTypeId); //redirect with entity ID in querystring this.ReloadPage(EntityList.SelectedValue.ToInt()); } catch (FaultException<ServiceEntityType.EntityLookupServiceFault> ex) { this.DisplayLocalMessage(ex.Message + " " + ex.Detail.ErrorMessage); } } }
private void BindEntityTypeList(int entityId) { if (entityId > 0) { using (ServiceEntityType.EntityLookupServiceClient entityLookupService = new ServiceEntityType.EntityLookupServiceClient()) { ServiceEntityType.EntityTypeDTOCollection entityTypeCollection = entityLookupService.GetEntityTypeCollection(entityId); if (entityTypeCollection != null) { LookupList.DataSource = entityTypeCollection; LookupList.DataBind(); } } } }
private void BindUpdateInfo(int entityTypeId) { using (ServiceEntityType.EntityLookupServiceClient entityLookupService = new ServiceEntityType.EntityLookupServiceClient()) { try { //call Service to get item ServiceEntityType.EntityTypeDTO itemToUpdate = entityLookupService.GetEntityType(entityTypeId); if (itemToUpdate != null) { HiddenEntityTypeId.Value = itemToUpdate.EntityTypeId.ToString(); //dispaly text in texbox if (!string.IsNullOrEmpty(itemToUpdate.EntityTypeValue)) EntityValueFeild.Text = itemToUpdate.EntityTypeValue; SaveButton.Text = "Update Lookup Value"; CancelButton.Visible = true; } else this.DisplayLocalMessage("Update failed. Couldn't find record."); } catch (FaultException<ServiceEntityType.EntityLookupServiceFault> ex) { this.DisplayLocalMessage(ex.Message + " " + ex.Detail.ErrorMessage); } } }
private void BindEntityDropDown() { using (ServiceEntityType.EntityLookupServiceClient entityLookupService = new ServiceEntityType.EntityLookupServiceClient()) { ServiceEntityType.EntityDTOCollection entityCollection = entityLookupService.GetEntityCollection(); if (entityCollection != null && entityCollection.Count() > 0) { EntityList.DataSource = entityCollection; EntityList.DataBind(); EntityList.Items.Insert(0, new ListItem { Text = "(Select Entity)", Value = "0" }); EntityList.SelectedValue = base.EntityId.ToString(); } else EntityList.Items.Add(new ListItem { Text = "Not Available", Value = "0" }); } }