public void LoadResultToList(ref People p, ListView lst, bool TempPeople = false)
        {
            ListViewItem item = new ListViewItem();

            // DateTime temp = DateTime.Parse("11/07/2015 23:22:22");
            item.Text = p.FirstName;
            item.SubItems.Add(p.Lasname);
            item.SubItems.Add(p.Details.Schools);
            item.SubItems.Add(p.Age.ToString());
            item.SubItems.Add(p.Tall.ToString());
            item.SubItems.Add(p.Details.Notes);
            item.SubItems.Add(p.ID.ToString());
            if (!TempPeople)
            {
                //  if (p.Register.LastUpdate < temp)
                //     item.ForeColor = Color.Gray;
            }
            if (TempPeople)
            {
                item.Tag = p.ByUser;
                item.SubItems.Add(p.TempId.ToString());
                item.SubItems.Add(p.Reason.ToString());
            }


            if (p.Sexs == 2)
            {
                item.ImageIndex = 0;
            }
            else
            {
                item.ImageIndex = 1;
            }
            switch (p.Reason)
            {
            case (int)People.ReasonType.Wedding:
                item.ForeColor = Color.Red;
                break;

            case (int)People.ReasonType.ShadChan:
                item.ForeColor = Color.Blue;
                break;

            case (int)People.ReasonType.AllowLimited:
                item.ForeColor = Color.Green;
                break;
            }
            switch (p.Show)
            {
            case (int)People.ShowTypes.HideDetails:
                item.BackColor = Color.LightGreen;
                if (GLOBALVARS.MyUser.Control == User.TypeControl.User)
                {
                    item.Text             = "חסוי";
                    item.SubItems[1].Text = "חסוי";
                }
                break;

            case (int)People.ShowTypes.HideFromUsers:
                item.BackColor = Color.LightBlue;
                break;

            case (int)People.ShowTypes.VIP:
                item.BackColor = Color.Gold;
                break;

            case (int)People.ShowTypes.Personal:
                item.BackColor = Color.LightGreen;
                break;
            }
            lst.Items.Add(item);
        }
Beispiel #2
0
        public static ArrayList GetMatches(People people)
        {
            ArrayList list = new ArrayList();

            mydic_whoami.Clear();
            mydic_whoiwant.Clear();

            foreach (DictinorayRow row in DictinorayRow.DictinorayList)
            {
                int temp = row.IsMatchWord(people.Details.WhoAmI);
                if (temp == 1 || temp == -1)
                {
                    if (temp == -1)
                    {
                        row.ChangeToUpSitewords();
                    }
                    mydic_whoami.Add(row);
                    mydic_not_type.Add(row);
                }
            }
            foreach (DictinorayRow row in DictinorayRow.DictinorayList)
            {
                int temp = row.IsMatchWord(people.Details.WhoAmI);
                if (temp == 1 || temp == -1)
                {
                    if (temp == -1)
                    {
                        row.ChangeToUpSitewords();
                    }
                    mydic_whoiwant.Add(row);
                    mydic_not_type.Add(row);
                }
            }

            MatchesChecks xmatch = new MatchesChecks();

            xmatch.p = people;
            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 + "}%'))";

            if (GLOBALVARS.MyUser.Control == User.TypeControl.Manger || GLOBALVARS.MyUser.Control == User.TypeControl.Admin)
            {
                show = " and show <> 8";
            }

            string sql = "select zerem,looks,show,chadchan,whoami,whoiwant,[peopledetails].[relatedid],[Peoples].[ID],FirstName,facecolor,sexs,Lastname,tall,status,fat,age,show,notes from peoples inner join peopledetails on ID=relatedid  ";

            sql += xmatch.GetSqlCheck() + show;
            SqlDataReader reader = DBFunction.ExecuteReader(sql);

            while (reader.Read())
            {
                Match result = new Match();

                result.Name = reader["firstname"].ToString() + " " + reader["lastname"].ToString();
                result.ID   = (int)reader["id"];

                //FAT CHECK
                result.FatCheckString = xmatch.FatCheck(reader["fat"].ToString(), ref result.FatMatchLevel);


                //FACECOLOR CHECK
                result.FaceColorCheckString = xmatch.FaceColorCheck(reader["facecolor"].ToString(), ref result.FaceColorMatchLevel);


                //Looks CHECK
                result.LooksCheckString = xmatch.LooksCheck(reader["looks"].ToString(), ref result.LooksMatchLevel);


                //FromDic CHECK
                result.DicCheckString.AddRange(xmatch.CheckFromDic(reader["looks"].ToString(), "LookChange", ref result.DicMatchLevel));
                //  result.DicCheckString.AddRange(xmatch.CheckFromDic(reader["zerem"].ToString(), "ZeremChange", ref result.DicMatchLevel));
                result.DicCheckString.AddRange(xmatch.CheckFromDic(reader["facecolor"].ToString(), "FaceChange", ref result.DicMatchLevel));



                // STATUS CHECK
                result.StatusCheckString = xmatch.StatusCheck(reader["status"].ToString(), ref result.MatchLevel);


                //EDA CHECK   NEEEED TO FIXXX
                result.ZeremOfEdaString = xmatch.ZeremCheck(reader["zerem"].ToString(), ref result.ZeremOfEdaMatchLevel);



                //WHOAMI + LOOKFOR CHECK

                result.WhoamiCheckString.AddRange(xmatch.FindPropties(reader["whoiwant"] as string, ref result.WhoAmIMatchLevel, false));

                result.LookForCheckString.AddRange(xmatch.FindPropties(reader["whoami"] as string, ref result.LookForMatchLevel, true));



                result.MatchLevel += result.FaceColorMatchLevel + result.FatMatchLevel + result.LooksMatchLevel +
                                     result.ZeremOfEdaMatchLevel + result.LookForMatchLevel + result.WhoAmIMatchLevel +
                                     result.DicMatchLevel;

                list.Add(result);
            }
            reader.Close();

            return(list);
        }
Beispiel #3
0
        public static bool ReaderToPeople(ref People peopleobj, ref SqlDataReader reader, bool register = false, bool detail = false)
        {
            peopleobj.Background               = (string)reader["Background"];
            peopleobj.Age                      = float.Parse(reader["Age"].ToString());
            peopleobj.City                     = (string)reader["city"];
            peopleobj.Eda                      = (string)reader["Eda"];
            peopleobj.DadWork                  = (string)reader["DadWork"];
            peopleobj.ID                       = (int)reader["relatedid"];
            peopleobj.Lasname                  = (string)reader["Lastname"];
            peopleobj.WorkPlace                = (string)reader["WorkPlace"];
            peopleobj.Sexs                     = (int)reader["Sexs"];
            peopleobj.Register.ByUserName      = (string)reader["ByUserName"];
            peopleobj.Status                   = (string)reader["Status"];
            peopleobj.LearnStaus               = (string)reader["LearnStatus"];
            peopleobj.FirstName                = (string)reader["FirstName"];
            peopleobj.FutureLearn              = (bool)reader["FutureLearn"];
            peopleobj.Beard                    = (string)reader["Beard"];
            peopleobj.CoverHead                = (string)reader["CoverHead"];
            peopleobj.FaceColor                = (string)reader["FaceColor"];
            peopleobj.GorTorN                  = (string)reader["GorTorN"];
            peopleobj.Looks                    = (string)reader["Looks"];
            peopleobj.OpenHead                 = (int)reader["OpenHead"];
            peopleobj.Show                     = int.Parse(reader["Show"].ToString());
            peopleobj.StakeM                   = (string)reader["StakeM"];
            peopleobj.Details.OwnChildrenCount = int.Parse((string)reader["OwnChildrenCount"].ToString());
            peopleobj.Tall                     = float.Parse(reader["Tall"].ToString());
            peopleobj.TneedE                   = (string)reader["TneedE"];
            peopleobj.Weight                   = reader["fat"].ToString();
            peopleobj.Zerem                    = (string)reader["Zerem"];
            peopleobj.Details.MoneyToShadchan  = (string)reader["MoneyToShadchan"];
            peopleobj.Tz                       = (string)reader["Tz"];
            peopleobj.KindChasidut             = (string)reader["KindChasidut"];
            peopleobj.ShiducNum                = (string)reader["ShiducNum"];
            peopleobj.HealthStatus             = (string)reader["HealthStatus"];
            peopleobj.HealthDetails            = (string)reader["HealthDetails"];
            peopleobj.ZeremMom                 = (string)reader["ZeremMom"];
            peopleobj.BirthDayHebrew           = (string)reader["BirthDayHebrew"];

            if (register)
            {
                peopleobj.Register.ID      = (int)reader["ID"];
                peopleobj.Register.RegDate = DateTime.Parse(reader["regdate"].ToString());

                //peopleobj.Register.RegType=(RegisterInfo.RegTypeE)reader["type"];
                peopleobj.Register.RelatedId = (int)reader["relatedid"];

                peopleobj.Register.LastUpdate = DateTime.Parse(reader["lastupdate"].ToString());
            }

            if (detail)
            {
                //need to addd chadcan
                try
                {
                    peopleobj.Chadchan = reader["chadchan"].ToString();
                }
                catch (Exception e) { };
                peopleobj.Details.ChildrenCount   = (int)reader["ChildrenCount"];
                peopleobj.Details.DadName         = (string)reader["DadName"];
                peopleobj.Details.FriendsInfo     = (string)reader["FriendsInfo"];
                peopleobj.Details.HomeRav         = (string)reader["HomeRav"];
                peopleobj.Details.MechutanimNames = (string)reader["MechutanimNames"];
                peopleobj.Details.MomLname        = (string)reader["MomLname"];
                peopleobj.Details.MomName         = (string)reader["MomName"];
                peopleobj.Details.MomWork         = (string)reader["MomWork"];
                peopleobj.Details.MoneyGives      = float.Parse(reader["MoneyGives"].ToString());
                peopleobj.Details.MoneyRequired   = float.Parse(reader["MoneyRequired"].ToString());
                peopleobj.Details.MoneyNotesFlex  = (bool)reader["MoneyNotesFlex"];
                // peopleobj.Details.Pic = (string)reader["Pic"];
                peopleobj.Details.RelatedId           = (int)reader["relatedid"];
                peopleobj.Details.Schools             = (string)reader["Schools"];
                peopleobj.Details.SiblingsSchools     = (string)reader["SiblingsSchools"];
                peopleobj.Details.Street              = (string)reader["street"];
                peopleobj.Details.Tel1                = (string)reader["tel1"];
                peopleobj.Details.Tel2                = (string)reader["tel2"];
                peopleobj.Details.WhoAmI              = (string)reader["whoami"];
                peopleobj.Details.Notes               = (string)reader["notes"];
                peopleobj.Details.WhoIWant            = (string)reader["WhoIWant"];
                peopleobj.Details.ZevetInfo           = (string)reader["ZevetInfo"];
                peopleobj.Details.YesivaKorHighSchool = (string)reader["YesivaKorHighSchool"];
                peopleobj.Details.YeshivaGorSeminary  = (string)reader["YeshivaGorSeminary"];
                peopleobj.Details.KibutzorMaslul      = (string)reader["KibutzorMaslul"];
                peopleobj.Details.Licence             = (bool)reader["Licence"];
                peopleobj.Details.Smoker              = (bool)reader["Smoker"];
                peopleobj.Details.EdaExpectation      = (string)reader["EdaExpectation"];
                peopleobj.Details.AgeExpectation      = float.Parse(reader["AgeExpectation"].ToString());
                peopleobj.Details.DadYeshiva          = (string)reader["DadYeshiva"];
                peopleobj.Details.MomSeminary         = (string)reader["MomSeminary"];
                peopleobj.Details.StatusParents       = (string)reader["StatusParents"];
                peopleobj.Details.CommunityTo         = (string)reader["CommunityTo"];
                peopleobj.Details.ParentHealth        = (string)reader["ParentHealth"];
                peopleobj.Details.ParentHealthDetails = (string)reader["ParentHealthDetails"];
                peopleobj.Details.LocationChild       = (int)reader["LocationChild"];
                peopleobj.Details.NumMarriedSibilings = (int)reader["NumMarriedSibilings"];
                peopleobj.Details.ContactShiduch      = (string)reader["ContactShiduch"];
                peopleobj.Details.ContactPhone        = (string)reader["ContactPhone"];
                peopleobj.Details.FamilyAbout         = (string)reader["FamilyAbout"];
                peopleobj.Details.Telephone           = (string)reader["Telephone"];
                peopleobj.Details.PhoneOfBachur       = (string)reader["PhoneOfBachur"];
                peopleobj.Details.PhoneKosherLevel    = (string)reader["PhoneKosherLevel"];
                peopleobj.Details.Mail                = (string)reader["Mail"];
            }

            if (GLOBALVARS.MyUser.Control > User.TypeControl.User && DBFunction.ColumnExists(reader, "Reason"))
            {
                peopleobj.Reason = (int)reader["reason"];
                peopleobj.RealId = int.Parse(reader["mrelatedID"].ToString());
                peopleobj.TempId = (int)reader["TID"];
                peopleobj.ByUser = (int)reader["ByUser"];
            }

            return(true);
        }
Beispiel #4
0
        public static SqlDataReader GetActivities(bool my, People p = null, bool all = false, bool inCare = false, bool allForManagerReport = false,
                                                  DateTime date1    = default(DateTime), DateTime date2 = default(DateTime), int peopleId = 0,
                                                  int userId        = 0, bool MyAllForDiary = false, int action = -1, int status = -1, bool DiaryManager = false)
        {
            List <ShiduchActivity> list = new List <ShiduchActivity>();
            ShiduchActivity        item;

            if (p == null)
            {
                p = new People();
            }
            //פעילויות שלי
            string select, from, where = "", sql, orderBy = "", sActionNUmber = " s.Action<4 ";

            select = "select s.*,p2.FirstName+' '+p2.LastName as FullNameB ";

            from  = "from ShiduchActivity s left join Peoples p2 on s.IdSideB=p2.ID ";
            where = " where s.PeopleId=" + p.ID;
            if (my)//פעיליות שהשדכן עשה לכרטיס זה
            {
                if (GLOBALVARS.MyUser.Control == User.TypeControl.Admin || GLOBALVARS.MyUser.Control == User.TypeControl.Manger)
                {
                    where += " and " + sActionNUmber;
                }
                else
                {
                    where += " and s.UserId=" + GLOBALVARS.MyUser.ID + " and s.action<4";
                }
            }
            if (all)//פעילויות של כלל השדכנים לכרטיס זה לא כולל פגישה
            {
                select += ",u.Name ";
                from   += " inner join users u on u.id =s.userid ";
                if (GLOBALVARS.MyUser.Control != User.TypeControl.Admin && GLOBALVARS.MyUser.Control != User.TypeControl.Manger)
                {
                    where += " and s.Action in(0,2,3,5)";
                }
            }
            if (inCare)
            {
                select += " ,p.FirstName+' '+p.LastName as FullNameA,r.Date as remindDate ";
                from   += " left join Peoples p on s.peopleid = p.id inner join ReminderActivity r on r.IdActivity=s.Id ";
                where   = " where s.UserId=" + GLOBALVARS.MyUser.ID + " and s.action<4 and s.Status=0 and r.Done=0 and r.Date<=getdate() ";
            }
            if (allForManagerReport)
            {
                if (DiaryManager)
                {
                    sActionNUmber = "s.action<5";
                    if (action > 0)//-1 לא נבחר 0 הכל
                    {
                        sActionNUmber = "s.Action=" + (action - 1);
                    }
                    //אם זה מנהל שבודק פעילות של שדכן מסוים אז הוא יכול לראות את הכל
                    if (status > 0)//אם לא בחר סטטוס מסוים אז מביאים את הכל
                    {
                        where += " and s.Status=" + (status - 1);
                    }
                }
                select += " ,p.FirstName+' '+p.LastName as FullNameA,u.Name,u.id as userID," +
                          "r.Date as remindDate,r.id as remindID ,r.IdUser as remindIdUser ,Done  ";
                from += " left join Peoples p on s.peopleid = p.id inner join users u on u.id =s.userid" +
                        " inner join ReminderActivity r on r.IdActivity=s.Id ";
                where = " where " + sActionNUmber + " and s.Date between'" + date1.ToString("yyyy-MM-dd h:mm tt") +
                        "' and '" + date2.ToString("yyyy-MM-dd h:mm tt") + "' ";
                if (peopleId != 0)
                {
                    where += " and s.PeopleId=" + peopleId;
                }
                if (userId != 0)
                {
                    where += " and s.UserId=" + userId;
                }
                orderBy = " order by s.Action,s.Status ";
            }
            if (MyAllForDiary)
            {
                select += ",r.Date as remindDate,r.Done,p.FirstName+' '+p.LastName as FullNameA,u.Name ";
                from   += " left join Peoples p on s.peopleid = p.id inner join ReminderActivity r on" +
                          " r.IdActivity=s.Id inner join users u on u.id =s.userid ";

                where = " where s.UserId=" + userId + " and s.Date between'" + date1.ToString("yyyy-MM-dd h:mm tt")
                        + "' and '" + date2.ToString("yyyy-MM-dd h:mm tt") + "' ";
                if (action > 0)//-1 לא נבחר 0 הכל
                {
                    where += " and s.Action=" + (action - 1);
                }
                else if (DiaryManager)//אם זה מנהל שבודק פעילות של שדכן מסוים אז הוא יכול לראות את הכל
                {
                    where += " and s.action<5";
                }
                else
                {
                    where += " and s.action<4";
                }
                if (status > 0)//אם לא בחר סטטוס מסוים אז מביאים את הכל
                {
                    where += " and s.Status=" + (status - 1);
                }
            }
            sql = select + from + where + orderBy;
            SqlDataReader reader = DBFunction.ExecuteReader(sql);

            return(reader);
        }
