public frmLocation(int locationID)
 {
     InitializeComponent();
     LoadCountry();
     Location.LocationWebService objWebService = new Location.LocationWebService();
     LocationInfo objInfo = new LocationInfo();
     objInfo.LocationID = locationID;
     objInfo = objWebService.LocationNameGetByID(objInfo.LocationID, TokenCleintEncrypt.Encrypt(ClientTokenBuilder.BuildTokens()));
     cmbCountryName.SelectedValue = objInfo.CountryID;
     cmbStateName.SelectedValue = objInfo.StateID;
     txtLocationName.Text = objInfo.LocationName;
     lblCountryID.Text = objInfo.LocationID.ToString();
     lblStateID.Text = objInfo.StateID.ToString();
     lblLocationID.Text = objInfo.LocationID.ToString();
 }
 private void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         if (ValidateForm())
         {
             Location.LocationWebService objWebService = new Location.LocationWebService();
             LocationInfo objInfo = new LocationInfo();
             objInfo.CountryID = Convert.ToInt32(cmbCountryName.SelectedValue);
             objInfo.StateID = Convert.ToInt32(cmbStateName.SelectedValue);
             objInfo.LocationName = txtLocationName.Text;
             int countryId = objInfo.CountryID;
             int stateId = objInfo.StateID;
             int locationId = Convert.ToInt32(lblLocationID.Text);
             if (countryId != 0 && stateId != 0 && locationId == 0)
             {
                 objInfo.AddedBy = GetLoginUser.UserName;
                 objWebService.LocationNameAdd(objInfo, TokenCleintEncrypt.Encrypt(ClientTokenBuilder.BuildTokens()));
                 MessageBox.Show("Data saved successfully");
             }
             else if (countryId != 0 && stateId != 0 && locationId != 0)
             {
                 objInfo.CountryID = countryId;
                 objInfo.StateID = stateId;
                 objInfo.LocationID = locationId;
                 objInfo.EditedBy = GetLoginUser.UserName;
                 objWebService.LocationNameUpdate(objInfo, TokenCleintEncrypt.Encrypt(ClientTokenBuilder.BuildTokens()));
                 MessageBox.Show("Data updated successfully");
             }
             ClearField();
             this.DialogResult = DialogResult.OK;
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 /// <remarks/>
 public void LocationNameUpdateAsync(LocationInfo objInfo, string token, object userState) {
     if ((this.LocationNameUpdateOperationCompleted == null)) {
         this.LocationNameUpdateOperationCompleted = new System.Threading.SendOrPostCallback(this.OnLocationNameUpdateOperationCompleted);
     }
     this.InvokeAsync("LocationNameUpdate", new object[] {
                 objInfo,
                 token}, this.LocationNameUpdateOperationCompleted, userState);
 }
 /// <remarks/>
 public void LocationNameUpdateAsync(LocationInfo objInfo, string token) {
     this.LocationNameUpdateAsync(objInfo, token, null);
 }
 public bool LocationNameUpdate(LocationInfo objInfo, string token) {
     object[] results = this.Invoke("LocationNameUpdate", new object[] {
                 objInfo,
                 token});
     return ((bool)(results[0]));
 }