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