Beispiel #5
0
        public void SForm_FormClosed(object sender, FormClosedEventArgs e)
        {
            ShiduchActivityForm f = (sender as ShiduchActivityForm);
            ShiduchActivityForm form2;

            if (f.save)
            {
                SaveOpenReminder = true;
                if (f.OpenNewActivity)
                {
                    ShiduchActivity s = new ShiduchActivity();
                    s.UserId   = f.Activity.UserId;
                    s.PeopleId = f.Activity.PeopleId;
                    s.IdSideB  = f.Activity.IdSideB;
                    form2      = new ShiduchActivityForm(s, f.MyPeople);
                    form2.isNew_Active_From_Complete_Active = true;
                    form2.Show();
                    form2.FormClosed += SForm_FormClosed;
                }
            }
            if ((sender as ShiduchActivityForm).OpenSideB)//אם רוצה לפתוח פעילות של הצד השני
            {
                //f.Close();
                People person  = f.Shiduch;
                People shiduch = f.MyPeople;
                string sql     = "select s.*,r.id as remindID, r.Date as remindDate,r.Done,r.IdUser as remindIdUser from ShiduchActivity s inner join ReminderActivity r " +
                                 "on s.Id=r.IdActivity " +
                                 "where s.UserId=" + f.Activity.UserId + " and PeopleId=" +
                                 person.ID + " and IdSideB=" + shiduch.ID + " and Action=" + f.Activity.Action +
                                 " and abs(DATEDIFF(day,s.Date,'" + f.Activity.Date.ToString("yyyy-MM-dd h:mm tt") + "'))" +
                                 " between 0 and 15";
                //        " and ( convert(varchar(10), s.Date, 103)='" + f.Activity.Date.ToShortDateString() + "' "+
                //"or convert(varchar(10), s.Date, 103)>'" + f.Activity.Date.ToShortDateString() +
                //        "' or s.Date >= DATEADD(DAY, -14,'" + f.Activity.Date.ToString("yyyy-MM-dd h:mm tt") + "'))";
                SqlDataReader   reader    = DBFunction.ExecuteReader(sql);
                ShiduchActivity s         = new ShiduchActivity();
                string          notesSide = removeFromString(f.Activity.NotesSummary);
                if (reader.Read())
                {
                    ShiduchActivity.readerToShiduchActivity(ref reader, ref s);
                    s.NotesSummary = removeFromString(s.NotesSummary) + "=====צד ב'=====" + Environment.NewLine + notesSide;
                    form2          = new ShiduchActivityForm(s, person, false, true);
                }
                else
                {
                    s.IdSideB       = shiduch.ID;
                    s.Action        = f.Activity.Action;
                    s.UserId        = f.Activity.UserId;
                    s.NotesSummary += "\r\n =====צד ב'=====\r\n" + notesSide;
                    form2           = new ShiduchActivityForm(s, person, true, false, true);
                }
                reader.Close();
                form2.Show();
                form2.FormClosed += SForm_FormClosed;

                //אם יש כבר פעילות דומה אז לפתוח אותה
                //אחרת לפתוח טופס חדש של פעילות
            }
            if ((sender as ShiduchActivityForm).save)
            {
                //foreach (Form frm in Application.OpenForms)
                //{
                //    if (frm.GetType() ==typeof( MainForm))
                //    {
                //        (frm as MainForm).LoadReminder();
                //    }
                //}
                //saveReminder = true;
            }
        }
        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;
        }
