protected void btnUpdate_Click(object sender, EventArgs e) { vendor = new Vendor(); purchaseData = new PurchaseData(); vendor.VendorId = string.IsNullOrEmpty(hfBrandId.Value) ? 0 : Convert.ToInt32(hfBrandId.Value); vendor.VendorName = string.IsNullOrEmpty(txtVendorName.Text.ToString()) ? string.Empty : Convert.ToString(txtVendorName.Text); vendor.VendorCode = string.IsNullOrEmpty(txtVendorCode.Text.ToString()) ? string.Empty : Convert.ToString(txtVendorCode.Text); vendor.Address = string.IsNullOrEmpty(txtAddress.Text.ToString()) ? string.Empty : Convert.ToString(txtAddress.Text); vendor.Mobile = string.IsNullOrEmpty(txtMobile.Text.ToString()) ? string.Empty : Convert.ToString(txtMobile.Text); vendor.Phone = string.IsNullOrEmpty(txtPhone.Text.ToString()) ? string.Empty : Convert.ToString(txtPhone.Text); vendor.Email = string.IsNullOrEmpty(txtEmail.Text.ToString()) ? string.Empty : Convert.ToString(txtEmail.Text); if (dpIsActive.SelectedItem.Value == "1") { vendor.IsActive = true; } else { vendor.IsActive = false; } vendor.City = dpCity.SelectedItem.Text.ToString(); vendor.State = dpState.SelectedItem.Text.ToString(); vendor.Flag = 3; //3 for update int Result = 0; Result = purchaseData.VendorDML(vendor); if (Result > 0) { divDanger.Visible = false; divwarning.Visible = false; divSusccess.Visible = true; lblSuccess.Text = "Brand Add Successfully"; ClearTextBox(); GetList(); pnlError.Update(); uprouteList.Update(); } else { divDanger.Visible = false; divwarning.Visible = true; divSusccess.Visible = false; lblwarning.Text = "Please Contact to Site Admin"; pnlError.Update(); } }
protected void btnSubmit_Click(object sender, EventArgs e) { vendor = new Vendor(); purchaseData = new PurchaseData(); vendor.VendorName = string.IsNullOrEmpty(txtVendorName.Text.ToString()) ? string.Empty : Convert.ToString(txtVendorName.Text); vendor.VendorCode = string.IsNullOrEmpty(txtVendorCode.Text.ToString()) ? string.Empty : Convert.ToString(txtVendorCode.Text); vendor.Address = string.IsNullOrEmpty(txtAddress.Text.ToString()) ? string.Empty : Convert.ToString(txtAddress.Text); vendor.Mobile = string.IsNullOrEmpty(txtMobile.Text.ToString()) ? string.Empty : Convert.ToString(txtMobile.Text); vendor.Phone = string.IsNullOrEmpty(txtPhone.Text.ToString()) ? string.Empty : Convert.ToString(txtPhone.Text); vendor.Email = string.IsNullOrEmpty(txtEmail.Text.ToString()) ? string.Empty : Convert.ToString(txtEmail.Text); if (dpIsActive.SelectedItem.Value == "1") { vendor.IsActive = true; } else { vendor.IsActive = false; } vendor.City = dpCity.SelectedItem.Text.ToString(); vendor.State = dpState.SelectedItem.Text.ToString(); vendor.Flag = 1; //1 for INSERT int Result = 0; Result = purchaseData.VendorDML(vendor); if (Result > 0) { divDanger.Visible = false; divwarning.Visible = false; divSusccess.Visible = true; lblSuccess.Text = "Vendor Added Successfully"; ClearTextBox(); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "rem1", "$('.modal-backdrop').remove();", true); GetList(); pnlError.Update(); uprouteList.Update(); } else { divDanger.Visible = false; divwarning.Visible = true; divSusccess.Visible = false; lblwarning.Text = "Please Contact to Site Admin"; pnlError.Update(); } }