private void btnDelete_Click(object sender, EventArgs e) { if (dgv_vol.RowCount == 0) { MessageBox.Show("Nothing to delete!", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { if (!DBAccess.findAcct("SELECT * FROM `t_request_sub` WHERE isActive = 1 and request_sub_id = '" + id + "' ")) { MessageBox.Show("ID not found!\nPlease check the record's ID!", "System Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { if (MessageBox.Show("Are you sure you want to delete this record ID " + id, "Confirm Action", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes) { DBAccess.deleteData("sp_recycle_req_sub_1", Convert.ToInt32(id)); //.Show(vol_ref_no); DBAccess.update_volunteer_status_via_delete(vol_ref_no); //para iupdate ung vol status once na idelete ung sub id nun dgv_vol.DataSource = DBAccess.dataTableLoad("sp_load_req_sub_volunteerInfo", req_id); logs = new auditTrail(frm_login.UserName, "Deleted Request ID " + txtRefNo.Text); DBAccess.insert_logs(logs); MessageBox.Show("Successfully deleted!", "Successful!", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } }
private void bunifuFlatButton2_Click(object sender, EventArgs e) { if (dgv_rqst.RowCount == 0) { MessageBox.Show("Nothing to delete!", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { if (!DBAccess.findAcct("SELECT * FROM `t_request` WHERE isActive = 1 and ref_no = '" + id + "' ")) { MessageBox.Show("ID not found!\nPlease select record ID!", "System Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { if (MessageBox.Show("Are you sure you want to delete this record ID (" + id + ")", "Confirm Action", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes) { DBAccess.deleteData("sp_recycle_request_1", id); dgv_rqst.DataSource = DBAccess.dataTableLoad("`sp_load_request`", 1); MessageBox.Show("Successfully deleted!", "Successful!", MessageBoxButtons.OK, MessageBoxIcon.Information); logs = new auditTrail(frm_login.UserName, "Deleted Request id " + id); DBAccess.insert_logs(logs); } } } }
private void bunifuFlatButton3_Click(object sender, EventArgs e) { if (dgv_bin_vol.RowCount == 0) { MessageBox.Show("Nothing to restore!", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { if (!DBAccess.findAcct("SELECT * FROM `t_volunteer` WHERE isActive = 0 and ref_no = '" + id2 + "' ")) { MessageBox.Show("Nothing to restore! Please select in the table !", "", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { if (MessageBox.Show("Are you sure you want to restore this record ID (" + id2 + ")", "Confirm Action", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes) { DBAccess.deleteData("sp_recycle_volunteer_0", id2); dgv_bin_vol.DataSource = DBAccess.dataTableLoad("`sp_load_volunteer`", 0); logs = new auditTrail(frm_login.UserName, "Restore Volunteer ID " + id2); DBAccess.insert_logs(logs); MessageBox.Show("Successfully restored!", "Successful!", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } }
private void bunifuFlatButton2_Click(object sender, EventArgs e) { if (dgv_vol.RowCount == 0 || id2 == "") { MessageBox.Show("Nothing to delete!", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { if (!DBAccess.find("sp_check_volunteer_before_deleting", id2)) { MessageBox.Show("Error in deleting Volunteer.The volunteer is currently tag in a request! ", "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { if (MessageBox.Show("Are you sure you want to delete this record ID (" + id2 + ")", "Confirm Action", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes) { DBAccess.deleteData("sp_recycle_volunteer_1", id2); dgv_vol.DataSource = DBAccess.dataTableLoad("`sp_load_volunteer`", 1); MessageBox.Show("Successfully deleted!", "Successful!", MessageBoxButtons.OK, MessageBoxIcon.Information); logs = new auditTrail(frm_login.UserName, "Deleted Volunteer id " + id2); DBAccess.insert_logs(logs); } } } }
private void bunifuFlatButton1_Click_1(object sender, EventArgs e) { if (check()) { MessageBox.Show("Please complete the fields(if not applicable please indicate n/a)", "System Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { try { int prov = DBAccess.get_cmb_data(cmbProvince.Text, "sp_get_cmb_province", "prov_id"); int reg = DBAccess.get_cmb_data(cmbRegion.Text, "sp_get_cmb_region", "region_id"); hostProj = new hostProjects( id.ToString(), txtTitle.Text.Trim(), txtMgr.Text.Trim(), txtDuration.Text.Trim(), txtAddressNo.Text.Trim(), txtAddressStreet.Text.Trim(), txtAddressCity.Text.Trim(), prov.ToString(), reg.ToString(), txtBudget.Text.Trim(), txtSourceFund.Text.Trim(), rtbObjective.Text.Trim(), txtStart.Text.Trim(), txtTargetBeneficiaries.Text.Trim(), txtPosition.Text, txtContactNo.Text ); DBAccess.insert_host_proj(hostProj); dgv_proj.DataSource = DBAccess.dtProject("sp_load_project", id); logs = new auditTrail(frm_login.UserName, "Added a Project for LPI ID " + id); DBAccess.insert_logs(logs); MessageBox.Show("Successfully Added!", "", MessageBoxButtons.OK, MessageBoxIcon.Information); clear(); dgv_proj.Enabled = true; btnDel.Enabled = true; btnUpdate.Enabled = true; txtID.Text = "(Auto generated)"; enabled(false); btnAdd.Visible = true; btnCancel.Visible = false; btnSave.Enabled = false; } catch (Exception ex) { MessageBox.Show(ex.Message + "\n" + ex.StackTrace); } }//if }
private void btnUpdate_Click(object sender, EventArgs e) { try { if (txtID.Text == string.Empty || txtID.Text == "(Auto Generated)") { MessageBox.Show("Please select user to update!", "", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { log_info = new loginInformation(int.Parse(txtID.Text.Trim()), rdbAdmin.Checked ? 2 : 1, rdbActivated.Checked ?1:0); DBAccess.update_login_admin(log_info); dgv_login.DataSource = DBAccess.dataTableLoad("sp_load_login"); logs = new auditTrail(frm_login.UserName, "Updated the account " + txtUsername.Text); DBAccess.insert_logs(logs); MessageBox.Show("Successfully Updated!", "", MessageBoxButtons.OK, MessageBoxIcon.Information); clear(); } } catch (Exception ex) { MessageBox.Show(ex.Message + "\n" + ex.StackTrace); } }
private void btnRestre_Click(object sender, EventArgs e) { if (dgv_bin_hstOrg.RowCount == 0) { MessageBox.Show("Nothing to restore! Please select in the table !", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { if (!DBAccess.findAcct("SELECT * FROM `t_host_org` WHERE isActive = 0 and host_org_id = '" + id + "' ")) { MessageBox.Show("Nothing to restore! Please select in the table !!", "", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { if (MessageBox.Show("Are you sure you want to restore this record ID " + id, "Confirm Action", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes) { DBAccess.deleteData("sp_recycle_hostOrg_0", Convert.ToInt32(id)); dgv_bin_hstOrg.DataSource = DBAccess.dataTableLoad("`sp_load_host_org`", 0); logs = new auditTrail(frm_login.UserName, "Restored LPI ID " + id); DBAccess.insert_logs(logs); MessageBox.Show("Successfully restored!", "Successful!", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } }
private void btnDel_Click(object sender, EventArgs e) { if (id != 0 && DBAccess.find("sp_check_volunteer_before_deleting", txtRefNo.Text)) { if (MessageBox.Show("Are you sure you want to Delete this ref No. " + txtRefNo.Text, "Confirm Action", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes) { DBAccess.deleteData("sp_delete_volunteer", id); logs = new auditTrail(frm_login.UserName, "Deleted Volunteer id " + txtRefNo.Text); DBAccess.insert_logs(logs); MessageBox.Show("Successfully Deleted!", "", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Hide(); } } else { MessageBox.Show("Error in deleting Volunteer.The volunteer is currently tag in a request! ", "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
private void bunifuFlatButton2_Click(object sender, EventArgs e) { if (dgv_req_sub.RowCount == 0) { MessageBox.Show("Nothing to delete!", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { if (!DBAccess.findAcct("SELECT * FROM `t_request_sub` WHERE isActive = 0 and request_sub_id = '" + id + "' ")) { MessageBox.Show("Nothing to delete! Please select in the table !", "System Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { if (MessageBox.Show("Are you sure you want to delete this record ID " + id, "Confirm Action", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes) { DBAccess.deleteData("sp_delete_request_sub_vol_info", Convert.ToInt32(id)); dgv_req_sub.DataSource = DBAccess.dataTableLoad("sp_load_req_sub_volunteerinfo_recyclebin", 0); logs = new auditTrail(frm_login.UserName, "Deleted Request sub permanently ID " + id); DBAccess.insert_logs(logs); MessageBox.Show("Successfully deleted!", "Successful!", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } }
private void btnUpdate_Click(object sender, EventArgs e) { if (txtID.Text == string.Empty || txtID.Text == "(Auto generated)") { MessageBox.Show("Please Select Project ID !", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (check()) { MessageBox.Show("Please complete the fields(if not applicable please indicate n/a)", "System Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { try { int prov = DBAccess.get_cmb_data(txtprv.Text, "sp_get_cmb_province", "prov_id"); int reg = DBAccess.get_cmb_data(txtReg.Text, "sp_get_cmb_region", "region_id"); hostProj = new hostProjects( int.Parse(txtID.Text), txtTitle.Text.Trim(), txtMgr.Text.Trim(), txtDuration.Text.Trim(), txtAddressNo.Text.Trim(), txtAddressStreet.Text.Trim(), txtAddressCity.Text.Trim(), prov.ToString(), reg.ToString(), txtBudget.Text.Trim(), txtSourceFund.Text.Trim(), rtbObjective.Text.Trim(), txtStart.Text.Trim(), txtTargetBeneficiaries.Text.Trim(), txtPosition.Text, txtContactNo.Text ); DBAccess.update_host_proj(hostProj); logs = new auditTrail(frm_login.UserName, "Updated Project id " + txtID.Text); DBAccess.insert_logs(logs); MessageBox.Show("Successfully updated!", "", MessageBoxButtons.OK, MessageBoxIcon.Information); clear(); txtID.Text = "(Auto generated)"; dgv_proj.DataSource = DBAccess.dtProject("sp_load_project", id); enabled(false); } catch (Exception ex) { MessageBox.Show(ex.Message + "\n" + ex.StackTrace); } } }
private void btnSave_Click(object sender, EventArgs e) { if (check()) { MessageBox.Show("Please complete required data!", "System Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { try { int prov = DBAccess.get_cmb_data(txtProv.Text, "sp_get_cmb_province", "prov_id"); int reg = DBAccess.get_cmb_data(txtReg.Text, "sp_get_cmb_region", "region_id"); int host_sub = DBAccess.get_cmb_data(txtOrgtypeSub.Text, "sp_get_cmb_host_org_type_sub", "host_org_type_sub_id"); int host_main = DBAccess.get_cmb_data(txtOrgtype.Text, "sp_get_cmb_host_org_type_main", "host_org_type_id"); hstOrg = new hostOrg( txtName.Text.Trim(), txtHeadName.Text.Trim(), txtPosition.Text.Trim(), txtAddressNo.Text.Trim(), txtAddressStreet.Text.Trim(), txtAddressCity.Text.Trim(), txtTelNumber1.Text.Trim(), txtTelNumber2.Text.Trim(), txtFaxNumber.Text.Trim(), txtEmail.Text.Trim(), txtWebsite.Text.Trim(), rtbMandate.Text, prov.ToString(), reg.ToString(), host_sub.ToString(), host_main.ToString() ); DBAccess.insert_host_org(hstOrg); logs = new auditTrail(frm_login.UserName, "Added a LPI"); DBAccess.insert_logs(logs); MessageBox.Show("Successfully Added!", "", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
private void btnUpdate_Click(object sender, EventArgs e) { try { if (txtID.Text == string.Empty || txtID.Text == "(Auto Generated)") { MessageBox.Show("Please select user to update!", "", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (txtTitle.Text == string.Empty.Trim()) { MessageBox.Show("Please input specilization!", "", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (lblerror1.Visible == true) { MessageBox.Show("Specialization sub Title is already in use!", "", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { int sector = DBAccess.get_cmb_data(cmbSector.Text, "sp_get_cmb_sector", "sector_id"); int spec = DBAccess.get_cmb_data(cmbSpec.Text, "sp_get_cmb_specialization", "specialization_id"); if (cmbSpec.Text == string.Empty) { spec = 106; } else { spec = DBAccess.get_cmb_data(cmbSpec.Text, "sp_get_cmb_specialization", "specialization_id"); } sub = new specializationSub(int.Parse(txtID.Text), spec.ToString(), sector.ToString(), txtTitle.Text); DBAccess.update_specialization_sub(sub); dgv_sub.DataSource = DBAccess.dataTableLoad("sp_load_specialization_sub"); logs = new auditTrail(frm_login.UserName, "Updated Specialization sub id " + txtID.Text); DBAccess.insert_logs(logs); MessageBox.Show("Successfully Updated!", "", MessageBoxButtons.OK, MessageBoxIcon.Information); clear(); } } catch (Exception ex) { MessageBox.Show(ex.Message + "\n" + ex.StackTrace); } }
private void btnUpdate_Click(object sender, EventArgs e) { if (txtStartOfAssistance.Text == string.Empty && txtEndOfAssistance.Text == string.Empty) { MessageBox.Show("Error in updating extension!", "", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (txtID.Text == "(Auto Generated)" || txtID.Text == "") { MessageBox.Show("Please select data to update!", "", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (dtStartOfAssistance.Value > dtEndOfAssistance.Value) { MessageBox.Show("Incorrect dates!", "", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { try { ext = new extensionVol( int.Parse(txtID.Text), req_sub_id, txtStartOfAssistance.Text, txtEndOfAssistance.Text, rtbRemarks.Text ); endDateEx = txtEndOfAssistance.Text; vol_stats_frm_ext = "In Service"; DBAccess.update_extension(ext); DBAccess.update_endAssistance_via_extension(req_sub_id, txtEndOfAssistance.Text); dgv_extension.DataSource = DBAccess.dataTableLoad("sp_load_extension", Req_sub_id); enable(false); clear(); logs = new auditTrail(frm_login.UserName, "updated extension of request sub id " + Req_sub_id); DBAccess.insert_logs(logs); MessageBox.Show("Successfully Updated!", "", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { MessageBox.Show(ex.Message + "\n" + ex.StackTrace); } } }
private void btnUpdate_Click(object sender, EventArgs e) { try { if (check()) { MessageBox.Show("Please complete the required data!", "", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (txtretypepassword.Text == string.Empty) { MessageBox.Show("Password does not matched!", "", MessageBoxButtons.OK, MessageBoxIcon.Error); lblerror2.Visible = true; } else if (lblerror1.Visible == true) { MessageBox.Show("Username is already in use!", "", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (lblerror2.Visible == true) { MessageBox.Show("Password does not matched!", "", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { log_info = new loginInformation(int.Parse(frm_login.UserID), txtUsername.Text.Trim(), txtPassword.Text.Trim(), txtAccountName.Text.Trim(), txtQuestion.Text.Trim(), txtAnswer.Text.Trim(), txtHint.Text.Trim() ); DBAccess.update_login_user(log_info); logs = new auditTrail(frm_login.UserName, "Updated his/her own account "); DBAccess.insert_logs(logs); MessageBox.Show("Successfully Updated!", "", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } } catch (Exception ex) { MessageBox.Show(ex.Message + "\n" + ex.StackTrace); } }
private void btnSave_Click(object sender, EventArgs e) { try { if (lblerror1.Visible == true) { MessageBox.Show("Username is already in use!", "", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (lblerror2.Visible == true) { MessageBox.Show("Password does not matched!", "", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (txtUsername.Text == string.Empty || txtPassword.Text == string.Empty) { MessageBox.Show("Please complete the required data!", "", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { log_info = new loginInformation(txtUsername.Text.Trim(), txtPassword.Text.Trim(), rdbAdmin.Checked ?2:1, 1); DBAccess.insert_login_admin(log_info); logs = new auditTrail(frm_login.UserName, "Added User Account "); DBAccess.insert_logs(logs); MessageBox.Show("Successfully Added!", "", MessageBoxButtons.OK, MessageBoxIcon.Information); dgv_login.DataSource = DBAccess.dataTableLoad("sp_load_login"); btnUpdate.Visible = true; btnSave.Visible = false; btnCancel.Visible = false; btnAdd.Visible = true; dgv_login.Enabled = true; clear(); } } catch (Exception ex) { MessageBox.Show(ex.Message + "\n" + ex.StackTrace); } }
private void btnSave_Click(object sender, EventArgs e) { try { if (lblerror1.Visible == true) { MessageBox.Show("Specialization sub Title is already in use!", "", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (txtTitle.Text == string.Empty) { MessageBox.Show("Please complete the required data!", "", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { int sector = DBAccess.get_cmb_data(cmbSector.Text, "sp_get_cmb_sector", "sector_id"); int spec = DBAccess.get_cmb_data(cmbSpec.Text, "sp_get_cmb_specialization", "specialization_id"); if (cmbSpec.Text == string.Empty) { spec = 106; } else { spec = DBAccess.get_cmb_data(cmbSpec.Text, "sp_get_cmb_specialization", "specialization_id"); } sub = new specializationSub(spec.ToString(), sector.ToString(), txtTitle.Text); DBAccess.insert_specialization_sub(sub); dgv_sub.DataSource = DBAccess.dataTableLoad("sp_load_specialization_sub"); logs = new auditTrail(frm_login.UserName, "Added a Specialization sub "); DBAccess.insert_logs(logs); MessageBox.Show("Successfully Added!", "", MessageBoxButtons.OK, MessageBoxIcon.Information); clear(); } } catch (Exception ex) { MessageBox.Show(ex.Message + "\n" + ex.StackTrace); } }
private void btnSave_Click(object sender, EventArgs e) { try { if (lblerror1.Visible == true) { MessageBox.Show("Institution sub type is already in use!", "", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (txtTitle.Text == string.Empty) { MessageBox.Show("Please complete the required data!", "", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { int host_main = DBAccess.get_cmb_data(txtOrgtype.Text, "sp_get_cmb_institution_Main", "host_org_type_id"); iSub = new institutionTypeSUB(host_main.ToString(), txtTitle.Text, chbisNGO.Checked ? 1 : 0); DBAccess.insert_institution_Sub(iSub); logs = new auditTrail(frm_login.UserName, "Added a Organization sub type"); DBAccess.insert_logs(logs); MessageBox.Show("Successfully Added!", "", MessageBoxButtons.OK, MessageBoxIcon.Information); dgv_orgTypeSUB.DataSource = DBAccess.dataTableLoad("sp_load_institution_type_Sub"); btnUpdate.Visible = true; btnAdd.Visible = true; btnUpdate.Visible = true; btnSave.Visible = false; btnCancel.Visible = false; dgv_orgTypeSUB.Enabled = true; clear(); } } catch (Exception ex) { MessageBox.Show(ex.Message + "\n" + ex.StackTrace); } }
private void btnUpdate_Click(object sender, EventArgs e) { try { if (txtID.Text == string.Empty || txtID.Text == "(Auto Generated)") { MessageBox.Show("Please select user to update!", "", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (txtTitle.Text == string.Empty) { MessageBox.Show("Please input Institution Main type!", "", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { int host_main = DBAccess.get_cmb_data(txtOrgtype.Text, "sp_get_cmb_institution_Main", "host_org_type_id"); iSub = new institutionTypeSUB(int.Parse(txtID.Text), host_main.ToString(), txtTitle.Text, chbisNGO.Checked ? 1:0); DBAccess.update_institution_Sub(iSub); dgv_orgTypeSUB.DataSource = DBAccess.dataTableLoad("sp_load_institution_type_Sub"); logs = new auditTrail(frm_login.UserName, "Updated Organization sub type id " + txtID.Text); DBAccess.insert_logs(logs); MessageBox.Show("Successfully Updated!", "", MessageBoxButtons.OK, MessageBoxIcon.Information); clear(); } } catch (Exception ex) { MessageBox.Show(ex.Message + "\n" + ex.StackTrace); } // clear(); }
private void btnSave_Click(object sender, EventArgs e) { try { if (lblerror1.Visible == true) { MessageBox.Show("IVSO name is already in use!", "", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (txtUsername.Text == string.Empty) { MessageBox.Show("Please complete the required data!", "", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { iv = new Ivso(txtUsername.Text); DBAccess.insert_ivso(iv); logs = new auditTrail(frm_login.UserName, "Added a IVSO"); DBAccess.insert_logs(logs); MessageBox.Show("Successfully Added!", "", MessageBoxButtons.OK, MessageBoxIcon.Information); dgv_ivso.DataSource = DBAccess.dataTableLoad("sp_load_vol_org_pop_up"); btnUpdate.Visible = true; btnAdd.Visible = true; btnUpdate.Visible = true; btnSave.Visible = false; btnCancel.Visible = false; dgv_ivso.Enabled = true; dgv_ivso.Enabled = true; clear(); } } catch (Exception ex) { MessageBox.Show(ex.Message + "\n" + ex.StackTrace); } }
private void btnUpdate_Click(object sender, EventArgs e) { try { if (lblerror1.Visible == true) { MessageBox.Show("Sector name is already in use!", "", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (txtID.Text == string.Empty || txtID.Text == "(Auto Generated)") { MessageBox.Show("Please select user to update!", "", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (txtTitle.Text == string.Empty) { MessageBox.Show("Please input Insitution type!", "", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { sec = new sector(int.Parse(txtID.Text), txtTitle.Text); DBAccess.update_sector(sec); dgv_sector.DataSource = DBAccess.dataTableLoad("sp_load_sector"); logs = new auditTrail(frm_login.UserName, "Updated sector id " + txtID.Text); DBAccess.insert_logs(logs); MessageBox.Show("Successfully Updated!", "", MessageBoxButtons.OK, MessageBoxIcon.Information); clear(); } } catch (Exception ex) { MessageBox.Show(ex.Message + "\n" + ex.StackTrace); } // clear(); }
private void btnSave_Click(object sender, EventArgs e) { if (lblerror2.Visible == true) { MessageBox.Show("Password does not match!", "", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { log_info = new loginInformation(txtSearch.Text, txtPassword.Text); DBAccess.update_login_password(log_info); logs = new auditTrail(txtSearch.Text, "Recover his/her account "); DBAccess.insert_logs(logs); MessageBox.Show("Password successfully change!", "", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } }
private void btnDel_Click(object sender, EventArgs e) { if (id2 == 0 || dgv_proj.RowCount == 0) { MessageBox.Show("Please select Project ID!", "System Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (DBAccess.find("sp_check_project", id2)) { MessageBox.Show("Project is Active! currently being use!", "System Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { if (!DBAccess.findAcct("SELECT * FROM t_project WHERE project_id = '" + id2 + "' ")) { MessageBox.Show("Please select Project ID!", "System Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { if (MessageBox.Show("Are you sure you want to delete this Project ID " + id2, "Confirm Action", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes) { DBAccess.deleteData("sp_delete_host_proj", id2); dgv_proj.DataSource = DBAccess.dtProject("sp_load_project", id); logs = new auditTrail(frm_login.UserName, "Deleted Project ID " + id2); DBAccess.insert_logs(logs); clear(); txtID.Text = "(Auto generated)"; enabled(false); MessageBox.Show("Successfully deleted!", "Successful!", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } }
private void btnSave_Click(object sender, EventArgs e) { try { if (lblerror1.Visible == true) { MessageBox.Show("Institution Main type is already in use!", "", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (txtTitle.Text == string.Empty) { MessageBox.Show("Please complete the required data!", "", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { iMain = new institutionTypeMain(txtTitle.Text); DBAccess.insert_institution_Main(iMain); logs = new auditTrail(frm_login.UserName, "Added a Organization type "); DBAccess.insert_logs(logs); MessageBox.Show("Successfully Added!", "", MessageBoxButtons.OK, MessageBoxIcon.Information); dgv_orgType.DataSource = DBAccess.dataTableLoad("sp_load_institution_type"); btnUpdate.Visible = true; btnAdd.Visible = true; btnUpdate.Visible = true; btnSave.Visible = false; btnCancel.Visible = false; dgv_orgType.Enabled = true; clear(); } } catch (Exception ex) { MessageBox.Show(ex.Message + "\n" + ex.StackTrace); } }
private void btnUpdate_Click(object sender, EventArgs e) { try { if (txtID.Text == string.Empty || txtID.Text == "(Auto Generated)") { MessageBox.Show("Please select user to update!", "", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (txtUsername.Text == string.Empty) { MessageBox.Show("Please complete input IVSO name!", "", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { iv = new Ivso(int.Parse(txtID.Text), txtUsername.Text); DBAccess.update_ivso(iv); dgv_ivso.DataSource = DBAccess.dataTableLoad("sp_load_vol_org_pop_up"); logs = new auditTrail(frm_login.UserName, "Updated IVSO id " + txtID.Text); DBAccess.insert_logs(logs); MessageBox.Show("Successfully Updated!", "", MessageBoxButtons.OK, MessageBoxIcon.Information); clear(); } } catch (Exception ex) { MessageBox.Show(ex.Message + "\n" + ex.StackTrace); } clear(); }
private void btnUpdate_Click(object sender, EventArgs e) { try { if (txtID.Text == string.Empty || txtID.Text == "(Auto Generated)") { MessageBox.Show("Please select user to update!", "", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (txtTitle.Text == string.Empty) { MessageBox.Show("Please input Insitution type!", "", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { iMain = new institutionTypeMain(int.Parse(txtID.Text), txtTitle.Text); DBAccess.update_institution_Main(iMain); dgv_orgType.DataSource = DBAccess.dataTableLoad("sp_load_institution_type"); logs = new auditTrail(frm_login.UserName, "Updated Organization type id " + txtID.Text); DBAccess.insert_logs(logs); MessageBox.Show("Successfully Updated!", "", MessageBoxButtons.OK, MessageBoxIcon.Information); clear(); } } catch (Exception ex) { MessageBox.Show(ex.Message + "\n" + ex.StackTrace); } // clear(); }
private void btnView_Click(object sender, EventArgs e) { DataTable dt = new DataTable(); MySqlCommand cmd = new MySqlCommand(); cmd.Connection = DBConnection.connection(); MySqlDataAdapter adp = new MySqlDataAdapter(); MySqlDataReader reader = null; dt = new DataTable(); sql = sql2; int vol_org_id = DBAccess.get_cmb_data(txtVolOrg.Text, "sp_get_vol_org", "vol_org_id"); int host_org_id = DBAccess.get_cmb_data(txtHostOrg.Text, "sp_get_host_org_id", "host_org_id"); int proj_id = DBAccess.get_cmb_data(txtProj.Text, "sp_get_project_id", "project_id"); int req_stat_id = DBAccess.get_cmb_data(cmbReqStatus.Text, "sp_get_cmb_req_status", "request_status_ID"); if (txtReqStatus.Text != "n/a") { sql = sql + " AND req.`request_status_id` = @reqStatus "; cmd.Parameters.AddWithValue("@reqStatus", req_stat_id); } // if (tabControl1.Controls[0] == tabControl1.SelectedTab) // { if (txtReceivedFrom.Text == string.Empty && txtReceivedTo.Text == string.Empty) { error = false; // goto awit; } else if (txtReceivedFrom.Text != "" && txtReceivedTo.Text == "") { MessageBox.Show("Incorrect dates", "System Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); error = true; goto finish; } else if (txtReceivedFrom.Text == "" && txtReceivedTo.Text != "") { MessageBox.Show("Incorrect dates", "System Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); error = true; goto finish; } else if (dtReceivedFrom.Value > dtReceivedTo.Value) { MessageBox.Show("Incorrect dates", "System Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); error = true; goto finish; } else { sql = sql + " AND req.`date_received` BETWEEN @date1 and @date2 "; cmd.Parameters.AddWithValue("@date1", txtReceivedFrom.Text); cmd.Parameters.AddWithValue("@date2", txtReceivedTo.Text); error = false; } // } // if (tabControl1.Controls[1] == tabControl1.SelectedTab) // { if (txtAssessedFrom.Text == string.Empty && txtAssessedTo.Text == string.Empty) { error = false; // goto awit; } else if (txtAssessedFrom.Text != "" && txtAssessedTo.Text == "") { MessageBox.Show("Incorrect dates", "System Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); error = true; goto finish; } else if (txtAssessedFrom.Text == "" && txtAssessedTo.Text != "") { MessageBox.Show("Incorrect dates", "System Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); error = true; goto finish; } else if (dtAssessedFrom.Value > dtAssessedTo.Value) { MessageBox.Show("Incorrect dates", "System Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); error = true; goto finish; } else { sql = sql + " AND req.`date_assessed` between @date3 and @date4 "; cmd.Parameters.AddWithValue("@date3", txtAssessedFrom.Text); cmd.Parameters.AddWithValue("@date4", txtAssessedTo.Text); error = false; } // } // if (tabControl1.Controls[2] == tabControl1.SelectedTab) // { if (txtApprovedFrom.Text == string.Empty && txtApprovedTo.Text == string.Empty) { error = false; //goto awit; } else if (txtApprovedFrom.Text != "" && txtApprovedTo.Text == "") { MessageBox.Show("Incorrect dates", "System Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); error = true; goto finish; } else if (txtApprovedFrom.Text == "" && txtApprovedTo.Text != "") { MessageBox.Show("Incorrect dates", "System Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); error = true; goto finish; } else if (dtApprovedFrom.Value > dtApprovedTo.Value) { MessageBox.Show("Incorrect dates", "System Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); error = true; goto finish; } else { sql = sql + " AND req.`date_approved` BETWEEN @date5 and @date6 "; cmd.Parameters.AddWithValue("@date5", txtApprovedFrom.Text); cmd.Parameters.AddWithValue("@date6", txtApprovedTo.Text); error = false; } // } // // if (tabControl2.Controls[0] == tabControl1.SelectedTab) // { if (txtLettetintentFrom.Text == string.Empty && txtLetterIntentTo.Text == string.Empty) { error = false; // goto awit; } else if (txtLettetintentFrom.Text != "" && txtLetterIntentTo.Text == "") { MessageBox.Show("Incorrect dates", "System Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); error = true; goto finish; } else if (txtLettetintentFrom.Text == "" && txtLetterIntentTo.Text != "") { MessageBox.Show("Incorrect dates", "System Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); error = true; goto finish; } else if (dtLettetintentFrom.Value > dtLetterIntentTo.Value) { MessageBox.Show("Incorrect dates", "System Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); error = true; goto finish; } else { sql = sql + " AND req.`date_letter_intent` BETWEEN @date7 and @date8 "; cmd.Parameters.AddWithValue("@date7", txtLettetintentFrom.Text); cmd.Parameters.AddWithValue("@date8", txtLetterIntentTo.Text); error = false; } // } // if (tabControl2.Controls[1] == tabControl1.SelectedTab) // { if (txtSiteAssestmentFrom.Text == string.Empty && txtSiteAssestmentTo.Text == string.Empty) { error = false; // goto awit; } else if (txtSiteAssestmentFrom.Text != "" && txtSiteAssestmentTo.Text == "") { MessageBox.Show("Incorrect dates", "System Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); error = true; goto finish; } else if (txtSiteAssestmentFrom.Text == "" && txtSiteAssestmentTo.Text != "") { MessageBox.Show("Incorrect dates", "System Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); error = true; goto finish; } else if (dtSiteAssestmentFrom.Value > dtSiteAssestmentTo.Value) { MessageBox.Show("Incorrect dates", "System Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); error = true; goto finish; } else { sql = sql + " AND req.`date_site_assesment` between @date9 and @date10 "; cmd.Parameters.AddWithValue("@date9", txtSiteAssestmentFrom.Text); cmd.Parameters.AddWithValue("@date10", txtSiteAssestmentTo.Text); error = false; } // } // if (tabControl2.Controls[2] == tabControl1.SelectedTab) // { if (txtRFVFormFrom.Text == string.Empty && txtRFVFormTo.Text == string.Empty) { error = false; // goto awit; } else if (txtRFVFormFrom.Text != "" && txtRFVFormTo.Text == "") { MessageBox.Show("Incorrect dates", "System Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); error = true; goto finish; } else if (txtRFVFormFrom.Text == "" && txtRFVFormTo.Text != "") { MessageBox.Show("Incorrect dates", "System Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); error = true; goto finish; } else if (dtRFVFormFrom.Value > dtRFVFormTo.Value) { MessageBox.Show("Incorrect dates", "System Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); error = true; goto finish; } else { sql = sql + " AND req.`date_approved` BETWEEN @date11 and @date12 "; cmd.Parameters.AddWithValue("@date11", txtRFVFormFrom.Text); cmd.Parameters.AddWithValue("@date12", txtRFVFormTo.Text); error = false; } // } //awit: if (txtHostOrg.Text != string.Empty) { sql = sql + " AND req.`host_org_id` =@hostOrgID"; cmd.Parameters.AddWithValue("@hostOrgID", host_org_id); } if (txtProj.Text != string.Empty) { sql = sql + " AND req.`project_id` =@projID"; cmd.Parameters.AddWithValue("@projID", proj_id); } if (txtVolOrg.Text != string.Empty) { sql = sql + " AND req.`vol_org_id`=@volOrgID"; cmd.Parameters.AddWithValue("@volOrgID", vol_org_id); } finish: cmd.CommandText = sql + "ORDER BY req.`date_created` "; sql3 = sql; if (error == true) { dgv_RFV.DataSource = null; } else { try { reader = cmd.ExecuteReader(); dt.Load(reader); dgv_RFV.DataSource = dt; dt2 = dt; logs = new auditTrail(frm_login.UserName, "Generate Reports from RFV Records"); DBAccess.insert_logs(logs); } catch (MySqlException ex) { MessageBox.Show(ex.Message, "System Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { cmd.Dispose(); cmd.Connection.Dispose(); reader.Dispose(); } } }
private void btnUpdate_Click(object sender, EventArgs e) { bool flag = false; if (lblError.Visible == true) { MessageBox.Show("Error in updating Volunteer Info!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (check() == true) { MessageBox.Show("Please input all required fields! (If not applicable please indicate n/a)", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (id == 0) { MessageBox.Show("Bug in raw ID! hindi nakuha ung raw Id sa pag double click sa datatable Volunteer"); } else { try { if (picturePathUponUploading != "") { try { path = Functions.GetSettingItem(Application.StartupPath + @"\\Settings.ini", "volPicturePath"); dest = path + Functions.generateRandomString() + Path.GetExtension(picturePathUponUploading); File.Copy(picturePathUponUploading, dest); try { File.Delete(destForDelete); }catch (Exception ex) {} } catch (Exception ex) { flag = true; MessageBox.Show(ex.Message); goto awit; } } int prov = DBAccess.get_cmb_data(cmbProvince.Text, "sp_get_cmb_province", "prov_id"); int reg = DBAccess.get_cmb_data(cmbRegion.Text, "sp_get_cmb_region", "region_id"); int org = DBAccess.get_cmb_data(txtOrganization.Text, "sp_get_vol_org", "vol_org_id"); vol = new volunteer(id, txtRefNo.Text.Trim(), txtName.Text.Trim(), org.ToString(), cmbSex.Text.Trim(), Convert.ToDateTime(txtbday.Text.Trim()), txtAddressNo.Text.Trim(), txtAddressStreet.Text.Trim(), txtAddressCity.Text.Trim(), prov.ToString(), reg.ToString(), txtEmail.Text.Trim(), txtMobileNumber.Text.Trim(), txtArrival.Text.Trim(), txtDeparture.Text.Trim(), txtVisa.Text.Trim(), txtPassport.Text.Trim(), rtbRemarks.Text.Trim(), dest ); DBAccess.update_volunteer(vol); logs = new auditTrail(frm_login.UserName, "Updated Volunteer id " + txtRefNo.Text); DBAccess.insert_logs(logs); MessageBox.Show("Successfully Updated!", "", MessageBoxButtons.OK, MessageBoxIcon.Information); awit: if (flag == false) { this.Close(); } } catch (Exception ex) { MessageBox.Show(ex.Message + "\n" + ex.StackTrace); } } }
private void btnView_Click(object sender, EventArgs e) { DataTable dt = new DataTable(); MySqlCommand cmd = new MySqlCommand(); cmd.Connection = DBConnection.connection(); MySqlDataAdapter adp = new MySqlDataAdapter(); MySqlDataReader reader = null; dt = new DataTable(); sql = sql2; int prov = DBAccess.get_cmb_data(cmbProvince.Text, "sp_get_cmb_province", "prov_id"); int reg = DBAccess.get_cmb_data(cmbRegion.Text, "sp_get_cmb_region", "region_id"); int vol_org_id = DBAccess.get_cmb_data(txtVolOrg.Text, "sp_get_vol_org", "vol_org_id"); int host_org_id = DBAccess.get_cmb_data(txtHostOrg.Text, "sp_get_host_org_id", "host_org_id"); int proj_id = DBAccess.get_cmb_data(txtProj.Text, "sp_get_project_id", "project_id"); int vol_status = DBAccess.get_cmb_data(cmbVolStatus.Text, "sp_get_cmb_vol_status", "status_id"); int sector = DBAccess.get_cmb_data(cmbSector.Text, "sp_get_cmb_sector", "sector_id"); int spec; int spec_sub; if (cmbSpecialization.Text == string.Empty) { spec = 106; } else { spec = DBAccess.get_cmb_data(cmbSpecialization.Text, "sp_get_cmb_specialization", "specialization_id"); } if (cmbSpecializationSub.Text == "") { spec_sub = 1; } else { spec_sub = DBAccess.get_cmb_data(cmbSpecializationSub.Text, "`sp_get_cmb_specializationSUB`", "specialization_sub_id"); } ////// if (tabControl1.Controls[0] == tabControl1.SelectedTab) { if (txtInserviceTo.Text == string.Empty && txtInserviceFrom.Text == string.Empty) { error = false; goto awit; } else if (txtInserviceFrom.Text != "" && txtInserviceTo.Text == "") { MessageBox.Show("Incorrect dates", "System Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); error = true; goto finish; } else if (txtInserviceFrom.Text == "" && txtInserviceTo.Text != "") { MessageBox.Show("Incorrect dates", "System Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); error = true; goto finish; } else if (dtInserviceFrom.Value > dtInserviceTo.Value) { MessageBox.Show("Incorrect dates", "System Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); error = true; goto finish; } else { sql = sql + " AND sub.`asst_start` <= @date1 and sub.`asst_end` >= @date2 "; cmd.Parameters.AddWithValue("@date1", txtInserviceTo.Text); cmd.Parameters.AddWithValue("@date2", txtInserviceFrom.Text); error = false; } } if (tabControl1.Controls[1] == tabControl1.SelectedTab) { if (txtDplymentFrom.Text == string.Empty && txtDplymentTo.Text == string.Empty) { error = false; goto awit; } else if (txtDplymentFrom.Text != "" && txtDplymentTo.Text == "") { MessageBox.Show("Incorrect dates", "System Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); error = true; goto finish; } else if (txtDplymentFrom.Text == "" && txtDplymentTo.Text != "") { MessageBox.Show("Incorrect dates", "System Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); error = true; goto finish; } else if (dtDplymentFrom.Value > dtDplymentTo.Value) { MessageBox.Show("Incorrect dates", "System Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); error = true; goto finish; } else { sql = sql + " AND sub.`asst_start` <= @date1 and sub.`asst_start` >= @date2 "; cmd.Parameters.AddWithValue("@date1", txtDplymentTo.Text); cmd.Parameters.AddWithValue("@date2", txtDplymentFrom.Text); error = false; } } if (tabControl1.Controls[2] == tabControl1.SelectedTab) { if (txtEndTo.Text == string.Empty && txtEndFrom.Text == string.Empty) { error = false; goto awit; } else if (txtEndTo.Text != "" && txtEndFrom.Text == "") { MessageBox.Show("Incorrect dates", "System Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); error = true; goto finish; } else if (txtEndTo.Text == "" && txtEndFrom.Text != "") { MessageBox.Show("Incorrect dates", "System Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); error = true; goto finish; } else if (dtEndFrom.Value > dtEndTo.Value) { MessageBox.Show("Incorrect dates", "System Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); error = true; goto finish; } else { sql = sql + " AND sub.`asst_end` <= @date1 and sub.`asst_end` >= @date2 "; cmd.Parameters.AddWithValue("@date1", txtEndTo.Text); cmd.Parameters.AddWithValue("@date2", txtEndFrom.Text); error = false; } } if (tabControl1.Controls[3] == tabControl1.SelectedTab) { if (txtvolstatus.Text != string.Empty) { sql = sql + " AND sub.vol_status_id = @volStatus"; cmd.Parameters.AddWithValue("@volStatus", vol_status); } if (txtFrom.Text == string.Empty && txtTo.Text == string.Empty) { error = false; goto awit; } else if (txtFrom.Text != "" && txtTo.Text == "") { MessageBox.Show("Incorrect dates", "System Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); error = true; goto finish; } else if (txtFrom.Text == "" && txtTo.Text != "") { MessageBox.Show("Incorrect dates", "System Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); error = true; goto finish; } else if (dtStartOfAssistance.Value > dtEndOfAssistance.Value) { MessageBox.Show("Incorrect dates", "System Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); error = true; goto finish; } else { sql = sql + " AND sub.`asst_start` <= @date1 and sub.`asst_end` >= @date2"; cmd.Parameters.AddWithValue("@date1", txtTo.Text); cmd.Parameters.AddWithValue("@date2", txtFrom.Text); error = false; } } awit: if (txtHostOrg.Text != string.Empty) { sql = sql + " AND req.`host_org_id` =@hostOrgID"; cmd.Parameters.AddWithValue("@hostOrgID", host_org_id); } if (txtProj.Text != string.Empty) { sql = sql + " AND req.`project_id` =@projID"; cmd.Parameters.AddWithValue("@projID", proj_id); } if (txtVolOrg.Text != string.Empty) { sql = sql + " AND req.`vol_org_id`=@volOrgID"; cmd.Parameters.AddWithValue("@volOrgID", vol_org_id); } if (txtsectr.Text != string.Empty) { sql = sql + " AND sub.`sector_id` =@secID"; cmd.Parameters.AddWithValue("@secID", sector); } if (txtspec.Text != string.Empty) { sql = sql + " AND sub.`specialization_id`=@specID"; cmd.Parameters.AddWithValue("@specID", spec); } if (txtspec_sub.Text != string.Empty) { sql = sql + " AND sub.`specialization_sub_id` =@specSubID"; cmd.Parameters.AddWithValue("@specSubID", spec_sub); } if (txtReg.Text != string.Empty) { sql = sql + " AND proj.`region_id` =@regID"; cmd.Parameters.AddWithValue("@regID", reg); } if (txtprv.Text != string.Empty) { sql = sql + " AND proj.`prov_id` = @provID"; cmd.Parameters.AddWithValue("@provID", prov); } finish: cmd.CommandText = sql + " ORDER BY sub.date_entry DESC"; sql3 = sql; if (error == true) { dgv_vol.DataSource = null; } else { try { reader = cmd.ExecuteReader(); dt.Load(reader); dgv_vol.DataSource = dt; dt2 = dt; logs = new auditTrail(frm_login.UserName, "Generate Reports from Volunteer Activities "); DBAccess.insert_logs(logs); } catch (MySqlException ex) { MessageBox.Show(ex.Message, "System Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { cmd.Dispose(); cmd.Connection.Dispose(); } } }
private void btnLogin_Click(object sender, EventArgs e) { if (txtpassword.Text == string.Empty && txtpassword.Text == string.Empty) { MessageBox.Show("Please input Username and Password!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (txtpassword.Text == string.Empty) { MessageBox.Show("Please input Password!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (txtusername.Text == string.Empty) { MessageBox.Show("Please input Username!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { isActive = DBAccess.get_data_login("sp_login_check_if_active", txtusername.Text, txtpassword.Text, "isActive"); if (!DBAccess.find("sp_login", txtusername.Text, txtpassword.Text)) { MessageBox.Show("Incorrect Username or Password !", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); this.ActiveControl = txtpassword; temp -= 1; } else if (isActive != "1") { MessageBox.Show("Your account is deactivated !", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); txtpassword.isPassword = true; } else { userID = DBAccess.get_data_login("sp_login_get_id", txtusername.Text, txtpassword.Text, "ID"); userName = DBAccess.get_data_login("sp_login_get_name", txtusername.Text, txtpassword.Text, "login_name"); userLvl = int.Parse(DBAccess.get_data_login("sp_login_get_userlevel", txtusername.Text, txtpassword.Text, "userLevel")); logs = new auditTrail(userName, "Logged in"); if (userLvl == 2) { frm_dashboard ds = new frm_dashboard(); DBAccess.insert_logs(logs); this.Hide(); ds.ShowDialog(); } else { frm_dashboard ds = new frm_dashboard(); ds.h.bunifuFlatButton2.Enabled = false; ds.v.bunifuFlatButton2.Enabled = false; ds.r.bunifuFlatButton2.Enabled = false; ds.btnMaintenance.Visible = false; DBAccess.insert_logs(logs); this.Hide(); ds.ShowDialog(); } if (bunifuCheckbox1.Checked == true) { Settings.Default.username = txtusername.Text; Settings.Default.password = txtpassword.Text; Settings.Default.check = true; Settings.Default.Save(); } else { Settings.Default.username = "******"; Settings.Default.password = "******"; Settings.Default.check = false; Settings.Default.Save(); } } lblattempt.Text = temp.ToString(); if (temp == 0) { MessageBox.Show("You have been reach the maximum trial for " + "entering Username and Password.This system will now EXIT.", "System Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); Application.Exit(); } } }
private void btnUpdate_Click(object sender, EventArgs e) { if (lblError.Visible == true) { MessageBox.Show("Error in Saving Request Info!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (txtRefNo.Text == string.Empty) { MessageBox.Show("Ref. No is required!", "Error in Saving!", MessageBoxButtons.OK, MessageBoxIcon.Error); this.ActiveControl = txtRefNo; txtRefNo.Focus(); } else if (txtSECRegistration.Text == string.Empty && isNgo == 1) { MessageBox.Show("Sec Registration is required in NGO!", "Error in Saving!", MessageBoxButtons.OK, MessageBoxIcon.Error); this.ActiveControl = txtSECRegistration; txtSECRegistration.Focus(); } else if (check()) { lblerror1.Visible = true; lblerror2.Visible = true; lblerror3.Visible = true; if (txtHostOrg.Text != string.Empty) { lblerror1.Visible = false; } if (txtProj.Text != string.Empty) { lblerror2.Visible = false; } if (txtVolOrg.Text != string.Empty) { lblerror3.Visible = false; } MessageBox.Show("Please complete the fields!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (req_id == 0) { MessageBox.Show("Bug in ID!"); } else { try { int vol_org_id = DBAccess.get_cmb_data(txtVolOrg.Text, "sp_get_vol_org", "vol_org_id"); int host_org_id = DBAccess.get_cmb_data(txtHostOrg.Text, "sp_get_host_org_id", "host_org_id"); int proj_id = DBAccess.get_cmb_data(txtProj.Text, "sp_get_project_id", "project_id"); int req_stat_id = DBAccess.get_cmb_data(cmbRequestStatus.Text, "sp_get_cmb_req_status", "request_status_ID"); req = new request(req_id, txtRefNo.Text, txtDuration.Text, host_org_id.ToString(), proj_id.ToString(), vol_org_id.ToString(), txtDateReceived.Text, txtDateAssesed.Text, txtDateApproved.Text, req_stat_id.ToString(), rtbRemarks.Text, txtLetterOfIntent.Text, txtRFV.Text, txtSiteAssestment.Text, txtSECRegistration.Text, txtAFVOR.Text, chbCompleteRequirement.Checked ? 1 : 0, txtDateCompletion.Text, rtbRequirementRemarks.Text ); DBAccess.update_request(req); logs = new auditTrail(frm_login.UserName, "Updated Request ID " + txtRefNo.Text); DBAccess.insert_logs(logs); MessageBox.Show("Successfully Updated!", "", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message + "\n" + ex.StackTrace); } } }