Beispiel #8
0
        public static bool InsretNew(People people, out int ID)
        {
            int n = people.Note.Count * 5;

            SqlParameter[] prms = new SqlParameter[92 + n];
            string         sql, sqlpeoples, sqldetails, sqlregister, sqlNotes = "";

            sqlpeoples = "INSERT INTO Peoples VALUES(" +
                         BuildSql.InsertSql(out prms[0], people.FirstName) +
                         BuildSql.InsertSql(out prms[1], people.Lasname) +
                         BuildSql.InsertSql(out prms[2], people.Sexs) +
                         BuildSql.InsertSql(out prms[3], people.Age) +
                         BuildSql.InsertSql(out prms[4], people.Tall) +
                         BuildSql.InsertSql(out prms[5], people.Weight) +
                         BuildSql.InsertSql(out prms[6], people.FaceColor) +
                         BuildSql.InsertSql(out prms[7], people.Looks) +
                         BuildSql.InsertSql(out prms[8], people.Beard) +
                         BuildSql.InsertSql(out prms[9], people.City) +
                         BuildSql.InsertSql(out prms[10], people.Zerem) +
                         BuildSql.InsertSql(out prms[11], people.Eda) +
                         BuildSql.InsertSql(out prms[12], people.FutureLearn) +
                         BuildSql.InsertSql(out prms[13], people.Background) +
                         BuildSql.InsertSql(out prms[14], people.DadWork) +
                         BuildSql.InsertSql(out prms[15], people.CoverHead) +
                         BuildSql.InsertSql(out prms[16], people.GorTorN) +
                         BuildSql.InsertSql(out prms[17], people.TneedE) +
                         BuildSql.InsertSql(out prms[18], people.StakeM) +
                         BuildSql.InsertSql(out prms[19], people.OpenHead) +
                         BuildSql.InsertSql(out prms[20], people.Status) +
                         people.Show + "," +
                         BuildSql.InsertSql(out prms[21], people.LearnStaus) +
                         BuildSql.InsertSql(out prms[22], people.Tz) +
                         BuildSql.InsertSql(out prms[23], people.KindChasidut) +
                         BuildSql.InsertSql(out prms[24], people.ShiducNum) +
                         BuildSql.InsertSql(out prms[25], people.HealthStatus) +
                         BuildSql.InsertSql(out prms[26], people.HealthDetails) +
                         BuildSql.InsertSql(out prms[27], people.ZeremMom) +

                         BuildSql.InsertSql(out prms[28], people.BirthDayHebrew) +
                         BuildSql.InsertSql(out prms[29], people.DeleteReason) +
                         BuildSql.InsertSql(out prms[30], people.Temp) +
                         BuildSql.InsertSql(out prms[31], people.Chadchan, true) +
                         ");";

            sqldetails = "INSERT INTO PeopleDetails VALUES(" +
                         BuildSql.InsertSql(out prms[32], people.Details.Street) +
                         BuildSql.InsertSql(out prms[33], people.Details.Schools) +
                         BuildSql.InsertSql(out prms[34], people.Details.Tel1) +
                         BuildSql.InsertSql(out prms[35], people.Details.Tel2) +
                         BuildSql.InsertSql(out prms[36], people.Details.WhoAmI) +
                         BuildSql.InsertSql(out prms[37], people.Details.WhoIWant) +
                         BuildSql.InsertSql(out prms[39], people.Details.DadName) +
                         BuildSql.InsertSql(out prms[40], people.Details.MomName) +
                         BuildSql.InsertSql(out prms[41], people.Details.ChildrenCount) +
                         BuildSql.InsertSql(out prms[42], people.Details.SiblingsSchools) +
                         BuildSql.InsertSql(out prms[43], people.Details.MomLname) +
                         BuildSql.InsertSql(out prms[44], people.Details.MomWork) +
                         BuildSql.InsertSql(out prms[45], people.Details.MoneyGives) +
                         BuildSql.InsertSql(out prms[46], people.Details.MoneyRequired) +
                         BuildSql.InsertSql(out prms[47], people.Details.MoneyNotesFlex) +
                         BuildSql.InsertSql(out prms[48], people.Details.HomeRav) +
                         BuildSql.InsertSql(out prms[49], people.Details.MechutanimNames) + "@DataID," +
                         BuildSql.InsertSql(out prms[50], people.Details.ZevetInfo) +
                         BuildSql.InsertSql(out prms[51], people.Details.FriendsInfo) +
                         BuildSql.InsertSql(out prms[54], people.Details.Notes) +
                         BuildSql.InsertSql(out prms[55], people.Details.OwnChildrenCount) +
                         BuildSql.InsertSql(out prms[56], people.WorkPlace) +
                         BuildSql.InsertSql(out prms[57], people.Details.MoneyToShadchan) +
                         BuildSql.InsertSql(out prms[58], people.Details.YesivaKorHighSchool) +
                         BuildSql.InsertSql(out prms[59], people.Details.YeshivaGorSeminary) +
                         BuildSql.InsertSql(out prms[60], people.Details.KibutzorMaslul) +
                         BuildSql.InsertSql(out prms[61], people.Details.Licence) +
                         BuildSql.InsertSql(out prms[62], people.Details.Smoker) +
                         BuildSql.InsertSql(out prms[63], people.Details.EdaExpectation) +
                         BuildSql.InsertSql(out prms[64], people.Details.AgeExpectation) +
                         BuildSql.InsertSql(out prms[65], people.Details.DadYeshiva) +
                         BuildSql.InsertSql(out prms[66], people.Details.MomSeminary) +
                         BuildSql.InsertSql(out prms[69], people.Details.StatusParents) +
                         BuildSql.InsertSql(out prms[70], people.Details.CommunityTo) +
                         BuildSql.InsertSql(out prms[71], people.Details.ParentHealth) +
                         BuildSql.InsertSql(out prms[72], people.Details.ParentHealthDetails) +
                         BuildSql.InsertSql(out prms[73], people.Details.LocationChild) +
                         BuildSql.InsertSql(out prms[74], people.Details.NumMarriedSibilings) +
                         BuildSql.InsertSql(out prms[75], people.Details.ContactShiduch) +
                         BuildSql.InsertSql(out prms[76], people.Details.ContactPhone) +
                         BuildSql.InsertSql(out prms[77], people.Details.FamilyAbout) +
                         BuildSql.InsertSql(out prms[78], people.Details.Telephone) +
                         BuildSql.InsertSql(out prms[79], people.Details.PhoneOfBachur) +
                         BuildSql.InsertSql(out prms[80], people.Details.PhoneKosherLevel) +

                         BuildSql.InsertSql(out prms[81], people.Details.Mail, true) +
                         ");";


            sqlregister = "INSERT INTO RegisterInfo VALUES(" +
                          BuildSql.InsertSql(out prms[82], DateTime.Now) +
                          "@DataID" + "," +
                          GLOBALVARS.MyUser.ID + "," +
                          BuildSql.InsertSql(out prms[83], GLOBALVARS.MyUser.Name) +
                          BuildSql.InsertSql(out prms[84], DateTime.Now, true)
                          + ");";
            int iPrm = 90;

            foreach (var item in people.Note)
            {
                sqlNotes += "INSERT INTO NotesOfPeople VALUES(" +
                            BuildSql.InsertSql(out prms[iPrm++], GLOBALVARS.MyUser.ID) +
                            BuildSql.InsertSql(out prms[iPrm++], GLOBALVARS.MyUser.Name) +
                            "@DataID" + "," +
                            BuildSql.InsertSql(out prms[iPrm++], item.NoteText) +
                            BuildSql.InsertSql(out prms[iPrm++], DateTime.Now, true)
                            + "); ";
            }

            prms[85]           = new SqlParameter("@D", SqlDbType.Int);
            prms[85].Direction = ParameterDirection.Output;
            sql = "BEGIN TRANSACTION " +
                  "DECLARE @DataID int;" +
                  sqlpeoples +
                  "SELECT @DataID = scope_identity();" +
                  "SELECT @D = scope_identity();" +
                  sqldetails +
                  sqlregister +
                  sqlNotes +
                  "COMMIT";
            int length = sql.Length;
            // return DBFunction.Execute(sql, prms);
            bool f = DBFunction.Execute(sql, prms);

            ID = 0;
            if (prms[85].Value != DBNull.Value)
            {
                ID = Convert.ToInt32(prms[85].Value);
            }
            ShiduchActivity Activity = new ShiduchActivity();

            Activity.Date     = DateTime.Now;
            Activity.UserId   = GLOBALVARS.MyUser.ID;
            Activity.PeopleId = ID;
            Activity.Action   = (int)ShiduchActivity.ActionType.reception;
            ShiduchActivity.insertActivity(Activity);
            return(f);
        }
