Exemplo n.º 1
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;
        }
Exemplo n.º 2
0
 private void btnshowinfo_Click(object sender, EventArgs e)
 {
     if (MyPeople.OpenDetailsForAdd || MyPeople.OpenForPersonalAdd)
     {
         MessageBox.Show("לא זמין במצב הוספה. " + Environment.NewLine + "שמרו את הכרטיס החדש ולאחר מכן פתחו שוב", "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     else
     {
         ShiduchActivityForm activityForm = new ShiduchActivityForm(new ShiduchActivity(), MyPeople);
         activityForm.Show();
         activityForm.FormClosed += s.SForm_FormClosed;
         //  string info = "";
         // info = txtDadPhone.Text + "\n" + txtMomPhone.Text + "\n" + txtTelephone.Text + "\n" + txtMail.Text;
         // Forms.FrmPhone frmphone = new Forms.FrmPhone(info, txtfname.Text + " " + txtlname.Text + "^" + MyPeople.ID.ToString(), MyPeople.ID.ToString());
         //   Log.AddAction(Log.ActionType.PhoneFormOpen, new Log(Log.ActionType.PhoneFormOpen, txtfname.Text + " " + txtlname.Text + "^" + MyPeople.ID.ToString()));
         // frmphone.ShowDialog();
     }
 }
Exemplo n.º 3
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;
            }
        }