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(); } }
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; } }