private void olstpeople_DoubleClick(object sender, EventArgs e)
        {
            if (olstpeople.SelectedObject != null)
            {
                People p    = olstpeople.SelectedObject as People;
                bool   show = true;

                Log.AddAction(Log.ActionType.ClientOpen, new Log(Log.ActionType.ClientOpen,
                                                                 p.FirstName + " " +
                                                                 p.Lasname + "^" + p.ID.ToString()));
                ShiduchActivity.insertActivity(
                    new ShiduchActivity()
                {
                    Action   = (int)ShiduchActivity.ActionType.openForms,
                    Date     = DateTime.Now,
                    PeopleId = p.ID,
                    UserId   = GLOBALVARS.MyUser.ID,
                });
                if (sender is bool && (bool)sender == false)
                {
                    show = false;
                }

                OpenDetails(p.ID, show);
            }
        }
        public void DiaryListResult(ref SqlDataReader reader)
        {
            List <ShiduchActivity> s = new List <ShiduchActivity>();
            ListViewItem           item;

            olstActivityDiary.Items.Clear();
            olstActivityDiary.BeginUpdate();
            while (reader.Read())
            {
                ShiduchActivity sh = new ShiduchActivity();
                ShiduchActivity.readerToShiduchActivity(ref reader, ref sh);
                string nameA = reader["FullNameA"] != System.DBNull.Value ? (string)reader["FullNameA"] : "";
                string nameB = reader["FullNameB"] != System.DBNull.Value ? (string)reader["FullNameB"] : "";

                sh.FullNameA     = nameA;
                sh.FullNameB     = nameB;
                sh.ActionConvert = ShiduchActivity.ConvertAction((ShiduchActivity.ActionType)sh.Action, reader);
                sh.StatusConvert = ShiduchActivity.ConvertStatus((ShiduchActivity.ActionStatus)sh.Status);
                sh.UserName      = (string)reader["Name"];
                item             = new ListViewItem(new string[] {
                    sh.Date.ToShortDateString(),
                    sh.ActionConvert,
                    sh.FullNameA,
                    sh.FullNameB,
                    sh.StatusConvert,
                    sh.reminder.Date.ToShortDateString(),
                    sh.NotesSummary
                });
                item.Tag = sh.Id;
                s.Add(sh);

                olstActivityDiary.Items.Add(item);
            }
            olstActivityDiary.EndUpdate();
        }
Exemple #3
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);
        }
        private void LoadMyActivities()
        {
            SqlDataReader reader = ShiduchActivity.GetActivities(true, MyPeople);

            lstMyActivity.Items.Clear();
            ListView     lst = lstMyActivity;
            ListViewItem item;

            lstMyActivity.BeginUpdate();
            while (reader.Read())
            {
                string notes = reader["NotesSummary"].ToString();
                string name  = reader["FullNameB"] != System.DBNull.Value ? (string)reader["FullNameB"] : "";
                if ((ShiduchActivity.ActionType)(int) reader["Action"] == ShiduchActivity.ActionType.other)
                {
                    notes = notes.Substring(notes.IndexOf('^') + 3);
                }
                item = new ListViewItem(new string[] {
                    DateTime.Parse(reader["Date"].ToString()).ToShortDateString(),
                    ShiduchActivity.ConvertAction((ShiduchActivity.ActionType)(int) reader["Action"], reader),
                    name,
                    ShiduchActivity.ConvertStatus((ShiduchActivity.ActionStatus)(int) reader["Status"]),
                    notes,
                    reader["IdSideB"].ToString()
                });
                item.Tag = reader["Id"];
                lst.Items.Add(item);
            }
            lstMyActivity.EndUpdate();
            reader.Close();
        }
        private void LoadTab2(DateTime d1, DateTime d2)
        {
            SqlDataReader reader = ShiduchActivity.GetActivities(false, null, false, false, false, d1, d2, 0,
                                                                 GLOBALVARS.MyUser.ID, true, cmbActivityDairy.SelectedIndex, cmbStatusDairy.SelectedIndex);

            DiaryListResult(ref reader);
            reader.Close();
        }
Exemple #6
0
        private void olstActivityDiary_FormatRow(object sender, FormatRowEventArgs e)
        {
            ShiduchActivity s = (ShiduchActivity)e.Model;

            if (s.HideDelete)
            {
                e.Item.BackColor = Color.Gray;
            }
        }
Exemple #7
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); }
        }
 public ShiduchActivityForm(ShiduchActivity Activity, People p, bool newActiv = true, bool updateActiv = false, bool SideB = false, bool openReminder = false, bool newActivFrom = false)
 {
     InitializeComponent();
     newActivity     = newActiv;
     updateActivity  = updateActiv;
     ShiduchActivity = Activity;
     MyPeople        = p;
     thisSideB       = SideB;
     OpenReminder    = openReminder;
 }
Exemple #9
0
        public void openShiduchActivityForm(ListView lst, People MyPeople = null)
        {
            //עדכון פעילות
            if (lst.SelectedItems.Count <= 0)
            {
                return;
            }
            if (lst.Name == "lstReminder")
            {
                openReminder = true;
            }
            int idActivity = int.Parse(lst.SelectedItems[0].Tag.ToString());

            // int idSideB = int.Parse(lstMyActivity.SelectedItems[0].SubItems[5].Text);
            s = ReadById(idActivity);
            //להביא את ההערות של הכרטיס השני
            string notesSide = removeFromString(s.NotesSummary) + "\r\n" +
                               "=====צד ב'=====" + Environment.NewLine;
            string sql = "select NotesSummary from ShiduchActivity s " +
                         "where s.UserId=" + s.UserId + " and PeopleId=" +
                         s.IdSideB + " and IdSideB=" + s.PeopleId + " and Action=" + s.Action +
                         " and abs(DATEDIFF(day,s.Date,'" + s.Date.ToString("yyyy-MM-dd h:mm tt") + "'))" +
                         " between 0 and 15";
            SqlDataReader reader = DBFunction.ExecuteReader(sql);

            if (reader.Read())
            {
                notesSide += removeFromString(reader["NotesSummary"].ToString());
            }
            reader.Close();
            s.NotesSummary = notesSide;
            if (MyPeople == null)
            {
                MyPeople = new People();
                SqlDataReader reader1 = People.ReadById(s.PeopleId);
                if (reader1.Read())
                {
                    PeopleManipulations.ReaderToPeople(ref MyPeople, ref reader1);
                }
                reader1.Close();
            }
            ShiduchActivityForm sForm;

            if (openReminder)//אם נפתח דרך התזכורות
            {
                sForm = new ShiduchActivityForm(s, MyPeople, false, true, false, true);
            }
            else
            {
                sForm = new ShiduchActivityForm(s, MyPeople, false, true, false);
            }
            sForm.Show();
            sForm.FormClosed += SForm_FormClosed;
        }
Exemple #10
0
        private string CreateColAction(ref SqlDataReader reader, string tdstyle = "")
        {
            string temp = "";

            temp += "<td + " + tdstyle + ">" + reader["Date"].ToString() + "</td>";
            temp += "<td + " + tdstyle + ">" + reader["Name"].ToString() + "</td>";
            temp += "<td + " + tdstyle + ">" + ShiduchActivity.ConvertStatus((ShiduchActivity.ActionStatus)(int) reader["Status"]) + "</td>";
            temp += "<td + " + tdstyle + ">" + reader["FullNameB"].ToString() + "</td>";
            temp += "<td + " + tdstyle + ">" + reader["remindDate"].ToString() + "</td>";

            return(temp);
        }
Exemple #11
0
        public void lstReminder_DoubleClick(object sender, EventArgs e)
        {
            ShiduchActivity s = new ShiduchActivity();

            for (int i = 0; i < 1; i++)
            {
                s.openShiduchActivityForm(lstReminder);
            }

            if (s.openReminder)
            {
                LoadReminder();
            }
        }
Exemple #12
0
        public static ShiduchActivity ReadById(int id)
        {
            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.Id=" + id;
            SqlDataReader   reader   = DBFunction.ExecuteReader(sql);
            ShiduchActivity activity = new ShiduchActivity();

            if (reader.Read())
            {
                readerToShiduchActivity(ref reader, ref activity);
            }
            reader.Close();
            return(activity);
        }
        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);
        }
Exemple #15
0
        public void LoadReminder()
        {
            SqlDataReader reader = ShiduchActivity.GetActivities(false, null, false, true);

            lstReminder.Items.Clear();
            ListView     lst = lstReminder;
            ListViewItem item;

            ShiduchActivity.ActionType action;
            lstReminder.BeginUpdate();
            while (reader.Read())
            {
                string name = reader["FullNameB"] != System.DBNull.Value ? (string)reader["FullNameB"] : "";
                action = (ShiduchActivity.ActionType)(int) reader["Action"];
                item   = new ListViewItem(new string[] {
                    DateTime.Parse(reader["Date"].ToString()).ToShortDateString(),
                    (string)reader["FullNameA"],
                    ShiduchActivity.ConvertAction(action, reader),
                    name
                });
                item.Tag = reader["Id"];
                //item.ImageKey = "phone-icon (1).png";
                switch (action)
                {
                case ShiduchActivity.ActionType.proposal:
                    item.BackColor = Color.FromArgb(234, 195, 152);
                    break;

                case ShiduchActivity.ActionType.date:
                    item.BackColor = Color.FromArgb(234, 133, 129);
                    break;

                case ShiduchActivity.ActionType.details:
                    item.BackColor = Color.FromArgb(234, 206, 187);
                    break;

                case ShiduchActivity.ActionType.other:
                    item.BackColor = Color.FromArgb(183, 183, 183);
                    break;
                }
                lst.Items.Add(item);
            }
            lstReminder.EndUpdate();
            reader.Close();
        }
 private void lstmyclients_DoubleClick(object sender, EventArgs e)
 {
     if (lstmyclients.SelectedItems.Count != 0)
     {
         ShiduchActivity.insertActivity(
             new ShiduchActivity()
         {
             Action   = (int)ShiduchActivity.ActionType.openForms,
             Date     = DateTime.Now,
             PeopleId = int.Parse(lstmyclients.SelectedItems[0].SubItems[6].Text),
             UserId   = GLOBALVARS.MyUser.ID,
         });
         Log.AddAction(Log.ActionType.ClientOpen, new Log(Log.ActionType.ClientOpen,
                                                          lstmyclients.SelectedItems[0].Text + " " +
                                                          lstmyclients.SelectedItems[0].SubItems[1].Text + "^" + lstmyclients.SelectedItems[0].SubItems[6].Text));
         OpenDetails(int.Parse(lstmyclients.SelectedItems[0].SubItems[6].Text));
     }
 }
Exemple #17
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));
        }
        private void LoadAllActivities()
        {
            SqlDataReader reader = ShiduchActivity.GetActivities(false, MyPeople, true);

            lstAllActivity.Items.Clear();
            ListView     lst = lstAllActivity;
            ListViewItem item;

            lstAllActivity.BeginUpdate();
            while (reader.Read())
            {
                string name = reader["FullNameB"] != System.DBNull.Value ? (string)reader["FullNameB"] : "";

                item = new ListViewItem(new string[] {
                    DateTime.Parse(reader["Date"].ToString()).ToShortDateString(),
                    (string)reader["Name"],
                    ShiduchActivity.ConvertAction((ShiduchActivity.ActionType)(int) reader["Action"], reader),
                    name
                });
                lst.Items.Add(item);
            }
            lstAllActivity.EndUpdate();
            reader.Close();
        }
