private Boolean UpdateIPconfigInfo(int id)
    {
        IIPservice service = null;

        // Create service.
        service            = AppService.Create <IIPservice>();
        service.AppManager = this.Master.AppManager;
        bool validatelocation = true;

        this.HideStatusMessage(string.Empty, false);
        try
        {
            // Validate the entity values.
            if (this.ValidateControls() == false)
            {
                return(false);
            }
            else
            {
                // create instance

                if (id != 0)
                {
                    service.Update(txtEntityIPAddress.Value, hdnEntityLocationId.Value.ToString(), ddlEntitylink.Value, chkEntityActive.Checked.ToString(), txtEntityReason.Value, Convert.ToInt16(hiddenEntityId.Value.ToString()));
                }

                else
                {
                    service.Update(txtEntityIPAddress.Value, hdnEntityLocationId.Value.ToString(), ddlEntitylink.Value, chkEntityActive.Checked.ToString(), txtEntityReason.Value, 0);
                }

                // clear
                this.ClearControls();
                this.CloseDialogControl();
            }
        }
        catch (ValidationException ve)
        {
            // Display validation erros.

            this.DisplayValidationError(this.ErrorMessage(ve));
            validatelocation = false;
        }



        finally
        {
            if (service != null)
            {
                service.Dispose();
            }
        }
        return(validatelocation);
    }
    private DataTable SearchIP(string IPAddress, string Location, string Linktype, string status)
    {
        IIPservice service = null;

        try
        {
            // Create service.
            service            = AppService.Create <IIPservice>();
            service.AppManager = this.Master.AppManager;

            // Call service method.
            return(service.Search(IPAddress, Location, Linktype, status));
        }
        catch { throw; }
        finally
        {
            if (service != null)
            {
                service.Dispose();
            }
        }
    }
    // Display Location info
    private void DisplayIPInfo(string IPAddress)
    {
        IIPservice service = null;

        try
        {
            // Create service.
            service            = AppService.Create <IIPservice>();
            service.AppManager = this.Master.AppManager;

            // Call service method.
            DataTable dt = service.Search(IPAddress, "", "", "ALL");

            if (dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    hiddenEntityId.Value      = dr["IpId"].ToString();
                    ddlEntitylink.Value       = dr["Linktype"].ToString();
                    txtEntityIPAddress.Value  = dr["IPAddress"].ToString();
                    txtEntityLocation.Value   = dr["Location"].ToString();
                    hdnEntityLocationId.Value = dr["LocationId"].ToString();
                    txtEntityReason.Value     = "";
                    chkEntityActive.Checked   = Convert.ToBoolean(dr["Status"]);
                }
            }
            //Show/Hide the controls.
            //this.ShowHideEditControls(true);
        }
        catch { throw; }
        finally
        {
            if (service != null)
            {
                service.Dispose();
            }
            service = null;
        }
    }