private void Submit_Click(object sender, EventArgs e) { var empty = from tb in tableLayoutPanel1.Controls.OfType <TextBox>() where string.IsNullOrWhiteSpace(tb.Text) select tb; if (empty.Any()) { MessageBox.Show("One or more input box is empty"); } else { newcomplaint.Date = _probdate.Value; newcomplaint.ProblemDetails = problem_details.Text; newcomplaint.ProblemStatus = _problemcombo.Text; DialogResult submitresult = MessageBox.Show("Are you sure that all data are correct? Pressing Ok will submit the data into the database", "Warning", MessageBoxButtons.YesNo); if (submitresult == DialogResult.Yes) { try { Activity_Layer _addcomplaint = new Activity_Layer(); _addcomplaint.insert_complaindetails(newcomplaint); MessageBox.Show("Complain added."); this.Close(); } catch (Exception ex) { MessageBox.Show("Error Found" + ex, "Warning"); } } } }
private void modify_Click(object sender, EventArgs e) { if (cdtextbox.TextLength > 0) { Activity_Layer moddata = new Activity_Layer(); client_details cd = new client_details(); cd.ClientID = cdtextbox.Text; cd.ClientName = cntextbox.Text; cd.ClientAddress = catextbox.Text; cd.ContactNo = Convert.ToInt64(cctextbox.Text); cd.IP_Address = iptextbox.Text; cd.MAC_Address = mactextbox.Text; cd.ConnectionType = cttextbox.Text; cd.ConnTakenOn = conDatebox.Value; cd.PackageTaken = packagecombobox.Text; try { moddata.UpdateClientDetails(cd); MessageBox.Show("Client Data Updated"); Cancel_Click(null, null); } catch (Exception ex) { MessageBox.Show("Error: " + ex, "OOPS!!!"); } } else { MessageBox.Show("Load data into the form first."); } }
private void Submit_Click(object sender, EventArgs e) { var empty = from tb in billdatapanel.Controls.OfType <TextBox>() where string.IsNullOrWhiteSpace(tb.Text) select tb; if (empty.Any()) { MessageBox.Show("One or more input is blank"); } else { newbilldata.paid = _paid.SelectedText; newbilldata.Current_Bill = Convert.ToDouble(currentbill.Text); newbilldata.Previous_Due = Convert.ToDouble(_previousduetextbox.Text); newbilldata.InvoicePeriod = billdate.Value; DialogResult submitresult = MessageBox.Show(@"Are you sure that all data are correct? Pressing Ok will submit the data into the database", "Warning", MessageBoxButtons.YesNo); if (submitresult == DialogResult.Yes) { try { Activity_Layer submittingrequest = new Activity_Layer(); submittingrequest.insert_billing(newbilldata); this.Close(); } catch (Exception ex) { MessageBox.Show("Error Found" + ex, "Warning"); } } } }
//============================================Clients Tab=================================================================== #region Client Details tab private void client_tab_Enter(object sender, EventArgs e) { Activity_Layer getclientdata = new Activity_Layer(); DataTable clientdata = new DataTable(); try { clientdata = getclientdata.showClientDetails(); clientdatagridview.DataSource = clientdata; } catch (Exception ex) { MessageBox.Show("An error has been found: " + ex, "OOPS"); } }
private void load_data_Click(object sender, EventArgs e) { DataTable dt_main_window = new DataTable(); Activity_Layer grid_data_load = new Activity_Layer(); switch (mainwindow_tabcontrol.SelectedIndex) { case 0: { try { client_dataGridView.DataSource = grid_data_load.showClientDetails(); } catch (Exception ex) { MessageBox.Show("Error: " + ex, "OOPS"); } } break; case 1: { try { complain_dataGridView.DataSource = grid_data_load.showComplainDetails(); } catch (Exception ex) { MessageBox.Show("Error: " + ex, "OOPS"); } } break; case 2: { try { billings_dataGridView.DataSource = grid_data_load.showBillingDetails(); } catch (Exception ex) { MessageBox.Show("Error: " + ex, "OOPS"); } } break; } }
} //done private void Submit_Click(object sender, EventArgs e) { data_select(); if (_searchdata.Length > 0) { Activity_Layer search_submit = new Activity_Layer(); _indexcheck(_index); tb = search_submit.stringsearch("clientdetails", _searchdata, column_name); _datasearchGridView.DataSource = tb; } else { MessageBox.Show("Search value is null or empty"); } } //checked
private void Delete_Click(object sender, EventArgs e) { Activity_Layer delclient = new Activity_Layer(); try { bool _deleted_client = delclient.Delete_client(cdtextbox.Text); if (_deleted_client) { MessageBox.Show("User entry has been successfully deleted", "Confirmed"); } } catch (Exception ex) { MessageBox.Show("Error: " + ex, "Warning"); } Cancel_Click(null, null); }
private void Submit_Click(object sender, EventArgs e) { var emptyimput = from tb in tableLayoutPanel1.Controls.OfType <TextBox>() where string.IsNullOrWhiteSpace(tb.Text) select tb; if (emptyimput.Any()) { MessageBox.Show("One or more input box is empty", "Can not execute command"); } else { client_details cd = new client_details(); cd.ClientID = cdtextbox.Text; cd.ClientName = cntextbox.Text; cd.ClientAddress = catextbox.Text; cd.ContactNo = Convert.ToInt64(cctextbox.Text); cd.IP_Address = iptextbox.Text; cd.MAC_Address = mactextbox.Text; cd.ConnectionType = cttextbox.Text; cd.ConnTakenOn = conDatebox.Value; cd.PackageTaken = packagecombobox.Text; DialogResult submitresult = MessageBox.Show("Are you sure that all data are correct? Pressing Ok will submit the data into the database", "Warning", MessageBoxButtons.YesNo); if (submitresult == DialogResult.Yes) { try { Activity_Layer submittingrequest = new Activity_Layer(); submittingrequest.insert_clientdetails(cd); MessageBox.Show("Entry Successful"); this.Close(); } catch (Exception ex) { MessageBox.Show("Error Found" + ex, "Warning"); } } } }