Beispiel #9
0
        public static bool UpdatePeople(People p, bool Wedding, bool Shadchan = false, string Notes = null, bool PublishClient = false)
        {
            string sql = "";

            string where = " where id=" + p.ID + " ";
            string Rwhere     = " where relatedid=" + p.ID + " ";
            bool   PlusTblReg = true;

            SqlParameter[] prms = new SqlParameter[100];

            //if (p.Show != 5)
            //{  // check is not personal user

            //    PlusTblReg = true; // for future use

            //    // if (Shadchan)
            //  //   return ShadchanUpdate();

            //    if (Wedding)
            //        return WeddingUpdate(p);

            //    //if (!GLOBALVARS.MyUser.CanEdit)
            //    //    return UpdateTemp(Notes);
            //}
            //else
            //{
            //    if (!PublishClient)
            //        p.Show = 5;
            //    p.Chadchan = "{" + GLOBALVARS.MyUser.ID.ToString() + "}";
            //}
            sql = "BEGIN TRANSACTION ";

            sql += "update peoples SET " +
                   BuildSql.UpdateSql(out prms[0], p.Age, "age") +
                   BuildSql.UpdateSql(out prms[1], p.Background, "background") +
                   BuildSql.UpdateSql(out prms[2], p.Beard, "Beard") +
                   BuildSql.UpdateSql(out prms[3], p.City, "City") +
                   BuildSql.UpdateSql(out prms[4], p.CoverHead, "CoverHead") +
                   BuildSql.UpdateSql(out prms[5], p.DadWork, "DadWork") +
                   BuildSql.UpdateSql(out prms[6], p.Eda, "eda") +
                   BuildSql.UpdateSql(out prms[7], p.FaceColor, "FaceColor") +
                   BuildSql.UpdateSql(out prms[8], p.FirstName, "FirstName") +
                   BuildSql.UpdateSql(out prms[9], p.FutureLearn, "FutureLearn") +
                   BuildSql.UpdateSql(out prms[10], p.GorTorN, "GorTorN") +
                   BuildSql.UpdateSql(out prms[11], p.Lasname, "Lastname") +
                   BuildSql.UpdateSql(out prms[12], p.Looks, "Looks") +
                   BuildSql.UpdateSql(out prms[13], p.OpenHead, "OpenHead") +
                   BuildSql.UpdateSql(out prms[15], p.Sexs, "Sexs") +
                   BuildSql.UpdateSql(out prms[16], p.Show, "show") +
                   BuildSql.UpdateSql(out prms[17], p.StakeM, "StakeM") +
                   BuildSql.UpdateSql(out prms[18], p.Status, "Status") +
                   BuildSql.UpdateSql(out prms[19], p.Tall, "Tall") +
                   BuildSql.UpdateSql(out prms[20], p.TneedE, "TneedE") +
                   BuildSql.UpdateSql(out prms[59], p.LearnStaus, "LearnStatus") +
                   BuildSql.UpdateSql(out prms[21], p.Zerem, "Zerem") +
                   BuildSql.UpdateSql(out prms[70], p.Tz, "Tz") +
                   BuildSql.UpdateSql(out prms[71], p.KindChasidut, "KindChasidut") +
                   BuildSql.UpdateSql(out prms[72], p.ShiducNum, "ShiducNum") +
                   BuildSql.UpdateSql(out prms[73], p.HealthStatus, "HealthStatus") +
                   BuildSql.UpdateSql(out prms[74], p.HealthDetails, "HealthDetails") +
                   BuildSql.UpdateSql(out prms[88], p.ZeremMom, "ZeremMom") +
                   BuildSql.UpdateSql(out prms[91], p.BirthDayHebrew, "BirthDayHebrew") +

                   BuildSql.UpdateSql(out prms[23], p.Chadchan, "Chadchan") +
                   BuildSql.UpdateSql(out prms[93], p.Temp, "Temp") +
                   BuildSql.UpdateSql(out prms[22], p.Weight, "fat", true) + where + ";";

            sql += " update peopledetails SET " +
                   BuildSql.UpdateSql(out prms[24], p.Details.ChildrenCount, "ChildrenCount") +
                   BuildSql.UpdateSql(out prms[25], p.Details.DadName, "DadName") +
                   BuildSql.UpdateSql(out prms[27], p.Details.FriendsInfo, "FriendsInfo") +
                   BuildSql.UpdateSql(out prms[28], p.Details.HomeRav, "HomeRav") +
                   BuildSql.UpdateSql(out prms[29], p.Details.MechutanimNames, "MechutanimNames") +
                   BuildSql.UpdateSql(out prms[30], p.Details.MomLname, "MomLname") +
                   BuildSql.UpdateSql(out prms[31], p.Details.MomName, "MomName") +
                   BuildSql.UpdateSql(out prms[32], p.Details.MomWork, "MomWork") +
                   BuildSql.UpdateSql(out prms[33], p.Details.MoneyGives, "MoneyGives") +
                   BuildSql.UpdateSql(out prms[34], p.Details.MoneyNotesFlex, "MoneyNotesFlex") +
                   BuildSql.UpdateSql(out prms[35], p.Details.MoneyRequired, "MoneyRequired") +
                   BuildSql.UpdateSql(out prms[36], p.Details.Notes, "Notes") +
                   BuildSql.UpdateSql(out prms[37], p.Details.OwnChildrenCount, "OwnChildrenCount") +
                   BuildSql.UpdateSql(out prms[38], p.Details.RelatedId, "RelatedId") +
                   BuildSql.UpdateSql(out prms[39], p.Details.Schools, "Schools") +
                   BuildSql.UpdateSql(out prms[40], p.Details.SiblingsSchools, "SiblingsSchools") +
                   BuildSql.UpdateSql(out prms[41], p.Details.Street, "Street") +
                   BuildSql.UpdateSql(out prms[42], p.Details.Tel1, "Tel1") +
                   BuildSql.UpdateSql(out prms[43], p.Details.Tel2, "Tel2") +
                   BuildSql.UpdateSql(out prms[44], p.Details.WhoAmI, "WhoAmI") +
                   BuildSql.UpdateSql(out prms[45], p.Details.WhoIWant, "WhoIWant") +

                   BuildSql.UpdateSql(out prms[48], p.WorkPlace, "WorkPlace") +
                   BuildSql.UpdateSql(out prms[49], p.Details.ZevetInfo, "ZevetInfo") +
                   BuildSql.UpdateSql(out prms[75], p.Details.YesivaKorHighSchool, "YesivaKorHighSchool") +
                   BuildSql.UpdateSql(out prms[76], p.Details.YeshivaGorSeminary, "YeshivaGorSeminary") +
                   BuildSql.UpdateSql(out prms[77], p.Details.KibutzorMaslul, "KibutzorMaslul") +
                   BuildSql.UpdateSql(out prms[78], p.Details.Licence, "Licence") +
                   BuildSql.UpdateSql(out prms[79], p.Details.Smoker, "Smoker") +
                   BuildSql.UpdateSql(out prms[80], p.Details.EdaExpectation, "EdaExpectation") +
                   BuildSql.UpdateSql(out prms[81], p.Details.AgeExpectation, "AgeExpectation") +
                   BuildSql.UpdateSql(out prms[82], p.Details.DadYeshiva, "DadYeshiva") +
                   BuildSql.UpdateSql(out prms[83], p.Details.MomSeminary, "MomSeminary") +
                   BuildSql.UpdateSql(out prms[84], p.Details.StatusParents, "StatusParents") +
                   BuildSql.UpdateSql(out prms[85], p.Details.CommunityTo, "CommunityTo") +
                   BuildSql.UpdateSql(out prms[86], p.Details.ParentHealth, "ParentHealth") +
                   BuildSql.UpdateSql(out prms[87], p.Details.ParentHealthDetails, "ParentHealthDetails") +
                   BuildSql.UpdateSql(out prms[89], p.Details.LocationChild, "LocationChild") +
                   BuildSql.UpdateSql(out prms[90], p.Details.NumMarriedSibilings, "NumMarriedSibilings") +
                   BuildSql.UpdateSql(out prms[63], p.Details.ContactShiduch, "ContactShiduch") +
                   BuildSql.UpdateSql(out prms[64], p.Details.ContactPhone, "ContactPhone") +
                   BuildSql.UpdateSql(out prms[65], p.Details.FamilyAbout, "FamilyAbout") +
                   BuildSql.UpdateSql(out prms[66], p.Details.Telephone, "Telephone") +
                   BuildSql.UpdateSql(out prms[67], p.Details.PhoneOfBachur, "PhoneOfBachur") +
                   BuildSql.UpdateSql(out prms[68], p.Details.PhoneKosherLevel, "PhoneKosherLevel") +
                   BuildSql.UpdateSql(out prms[69], p.Details.Mail, "Mail") +
                   BuildSql.UpdateSql(out prms[61], p.Details.MoneyToShadchan, "MoneyToShadchan", true)
                   + Rwhere + ";";
            // ^ it right
            sql += " update RegisterInfo SET ";

            sql += BuildSql.UpdateSql(out prms[62], DateTime.Now.Date, "LastUpdate", true) + Rwhere + "; ";
            sql += "COMMIT";

            DBFunction.Execute(sql, prms);

            PopUpMessage(false);
            ShiduchActivity Activity = new ShiduchActivity();

            Activity.Date     = DateTime.Now;
            Activity.UserId   = GLOBALVARS.MyUser.ID;
            Activity.PeopleId = p.ID;
            Activity.Action   = (int)ShiduchActivity.ActionType.update;
            ShiduchActivity.insertActivity(Activity);
            return(true);
        }
