Пример #1
0
        private void UpdateUser()
        {
            int level = 0;

            if (GLOBALVARS.MyUser.Control == User.TypeControl.Admin)
            {
                level = txttype.SelectedIndex;
            }
            SqlParameter[] prms = new SqlParameter[10];
            string         sql  = "update users set " +
                                  BuildSql.UpdateSql(out prms[0], txtusername.Text, "username") +
                                  BuildSql.UpdateSql(out prms[1], User.SetPassword(txtpassword.Text), "password") +
                                  BuildSql.UpdateSql(out prms[2], level, "control") +
                                  BuildSql.UpdateSql(out prms[3], txtmail.Text, "email") +
                                  BuildSql.UpdateSql(out prms[4], DateTime.Now, "dateadded") +
                                  BuildSql.UpdateSql(out prms[5], txtname.Text, "name") +
                                  BuildSql.UpdateSql(out prms[6], txttel.Text, "tel") +
                                  BuildSql.UpdateSql(out prms[7], txtTempPersonal.SelectedIndex, "TempPersonal") +
                                  BuildSql.UpdateSql(out prms[8], txtTempGeneral.SelectedIndex, "TempGeneral") +
                                  BuildSql.UpdateSql(out prms[9], SetSector(), "Sector", true) +
                                  " where id=" + userid + ";";

            if (DBFunction.Execute(sql, prms))
            {
                MessageBox.Show("עודכן בהצלחה", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("אירעה שגיאה", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #2
0
        public static bool ChangeUserNameAndPassword(string uname, string psw, int userid)
        {
            SqlParameter[] prms = new SqlParameter[7];
            string         sql  = "update users set " +
                                  BuildSql.UpdateSql(out prms[0], uname, "username") +
                                  BuildSql.UpdateSql(out prms[1], psw, "password", true) +
                                  " where id=" + userid + ";";

            if (DBFunction.Execute(sql, prms))
            {
                return(true);
            }
            return(false);
        }
        public static void UpdateReminder(ShiduchActivity Activity)
        {
            SqlParameter[] prms = new SqlParameter[10];
            string         sqlAct, sql;

            sqlAct = "update ReminderActivity SET " +
                     BuildSql.UpdateSql(out prms[0], Activity.reminder.IdActivity, "IdActivity") +
                     BuildSql.UpdateSql(out prms[1], Activity.reminder.IdUser, "IdUser") +
                     BuildSql.UpdateSql(out prms[2], Activity.reminder.Date, "Date") +
                     BuildSql.UpdateSql(out prms[3], Activity.reminder.Done, "Done", true)
                     + " where Id=" + Activity.reminder.Id + ";";
            sql = "BEGIN TRANSACTION " +
                  sqlAct +
                  "COMMIT";
            DBFunction.Execute(sql, prms);
        }
Пример #4
0
        public static bool UpdateNotes(NotesOfPeople note)
        {
            SqlParameter[] prms = new SqlParameter[10];
            string         sqlnotes, sql;

            sql = "BEGIN TRANSACTION ";

            sql += "update NotesOfPeople SET " +
                   BuildSql.UpdateSql(out prms[0], note.UserId, "UserId") +
                   BuildSql.UpdateSql(out prms[1], note.UserName, "UserName") +
                   BuildSql.UpdateSql(out prms[2], note.PeopleId, "PeopleId") +
                   BuildSql.UpdateSql(out prms[3], note.NoteText, "NoteText") +
                   BuildSql.UpdateSql(out prms[4], note.NoteDate, "NoteDate", true)
                   + " where NoteId=" + note.NoteId + "; COMMIT";
            return(DBFunction.Execute(sql, prms));
        }
Пример #5
0
        public static bool updateActivity(ShiduchActivity Activity)
        {
            SqlParameter[] prms = new SqlParameter[10];
            string         sqlAct, sql;

            sqlAct = "update ShiduchActivity SET " +
                     BuildSql.UpdateSql(out prms[0], Activity.Date, "Date") +
                     BuildSql.UpdateSql(out prms[1], Activity.UserId, "UserId") +
                     BuildSql.UpdateSql(out prms[2], Activity.PeopleId, "PeopleId") +
                     BuildSql.UpdateSql(out prms[3], Activity.Action, "Action") +
                     BuildSql.UpdateSql(out prms[4], Activity.IdSideB, "IdSideB") +
                     BuildSql.UpdateSql(out prms[5], Activity.Status, "Status") +
                     BuildSql.UpdateSql(out prms[6], Activity.NotesSummary, "NotesSummary") +
                     BuildSql.UpdateSql(out prms[7], Activity.HideDelete, "HideDelete", true)
                     + " where Id=" + Activity.Id + ";";
            sql = "BEGIN TRANSACTION " +
                  sqlAct +
                  "COMMIT";

            return(DBFunction.Execute(sql, prms));
        }
Пример #6
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);
        }