private void RBCreate_CheckedChanged(object sender, EventArgs e) { BtnAdd.Enabled = true; BtnUpdate.Enabled = false; TextBoxClearEvent(); CmbCustID.Focus(); }
private void BtnAdd_Click(object sender, EventArgs e) { int outVal = privilege.GetUserAccessable("UTRW_CREATE", 1); if (outVal == 1) { try { DialogResult result = MessageBox.Show("Do you want to save the Record?", "Confirm item saving", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { int customerID = Convert.ToInt32(CmbCustID.SelectedValue); string area = TxtAreaName.Text; double latitude = Convert.ToDouble(TxtCustLat.Text); double longitude = Convert.ToDouble(TxtCustLon.Text); int deviceID = Convert.ToInt32(CmbVhiID.SelectedValue); string days = CmbDaysOfWeek.Text; int repID = Convert.ToInt32(CmbSalesRep.SelectedValue); if (db.InsertNewCustomer(customerID, area, deviceID, latitude, longitude, repID, days)) { MessageBox.Show("Record Sucessfully Added", "Record Status", MessageBoxButtons.OK, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button2); GridViewLoad(); TextBoxClearEvent(); CmbCustID.Focus(); } else { MessageBox.Show("Sorry Somthing is Wrong!", "Saving Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button2); } } else { MessageBox.Show("Item Didnt save....!", "Saving details", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Saving Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button2); } } else { MessageBox.Show("You dont have the privelages to Save this....!", "Privelages", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }