Пример #1
0
        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();
        }
Пример #2
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;
            }
        }