private void btnSave_Click(object sender, EventArgs e) { try { if (ValidateForm()) { Country.CountryWebService obj = new Country.CountryWebService(); CountryInfo objInfo = new CountryInfo(); objInfo.CountryName = txtCountryName.Text; int Id = Convert.ToInt32(lblCountryID.Text); if (Id == 0) { objInfo.AddedBy = GetLoginUser.UserName; obj.CountryNameAdd(objInfo, TokenCleintEncrypt.Encrypt(ClientTokenBuilder.BuildTokens())); MessageBox.Show("Data Saved Successfully..."); } else { objInfo.EditedBy = GetLoginUser.UserName; objInfo.CountryID = Id; obj.CountryNameUpdate(objInfo, TokenCleintEncrypt.Encrypt(ClientTokenBuilder.BuildTokens())); MessageBox.Show("Data Updated Successfully..."); } ClearField(); this.DialogResult = DialogResult.OK; } } catch (Exception ex) { throw ex; } }
public frmCountry(int countryID) { InitializeComponent(); Country.CountryWebService objWebService = new Country.CountryWebService(); CountryInfo objInfo = new CountryInfo(); objInfo.CountryID = countryID; objInfo = objWebService.CountryNameGetByID(objInfo.CountryID, TokenCleintEncrypt.Encrypt(ClientTokenBuilder.BuildTokens())); lblCountryID.Text = objInfo.CountryID.ToString(); txtCountryName.Text = objInfo.CountryName; }
/// <remarks/> public void CountryNameUpdateAsync(CountryInfo objInfo, string token, object userState) { if ((this.CountryNameUpdateOperationCompleted == null)) { this.CountryNameUpdateOperationCompleted = new System.Threading.SendOrPostCallback(this.OnCountryNameUpdateOperationCompleted); } this.InvokeAsync("CountryNameUpdate", new object[] { objInfo, token}, this.CountryNameUpdateOperationCompleted, userState); }
/// <remarks/> public void CountryNameUpdateAsync(CountryInfo objInfo, string token) { this.CountryNameUpdateAsync(objInfo, token, null); }
public bool CountryNameUpdate(CountryInfo objInfo, string token) { object[] results = this.Invoke("CountryNameUpdate", new object[] { objInfo, token}); return ((bool)(results[0])); }
private void dataGridViewCountry_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == dataGridViewCountry.Columns["clmEdit"].Index) { int x = Convert.ToInt32(dataGridViewCountry.CurrentRow.Cells["clmCountryID"].Value.ToString()); frmCountry objFrm = new frmCountry(x); objFrm.ShowDialog(); dataGridViewCountry.DataSource = null; LoadCountry(); } if (e.ColumnIndex == dataGridViewCountry.Columns["clmDelete"].Index) { try { Country.CountryWebService objWebService = new Country.CountryWebService(); CountryInfo objInfo = new CountryInfo(); objInfo.CountryID = Convert.ToInt32(dataGridViewCountry.Rows[e.RowIndex].Cells["clmCountryID"].Value.ToString()); if (DialogResult.Yes == MessageBox.Show("Do You Want Delete ?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Warning)) { string deletedBy = GetLoginUser.UserName; objWebService.CountryNameDeleteByID(objInfo.CountryID, deletedBy, TokenCleintEncrypt.Encrypt(ClientTokenBuilder.BuildTokens())); MessageBox.Show("Data Deleted Successfully"); LoadCountry(); } } catch (Exception ex) { throw ex; } } }