Beispiel #10
0
        public static SqlDataReader ReadAll(int temp = 0, bool all = false, bool login = false, bool persnoal_vip = false, bool vip = false, bool openForActivity = false, People p = null)
        {
            //try
            //{
            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 + "}%'))";

            if (persnoal_vip)
            {
                show = " where (show=5 and chadchan like '%{" + GLOBALVARS.MyUser.ID + "}%') or (show=4 and chadchan like '%{" + GLOBALVARS.MyUser.ID + "}%')";
            }
            if (GLOBALVARS.MyUser.Control == User.TypeControl.Manger || GLOBALVARS.MyUser.Control == User.TypeControl.Admin)
            {
                show = " where show <> 8";
                if (persnoal_vip)
                {
                    show = " where show > 0 and show <> 8";
                }
            }
            show += " and Temp='false'";
            string sql = "select * from peoples p inner join peopledetails pd on p.ID=pd.relatedid inner join " +
                         "registerinfo r on pd.relatedid=r.relatedid " + show;

            if (openForActivity)
            {
                string where = " and sexs=";
                if (p.Sexs == 1)
                {
                    where += "2 ";
                }
                else
                {
                    where += "1 ";
                }
                sql = "select FirstName, LastName, YeshivaGorSeminary,Street,City,ID from peoples p inner join" +
                      " peopledetails pd on p.ID=pd.relatedid " + show + where;
            }
            if (temp == 1)
            {
                sql = "select * from peoples p left join peopledetails pd on p.ID=pd.relatedid where temp='true'" + show;
            }
            if (all)
            {
                sql = "select  p.ID,p.FirstName+' '+p.LastName as FullName from peoples p " + show;
            }
            if (login)
            {
                sql = "select top 50 id,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  from peoples p inner join peopledetails pd on p.ID=pd.relatedid " + show + " order by id desc";
            }
            if (persnoal_vip)
            {
                sql = "select top 50 id,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  from peoples p inner join peopledetails pd on p.ID=pd.relatedid " + show + " order by show desc";
            }
            if (vip)
            {
                sql = "select MONEYTOSHADCHAN,chadchan,id,show,schools,sexs,firstname,lastname,tall,age,notes,City,Tel1,Tel2,Telephone,PhoneOfBachur from peoples p inner join peopledetails pd on p.ID=pd.relatedid " + show + " order by show desc";
            }
            SqlDataReader reader = DBFunction.ExecuteReader(sql);

            return(reader);
            //}
            //catch (Exception)
            //{
            //    return null;
            //}
        }