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() + " התאמות";
        }
 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;
     }
 }
Example #3
0
        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 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;
        }