protected void ButtonDate_Click(object sender, EventArgs e) { USER user = (USER)this.Session["user"]; List <HelpClassLogs> list = new LOGDAL().GetTop50ByAdminInstitution(user); DateTime? nullable1 = new DateTime?(); DateTime? nullable2 = new DateTime?(); try { nullable1 = new DateTime?(Convert.ToDateTime(this.txtDateFrom.Text)); } catch { } try { DateTime dateTime = Convert.ToDateTime(this.txtDateTo.Text); dateTime = dateTime.AddHours(24.0); nullable2 = new DateTime?(dateTime.AddMilliseconds(-1.0)); } catch { } if (nullable1.HasValue && nullable2.HasValue) { list = new LOGDAL().GetAllByAdminInstitutionForDate(user, nullable1.Value, nullable2.Value); } this.Session["Log"] = (object)list; this.LOGGridView.DataSource = (object)list; this.LOGGridView.DataBind(); }
protected void DropDownListUsers_SelectedIndexChanged(object sender, EventArgs e) { List <HelpClassLogs> list = new List <HelpClassLogs>(); if (this.DropDownListUsers.SelectedValue != "0") { list = new LOGDAL().GetTop50ByUser(new UsersDAL().GetByID(new Guid(this.DropDownListUsers.SelectedValue.ToString()))); } this.Session["Log"] = (object)list; this.LOGGridView.DataSource = (object)list; this.LOGGridView.DataBind(); }
protected void ButtonDate_Click(object sender, EventArgs e) { List <HelpClassLogs> list1; if (this.DropDownListUsers.SelectedItem.Text == "- - Корисник - -") { List <HelpClassLogs> list2 = new LOGDAL().GetTop50(); DateTime? nullable1 = new DateTime?(); DateTime? nullable2 = new DateTime?(); try { nullable1 = new DateTime?(Convert.ToDateTime(this.txtDateFrom.Text)); } catch { } try { nullable2 = new DateTime?(Convert.ToDateTime(this.txtDateTo.Text).AddHours(24.0)); } catch { } if (nullable1.HasValue && nullable2.HasValue) { list1 = (List <HelpClassLogs>)null; list2 = new LOGDAL().GetByDate(nullable1.Value, nullable2.Value); } this.Session["Log"] = (object)list2; this.LOGGridView.DataSource = (object)list2; this.LOGGridView.DataBind(); } else { USER byId = new UsersDAL().GetByID(new Guid(this.DropDownListUsers.SelectedValue.ToString())); List <HelpClassLogs> list2 = new LOGDAL().GetTop50ByUser(byId); DateTime? nullable1 = new DateTime?(); DateTime? nullable2 = new DateTime?(); try { nullable1 = new DateTime?(Convert.ToDateTime(this.txtDateFrom.Text)); } catch { } try { nullable2 = new DateTime?(Convert.ToDateTime(this.txtDateTo.Text)); } catch { } if (nullable1.HasValue && nullable2.HasValue) { list1 = (List <HelpClassLogs>)null; list2 = new LOGDAL().GetByUserForDate(byId, nullable1.Value, nullable2.Value); } this.Session["Log"] = (object)list2; this.LOGGridView.DataSource = (object)list2; this.LOGGridView.DataBind(); } }