Exemple #19
0
 public static void readerToShiduchActivity(ref SqlDataReader reader, ref ShiduchActivity shiduch)
 {
     shiduch.Id                  = int.Parse(reader["Id"].ToString());
     shiduch.UserId              = int.Parse(reader["UserId"].ToString());
     shiduch.PeopleId            = int.Parse(reader["PeopleId"].ToString());
     shiduch.IdSideB             = int.Parse(reader["IdSideB"].ToString());
     shiduch.Action              = int.Parse(reader["Action"].ToString());
     shiduch.Status              = int.Parse(reader["Status"].ToString());
     shiduch.Date                = DateTime.Parse(reader["Date"].ToString());
     shiduch.NotesSummary        = (string)reader["NotesSummary"];
     shiduch.HideDelete          = (bool)reader["HideDelete"];
     shiduch.reminder.Date       = DateTime.Parse(reader["remindDate"].ToString());
     shiduch.reminder.Done       = (bool)reader["Done"];
     shiduch.reminder.IdActivity = shiduch.Id;
     try
     {
         if (DBFunction.ColumnExists(reader, "remindID"))
         {
             shiduch.reminder.Id     = int.Parse(reader["remindID"].ToString());
             shiduch.reminder.IdUser = int.Parse(reader["remindIdUser"].ToString());
         }
     }
     catch { }
 }
