private void dgvHousehold_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == 0) { householdEL.Householdid = Convert.ToInt32(dgvHousehold.SelectedRows[0].Cells["householdid"].Value); householdEL = householdBL.Select(householdEL); txtHousehold.Text = householdEL.Household + " (" + householdEL.Householdnumber + ")"; ShowHouseholds(false); } }
public EL.Registrations.Households Select(EL.Registrations.Households householdEL) { DataTable dt = Helper.executeQuery("select * from households where householdid = '" + householdEL.Householdid + "'"); if (dt.Rows.Count > 0) { householdEL.Householdid = Convert.ToInt32(dt.Rows[0]["householdid"]); householdEL.Household = dt.Rows[0]["household"].ToString(); householdEL.Householdnumber = dt.Rows[0]["householdnumber"].ToString(); return(householdEL); } else { return(null); } }
private void dgv_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == 0 | e.ColumnIndex == 1 | e.ColumnIndex == 2) { householdEL.Householdid = Convert.ToInt32(dgv.SelectedRows[0].Cells["householdid"].Value); } if (e.ColumnIndex == 0) { s = "VIEW"; ShowView(); lblTitle.Text = "View Household"; householdEL = householdBL.Select(householdEL); lblHousehold.Text = householdEL.Household; lblHouseHoldNumber.Text = householdEL.Householdnumber; var dt = residentBL.ListByHousehold(householdEL.Householdid); lblTotal.Text = "Total Number of Family Member: " + dt.Rows.Count; methods.LoadDGV(dgvHouseholdmembers, dt); methods.DGVRenameColumns(dgvHouseholdmembers, "Household Member", "Last Name", "First Name", "Middle Name"); methods.DGVTheme(dgvHouseholdmembers); } else if (e.ColumnIndex == 1) { s = "EDIT"; ShowAddEdit(); lblTitle.Text = "Updating Household"; householdEL = householdBL.Select(householdEL); txtHousehold.Text = householdEL.Household; txtHouseholdNumber.Text = householdEL.Householdnumber; } else if (e.ColumnIndex == 2) { DialogResult dialogResult = MessageBox.Show("ARE YOU SURE TO DELETE THIS SELECTED ITEM?", "DELETING", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { ShowResult(householdBL.Delete(householdEL)); } } }
public Boolean Delete(EL.Registrations.Households householdEL) { return(householdDL.Delete(householdEL)); }
public Boolean Update(EL.Registrations.Households householdEL) { return(householdDL.Update(householdEL)); }
public long Insert(EL.Registrations.Households householdEL) { return(householdDL.Insert(householdEL)); }
public EL.Registrations.Households Select(EL.Registrations.Households householdEL) { return(householdDL.Select(householdEL)); }
public Boolean Delete(EL.Registrations.Households householdEL) { return(Helper.executeNonQueryBool("delete from households where householdid = '" + householdEL.Householdid + "'")); }
public Boolean Update(EL.Registrations.Households householdEL) { return(Helper.executeNonQueryBool("update households set household = '" + householdEL.Household + "', householdnumber = '" + householdEL.Householdnumber + "' where householdid = '" + householdEL.Householdid + "'")); }
public long Insert(EL.Registrations.Households householdEL) { return(Helper.executeNonQueryLong("insert into households (household, householdnumber) values ('" + householdEL.Household + "', '" + householdEL.Householdnumber + "')")); }
private void dgv_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == 0 | e.ColumnIndex == 1 | e.ColumnIndex == 2) { residentEL.Residentid = Convert.ToInt32(dgv.SelectedRows[0].Cells["residentid"].Value); educationEL.Residentid = residentEL.Residentid; residentreligionEL.Residentid = residentEL.Residentid; residentcivilstatusEL.Residentid = residentEL.Residentid; residentsexEL.Residentid = residentEL.Residentid; residentcitizenshipEL.Residentid = residentEL.Residentid; residentoccupationEL.Residentid = residentEL.Residentid; homeaddressEL.Residentid = residentEL.Residentid; residenthouseholdEL.Residentid = residentEL.Residentid; provincialaddressEL.Residentid = residentEL.Residentid; contactdetailEL.Residentid = residentEL.Residentid; birthinformationEL.Residentid = residentEL.Residentid; } if (e.ColumnIndex == 0) { s = "VIEW"; ShowView(); ShowHouseholds(false); lblTitle.Text = "View Resident Profile"; residentEL = residentBL.Select(residentEL); educationEL = educationBL.Select(educationEL); residentreligionEL = residentreligionBL.Select(residentreligionEL); residentcivilstatusEL = residentcivilstatusBL.Select(residentcivilstatusEL); residentsexEL = residentsexBL.Select(residentsexEL); residentcitizenshipEL = residentcitizenshipBL.Select(residentcitizenshipEL); residentoccupationEL = residentoccupationBL.Select(residentoccupationEL); homeaddressEL = homeaddressBL.Select(homeaddressEL); residenthouseholdEL = residenthouseholdBL.Select(residenthouseholdEL); provincialaddressEL = provincialaddressBL.Select(provincialaddressEL); contactdetailEL = contactdetailBL.Select(contactdetailEL); birthinformationEL = birthinformationBL.Select(birthinformationEL); purokEL.Purokid = homeaddressEL.Purokid; purokEL = purokBL.Select(purokEL); citizenshipEL.Citizenshipid = residentcitizenshipEL.Citizenshipid; citizenshipEL = citizenshipBL.Select(citizenshipEL); householdEL.Householdid = residenthouseholdEL.Householdid; householdEL = householdBL.Select(householdEL); religionEL.Religionid = residentreligionEL.Religionid; religionEL = religionBL.Select(religionEL); sexEL.Sexid = residentsexEL.Sexid; sexEL = sexBL.Select(sexEL); civilstatusEL.Civilstatusid = residentcivilstatusEL.Civilstatusid; civilstatusEL = civilstatusBL.Select(civilstatusEL); educationalattainmentEL.Educationalattainmentid = educationEL.Educationalattainmentid; educationalattainmentEL = educationalattainmentBL.Select(educationalattainmentEL); occupationEL.Occupationid = residentoccupationEL.Occupationid; occupationEL = occupationBL.Select(occupationEL); lblBarangayIDNumber.Text = residentEL.Barangayidnumber; lblFullName.Text = residentEL.Firstname + " " + residentEL.Middlename + " " + residentEL.Lastname; lblHouseholdControl.Text = "Household Member Control: " + householdEL.Householdnumber + " " + householdEL.Household; lblAddress.Text = homeaddressEL.Housenumber + ", " + homeaddressEL.Street + ", " + homeaddressEL.Subdivision + ", " + purokEL.Purok + ", Barangay Bukay Pait, " + provincialaddressEL.Municipality + ", " + provincialaddressEL.Province; lblDateRecorded.Text = "Date Recorded: " + Convert.ToDateTime(residentEL.Daterecorded).ToString("MMMM dd, yyyy"); lblBarangayIDNumber1.Text = residentEL.Barangayidnumber; lblLastName.Text = residentEL.Lastname; lblFirstName.Text = residentEL.Firstname; lblMiddleName.Text = residentEL.Middlename; lblCitizenship.Text = citizenshipEL.Citizenship; lblReligion.Text = religionEL.Religion; lblBirthPlace.Text = birthinformationEL.Birthplace; lblBirthday.Text = Convert.ToDateTime(birthinformationEL.Birthdate).ToString("MMMM dd, yyyy"); lblGender.Text = sexEL.Sex; lblHeight.Text = residentEL.Height + " cm"; lblWeight.Text = residentEL.Weight + " kg"; lblCivilStatus.Text = civilstatusEL.Civilstatus; lblEducationalAttainment.Text = educationalattainmentEL.Educationalattainment; lblCourse.Text = educationEL.Course; lblYear.Text = educationEL.Yeargraduated; lblOccupation.Text = occupationEL.Occupation; lblHouseNumber.Text = homeaddressEL.Housenumber; lblStreet.Text = homeaddressEL.Street; lblSubdivision.Text = homeaddressEL.Subdivision; lblPurok.Text = purokEL.Purok; lblMunicipality.Text = provincialaddressEL.Municipality; lblProvince.Text = provincialaddressEL.Province; lblPrecintNumber.Text = residentEL.Precintnumber; lblEmailAddress.Text = contactdetailEL.Emailaddress; lblPhoneNumber.Text = contactdetailEL.Phonenumber; lblCellphoneNumber.Text = contactdetailEL.Cellphonenumber; lblCTCNumber.Text = residentEL.Ctcnumber; lblDateAccomplished.Text = Convert.ToDateTime(residentEL.Dateaccomplished).ToString("MMMM dd, yyyy"); } else if (e.ColumnIndex == 1) { s = "EDIT"; ShowAddEdit(); ShowHouseholds(false); lblTitle.Text = "Updating Resident"; residentEL = residentBL.Select(residentEL); educationEL = educationBL.Select(educationEL); residentreligionEL = residentreligionBL.Select(residentreligionEL); residentcivilstatusEL = residentcivilstatusBL.Select(residentcivilstatusEL); residentsexEL = residentsexBL.Select(residentsexEL); residentcitizenshipEL = residentcitizenshipBL.Select(residentcitizenshipEL); residentoccupationEL = residentoccupationBL.Select(residentoccupationEL); homeaddressEL = homeaddressBL.Select(homeaddressEL); residenthouseholdEL = residenthouseholdBL.Select(residenthouseholdEL); provincialaddressEL = provincialaddressBL.Select(provincialaddressEL); contactdetailEL = contactdetailBL.Select(contactdetailEL); birthinformationEL = birthinformationBL.Select(birthinformationEL); txtBarangayIDNumber.Text = residentEL.Barangayidnumber; txtLastName.Text = residentEL.Lastname; txtFirstName.Text = residentEL.Firstname; txtMiddleName.Text = residentEL.Middlename; txtHeight.Text = residentEL.Height; txtWeight.Text = residentEL.Weight; txtPrecintNumber.Text = residentEL.Precintnumber; txtCTCNumber.Text = residentEL.Ctcnumber; dtpDateAccomplished.Text = residentEL.Dateaccomplished; cbIsPwd.Checked = Convert.ToBoolean(residentEL.Ispwd); cbEducationalAttainment.SelectedValue = educationEL.Educationalattainmentid.ToString(); txtCourse.Text = educationEL.Course; txtYearGraduated.Text = educationEL.Yeargraduated; cbReligion.SelectedValue = residentreligionEL.Religionid.ToString(); cbCivilStatus.SelectedValue = residentcivilstatusEL.Civilstatusid; cbSex.SelectedValue = residentsexEL.Sexid; cbCitizenship.SelectedValue = residentcitizenshipEL.Citizenshipid; cbProfessionOrOccupation.SelectedValue = residentoccupationEL.Occupationid; cbPurok.SelectedValue = homeaddressEL.Purokid; txtHouseNumber.Text = homeaddressEL.Housenumber; txtStreet.Text = homeaddressEL.Street; txtSubdivision.Text = homeaddressEL.Subdivision; householdEL.Householdid = residenthouseholdEL.Householdid; householdEL = householdBL.Select(householdEL); txtHousehold.Text = householdEL.Household + " (" + householdEL.Householdnumber + ")"; cbHouseholdMember.SelectedValue = residenthouseholdEL.Householdmemberid; txtProvince.Text = provincialaddressEL.Province; txtMunicipality.Text = provincialaddressEL.Municipality; txtEmailAddress.Text = contactdetailEL.Emailaddress; txtPhoneNumber.Text = contactdetailEL.Phonenumber; txtCellphoneNumber.Text = contactdetailEL.Cellphonenumber; txtBirthPlace.Text = birthinformationEL.Birthplace; dtpBirthDate.Text = birthinformationEL.Birthdate; } else if (e.ColumnIndex == 2) { DialogResult dialogResult = MessageBox.Show("ARE YOU SURE TO DELETE THIS SELECTED ITEM?", "DELETING", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { ShowResult((birthinformationBL.Delete(birthinformationEL)) & (educationBL.Delete(educationEL)) & (residentreligionBL.Delete(residentreligionEL)) & (residentcivilstatusBL.Delete(residentcivilstatusEL)) & (residentsexBL.Delete(residentsexEL)) & (residentcitizenshipBL.Delete(residentcitizenshipEL)) & (residentoccupationBL.Delete(residentoccupationEL)) & (homeaddressBL.Delete(homeaddressEL)) & (residenthouseholdBL.Delete(residenthouseholdEL)) & (provincialaddressBL.Delete(provincialaddressEL)) & (contactdetailBL.Delete(contactdetailEL)) & (residentBL.Delete(residentEL))); } } }