private void ProcessForm()
        {
            ServiceEntityLookup.EntityTypeDTO itemToSave = new ServiceEntityLookup.EntityTypeDTO();

            itemToSave.EntityId       = drpEntity.SelectedValue.ToInt();
            itemToSave.EntityTypeName = txtEntityName.Text.Trim();
            itemToSave.DisplayName    = txtEntityDisplayName.Text.Trim();

            if (HiddenEntityTypeId.Value.ToInt() > 0)
            {
                itemToSave.EntityTypeId = HiddenEntityTypeId.Value.ToInt();
            }

            using (ServiceEntityLookup.EntityTypeLookupServiceClient entityLookupService =
                       new ServiceEntityLookup.EntityTypeLookupServiceClient())
            {
                try
                {
                    entityLookupService.SaveEntityType(itemToSave);

                    this.ReloadPage(drpEntity.SelectedValue.ToInt());
                }
                catch (FaultException <ServiceEntityLookup.EntityLookupServiceFault> ex)
                {
                    this.DisplayLocalMessage(ex.Message + " " + ex.Detail.ErrorMrssage);
                }
            }
        }
        private void BindEntityDropDown()
        {
            using (ServiceEntityLookup.EntityTypeLookupServiceClient entityLookupService =
                       new ServiceEntityLookup.EntityTypeLookupServiceClient())
            {
                ServiceEntityLookup.EntityDTOCollection entityCollection = entityLookupService.GetEntityCollection();
                if (entityCollection != null && entityCollection.Count() > 0)
                {
                    drpEntity.DataSource = entityCollection;
                    drpEntity.DataBind();

                    drpEntity.Items.Insert(0, new ListItem {
                        Text = "(Select Entity)", Value = "0"
                    });

                    drpEntity.SelectedValue = base.EntityId.ToString();
                }
                else
                {
                    drpEntity.Items.Add(new ListItem {
                        Text = "Not Available", Value = "0"
                    });
                }
            }
        }
 private void DeleteItem(int entityTypeId)
 {
     using (ServiceEntityLookup.EntityTypeLookupServiceClient entityLookService =
                new ServiceEntityLookup.EntityTypeLookupServiceClient())
     {
         try
         {
             entityLookService.DeleteEntityType(entityTypeId);
             this.ReloadPage(drpEntity.SelectedValue.ToInt());
         }
         catch (FaultException <ServiceEntityLookup.EntityLookupServiceFault> ex)
         {
             this.DisplayLocalMessage(ex.Message + " " + ex.Detail.ErrorMrssage);
         }
     }
 }
 private void BindEntityTypeList(int entityId)
 {
     if (entityId > 0)
     {
         using (ServiceEntityLookup.EntityTypeLookupServiceClient entityLookupService =
                    new ServiceEntityLookup.EntityTypeLookupServiceClient())
         {
             ServiceEntityLookup.EntityTypeDTOCollection entityTypeCollection =
                 entityLookupService.GetEntityTypeCollection(entityId);
             if (entityTypeCollection != null)
             {
                 rptLookupList.DataSource = entityTypeCollection;
                 rptLookupList.DataBind();
             }
         }
     }
 }
        private void BindUpdateInfo(int entityTypeId)
        {
            using (ServiceEntityLookup.EntityTypeLookupServiceClient entityLookupService =
                       new ServiceEntityLookup.EntityTypeLookupServiceClient())
            {
                try
                {
                    ServiceEntityLookup.EntityTypeDTO itemToUpdate = entityLookupService.GetEntityType(entityTypeId);

                    if (itemToUpdate != null)
                    {
                        HiddenEntityTypeId.Value = itemToUpdate.EntityTypeId.ToString();

                        if (!string.IsNullOrEmpty(itemToUpdate.EntityTypeName))
                        {
                            txtEntityName.Text = itemToUpdate.EntityTypeName;
                        }

                        if (!string.IsNullOrEmpty(itemToUpdate.DisplayName))
                        {
                            txtEntityDisplayName.Text = itemToUpdate.DisplayName;
                        }

                        SaveButton.Text = "Update Lookup Value";

                        btnCancel.Visible = true;
                    }
                    else
                    {
                        this.DisplayLocalMessage("Update failed. Couldn't find record.");
                    }
                }
                catch (FaultException <ServiceEntityLookup.EntityLookupServiceFault> ex)
                {
                    this.DisplayLocalMessage(ex.Message + " " + ex.Detail.ErrorMrssage);
                }
            }
        }