Exemple #20
0
        public string CreateUserReport(string username, int userid, DateTime dt_start, DateTime dt_end)
        {
            // string clienttableheader = global::Schiduch.Properties.Resources.ClientTableHeader;
            string html = "";

            SqlParameter[] prms = new SqlParameter[2];
            prms[0] = new SqlParameter("dt_start", dt_start);
            prms[1] = new SqlParameter("dt_end", dt_end);

            string moreinfo = "<b>שדכן:</b> " + username + ", <b>מזהה שדכן:</b> " + userid.ToString() + "</br>";

            string sqlLog = "select  firstname + ' ' + lastname as allname, peoples.ID ,action,userid,date " +
                            " from log JOIN peoples ON log.info not like '' and SUBSTRING(log.info, CHARINDEX('^',log.Info)+1,DATALENGTH(log.info) - 1)= Peoples.ID" +
                            " where UserId = " + userid + " and action = 2 ";

            if (dt_start != null && dt_end != null)
            {
                sqlLog   += " and date between @dt_start and @dt_end";
                moreinfo += " מתאריך " + dt_start.ToShortDateString() + " עד לתאריך " + dt_end.ToShortDateString();
            }
            html += CreateHtmlReport("שדכן", moreinfo);

            html += RegisterDateToReport(userid);
            SqlDataReader reader = DBFunction.ExecuteReader(sqlLog, prms);

            html += "<u><h2>פירוט</h2></u><div class='row' style='width:80%'>";
            while (reader.Read())
            {
                Log.ActionType a_type = (Log.ActionType) int.Parse(reader["ACTION"].ToString());

                switch (a_type)
                {
                case Log.ActionType.ClientOpen:
                    clientlog_open += START_TABLE_ROW + CreateCol("", reader["allname"]) + CreateCol(null, reader["date"]) + END_TABLE_ROW;
                    InsertUserAction(reader["allname"].ToString(), (int)reader["ID"], ShiduchActivity.ActionType.openForms, ShiduchActivity.ActionStatus.completed);
                    count_openclient++;
                    break;
                }
            }
            reader.Close();
            reader = ShiduchActivity.GetActivities(false, null, false, false, true, dt_start, dt_end, 0, userid);
            while (reader.Read())
            {
                ShiduchActivity.ActionType action = (ShiduchActivity.ActionType) int.Parse(reader["Action"].ToString());
                switch (action)
                {
                case ShiduchActivity.ActionType.proposal:
                    userAction_proposal += START_TABLE_ROW + CreateColAction(ref reader) + END_TABLE_ROW;
                    InsertUserAction(reader["FullNameA"].ToString(), (int)reader["PeopleId"], ShiduchActivity.ActionType.proposal, (ShiduchActivity.ActionStatus)(int) reader["Status"]);
                    count_clientProposal++;
                    break;

                case ShiduchActivity.ActionType.date:
                    userAction_date += START_TABLE_ROW + CreateColAction(ref reader) + END_TABLE_ROW;
                    InsertUserAction(reader["FullNameA"].ToString(), (int)reader["PeopleId"], ShiduchActivity.ActionType.date, (ShiduchActivity.ActionStatus)(int) reader["Status"]);
                    count_clientDate++;
                    break;

                case ShiduchActivity.ActionType.details:
                    userAction_details += START_TABLE_ROW + CreateColAction(ref reader) + END_TABLE_ROW;
                    InsertUserAction(reader["FullNameA"].ToString(), (int)reader["PeopleId"], ShiduchActivity.ActionType.details, (ShiduchActivity.ActionStatus)(int) reader["Status"]);
                    count_clientDetails++;
                    break;

                case ShiduchActivity.ActionType.other:
                    userAction_other += START_TABLE_ROW + CreateColAction(ref reader) + END_TABLE_ROW;
                    InsertUserAction(reader["FullNameA"].ToString(), (int)reader["PeopleId"], ShiduchActivity.ActionType.other, (ShiduchActivity.ActionStatus)(int) reader["Status"]);
                    count_clientOther++;
                    break;
                }
            }
            reader.Close();

            clientlog_open      += "</tbody></table></div>";
            userAction_proposal += "</tbody></table></div>";
            userAction_date     += "</tbody></table></div>";
            userAction_details  += "</tbody></table></div>";
            userAction_other    += "</tbody></table></div>";
            html += clientlog_open + userAction_proposal + userAction_date + userAction_details + userAction_other;
            html += "</div><hr>"; // end div of all info tables and create hr
            html += Schiduch.Properties.Resources.ClientSumAction.Replace("שדכן", "לקוח");
            html += SumClientsTableList();
            html += "</tbody></table><hr><u><h2>סך הכל</h2></u>";
            html += SumClientsData();
            html += global::Schiduch.Properties.Resources.ReportEnd;
            using (TextWriter txtwrite = File.CreateText(path))
            {
                txtwrite.Write(html);
            }
            return(path);
        }
