private bool TestForHousehold(int TestHHId) { Household clsTmpHH = new Household(CCFBGlobal.connectionString); string sqlWhere = "Name = '" + CCFBGlobal.SQLApostrophe(tbLastName.Text) + ", " + CCFBGlobal.SQLApostrophe(tbFirstName.Text) + "'"; if (TestHHId > 0) { sqlWhere += " OR ID = " + TestHHId.ToString(); } clsTmpHH.openWhere(sqlWhere); return(clsTmpHH.RowCount > 0); }
public static bool SaveValue(string fldname, string newvalue) { return(doUpdate("Update " + tbName + " SET FldVal = '" + CCFBGlobal.SQLApostrophe(newvalue) + "' WHERE FldName = '" + fldname + "'") > 0); }
public bool householdMemberExists(string nameFirst, string nameLast) { int iResult = (int)CCFBGlobal.getSQLValue("SELECT Count(*) FROM HouseholdMembers WHERE LastName = '" + CCFBGlobal.SQLApostrophe(nameLast) + "' AND FirstName = '" + CCFBGlobal.SQLApostrophe(nameFirst) + "'"); return(iResult > 0); }
//private bool FillHHMemberGrid() //{ // bool HeadHHMatch = false; // int testHHId = 0; // int insertIndex = 0; // string tmp = ""; // spltcontMain.Panel2Collapsed = false; // lvwPeople.Items.Clear(); // tpgLastFirst.Text = "Loading .."; // Application.DoEvents(); // HHMembers clsTmpHHM = new HHMembers(CCFBGlobal.connectionString); // List<int> hhidList = new List<int>(); // List<ListViewGroup> hhidGroup = new List<ListViewGroup>(); // if (clsTmpHHM.openWhere(" Where SoundEx(LastName) = SoundEx('" + tbLastName.Text + "') AND SoundEx(FirstName) = SoundEx('" + tbFirstName.Text + "')", "HouseholdId, Id", false) == true) // { // for (int i = 0; i < clsTmpHHM.RowCount; i++) // { // clsTmpHHM.SetRecord(i); // testHHId = clsTmpHHM.HouseholdID; // ListViewItem lvItm = new ListViewItem(""); //clsTmpHHM.LastName); // lvItm.SubItems.Add(clsTmpHHM.FirstName); // lvItm.SubItems.Add(CCFBGlobal.ValidDateString(clsTmpHHM.Birthdate)); // lvItm.SubItems.Add(clsTmpHHM.Age.ToString()); // lvItm.SubItems.Add(clsTmpHHM.HouseholdID.ToString()); // lvItm.SubItems.Add(clsTmpHHM.Inactive.ToString()); // if (clsTmpHHM.HeadHH == true) // { // tmp = "HeadHH"; // if (tbLastName.Text.ToUpper() == clsTmpHHM.LastName.ToUpper() && tbFirstName.Text.ToUpper() == clsTmpHHM.FirstName.ToUpper()) // HeadHHMatch = true; // } // else // tmp = ""; // lvItm.SubItems.Add(tmp); // //if (i % 2 == 0) // // lvItm.BackColor = Color.White; // //else // // lvItm.BackColor = Color.LightYellow; // insertIndex = -1; // for (int j = 0; j < hhidList.Count; j++) // { // if (testHHId == hhidList[j]) // { // lvItm.Group = hhidGroup[j]; // insertIndex = j; // break; // } // } // if (insertIndex == -1) // { // hhidList.Add(testHHId); // hhidGroup.Add(MakeHouseholdGroup(testHHId, clsTmpHHM.ID)); // insertIndex = hhidGroup.Count - 1; // lvwPeople.Groups.Add(hhidGroup[insertIndex]); // lvItm.Group = hhidGroup[insertIndex]; // } // lvwPeople.Items.Add(lvItm); // } // tpgLastFirst.Text = "[ " + clsClient.clsHHmem.RowCount.ToString() + " ] " + tpgLastFirst.Tag.ToString(); // //spltcontLists.Panel1Collapsed = false; // if (addMember == true) // return true; // else // return HeadHHMatch; // } // if (addMember == false) // return TestForHousehold(0); // else // return false; //} private bool TestForBrithdateandName(string nameLast, string nameFirst, string dateBirth) { Household clsTmpHH = new Household(CCFBGlobal.connectionString); string sqlText = "SELECT hm.ID MbrId, hm.HouseholdID, h.Name, h.Address, h.City, h.State, h.Zipcode, hhm.Inactive MbrInactive, h.Inactive HhInactive FROM HouseholdMembers hm " + " INNER JOIN Household h ON hhm.HouseholdId = h.ID WHERE LastName = '" + CCFBGlobal.SQLApostrophe(tbLastName.Text) + "' AND FirstName = '" + CCFBGlobal.SQLApostrophe(tbFirstName.Text) + "' AND BirthDate = '" + dateBirth + "'"; DataTable dtblwrk = csdgdataaccess.TransferDataToLocalDataTable(sqlText); if (dtblwrk.Rows.Count > 0) { } return(true); }
private void btnSaveClient_Click(object sender, EventArgs e) { if (tbAge.Text.Trim() == "" && tbBirthDate.Text.Trim() == "") { MessageBox.Show("Cannot Save When Both Age And Birthdate Are Blank", modedescription); } else if (lblDateError.Visible == true && chkEnterAge.Checked == false) { MessageBox.Show("Cannot Save With Invalid Birthdate", modedescription); tbBirthDate.Focus(); } else { string hhName = tbLastName.Text.Trim() + ", " + tbFirstName.Text.Trim(); newHHID = 0; clsHH.openWhere("Name='" + CCFBGlobal.SQLApostrophe(tbLastName.Text.Trim()) + ", " + CCFBGlobal.SQLApostrophe(tbFirstName.Text.Trim()) + "'"); if (clsHH.ISValid == true && CCFBPrefs.AllowDuplicateHHNames == false) { MessageBox.Show("Name " + hhName + "\r\nAlready Exists In Household Table as ID = " + clsHH.ID.ToString(), modedescription, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { if (clsHHM.nameExists(CCFBGlobal.SQLApostrophe(tbFirstName.Text.Trim()), CCFBGlobal.SQLApostrophe(tbLastName.Text.Trim()), tbBirthDate.Text, true) == false || CCFBPrefs.AllowDuplicateHHNames == true || newHHMID > 0) { newRow = clsHH.DSet.Tables[0].NewRow(); newRow["Name"] = hhName; newRow["Inactive"] = 0; if (cboIDType.SelectedValue != null) { newRow["IdType"] = cboIDType.SelectedValue; } else { newRow["IdType"] = 0; } newRow["ClientType"] = cboClientType.SelectedValue; if (cboPhoneType.SelectedValue == null) { newRow["PhoneType"] = 0; } else { newRow["PhoneType"] = cboPhoneType.SelectedValue; } newRow["Phone"] = tbPhone.Text; newRow["EthnicSpeaking"] = cboSpecialLang.SelectedValue; switch (CCFBPrefs.UseFamilyList) { case CCFBPrefs.UseFamilyListCode.Normally: newRow["UseFamilyList"] = true; break; case CCFBPrefs.UseFamilyListCode.Sometimes: newRow["UseFamilyList"] = false; break; case CCFBPrefs.UseFamilyListCode.Always: newRow["UseFamilyList"] = true; break; case CCFBPrefs.UseFamilyListCode.Never: newRow["UseFamilyList"] = false; break; default: break; } newRow["Inactive"] = false; newRow["UserFlag0"] = false; newRow["UserFlag1"] = false; newRow["UserFlag2"] = false; newRow["UserFlag3"] = false; newRow["UserFlag4"] = false; newRow["UserFlag5"] = false; newRow["UserFlag6"] = false; newRow["UserFlag7"] = false; newRow["UserFlag8"] = false; newRow["UserFlag9"] = false; newRow["UserNum0"] = 0; newRow["UserNum1"] = 0; newRow["Infants"] = 0; newRow["Youth"] = 0; newRow["Teens"] = 0; newRow["Eighteen"] = 0; newRow["Adults"] = 0; newRow["Seniors"] = 0; switch (clsHHM.GetEFAPAgeGroup(Convert.ToInt32(tbAge.Text))) { case 0: { newRow["Infants"] = 1; break; } case 1: { newRow["Youth"] = 1; break; } case 2: { newRow["Teens"] = 1; break; } case 3: { newRow["Eighteen"] = 1; break; } case 4: { newRow["Adults"] = 1; break; } case 5: { newRow["Seniors"] = 1; break; } } newRow["TotalFamily"] = 1; if (cboIDType.SelectedIndex < 0) { newRow["NeedToVerifyId"] = true; } else { if (cboIDType.SelectedValue.ToString() == "0") { newRow["NeedToVerifyId"] = true; } else { newRow["NeedToVerifyId"] = false; } newRow["DateIDVerified"] = dateIdVerified; } newRow["SupplOnly"] = false; newRow["IncludeOnLog"] = true; newRow["Disabled"] = 0; newRow["SpecialDiet"] = false; newRow["NoCommodities"] = chkNoCommodities.Checked; newRow["NeedCommoditySignature"] = false; newRow["IncludeOnLog"] = false; newRow["AutoAlert"] = false; newRow["FirstSvcThisYear"] = CCFBGlobal.FBNullDateValue; newRow["SecondServiceThisMonth"] = false; newRow["InCityLimits"] = chkInCityLimits.Checked; newRow["Homeless"] = chkHomeless.Checked; newRow["LatestService"] = "01/01/1900"; newRow["AnnualIncome"] = 0; newRow["BabyServices"] = chkBabyServices.Checked; newRow["BabySvcDescr"] = tbBabySvcDescr.Text; newRow["SurveyComplete"] = 0; newRow["NbrCSFP"] = 0; newRow["Address"] = tbeAddress.Text; newRow["AptNbr"] = tbeApt.Text; newRow["City"] = tbeCity.Text; newRow["State"] = tbeState.Text; newRow["Zipcode"] = tbeZipCode.Text; newRow["CreatedBy"] = CCFBGlobal.dbUserName; newRow["Created"] = DateTime.Now; newRow["BarCode"] = 0; newRow["TEFAPSignDate"] = DateTime.Now.ToShortDateString(); newRow["SingleHeadHH"] = chkSingleHeadHH.Checked; newRow["NeedIncomeVerification"] = true; newRow["IncomeVerifiedDate"] = CCFBGlobal.FBNullDateValue; newRow["ServiceMethod"] = 0; newRow["HDRoute"] = 0; newRow["HDBuilding"] = 0; newRow["HDProgram"] = 0; newRow["HUDCategory"] = 0; newRow["HDItem"] = 0; newRow["DriverNotes"] = ""; newRow["AlertText"] = ""; newRow["Transportation"] = 0; newRow["SchSupplyPickupPerson"] = ""; newRow["SchSupplyRegDate"] = CCFBGlobal.FBNullDateValue; newRow["SchSupplyFlag"] = 0; newRow["SchSupplyRegistration"] = 0; clsHH.DSet.Tables[0].Rows.Add(newRow); clsHH.insert(); clsHH.openWhere("Name='" + CCFBGlobal.SQLApostrophe(hhName) + "' AND CREATED >='" + DateTime.Today.ToShortDateString() + "'"); newHHID = clsHH.ID; addHHMember(newHHID); this.Visible = false; } else { MessageBox.Show(tbFirstName.Text + " " + tbLastName.Text + "\r\nAlready Exists In Household Members Table", modedescription, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); tbFirstName.Focus(); } } } }