private void BtnInsertUpdate_Click(object sender, EventArgs e) { try { if (string.IsNullOrEmpty(TxtSName.Text.ToString())) { messageShow.singlemsgtext("Supplier name should not be empty"); TxtSName.Focus(); return; } if (string.IsNullOrEmpty(TxtSMobNum.Text.ToString())) { messageShow.singlemsgtext("Supplier mobile number should not be empty"); TxtSMobNum.Focus(); return; } if (string.IsNullOrEmpty(TxtSEmailId.Text.ToString())) { messageShow.singlemsgtext("Email id should not be empty"); TxtSEmailId.Focus(); return; } if (string.IsNullOrEmpty(TxtSGSTNum.Text.ToString())) { messageShow.singlemsgtext("GSTIN number should not be empty"); TxtSGSTNum.Focus(); return; } if (string.IsNullOrEmpty(TxtArSAddrOne.Text.ToString())) { messageShow.singlemsgtext("Address should not be empty"); TxtArSAddrOne.Focus(); return; } var supplier_master = new SupplierMaster { SupplierCode = SelectedSupplierCode, SupplierName = TxtSName.Text.ToString(), MobileNumber = Convert.ToInt64(TxtSMobNum.Text.ToString()), EmailId = TxtSEmailId.Text.ToString(), GSTINNumber = TxtSGSTNum.Text.ToString(), Address1 = TxtArSAddrOne.Text.ToString(), Address2 = TxtArSAddrTwo.Text.ToString(), OperationType = SelectedSupplierCode == 0 ? 1 : 2 }; int id = _instanceRepository.InsertUpdateDeleteSupplierLegder(supplier_master); supplier_master.SupplierName = ""; ResetControllers(); } catch (Exception _exception) { CmC.InsertException(_exception); messageShow.singlemsgtext(CmC.ExceptionErrorMessage); } }
private string ValidateControlles() { string ValidateMessage = string.Empty; if (string.IsNullOrEmpty(TxtUserName.Text.ToString())) { TxtUserName.Focus(); return("Please enter the user name"); } if (string.IsNullOrEmpty(TxtPassword.Text.ToString())) { TxtPassword.Focus(); return("Please enter the password"); } if (DropDownUserRole.SelectedIndex <= 0) { DropDownUserRole.Focus(); return("Please select the role type"); } if (string.IsNullOrEmpty(TxtMobileNo.Text.ToString())) { TxtMobileNo.Focus(); return("Please enter the mobile number"); } if (string.IsNullOrEmpty(TxtSEmailId.Text.ToString())) { TxtSEmailId.Focus(); return("Please enter email id"); } if (string.IsNullOrEmpty(TxtArSAddrOne.Text.ToString())) { TxtArSAddrOne.Focus(); return("Please enter address one"); } return(ValidateMessage); }