Exemple #21
0
        public string CreateClientReport(string clientname, int userid, DateTime dt_start, DateTime dt_end)
        {
            string clienttableheader = global::Schiduch.Properties.Resources.ClientTableHeader;
            string html = "";

            SqlParameter[] prms = new SqlParameter[2];
            prms[0] = new SqlParameter("dt_start", dt_start);
            prms[1] = new SqlParameter("dt_end", dt_end);

            string moreinfo = "<b>לקוח:</b> " + clientname + ", <b>מזהה לקוח:</b> " + userid.ToString() + "</br>";
            string sqlLog   = "select name,users.id as xid,info,action,userid,date,level from log LEFT JOIN USERS ON users.id=log.userid where log.info like '%" + userid.ToString() + "'";

            if (dt_start != null && dt_end != null)
            {
                sqlLog   += " and date between @dt_start and @dt_end";
                moreinfo += " מתאריך " + dt_start.ToShortDateString() + " עד לתאריך " + dt_end.ToShortDateString();
            }
            sqlLog += " order BY log.ACTION ";

            html += CreateHtmlReport("לקוח", moreinfo);

            html += RegisterDateToReport(userid);
            SqlDataReader reader = DBFunction.ExecuteReader(sqlLog, prms);

            html += "<u><h2>פירוט</h2></u><div class='row' style='width:80%'>";
            while (reader.Read())
            {
                Log.ActionType a_type = (Log.ActionType) int.Parse(reader["ACTION"].ToString());

                switch (a_type)
                {
                case Log.ActionType.ClientOpen:
                    clientlog_open += START_TABLE_ROW + CreateCol("", reader["name"]) + CreateCol(null, reader["date"]) + END_TABLE_ROW;
                    InsertUserAction(reader["name"].ToString(), (int)reader["userid"], ShiduchActivity.ActionType.openForms, ShiduchActivity.ActionStatus.completed);
                    count_openclient++;
                    break;
                }
            }
            reader.Close();
            reader = ShiduchActivity.GetActivities(false, null, false, false, true, dt_start, dt_end, userid);
            while (reader.Read())
            {
                ShiduchActivity.ActionType action = (ShiduchActivity.ActionType) int.Parse(reader["Action"].ToString());
                switch (action)
                {
                case ShiduchActivity.ActionType.proposal:
                    clientAction_proposal += START_TABLE_ROW + CreateColAction(ref reader) + END_TABLE_ROW;
                    InsertUserAction(reader["Name"].ToString(), (int)reader["userID"], ShiduchActivity.ActionType.proposal, (ShiduchActivity.ActionStatus)(int) reader["Status"]);
                    count_clientProposal++;
                    break;

                case ShiduchActivity.ActionType.date:
                    clientAction_date += START_TABLE_ROW + CreateColAction(ref reader) + END_TABLE_ROW;
                    InsertUserAction(reader["Name"].ToString(), (int)reader["userID"], ShiduchActivity.ActionType.date, (ShiduchActivity.ActionStatus)(int) reader["Status"]);
                    count_clientDate++;
                    break;

                case ShiduchActivity.ActionType.details:
                    clientAction_details += START_TABLE_ROW + CreateColAction(ref reader) + END_TABLE_ROW;
                    InsertUserAction(reader["Name"].ToString(), (int)reader["userID"], ShiduchActivity.ActionType.details, (ShiduchActivity.ActionStatus)(int) reader["Status"]);
                    count_clientDetails++;
                    break;

                case ShiduchActivity.ActionType.other:
                    clientAction_other += START_TABLE_ROW + CreateColAction(ref reader) + END_TABLE_ROW;
                    InsertUserAction(reader["Name"].ToString(), (int)reader["userID"], ShiduchActivity.ActionType.other, (ShiduchActivity.ActionStatus)(int) reader["Status"]);
                    count_clientOther++;
                    break;
                }
            }
            reader.Close();

            clientlog_open        += "</tbody></table></div>";
            clientAction_proposal += "</tbody></table></div>";
            clientAction_date     += "</tbody></table></div>";
            clientAction_details  += "</tbody></table></div>";
            clientAction_other    += "</tbody></table></div>";
            html += clientlog_open + clientAction_proposal + clientAction_date + clientAction_details + clientAction_other;
            html += "</div><hr>"; // end div of all info tables and create hr
            html += Schiduch.Properties.Resources.ClientSumAction;
            html += SumClientsTableList();
            html += "</tbody></table><hr><u><h2>סך הכל</h2></u>";
            html += SumClientsData();
            html += global::Schiduch.Properties.Resources.ReportEnd;
            using (TextWriter txtwrite = File.CreateText(path))
            {
                txtwrite.Write(html);
            }
            return(path);
        }
Exemple #22
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);
        }
Exemple #23
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 olstActivityDiary_DoubleClick(object sender, EventArgs e)
        {
            ShiduchActivity s = new ShiduchActivity();

            s.openShiduchActivityForm(olstActivityDiary);
        }
