private void btn_show_Click(object sender, EventArgs e) { try { Form_Methods.GetConfigFromDB(comboBox1.Text, lbl_cpu, lbl_mobo, lbl_ram, lbl_hdd, lbl_video, lbl_psu, lbl_os, lbl_backup, lbl_bak_id, lbl_bak_date); Form_Methods.GetPCDetailsFromDB(comboBox1.Text, lbl_owner, lbl_desc); Form_Methods.ReadPDFLog(comboBox1.Text, richTextBox1); lbl_owner.Visible = true; lbl_desc.Visible = true; lbl_cpu.Visible = true; lbl_mobo.Visible = true; lbl_ram.Visible = true; lbl_video.Visible = true; lbl_psu.Visible = true; lbl_backup.Visible = true; lbl_bak_id.Visible = true; lbl_bak_date.Visible = true; lbl_hdd.Visible = true; lbl_os.Visible = true; } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { Form_Methods.CloseDBConnection(); } }
public frm_main() { InitializeComponent(); lbl_owner.Visible = false; lbl_desc.Visible = false; lbl_cpu.Visible = false; lbl_mobo.Visible = false; lbl_ram.Visible = false; lbl_video.Visible = false; lbl_psu.Visible = false; lbl_hdd.Visible = false; lbl_os.Visible = false; lbl_backup.Visible = false; lbl_bak_id.Visible = false; lbl_bak_date.Visible = false; try { Form_Methods.FillCombo(comboBox1); Form_Methods.NRSystems(lbl_sys_count); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { Form_Methods.CloseDBConnection(); } }
private void btn_reload_Click(object sender, EventArgs e) { comboBox1.Items.Clear(); richTextBox1.Clear(); try { lbl_owner.Visible = false; lbl_desc.Visible = false; lbl_cpu.Visible = false; lbl_mobo.Visible = false; lbl_ram.Visible = false; lbl_video.Visible = false; lbl_psu.Visible = false; lbl_backup.Visible = false; lbl_bak_id.Visible = false; lbl_bak_date.Visible = false; lbl_hdd.Visible = false; lbl_os.Visible = false; Form_Methods.FillCombo(comboBox1); Form_Methods.NRSystems(lbl_sys_count); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { Form_Methods.CloseDBConnection(); } }
private void btn_add_Click(object sender, EventArgs e) { string message = null; string message2 = null; try { if (cmb_select.Text == "Owner" || cmb_select.Text == "Description") { Form_Methods.EditPCDB(getID, cmb_select.Text, txt_update.Text); message = txt_update.Text; } else if (cmb_select.Text == "Backup Date") { Form_Methods.EditConfigDB(getID, cmb_select.Text, dateTimePicker1.Text); message = dateTimePicker1.Text; } else { Form_Methods.EditConfigDB(getID, cmb_select.Text, txt_update.Text); message = txt_update.Text; } message2 = cmb_select.Text + " has been updated to " + message; try { Form_Methods.AddEditLog(getID, getText, message2); } catch (Exception ex) { MessageBox.Show(ex.Message); } this.Close(); MessageBox.Show(message2); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { Form_Methods.CloseDBConnection(); } }
private void btn_add_Click(object sender, EventArgs e) { try { Form_Methods.AddConfigtoDB(txt_system.Text, txt_cpu.Text, txt_mobo.Text, txt_ram.Text, txt_hdd.Text, txt_video_c.Text, txt_psu.Text, txt_os.Text, cmb_back.Text, txt_back_id.Text, dateTimePicker1.Text); Form_Methods.AddPCtoDB(txt_system.Text, txt_owner.Text, txt_description.Text); Form_Methods.CreateNewPDFLog(txt_system.Text, txt_owner.Text, txt_description.Text, txt_cpu.Text, txt_mobo.Text, txt_ram.Text, txt_hdd.Text, txt_video_c.Text, txt_psu.Text, txt_os.Text, cmb_back.Text, txt_back_id.Text, dateTimePicker1.Text); MessageBox.Show("Added"); this.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { Form_Methods.CloseDBConnection(); } }
private void btn_delete_Click(object sender, EventArgs e) { DialogResult dl = MessageBox.Show("Do Your really want to delete this entry", "Delete Entry", MessageBoxButtons.YesNo); if (dl == DialogResult.Yes) { try { Form_Methods.deletePCConfig(comboBox1.Text); Form_Methods.deletePC(comboBox1.Text); Form_Methods.DeleteLog(comboBox1.Text); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { Form_Methods.CloseDBConnection(); MessageBox.Show("Record id " + comboBox1.Text + " has been deleted"); } } }
private void btn_add_log_Click(object sender, EventArgs e) { Form_Methods.AddNewLog(comboBox1.Text, richTextBox1, richTextBox2); MessageBox.Show("Log Added"); richTextBox2.Clear(); }