public bool calcSpecialDietAndDissabled() { if (clsHH.UseFamilyList) { int specialDiet = 0; int dissabled = 0; for (int i = 0; i < clsHHmem.RowCount; i++) { HHMemberItem clsHHMemberItem = new HHMemberItem(clsHHmem.DSet.Tables[0].Rows[i], clsHHmem.DSet.Tables[0].Columns, null, null); if (clsHHMemberItem.Inactive == false) { if (clsHHMemberItem.SpecialDiet == true) { specialDiet++; } if (clsHHMemberItem.IsDisabled == true) { dissabled++; } } } if (clsHH.SpecialDiet != specialDiet || clsHH.Disabled != dissabled) { clsHH.SpecialDiet = specialDiet; clsHH.Disabled = dissabled; return(true); } } return(false); }
public void setHHMember(HHMemberItem clshhmItm) { clsHHMItem = new HHMemberItem(clshhmItm.DRowHhM , clsHHM.DSet.Tables[0].Columns , clshhmItm.DRowDemographics , clsHHM.DSet.Tables[1].Columns); modedescription = "Create Household From " + clsHHMItem.LastName + ", " + clsHHMItem.FirstName; newHHMID = clsHHMItem.ID; tbLastName.Text = clsHHMItem.LastName; tbFirstName.Text = clsHHMItem.FirstName; chkEnterAge.Checked = clsHHMItem.UseAge; tbBirthDate.Text = clsHHMItem.BirthDate.ToShortDateString(); tbAge.Text = clsHHMItem.Age.ToString(); tbSex.Text = clsHHMItem.Sex; tbMemIdNbr.Text = clsHHMItem.MemIDNbr; cboMemIDType.SelectedValue = clsHHMItem.MemIDType.ToString(); cboRace.SelectedValue = clsHHMItem.Race.ToString(); chkHispanic.Checked = clsHHMItem.Hispanic; chkSpecialDiet.Checked = clsHHMItem.SpecialDiet; chkDissabled.Checked = clsHHMItem.IsDisabled; tbPhone.Text = clsHHMItem.Phone; cboPhoneType.SelectedValue = "0"; tbeZipCode.Text = clsHH.Zipcode; tbeCity.Text = clsHH.City.Trim(); tbeState.Text = clsHH.State; cboClientType.SelectedValue = clsHH.ClientType.ToString(); cboSpecialLang.SelectedValue = clsHH.EthnicSpeaking.ToString(); }
private void FillHHMemItem(ref HHMemberItem itemHHM) { itemHHM.LastName = tbLastName.Text; itemHHM.FirstName = tbFirstName.Text; itemHHM.HeadHH = true; itemHHM.BirthDate = Convert.ToDateTime(tbBirthDate.Text); itemHHM.UseAge = chkEnterAge.Checked; itemHHM.Age = Convert.ToInt32(tbAge.Text); itemHHM.AgeGroup = clsHHM.GetEFAPAgeGroup(itemHHM.Age); itemHHM.Language = Convert.ToInt32(cboSpecialLang.SelectedValue); itemHHM.MemIDNbr = tbMemIdNbr.Text; itemHHM.MemIDType = Convert.ToInt32(cboMemIDType.SelectedValue); itemHHM.Sex = tbSex.Text; itemHHM.SpecialDiet = chkSpecialDiet.Checked; itemHHM.IsDisabled = chkDissabled.Checked; itemHHM.Race = Convert.ToInt32(cboRace.SelectedValue); itemHHM.Hispanic = chkHispanic.Checked; itemHHM.BackPack = false; itemHHM.BPExpiration = Convert.ToDateTime("01/01/1900"); itemHHM.BPSize = 0; itemHHM.BPSchool = 0; itemHHM.BPNotes = ""; itemHHM.Relationship = 1; itemHHM.EmailAddress = ""; itemHHM.Phone = ""; itemHHM.Grade = -1; itemHHM.SchSupply = false; itemHHM.SchSupplyDelivered = CCFBGlobal.FBNullDateValue; itemHHM.SchSupplySchool = 0; itemHHM.CSFP = false; itemHHM.CSFPRoute = 0; itemHHM.CSFPComments = ""; itemHHM.CSFPStatus = 0; }
/// <summary> /// Calculates the Ages of each Household Member and sets those values in the form and in the database /// </summary> public bool calcAllHHMemAges(DateTime BaseDate) { int[] AgeGroupsTotals = new int[6] { 0, 0, 0, 0, 0, 0 }; DateTime BirthDay; if (clsHH.UseFamilyList == true) { for (int i = 0; i < clsHHmem.RowCount; i++) { HHMemberItem clsHHMemberItem = new HHMemberItem(clsHHmem.DSet.Tables[0].Rows[i], clsHHmem.DSet.Tables[0].Columns, null, null); int newAge = 0; if (clsHHMemberItem.Inactive == false && clsHHMemberItem.NotCounted == false) { newAge = clsHHMemberItem.Age; if (clsHHMemberItem.UseAge == false || (clsHHMemberItem.BirthDate.ToShortDateString() != CCFBGlobal.OURNULLDATE && clsHHMemberItem.BirthDate.ToShortDateString() != CCFBGlobal.OUROTHERNULLDATE)) { BirthDay = clsHHMemberItem.BirthDate; if (BirthDay != null && BirthDay.ToShortDateString() != "" && BirthDay != DateTime.MaxValue) { newAge = CCFBGlobal.calcAge(BirthDay, BaseDate); clsHHMemberItem.Age = newAge; } } clsHHMemberItem.AgeGroup = clsHHmem.GetEFAPAgeGroup(newAge); AgeGroupsTotals[clsHHMemberItem.AgeGroup]++; } } int totalFamily = AgeGroupsTotals[CCFBGlobal.ageGroup_Infant] + AgeGroupsTotals[CCFBGlobal.ageGroup_Youth] + AgeGroupsTotals[CCFBGlobal.ageGroup_Teen] + AgeGroupsTotals[CCFBGlobal.ageGroup_Eighteen] + AgeGroupsTotals[CCFBGlobal.ageGroup_Adult] + AgeGroupsTotals[CCFBGlobal.ageGroup_Senior]; if (clsHH.Infants != AgeGroupsTotals[CCFBGlobal.ageGroup_Infant] || clsHH.Youth != AgeGroupsTotals[CCFBGlobal.ageGroup_Youth] || clsHH.Teens != AgeGroupsTotals[CCFBGlobal.ageGroup_Teen] || clsHH.Eighteens != AgeGroupsTotals[CCFBGlobal.ageGroup_Eighteen] || clsHH.Adults != AgeGroupsTotals[CCFBGlobal.ageGroup_Adult] || clsHH.Seniors != AgeGroupsTotals[CCFBGlobal.ageGroup_Senior] || clsHH.TotalFamily != totalFamily) { clsHH.Infants = AgeGroupsTotals[CCFBGlobal.ageGroup_Infant]; clsHH.Youth = AgeGroupsTotals[CCFBGlobal.ageGroup_Youth]; clsHH.Teens = AgeGroupsTotals[CCFBGlobal.ageGroup_Teen]; clsHH.Eighteens = AgeGroupsTotals[CCFBGlobal.ageGroup_Eighteen]; clsHH.Adults = AgeGroupsTotals[CCFBGlobal.ageGroup_Adult]; clsHH.Seniors = AgeGroupsTotals[CCFBGlobal.ageGroup_Senior]; clsHH.TotalFamily = totalFamily; return(true); } } return(false); }
private void addHHMember(int hhid) { if (newHHMID == 0) { clsHHM.openHHID(newHHID); clsHHMItem = new HHMemberItem(clsHHM.addHHMember(hhid, "") , clsHHM.DSet.Tables[0].Columns , clsHHM.addHHMDemographics(0) , clsHHM.DSet.Tables[1].Columns); FillHHMemItem(ref clsHHMItem); clsHHM.newHHMemberSave(clsHHMItem); } else { clsHHMItem.HouseholdID = hhid; FillHHMemItem(ref clsHHMItem); //DataRow drhhm = new DataRow() = clsHHMItem.DRowHhM; //DataRow drdemog = new DataRow() = clsHHMItem.DRowDemographics; clsHHM.DRowHhm = clsHHMItem.DRowHhM; clsHHM.DRowDemograhics = clsHHMItem.DRowDemographics; clsHHM.update(true); } }