private void LoadSearchShiduch()
        {
            SqlDataReader reader = People.ReadAll(0, false, false, false, false, true, MyPeople);
            KeyValueClass item;

            item       = new KeyValueClass();
            item.Text  = "";
            item.Value = "-1";
            txtSearchShiduch.Items.Add(item);
            while (reader.Read())
            {
                item = new KeyValueClass();
                string text = (string)reader["FirstName"] + " " + (string)reader["LastName"];
                text      += " " + reader["YeshivaGorSeminary"].ToString();
                text      += " " + reader["City"].ToString();
                text      += " " + reader["Street"].ToString();
                item.Text  = text;
                item.Value = reader["ID"].ToString();
                txtSearchShiduch.Items.Add(item);
            }
            reader.Close();

            //else
            //    lblSearchShiduch.Visible = true;
        }
        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() + " התאמות";
        }
Beispiel #3
0
        public void LoadClients()
        {
            string sql;

            GLOBALVARS.Clients = new ArrayList();
            sql = "select firstname + ' ' + lastname as allname,id from peoples where show=0 order by firstname ";
            SqlDataReader reader;

            reader = DBFunction.ExecuteReader(sql);
            while (reader != null && reader.Read())
            {
                KeyValueClass temp = new KeyValueClass((string)reader["allname"], (int)reader["ID"]);
                GLOBALVARS.Clients.Add(temp);
            }
            reader.Close();
        }
        public void LoadShadcanim()
        {
            string sql, where;
            int    controlhide = 1, index = -1;

            Shadchanim = new ArrayList();
            if (GLOBALVARS.MyUser.Control == User.TypeControl.Admin || GLOBALVARS.MyUser.Control == User.TypeControl.Manger)
            {
                where = "";
            }
            else if (thisSideB)
            {
                where = " where id=" + ShiduchActivity.UserId;
            }
            else
            {
                where = "where id=" + GLOBALVARS.MyUser.ID;
            }
            sql = "select name,id from users " + where;
            SqlDataReader reader = DBFunction.ExecuteReader(sql);

            while (reader != null && reader.Read())
            {
                KeyValueClass temp = new KeyValueClass((string)reader["name"], (int)reader["ID"]);
                if (int.Parse(temp.Value.ToString()) == GLOBALVARS.MyUser.ID)
                {
                    if (index < 0)
                    {
                        index = txtReminderInCare.Items.Count;
                    }
                    temp.Text = "שלי";
                }
                //אם הטיפול הוא אצל מישהו אחר ממני
                if (updateActivity && int.Parse(temp.Value.ToString()) == ShiduchActivity.reminder.IdUser)
                {
                    index = txtReminderInCare.Items.Count;
                }
                Shadchanim.Add(temp);
                txtReminderInCare.Items.Add(temp);
            }
            reader.Close();
            DBFunction.CloseConnections();
            txtReminderInCare.SelectedIndex = index;
        }
Beispiel #5
0
        public void LoadShadcanim()
        {
            string sql;
            //    string txt="";
            int controlhide = 1;

            GLOBALVARS.Shadchanim = new ArrayList();
            GLOBALVARS.Users      = new List <User>();
            User u;

            // cmbusers.Items.Add(new KeyValueClass("הכל", 0));
            if (GLOBALVARS.MyUser.Control == User.TypeControl.Admin)
            {
                controlhide = 100;
            }
            sql = @"select u.ID,u.name,u.tel,u.email,count(r.ByUser) as d,t1.mdate,t2.mdateexit,Sector
                    from users u left join RegisterInfo r on u.ID=r.ByUser left join
                    (select l.UserId, max(l.date) mdate from log l where l.Action=1 group by l.UserId ) t1 on t1.UserId=u.ID left join
                    (select l.UserId, max(l.DateExit) mdateexit from log l where l.Action=1  group by l.UserId ) t2 on t2.UserId=u.ID
                    where u.Control<" + controlhide + @"
                    group by u.ID,u.name,u.tel,u.email,t1.mdate,t2.mdateexit,Sector
                    order by d desc";
            SqlDataReader reader;

            reader = DBFunction.ExecuteReader(sql);
            lstchadcan.Items.Clear();
            ConnetKnow = 0;
            while (reader != null && reader.Read())
            {
                u        = new User();
                u.Name   = (string)reader["name"];
                u.ID     = (int)reader["ID"];
                u.Tel    = (string)reader["tel"];
                u.Email  = (string)reader["email"];
                u.Sector = (string)reader["Sector"];
                if (u.Sector.Length > 0)
                {
                    string[] s = u.Sector.Split(',');
                    for (int i = 0; i < s.Length; i++)
                    {
                        if (u.SectorView.Length > 0)
                        {
                            u.SectorView += ", ";
                        }
                        u.SectorView += GLOBALVARS.Sectors.ToArray()[int.Parse(s[i])].SectorName;
                    }
                }
                GLOBALVARS.Users.Add(u);
                KeyValueClass temp = new KeyValueClass((string)reader["name"], (int)reader["ID"]);
                GLOBALVARS.Shadchanim.Add(temp);
                lstchadcan.Items.Add(new ListViewItem(new string[] { (string)reader["name"],
                                                                     (string)reader["tel"], (string)reader["email"], reader["ID"].ToString(),
                                                                     reader["d"].ToString(), Connect(ref reader) }, 2));
            }
            reader.Close();
            DBFunction.CloseConnections();
            if (controlhide != 1)
            {
                lblconnect.Visible = true;
                lblconnect.Text   += ConnetKnow + " מתוך " + GLOBALVARS.Shadchanim.Count;
            }
        }
        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;
        }