private void btn_add_Click(object sender, EventArgs e) { string loggeddUsr = frmLogin.loggedIn; userBLL usr = uDal.GetIDFromUsername(loggeddUsr); dc.type = cmbType.Text; dc.name = txtName.Text; dc.email = txtEmail.Text; dc.contact = txtContact.Text; dc.address = txtAddress.Text; dc.added_date = DateTime.Now; dc.added_by = usr.id; bool success = dcDal.Insert(dc); if (success) { Clear(); DataTable dt = dcDal.Select(); dgvDeaCust.DataSource = dt; } else { MessageBox.Show("Failed to insert new dealer/customer"); } }
private void btnAdd_Click(object sender, EventArgs e) { dc.type = cmbType.Text; dc.name = txtName.Text; dc.email = txtEmail.Text; dc.contact = txtContact.Text; dc.address = txtAddress.Text; dc.added_date = DateTime.Now; //getting id in added by field string loggedUser = frmLogin.loggedIn; userBLL usr = uDal.GetIDFromUsername(loggedUser); //passing the id of logged in user in added by field dc.added_by = usr.id; //creating boolean method to insert data into database bool success = dcdal.Insert(dc); if (success == true) { MessageBox.Show("Dealer or Customer Added Successfully."); Clear(); //refresh data grid view DataTable dt = dcdal.Select(); dgvDeaCust.DataSource = dt; } else { MessageBox.Show("Failed to Add New Dealer or customer."); } }
private void btnAdd_Click(object sender, EventArgs e) { dc.type = cmbDeaCust.Text; dc.name = txtName.Text; dc.email = txtEmail.Text; dc.contact = txtContact.Text; dc.address = txtAddress.Text; dc.added_date = DateTime.Now; string loggedUsr = frmLogin.loggedIn; userBLL usr = uDAL.GetIDFromUsername(loggedUsr); dc.added_by = usr.id; bool success = dcDal.Insert(dc); if (success == true) { MessageBox.Show("Dealer or Customer Added Successfully"); Clear(); DataTable dt = dcDal.Select(); dgvDeaCust.DataSource = dt; } else { } }
private void btnAdd_Click(object sender, EventArgs e) { //get the values from form dc.type = cmbType.Text; dc.name = txtName.Text; dc.email = txtEmail.Text; dc.contact = txtContact.Text; dc.address = txtAddress.Text; dc.added_date = DateTime.Now; //Getting ID in Added by field string loggedUser = frmLogin.loggedIn; userBLL usr = uDal.GetIDFromUsername(loggedUser); //passing the id of logged in user in added by field dc.added_by = usr.id; //Creating Boolean Method To insert data into database bool success = dcDal.Insert(dc); if (success == true) { //new category inserted successfull MessageBox.Show("Dealer or Customer Added Sucessfully."); Clear(); //Refresh Data grid view DataTable dt = dcDal.Select(); dgvDeaCust.DataSource = dt; } else { //failed to insert MessageBox.Show("Dealer or Customer Failed ."); } }
private void btnAdd_Click(object sender, EventArgs e) { //get the values from form dc.type = cmbDeaCust.Text; dc.name = txtName.Text; dc.email = txtEmail.Text; dc.contact = txtContact.Text; dc.address = txtAddress.Text; dc.added_date = DateTime.Now; //getting the ID of logged in user and passing its value to Dealer or Customer module string loggedUsr = frmLogin.loggedIn; userBLL usr = udal.GetIDFromUsername(loggedUsr); dc.added_by = usr.id; //Creating a Boolean Variable to check the dealer or customer is added or not bool success = dcDal.INSERT(dc); if (success == true) { MessageBox.Show("Dealer or Customer Added Successfully."); Clear(); //Refresh Data Grid View DataTable dt = dcDal.Select(); dgvDeaCust.DataSource = dt; } else { MessageBox.Show("Failed to Add Dealer or Customer."); } error(); }
private void btnAdd_Click(object sender, EventArgs e) { //Get the Values from Form dc.type = cmbDeaCust.Text; dc.name = txtName.Text; dc.email = txtEmail.Text; dc.contact = txtContact.Text; dc.address = txtAddress.Text; dc.added_date = DateTime.Now; //Getting the ID to Logged in user and passign its value in dealer or cutomer module string loggedUsr = frmLogin.loggedIn; userBLL usr = uDal.GetIDFromUsername(loggedUsr); dc.added_by = usr.id; //Creating boolean variable to check whether the dealer or cutomer is added or not bool success = dcDal.Insert(dc); if (success == true) { //Dealer or Cutomer inserted successfully MessageBox.Show("Dealer or Customer Added Successfully"); Clear(); //Refresh Data Grid View DataTable dt = dcDal.Select(); dgvDeaCust.DataSource = dt; } else { //failed to insert dealer or customer } }
private void btnAdd_Click(object sender, EventArgs e) { // get the values from form dc.type = cmbDeaCust.Text; dc.name = txtName.Text; dc.email = txtEmail.Text; dc.contact = txtContact.Text; dc.address = txtAddress.Text; dc.added_date = DateTime.Now; // getting the loggedin user id and passing its value to deal or customer module string loggedUsr = frmLogin.loggedIn; userBLL usr = uDal.GetIDFromUsername(loggedUsr); dc.added_by = usr.id; // boolean variable to check if the dealer/customer is added or not bool success = dcDal.Insert(dc); if (success == true) { //dealer/customer is inserted successfully MessageBox.Show("Dealer or customer added Successfully"); Clear(); // refresh data grid view DataTable dt = dcDal.Select(); dgvDeaCust.DataSource = dt; } else { //Failed to insert dealer /customer MessageBox.Show(""); } }
private void btnAdd_Click(object sender, EventArgs e) { dc.type = cmbDlrCust.Text; dc.name = txtName.Text; dc.email = txtEmail.Text; dc.contact = txtContact.Text; dc.address = txtAddress.Text; dc.added_date = DateTime.Now; string loggedUsr = frmLogin.loggedIn; userBLL usr = uDal.GetIdFromUsername(loggedUsr); dc.added_by = usr.Id; bool success = dcdal.Insert(dc); if (success == true) { MassageBox mb = new MassageBox("Added Success", MsgType.success); mb.Show(); //MessageBox.Show("Dealer/Customer Added Successfully..."); Clear(); DataTable dt = dcdal.Select(); dgvDlr_Customer.DataSource = dt; } else { MassageBox mb = new MassageBox("Added Failed", MsgType.retry); mb.Show(); //MessageBox.Show("Failed to ADD Dealer/Customer...!!! Try Again.."); } }
private void btnAddCust_Click(object sender, EventArgs e) { dc.type = cmbtype.Text; dc.name = txtName.Text; dc.email = txtEMail.Text; dc.contact = txtContact.Text; dc.address = txtAddress.Text; dc.added_date = DateTime.Now; string loggedIn = Login.loggedInUser; UserBLL usr = udal.getIdFromUserName(loggedIn); dc.added_by = usr.id; bool success = dcDal.Insert(dc); if (success == true) { Mymessage mymessage = new Mymessage("Data Successfully Inserted! "); mymessage.Show(); Clear(); DataTable dt = dcDal.Select(); GDVCustomer.DataSource = dt; } else { Mymessage mymessage = new Mymessage("Erroe While Inserting Data... "); mymessage.Show(); } }
private void btnAdd_Click(object sender, EventArgs e) { dc.type = cmbDeaCust.Text; dc.name = txtName.Text; dc.email = txtEmail.Text; dc.contact = txtContact.Text; dc.address = txtAddress.Text; dc.added_date = DateTime.Now; string loggedUsr = frmLogin.loggedIn; userBLL usr = uDal.GetIDFromUsername(loggedUsr); dc.added_by = usr.id; bool success = dcDal.Insert(dc); if (success == true) { MessageBox.Show("ทำการเพิ่ม Dealer หรือ Customer เรียบร้อยแล้ว"); Clear(); DataTable dt = dcDal.Select(); dgvDeaCust.DataSource = dt; } else { MessageBox.Show("ไม่สามารถทำการเพิ่ม Dealer หรือ Customer ได้! กรุณาลองใหม่อีกครั้ง"); } }
private void btnAdd_Click(object sender, EventArgs e) { try { //get the values from form dc.type = cmbDeaCust.Text; dc.name = txtName.Text; dc.email = txtEmail.Text; dc.contact = txtContact.Text; dc.address = txtAddress.Text; dc.added_date = DateTime.Now; //getting the ID to logged in user and passing its value in dealer customer module string loggedUsr = frmLogin.loggedIn; userBLL usr = uDal.GetIDFromUsername(loggedUsr); dc.added_by = usr.id; //creating boolean variable to check whether the dealer or customer is added or not bool success = dcDal.Insert(dc); if (success == true) { //dealer or customer added successfully MessageBox.Show("Dealer/Customer added successfully!"); Clear(); //refresh datagrid view DataTable dt = dcDal.Select(); dgvDeaCust.DataSource = dt; } else { //failed to insert dealer or customer MessageBox.Show("Dealer/Customer adding failed!"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } bool IsValidEmail(string email) { try { var addr = new System.Net.Mail.MailAddress(email); return(addr.Address == email); } catch { return(false); } } }
private void btnAdd_Click(object sender, EventArgs e) { // Get the values from all Text boxes and store in BLL dc.type = cmbDeaCust.Text; dc.name = txtName.Text; dc.email = txtEmail.Text; dc.contact = txtContact.Text; dc.address = txtAddress.Text; dc.added_date = DateTime.Now; // Getting ID of Logged In User and Passing its value in Dealer or Customer Module // we will get user name who is logged in string loggedUsr = frmLogin.loggedIn; userBLL usr = uDal.GetIDFromUsername(loggedUsr); // we will pass this value dc.added_by = usr.id; // create Boolean variable to check if the Dealer is added successfully or Not bool success = dcDal.Insert(dc); // if the product is added successfully then the value of success will be true or will be false. if (success == true) { // product inserted successfully MessageBox.Show("Dealer or Customer Inserted Successfully"); // we need to clear Text Boxes. we will write a method for this. // Calling the Clear Method Clear(); // Refresh the Data Grid View as well.For that we wil lcreate a data Table. DataTable dt = dcDal.Select(); dgvDeaCust.DataSource = dt; } else { // Falied to Insert MessageBox.Show("Product NOT Inserted Successfully"); } }
private void BtnADD_Click(object sender, EventArgs e) { d.type = cmbType.Text; d.name = txtName.Text; d.email = txtEmail.Text; d.contact = txtContact.Text; d.address = txtAddress.Text; d.added_date = DateTime.Now; //Geting Username of logged in user string loggedUser = frmLogin.loggedIn; DeaCustBLL usr = dal.GetIDFromUsername(loggedUser); d.added_by = usr.id; //Creatae boolean to chec if the product is added successflly or not bool success = dal.Insert(d); if (success == true) { //Product Inserted successfully MessageBox.Show("Data Added Successfully"); Clear(); DataTable dt = dal.Select(); dgvDeaCust.DataSource = dt; } else { //Failed to ADD New Product MessageBox.Show("Failed to Add new Data"); Clear(); DataTable dt = dal.Select(); dgvDeaCust.DataSource = dt; } }