예제 #1
0
        public static int insertActivity(ShiduchActivity Activity)
        {
            SqlParameter[] prms = new SqlParameter[10];
            string         sqlAct, sql;

            sqlAct = "insert into ShiduchActivity values(" +
                     BuildSql.InsertSql(out prms[0], Activity.Date) +
                     BuildSql.InsertSql(out prms[1], Activity.UserId) +
                     BuildSql.InsertSql(out prms[2], Activity.PeopleId) +
                     BuildSql.InsertSql(out prms[3], Activity.Action) +
                     BuildSql.InsertSql(out prms[4], Activity.IdSideB) +
                     BuildSql.InsertSql(out prms[5], Activity.Status) +
                     BuildSql.InsertSql(out prms[6], Activity.NotesSummary) +
                     BuildSql.InsertSql(out prms[8], Activity.HideDelete, true)
                     + ");";
            prms[7]           = new SqlParameter("@D", SqlDbType.Int);
            prms[7].Direction = ParameterDirection.Output;
            sql = "BEGIN TRANSACTION " +
                  sqlAct +
                  "SELECT @D = scope_identity();" +
                  "COMMIT";

            DBFunction.Execute(sql, prms);
            int ID = 0;

            if (prms[7].Value != DBNull.Value)
            {
                ID = Convert.ToInt32(prms[7].Value);
            }
            return(ID);
        }
예제 #2
0
        public static void InserListHistory(List <HistoryChangeDetails> h)
        {
            int n = h.Count * 7 + 1, i = 0;

            SqlParameter[] prms = new SqlParameter[n];
            string         sqlHistory = "", sql;

            foreach (HistoryChangeDetails item in h)
            {
                sqlHistory += "INSERT INTO HistoryChangeDetails VALUES(" +
                              BuildSql.InsertSql(out prms[i++], item.Date) +
                              BuildSql.InsertSql(out prms[i++], item.IdUser) +
                              BuildSql.InsertSql(out prms[i++], item.IdPeople) +
                              BuildSql.InsertSql(out prms[i++], item.NameUser) +
                              BuildSql.InsertSql(out prms[i++], item.FieldName) +
                              BuildSql.InsertSql(out prms[i++], item.CurrentValue) +
                              BuildSql.InsertSql(out prms[i++], item.NewValue, true)
                              + "); ";
            }

            sql = "BEGIN TRANSACTION " +
                  sqlHistory +
                  "COMMIT";
            DBFunction.Execute(sql, prms);
        }
예제 #3
0
        public static void SendMessage(Messages msg, string Content)
        {
            string sql = "";

            MessageDetails.MsgYype messageto = MessageDetails.MsgYype.UserToManger;
            SqlParameter[]         prms      = new SqlParameter[5];
            prms[1] = new SqlParameter("topic", msg.Topic);
            prms[2] = new SqlParameter("content", Content);
            prms[3] = new SqlParameter("byuser", msg.ByUser);
            prms[4] = new SqlParameter("date", DateTime.Now);
            int UnReadUser   = 0;
            int UnReadManger = 0;

            if (GLOBALVARS.MyUser.Control == User.TypeControl.Admin)
            {
                messageto  = MessageDetails.MsgYype.MangerToUser;
                UnReadUser = 1;
            }
            else
            {
                UnReadManger = 1;
            }


            sql = "BEGIN TRANSACTION " +
                  "DECLARE @DataID int;" +
                  DBFunction.Execute("insert into [msgs] values(@byuser,@topic," + UnReadUser + "," + UnReadManger +
                                     ");SELECT @DataID = scope_identity(); insert into msgdetails values(" +
                                     (int)messageto + "," +
                                     "@DataID,@date,0,@content); COMMIT");
            DBFunction.Execute(sql, prms);
        }
예제 #4
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);
            }
        }
예제 #5
0
        private void btnNoteDelete_Click(object sender, EventArgs e)
        {
            if (lstNotesOfPeople.SelectedItems.Count <= 0)
            {
                return;
            }
            txtNoteText.Text    = "";
            btnNoteSave.Enabled = false;

            if (MyPeople.OpenDetailsForAdd || MyPeople.OpenForPersonalAdd)
            {
                NotesOfPeople n = MyPeople.Note.Find(p => p.NoteId == int.Parse(lstNotesOfPeople.SelectedItems[0].SubItems[3].Text));
                MyPeople.Note.Remove(n);
                lstNotesOfPeople.Items.Remove(lstNotesOfPeople.SelectedItems[0]);
            }
            else
            {
                int id = int.Parse(lstNotesOfPeople.SelectedItems[0].SubItems[3].Text);
                DBFunction.Execute("delete from NotesOfPeople where NoteId=" + id);
                HistoryChangeDetails h = new HistoryChangeDetails(
                    GLOBALVARS.MyUser.ID,
                    MyPeople.ID,
                    GLOBALVARS.MyUser.Name,
                    "הערה - מחיקה",
                    lstNotesOfPeople.SelectedItems[0].SubItems[2].Text,
                    "");
                h.InserHistory();
                loadNotes();
            }
        }