Exemple #25
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);
        }
        private void btn_Click(object sender, EventArgs e)
        {
            //או שלא בחרו עדיין שידוך
            //או שזה פעילות חדשה ובחרו את אינדקס אפס שזה ריק
            //
            if ((sender as Button) == btnSaveOpenB && (
                    txtSearchShiduch.SelectedIndex < 0 || txtSearchShiduch.SelectedIndex == 0 && newActivity && !thisSideB))
            {
                //אם רוצים לפתוח פעילות כאשר הצד השני לא נבחר אז לא לתת
                // את זה כי זה יכול לעשות הרבה בעיות
                MessageBox.Show("לא נבחר צד ב'");
            }
            else if (radOther.Checked && txtOther.Text.Length <= 0)
            {
                MessageBox.Show("נא לפרט על אופי הפעילות", "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                txtOther.Focus();
            }
            else if (!radDate.Checked && !radProposal.Checked && !radOther.Checked && !radDetails.Checked)
            {
                MessageBox.Show("נא לבחור פעולה", "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                radProposal.Focus();
            }
            else
            {
                Activity          = new ShiduchActivity();
                Activity.Date     = DateTime.Parse(txtDate.Text);
                Activity.PeopleId = MyPeople.ID;
                Activity.Action   = radProposal.Checked ? 0
                    : radDate.Checked ? 1 : radDetails.Checked ? 2 : 3;
                if (Shiduch != null && (txtSearchShiduch.SelectedIndex > 0 || updateActivity || thisSideB || isNew_Active_From_Complete_Active))
                {
                    Activity.IdSideB = Shiduch.ID;
                }
                else if (radDetails.Checked || radOther.Checked) //אם זה רק ברור אז אין צורך בצד ב'
                {
                    Activity.IdSideB = -1;
                }
                else
                {
                    MessageBox.Show("נא לבחור את ההצעה", "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    txtSearchShiduch.Focus();
                    return;
                }
                Activity.Status = radIncare.Checked ? 0
                     : radComplete.Checked ? 1 : 2;
                Activity.NotesSummary = txtNotesSummary.Text;
                if (Activity.Action == 3)
                {
                    Activity.NotesSummary = txtOther.Text + "^^^" + txtNotesSummary.Text;
                }
                Activity.reminder.IdUser = int.Parse(
                    (txtReminderInCare.SelectedItem as KeyValueClass).Value.ToString());
                Activity.reminder.Date = txtDateReminder.Value;
                Activity.UserId        = Activity.reminder.IdUser;

                if (newActivity)
                {
                    try
                    {
                        Activity.Id = ShiduchActivity.insertActivity(Activity);
                        ReminderActivity.InsertReminder(Activity);
                    }
                    catch { }
                }
                else if (updateActivity)
                {
                    Activity.Id     = ShiduchActivity.Id;
                    Activity.UserId = ShiduchActivity.UserId;
                    try
                    {
                        ShiduchActivity.updateActivity(Activity);

                        //if (OpenReminder&&txtDateReminder.Value == ShiduchActivity.reminder.Date)
                        //    Activity.reminder.Done = true;
                        if (Activity.Status == (int)ShiduchActivity.ActionStatus.inCare)
                        {
                            Activity.reminder.Done = false;
                        }
                        else
                        {
                            Activity.reminder.Done = true;
                        }
                        ReminderActivity.UpdateReminder(Activity);
                        MessageBox.Show("עודכן בהצלחה");
                    }
                    catch (Exception ex)
                    {
                    }
                }
                if ((sender as Button) == btnSaveOpenB)
                {
                    OpenSideB = true;
                }
                else if (Activity.Status == (int)ShiduchActivity.ActionStatus.completed &&
                         MessageBox.Show("האם ברצונך לפתוח פעילות חדשה?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    OpenNewActivity = true;
                }
                save = true;
                //foreach (Form frm in Application.OpenForms)
                //{
                //    if (frm.GetType() == typeof(MainForm))
                //    {
                //        (frm as MainForm).LoadReminder();
                //    }
                //}

                Close();
            }
        }