public bool LoadData(bool reset = false) { ListNameColumnPeople = new List <KeyValueClass>(); ListNameColumnPeople.Add(new KeyValueClass("Status", 0)); ListNameColumnPeople.Add(new KeyValueClass("Tz", 0)); ListNameColumnPeople.Add(new KeyValueClass("HealthStatus", 0)); List <People> lst = new List <People>(); SqlDataReader myreader; myreader = People.ReadAll(0, false, true); while (myreader.Read()) { People p = new People(); PeopleManipulations.ReaderToPeople(ref p, ref myreader, PeopleManipulations.RtpFor.ForSearch); lst.Add(p); } olstpeople.BeginUpdate(); olstpeople.SetObjects(lst); olstpeople.EndUpdate(); myreader.Close(); DBFunction.CloseConnections(); formloadmsg.Close(); return(true); }
private void txtSearchShiduch_SelectedIndexChanged(object sender, EventArgs e) { if (txtSearchShiduch.SelectedIndex > 0 || updateActivity || thisSideB || isNew_Active_From_Complete_Active) { if (newActivity && !thisSideB && !isNew_Active_From_Complete_Active) { int id = int.Parse((txtSearchShiduch.SelectedItem as KeyValueClass).Value.ToString()); SqlDataReader reader = People.ReadById(id); while (reader.Read()) { Shiduch = new People(); PeopleManipulations.ReaderToPeople(ref Shiduch, ref reader, true, true); } reader.Close(); } txtNameShiduch.Text = Shiduch.FirstName + " " + Shiduch.Lasname; txtAgeShiduch.Text = Shiduch.Age.ToString(); txtSchoolShiduch.Text = Shiduch.Details.YeshivaGorSeminary; txtAdressShiduch.Text = Shiduch.Details.Street + " " + Shiduch.City; txtWorkShiduch.Text = Shiduch.WorkPlace; btnDetailsShiduch.Enabled = true; groupBoxSideB.Text = "צד ב - " + Shiduch.FirstName + " " + Shiduch.Lasname; } else { btnDetailsShiduch.Enabled = false; txtNameShiduch.Text = ""; txtAgeShiduch.Value = 0; txtSchoolShiduch.Text = ""; txtAdressShiduch.Text = ""; txtWorkShiduch.Text = ""; Shiduch = null; } }
private void RunMatchSearch(object obj) { KeyValueClass id = new KeyValueClass(); if ((int)obj > 0) { id.Value = (int)obj; } else { id = cmb_matchclient.SelectedItem as KeyValueClass; } SqlDataReader read = People.ReadById((int)id.Value); read.Read(); People p = new People(); PeopleManipulations.ReaderToPeople(ref p, ref read, false, true); read.Close(); ArrayList results = MatchesChecks.GetMatches(p); olstmatch.SetObjects(results); olstmatch.Sort(olvColumn9); picmatch.Visible = false; lblmatchfound.Text = "נמצאו : " + olstmatch.Items.Count.ToString() + " התאמות"; }
public void openShiduchActivityForm(ListView lst, People MyPeople = null) { //עדכון פעילות if (lst.SelectedItems.Count <= 0) { return; } if (lst.Name == "lstReminder") { openReminder = true; } int idActivity = int.Parse(lst.SelectedItems[0].Tag.ToString()); // int idSideB = int.Parse(lstMyActivity.SelectedItems[0].SubItems[5].Text); s = ReadById(idActivity); //להביא את ההערות של הכרטיס השני string notesSide = removeFromString(s.NotesSummary) + "\r\n" + "=====צד ב'=====" + Environment.NewLine; string sql = "select NotesSummary from ShiduchActivity s " + "where s.UserId=" + s.UserId + " and PeopleId=" + s.IdSideB + " and IdSideB=" + s.PeopleId + " and Action=" + s.Action + " and abs(DATEDIFF(day,s.Date,'" + s.Date.ToString("yyyy-MM-dd h:mm tt") + "'))" + " between 0 and 15"; SqlDataReader reader = DBFunction.ExecuteReader(sql); if (reader.Read()) { notesSide += removeFromString(reader["NotesSummary"].ToString()); } reader.Close(); s.NotesSummary = notesSide; if (MyPeople == null) { MyPeople = new People(); SqlDataReader reader1 = People.ReadById(s.PeopleId); if (reader1.Read()) { PeopleManipulations.ReaderToPeople(ref MyPeople, ref reader1); } reader1.Close(); } ShiduchActivityForm sForm; if (openReminder)//אם נפתח דרך התזכורות { sForm = new ShiduchActivityForm(s, MyPeople, false, true, false, true); } else { sForm = new ShiduchActivityForm(s, MyPeople, false, true, false); } sForm.Show(); sForm.FormClosed += SForm_FormClosed; }
private void tabControl1_Selected(object sender, TabControlEventArgs e) { if (isFirstLoad) { // LoadShadcanim(); isFirstLoad = false; } if (e.TabPage == tabPage2) { dtActivityDatefrom.Value = DateTime.Now.AddDays(-7); LoadTab2(dtActivityDatefrom.Value, dtActivityDateto.Value); } else if (e.TabPage == tabPage3 && Tab3 == false) { //e.TabPage.BackgroundImage = Properties.Resources.bg; Tab3 = true; People p = new People(); SqlDataReader reader; reader = People.ReadAll(0, false, false, true); lstmyclients.BeginUpdate(); while (reader.Read()) { PeopleManipulations.ReaderToPeople(ref p, ref reader, PeopleManipulations.RtpFor.ForSearch); LoadResultToList(ref p, lstmyclients); } lstmyclients.EndUpdate(); reader.Close(); } else if (e.TabPage == tabPage9 && Tab9 == false) { if (cmb_matchclient.Items.Count == 1) { cmb_matchclient.Items.Add(new KeyValueClass("", 1000)); return; } cmb_matchclient.Items.Clear(); picmatch.Visible = true; ThreadPool.QueueUserWorkItem(new WaitCallback(LoadTab9)); } }
private void OpenDetails(int id, bool show = true) { FormCollection fc = Application.OpenForms; foreach (Form frm in fc) { if (frm is DetailForm) { ((DetailForm)frm).btnceratehtml.Enabled = false; ((DetailForm)frm).btnconfirm.Enabled = false; //((DetailForm)frm).btnshowinfo.Enabled = false; } } if (id == 0) { return; } SqlDataReader reader; People p = new People(); p.ID = id; reader = People.ReadById(p.ID); while (reader.Read()) { PeopleManipulations.ReaderToPeople(ref p, ref reader, true, true); } reader.Close(); DBFunction.CloseConnections(); if (GLOBALVARS.MyUser.Control == User.TypeControl.User && p.Show == (int)People.ShowTypes.Personal) { p.OpenForPersonalEdit = true; } DetailForm detail = new DetailForm(p); if (show) { detail.Show(this); } }
private void LoadTxt() { groupBoxSideA.Text += MyPeople.FirstName + " " + MyPeople.Lasname; if (MyPeople.Sexs == 2) { lblSearchShiduch.Visible = false; } lblActiveFor.Text += MyPeople.FirstName + " " + MyPeople.Lasname; //if (lblActiveFor.Location.X + lblActiveFor.Width > btnSaveOpenB.Location.X) //{ // lblActiveFor.Location = new Point(btnSaveOpenB.Location.X - lblActiveFor.Width - 20, lblActiveFor.Location.Y); //} txtName.Text = MyPeople.FirstName + " " + MyPeople.Lasname; txtAge.Value = decimal.Parse(MyPeople.Age.ToString()); txtSchool.Text = MyPeople.Details.YeshivaGorSeminary; txtAdress.Text = MyPeople.Details.Street + " " + MyPeople.City; txtWork.Text = MyPeople.WorkPlace; txtPhoneDad.Text = MyPeople.Details.Tel1; txtPhoneMom.Text = MyPeople.Details.Tel2; txtPhone.Text = MyPeople.Details.Telephone; txtDate.Text = DateTime.Now.ToString(); if (newActivity && ShiduchActivity.IdSideB == 0) { LoadSearchShiduch(); } // if (updateActivity || ShiduchActivity.IdSideB > 0) //אם הפעילות נוצרה עם צד' ב if (ShiduchActivity.IdSideB != -1 && ShiduchActivity.IdSideB != 0) { SqlDataReader reader = People.ReadById(ShiduchActivity.IdSideB); if (reader.Read()) { Shiduch = new People(); PeopleManipulations.ReaderToPeople(ref Shiduch, ref reader, true, true); } reader.Close(); KeyValueClass item = new KeyValueClass(); item.Text = Shiduch.FirstName + " " + Shiduch.Lasname + " " + Shiduch.Details.YeshivaGorSeminary + " " + Shiduch.Details.Street + " " + Shiduch.City; item.Value = Shiduch.ID.ToString(); txtSearchShiduch.Items.Add(item); txtSearchShiduch.SelectedIndex = 0; //שיהיה אותה הפעילות לשני הצדדים ולא לאפשר לשנות if (thisSideB || updateActivity) { radDate.Checked = ShiduchActivity.Action == (int)ShiduchActivity.ActionType.date; radProposal.Checked = ShiduchActivity.Action == (int)ShiduchActivity.ActionType.proposal; radProposal.Enabled = radDate.Enabled = radOther.Enabled = radDetails.Enabled = txtOther.Enabled = false; txtNotesSummary.Text = ShiduchActivity.NotesSummary; } } if (updateActivity) { Text = "פעילות " + ShiduchActivity.ConvertAction((ShiduchActivity.ActionType)ShiduchActivity.Action) + " ל"; txtDate.Text = ShiduchActivity.Date.ToString(); txtDateReminder.Value = ShiduchActivity.reminder.Date; radDate.Checked = ShiduchActivity.Action == (int)ShiduchActivity.ActionType.date; radProposal.Checked = ShiduchActivity.Action == (int)ShiduchActivity.ActionType.proposal; radDetails.Checked = ShiduchActivity.Action == (int)ShiduchActivity.ActionType.details; radOther.Checked = ShiduchActivity.Action == (int)ShiduchActivity.ActionType.other; if (radOther.Checked) { string text = ShiduchActivity.NotesSummary.Substring(0, ShiduchActivity.NotesSummary.IndexOf('^')); string t = ShiduchActivity.NotesSummary.Substring(ShiduchActivity.NotesSummary.IndexOf('^') + 3); txtOther.Text = text; txtNotesSummary.Text = t; } else { txtNotesSummary.Text = ShiduchActivity.NotesSummary; } radComplete.Checked = ShiduchActivity.Status == 1; radNoRelevant.Checked = ShiduchActivity.Status == 2; radProposal.Enabled = radDate.Enabled = radOther.Enabled = radDetails.Enabled = txtOther.Enabled = false; //אחרי שהפעילות נוצרה רק המנהל הראשי יכול לשנות אצ בטיפול של if (GLOBALVARS.MyUser.Control != User.TypeControl.Admin) { txtReminderInCare.Enabled = false; } } Text += MyPeople.FirstName + " " + MyPeople.Lasname; }
private void Search(object obj) { SqlDataReader reader; SqlParameter[] prms = new SqlParameter[25]; string Sql = ""; string AgeSql = ""; string whoami = ""; string whoiwant = ""; string sqlwhoiwant = ""; string sqlwhoami = ""; string noteswhoami = ""; string noteswhoiwant = ""; string LearnStatus = ""; string Subscription = ""; string sexs = ""; int fromage = (int)txtfromage.Value; int tillage = (int)txttillage.Value; string show = " AND SHOW <> 8 AND (show <2 or (show=5 and chadchan like '%{" + GLOBALVARS.MyUser.ID + "}%') or (show=4 and chadchan like '%{" + GLOBALVARS.MyUser.ID + "}%'))"; string IdFilter = ""; if (GLOBALVARS.MyUser.Control == User.TypeControl.Manger || GLOBALVARS.MyUser.Control == User.TypeControl.Admin) { show = " and show <> 8"; } if (txtlearnstatus.SelectedIndex != -1) { LearnStatus = BuildSql.GetSql(out prms[16], txtlearnstatus.Text, "LearnStatus", BuildSql.SqlKind.EQUAL); } if (tillage > 0) { AgeSql = BuildSql.GetSql(out prms[0], fromage, "age", BuildSql.SqlKind.BETWEEN, true, tillage); } // if(chksubscription.Checked) // Subscription= BuildSql.GetSql(out prms[17], chksubscription.Checked, "Subscription", BuildSql.SqlKind.EQUAL,false); if (txtid.Value != 0) { IdFilter = " peoples.ID=" + txtid.Value + " AND "; } if (txtwhoami.Text.Length > 0) { noteswhoami = whoami = "("; foreach (string s in splitwords(txtwhoami.Text)) { if (s.Trim().Length > 0) { whoami += " whoami like N'%" + s + "%' and"; noteswhoami += " notes like N'%" + s + "%' and"; } } whoami = whoami.Remove(whoami.Length - 3, 3); noteswhoami = noteswhoami.Remove(noteswhoami.Length - 3, 3); noteswhoami += ")"; whoami += ")"; sqlwhoami = "(" + whoami + " or " + noteswhoami + ")"; } if (txtwhoiwant.Text.Length > 0) { whoiwant = noteswhoiwant = "("; foreach (string s in splitwords(txtwhoiwant.Text)) { if (s.Trim().Length > 0) { whoiwant += " whoiwant like N'%" + s + "%' and"; noteswhoiwant += " notes like N'%" + s + "%' and"; } } whoiwant = whoiwant.Remove(whoiwant.Length - 3, 3); noteswhoiwant = noteswhoiwant.Remove(noteswhoiwant.Length - 3, 3); noteswhoiwant += ")"; whoiwant += ")"; sqlwhoiwant = "(" + whoiwant + " or " + noteswhoiwant + ")"; } if (!string.IsNullOrEmpty(whoiwant) && !string.IsNullOrEmpty(whoami)) { sqlwhoami += " and "; } if (txtsexs.SelectedIndex != -1) { sexs = BuildSql.GetSql(out prms[12], txtsexs.SelectedIndex + 1, "sexs", BuildSql.SqlKind.EQUAL); } Sql = " select schools,sexs,firstname,lastname,tall,age,City,fat," + "FaceColor,Looks,WorkPlace,Beard,Zerem,Eda,LearnStatus,DadWork," + "Background,Status,Tz,KindChasidut,HealthStatus,ZeremMom,Street," + "DadName,MomName,MomWork," + "[peopledetails].[relatedid],[Peoples].[ID],Tel1,Tel2,Telephone,PhoneOfBachur from peoples inner join peopledetails on ID=relatedid where temp='false' AND " + BuildSql.GetSql(out prms[1], txtfname.Text, "FirstName", BuildSql.SqlKind.LIKE) + BuildSql.GetSql(out prms[2], txtlname.Text, "Lastname", BuildSql.SqlKind.LIKE) + BuildSql.GetSql(out prms[3], txtbeard.Text, "beard", BuildSql.SqlKind.LIKE) + BuildSql.GetSql(out prms[4], txtbg.Text, "background", BuildSql.SqlKind.LIKE) + BuildSql.GetSql(out prms[5], txtcoverhead.Text, "coverhead", BuildSql.SqlKind.LIKE) + BuildSql.GetSql(out prms[6], txtdadwork.Text, "dadwork", BuildSql.SqlKind.LIKE) + BuildSql.GetSql(out prms[7], txtfacecolor.Text, "facecolor", BuildSql.SqlKind.LIKE) + IdFilter + BuildSql.GetSql(out prms[8], txtfat.Text, "fat", BuildSql.SqlKind.LIKE) + AgeSql + BuildSql.GetSql(out prms[9], txtlooks.Text, "looks", BuildSql.SqlKind.LIKE) + BuildSql.GetSql(out prms[10], txtpeticut.Text, "openhead", BuildSql.SqlKind.LIKE) + BuildSql.GetSql(out prms[11], txtschool.Text, "schools", BuildSql.SqlKind.LIKE) + sexs + BuildSql.GetSql(out prms[13], txtzerem.Text, "(eda", BuildSql.SqlKind.LIKE, false, null, true) + BuildSql.GetSql(out prms[14], txtzerem.Text, "zerem", BuildSql.SqlKind.LIKE, false, null, false, ") AND ") + BuildSql.GetSql(out prms[15], txtstatus.Text, "Status", BuildSql.SqlKind.EQUAL) + BuildSql.GetSql(out prms[17], txtCity.Text, "City", BuildSql.SqlKind.LIKE) + BuildSql.GetSql(out prms[18], txtPhone.Text, "(Tel1", BuildSql.SqlKind.LIKE, false, null, true) + BuildSql.GetSql(out prms[19], txtPhone.Text, "Tel2", BuildSql.SqlKind.LIKE, false, null, true) + BuildSql.GetSql(out prms[20], txtPhone.Text, "Telephone", BuildSql.SqlKind.LIKE, false, null, true) + BuildSql.GetSql(out prms[21], txtPhone.Text, "PhoneOfBachur", BuildSql.SqlKind.LIKE, false, null, false, " ) AND ") + sqlwhoami + sqlwhoiwant + LearnStatus + Subscription; Sql = BuildSql.CheckForLastAnd(ref Sql); Sql += show; Sql += " ORDER BY ID DESC"; reader = DBFunction.ExecuteReader(Sql, prms); // fs.Search(txtfreeserach.Text, (FreeSearch.accuracy)cmb_accuracy.SelectedIndex); List <People> lst = new List <People>(); while (reader.Read()) { People p = new People(); PeopleManipulations.ReaderToPeople(ref p, ref reader, PeopleManipulations.RtpFor.ForSearch); lst.Add(p); } olstpeople.BeginUpdate(); olstpeople.SetObjects(lst); olstpeople.EndUpdate(); reader.Close(); DBFunction.CloseConnections(); //picload.Visible = false; btnfilter.Enabled = true; }