예제 #6
0
        public static bool AllowLimited(People p)
        {
            bool ret = false;

            ret = DBFunction.Execute("insert into notes values (" + GLOBALVARS.MyUser.ID + "," + p.ID + ",'אפשר לי לראות את החסוי הזה'," + (int)People.ReasonType.AllowLimited + ")");
            PopUpMessage(true);
            return(ret);
        }
예제 #7
0
        private static bool WeddingUpdate(People p)
        {
            bool ret = false;

            ret = DBFunction.Execute("insert into notes values (" + GLOBALVARS.MyUser.ID + "," + p.ID + ",''," + (int)People.ReasonType.Wedding + ")");
            PopUpMessage(true);
            return(ret);
        }
예제 #8
0
 public static void CheckOs(int userid)
 {
     if (!File.Exists("OS"))
     {
         DBFunction.Execute("update users set OS='" + Environment.OSVersion.VersionString + "' where id=" + userid + " and OS IS NULL");
         File.Create("OS").Close();
     }
 }
예제 #9
0
        public static bool DeletePeople(int peopleid, bool ask = true, bool perment = false)
        {
            try
            {
                int          id    = peopleid;
                DialogResult yesno = DialogResult.Yes;
                if (ask)
                {
                    yesno = MessageBox.Show("האם אתה בטוח שברצונך למחוק", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                }

                Forms.DeleteForm delf = new Forms.DeleteForm();
                if (yesno == DialogResult.Yes)
                {
                    string sql = "";
                    if (!perment)
                    {
                        delf.ShowDialog();
                        sql = "update peoples set show=8,DeleteReason=N'" + delf.ReasonDelete + "' where ID=" + id;
                    }
                    else
                    {
                        sql = "BEGIN TRANSACTION delete from peoples where ID=" + id + "; " +
                              "delete from peopledetails where relatedid=" + id + "; " +
                              "delete from registerinfo where relatedid=" + id + "; COMMIT";
                    }
                    if (DBFunction.Execute(sql))
                    {
                        if (!perment)
                        {
                            ShiduchActivity.insertActivity(
                                new ShiduchActivity()
                            {
                                Action   = (int)ShiduchActivity.ActionType.delete,
                                Date     = DateTime.Now,
                                PeopleId = id,
                                UserId   = GLOBALVARS.MyUser.ID,
                            });
                            MessageBox.Show("נמחק בהצלחה, תוכל למצוא את הכרטיס בסל המחזור", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        else
                        {
                            MessageBox.Show("הכרטיס נמחק לצמיתות", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }

                        return(true);
                    }
                    else
                    {
                        MessageBox.Show("אירעה שגיאה", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                return(false);
            }
            catch { MessageBox.Show("אירעה שגיאה", "", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); }
        }
예제 #10
0
 public static void DeleteAction(Log idlog)
 {
     if (idlog.Date == null)
     {
         idlog.Date = DateTime.Now;
     }
     idlog.UserId = GLOBALVARS.MyUser.ID;
     idlog.Level  = GLOBALVARS.MyUser.Control;
     DBFunction.Execute("delete LOG where Id=" +
                        idlog.ID);
 }
예제 #11
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 InsertReminder(ShiduchActivity Activity)
        {
            SqlParameter[] prms = new SqlParameter[10];
            string         sqlAct, sql;

            sqlAct = "insert into ReminderActivity values(" +
                     BuildSql.InsertSql(out prms[0], Activity.Id) +
                     BuildSql.InsertSql(out prms[1], Activity.reminder.IdUser) +
                     BuildSql.InsertSql(out prms[2], Activity.reminder.Date) +
                     BuildSql.InsertSql(out prms[3], false, true)
                     + ");";
            sql = "BEGIN TRANSACTION " +
                  sqlAct +
                  "COMMIT";
            DBFunction.Execute(sql, prms);
        }
        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);
        }
예제 #14
0
        public static void UpdateLastTimeCheckToDb()
        {
            SqlParameter[] prms   = new SqlParameter[5];
            SqlParameter   sw     = new SqlParameter("@sw", DateTime.Now);
            SqlParameter   alert  = new SqlParameter("@alert", DateTime.Now);
            SqlParameter   people = new SqlParameter("@people", DateTime.Now);
            SqlParameter   user   = new SqlParameter("@user", DateTime.Now);
            SqlParameter   chat   = new SqlParameter("@chat", DateTime.Now);

            prms[0] = sw;
            prms[1] = alert;
            prms[2] = people;
            prms[3] = user;
            prms[4] = chat;
            DBFunction.Execute("Update general set LastUpdate=@sw,LastAlertsChanges=@alert,LastPeopleChanges=@people,LastUserChange=@user,LastChatChange=@chat", prms);
        }
예제 #15
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));
        }
예제 #16
0
 public static void RemoveHandler(int id)
 {
     try
     {
         if (id == 0)
         {
             return;
         }
         DBFunction.Execute("update peopledetails set chadchan=0 where chadchan=" + id);
         MessageBox.Show("הוסר בהצלחה");
     }
     catch
     {
         MessageBox.Show("אירעה שגיאה בהסרת השדכן מטפל");
     }
 }
예제 #17
0
        public static bool InsertNewNotes(NotesOfPeople note)
        {
            SqlParameter[] prms = new SqlParameter[10];
            string         sqlnotes, sql;

            sqlnotes = "INSERT INTO NotesOfPeople VALUES(" +
                       BuildSql.InsertSql(out prms[0], GLOBALVARS.MyUser.ID) +
                       BuildSql.InsertSql(out prms[1], GLOBALVARS.MyUser.Name) +
                       BuildSql.InsertSql(out prms[2], note.PeopleId) +
                       BuildSql.InsertSql(out prms[3], note.NoteText) +
                       BuildSql.InsertSql(out prms[4], DateTime.Now, true)
                       + ");";
            sql = "BEGIN TRANSACTION " +
                  sqlnotes +
                  "COMMIT";
            return(DBFunction.Execute(sql, prms));
        }
예제 #18
0
        public static void SetDurationLogin()
        {
            string sql = "select * from[Log] t inner join("
                         + "select UserId, max(date) as MaxDate from[Log] where UserId ="
                         + GLOBALVARS.MyUser.ID + " group by UserId, action) tm "
                         + " on t.UserId = tm.UserId and t.date = tm.MaxDate where Action = 1";
            SqlDataReader reader = DBFunction.ExecuteReader(sql);

            if (reader.Read())
            {
                string s = "update Log set DateExit='" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss tt") + "' where id =" + reader["id"].ToString();
                reader.Close();
                DBFunction.Execute(s);
            }
            if (!reader.IsClosed)
            {
                reader.Close();
            }
        }
예제 #19
0
        public void InserHistory()
        {
            SqlParameter[] prms = new SqlParameter[10];
            string         sqlHistory, sql;

            sqlHistory = "INSERT INTO HistoryChangeDetails VALUES(" +
                         BuildSql.InsertSql(out prms[1], this.Date) +
                         BuildSql.InsertSql(out prms[2], this.IdUser) +
                         BuildSql.InsertSql(out prms[3], this.IdPeople) +
                         BuildSql.InsertSql(out prms[4], this.NameUser) +
                         BuildSql.InsertSql(out prms[5], this.FieldName) +
                         BuildSql.InsertSql(out prms[6], this.CurrentValue) +
                         BuildSql.InsertSql(out prms[7], this.NewValue, true)
                         + ");";
            sql = "BEGIN TRANSACTION " +
                  sqlHistory +
                  "COMMIT";
            DBFunction.Execute(sql, prms);
        }
예제 #20
0
 private void btnunblockuser_Click(object sender, EventArgs e)
 {
     if (lstchadcan.SelectedItems.Count <= 0)
     {
         return;
     }
     if (MessageBox.Show("האם אתה בטוח שברצונך לבטל את החסימה", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         int    userid = int.Parse(lstchadcan.SelectedItems[0].SubItems[3].Text);
         string sql    = "update users set control=0 where id=" + userid;
         if (DBFunction.Execute(sql))
         {
             MessageBox.Show("נפתח בהצלחה");
         }
         else
         {
             MessageBox.Show("אירעה שגיאה");
         }
     }
 }
예제 #21
0
 private void btndelsw_Click(object sender, EventArgs e)
 {
     if (lstchadcan.SelectedItems.Count <= 0)
     {
         return;
     }
     if (MessageBox.Show("האם אתה בטוח שברצונך למחוק לו את התוכנה", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         int    userid = int.Parse(lstchadcan.SelectedItems[0].SubItems[3].Text);
         string sql    = "update users set control=" + (int)User.TypeControl.Delete + " where id=" + userid;
         if (DBFunction.Execute(sql))
         {
             MessageBox.Show("התוכנה תמחק בפעם הבאה שהמשתמש ינסה להתחבר");
         }
         else
         {
             MessageBox.Show("אירעה שגיאה");
         }
     }
 }
예제 #22
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));
        }
예제 #23
0
 private void btnuserdel_Click(object sender, EventArgs e)
 {
     if (lstchadcan.SelectedItems.Count <= 0)
     {
         return;
     }
     if (MessageBox.Show("האם אתה בטוח שברצונך למחוק", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         int    userid = int.Parse(lstchadcan.SelectedItems[0].SubItems[3].Text);
         string sql    = "delete from users where id=" + userid;
         if (DBFunction.Execute(sql))
         {
             MessageBox.Show("נמחק בהצלחה");
             lstchadcan.Items.Remove(lstchadcan.SelectedItems[0]);
         }
         else
         {
             MessageBox.Show("אירעה שגיאה");
         }
     }
 }
예제 #24
0
        public static void AddAction(ActionType action, Log idlog = null, string info = "")
        {
            if (GLOBALVARS.MyUser == null)
            {
                GLOBALVARS.MyUser = new User();
            }
            if (idlog == null)
            {
                idlog = new Log();
            }
            if (idlog.Date == null)
            {
                idlog.Date = DateTime.Now;
            }
            if (action != ActionType.RegisterFirst)
            {
                idlog.UserId = GLOBALVARS.MyUser.ID;
                idlog.Level  = GLOBALVARS.MyUser.Control;
                //כשנרשמים לתוכנה - שומר את קוד הסריאל הרשום
                idlog.Info = info;
            }
            else
            {
                idlog.UserId = 0;
                idlog.Level  = User.TypeControl.User;
            }
            SqlParameter[] dt = new SqlParameter[2];
            dt[0] = new SqlParameter("@dt", DateTime.Now);
            if (idlog.Info == null)
            {
                idlog.Info = "";
            }
            dt[1] = new SqlParameter("@info", idlog.Info);

            DBFunction.Execute("INSERT INTO log VALUES(@dt," +
                               (int)idlog.UserId + "," +
                               (int)action + "," +
                               (int)idlog.Level + ",@info" +
                               ",@dt)", dt);
        }
예제 #25
0
        private void Add()
        {
            int level = 0;

            if (DBFunction.CheckExist(txtusername.Text, "USERS", "username"))
            {
                MessageBox.Show("המשתמש קיים כבר במערכת", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (GLOBALVARS.MyUser.Control == User.TypeControl.Admin)
            {
                level = txttype.SelectedIndex;
            }
            string sector = SetSector();

            SqlParameter[] prms = new SqlParameter[10];
            string         pass = User.SetPassword(txtpassword.Text);
            string         sql  = "insert into users(username,password,control,email,dateadded,name,tel,TempPersonal,TempGeneral,Sector) values(" +
                                  BuildSql.InsertSql(out prms[0], txtusername.Text) +
                                  BuildSql.InsertSql(out prms[1], pass) +
                                  BuildSql.InsertSql(out prms[2], level) +
                                  BuildSql.InsertSql(out prms[3], txtmail.Text) +
                                  BuildSql.InsertSql(out prms[4], DateTime.Now) +
                                  BuildSql.InsertSql(out prms[5], txtname.Text) +
                                  BuildSql.InsertSql(out prms[6], txttel.Text) +
                                  BuildSql.InsertSql(out prms[7], txtTempPersonal.SelectedIndex) +
                                  BuildSql.InsertSql(out prms[8], txtTempGeneral.SelectedIndex) +
                                  BuildSql.InsertSql(out prms[9], sector, true) +
                                  ");";

            if (DBFunction.Execute(sql, prms))
            {
                MessageBox.Show("נוסף בהצלחה", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("אירעה שגיאה", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #26
0
        private void btnaddotherfiles_Click(object sender, EventArgs e)
        {
            string sapp = "";

            OpenFileDialog file = new OpenFileDialog();

            file.Filter = "Jpg files (*.jpg)|";
            file.ShowDialog();
            sapp = file.FileName;
            byte[] sfile = File.ReadAllBytes(sapp);


            SqlParameter[] prms = new SqlParameter[3];
            prms[0] = new SqlParameter("@app", sfile);
            prms[1] = new SqlParameter("@str", Microsoft.VisualBasic.Interaction.InputBox("הקלד את שם הקובץ"));
            bool good = DBFunction.Execute("insert into otherfiles values(@app,@str)", prms);

            if (good)
            {
                MessageBox.Show("קובץ נוסף בהצלחה", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
예제 #27
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);
        }
예제 #28
0
        public static bool AllowHide(int id, int toid)
        {
            string Sql = "insert into LimitedAllow(UserId,AllowId) VALUES(" + id + "," + toid + ")";

            return(DBFunction.Execute(Sql));
        }
예제 #29
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);
        }