private void btnOpenDetails_Click(object sender, EventArgs e) { if (lsttrash.SelectedItems.Count <= 0) { MessageBox.Show("צריך לבחור שורה בטבלה"); return; } int id = int.Parse(lsttrash.SelectedItems[0].SubItems[5].Text); SqlDataReader reader; People p = new People(); p.ID = id; reader = People.ReadById(p.ID); while (reader.Read()) { PeopleManipulations.ReaderToPeople(ref p, ref reader, true, true); } reader.Close(); DBFunction.CloseConnections(); p.OpenForTrashPeople = true; DetailForm detail = new DetailForm(p); detail.Show(); ShiduchActivity.insertActivity( new ShiduchActivity() { Action = (int)ShiduchActivity.ActionType.openForms, Date = DateTime.Now, PeopleId = id, UserId = GLOBALVARS.MyUser.ID, }); }
private void btnrecycling_Click(object sender, EventArgs e) { if (lsttrash.SelectedItems.Count <= 0) { MessageBox.Show("צריך לבחור שורה בטבלה"); return; } DialogResult result = MessageBox.Show("האם אתה בטוח שברצונך לשחזר?", "שחזור הכרטיס", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (result == DialogResult.Cancel) { return; } int id = int.Parse(lsttrash.SelectedItems[0].SubItems[5].Text); string sql = "update peoples set show="; SqlDataReader reader; People p = new People(); p.ID = id; reader = People.ReadById(p.ID); while (reader.Read()) { PeopleManipulations.ReaderToPeople(ref p, ref reader, true, true); } reader.Close(); DBFunction.CloseConnections(); if (p.Chadchan.Length > 0) { sql += "5"; } else { sql += "0"; } sql += " where ID=" + id; if (DBFunction.Execute(sql)) { MessageBox.Show("השחזור בוצע בהצלחה"); } else { MessageBox.Show("", "קרתה שגיאה בעת השחזור. נא נסו שוב במועד מיוחר יותר", MessageBoxButtons.OK, MessageBoxIcon.Error); } LoadTab10(); ShiduchActivity.insertActivity( new ShiduchActivity() { Action = (int)ShiduchActivity.ActionType.recycling, Date = DateTime.Now, PeopleId = id, UserId = GLOBALVARS.MyUser.ID, }); }
private void TempLoad() { string sql = ""; sql = " select firstname,lastname,sexs,age,City,Eda,Background,DadWork,Status, p.id," + "LearnStatus,Temp, pd.schools,MomWork,WorkPlace,r.ByUserName,r.RegDate" + " from peoples p inner join peopledetails pd on p.ID=pd.relatedid inner join RegisterInfo r on pd.relatedid=r.relatedid where Temp= 'true' "; SqlDataReader reader = DBFunction.ExecuteReader(sql); List <People> peoples = new List <People>(); while (reader.Read()) { People p = new People(); PeopleManipulations.ConvertTempPeople(ref reader, ref p); peoples.Add(p); } TempLst.BeginUpdate(); TempLst.SetObjects(peoples); TempLst.EndUpdate(); reader.Close(); }