protected void btnCalender_Click(object sender, EventArgs e) { DateTime dateStart = Convert.ToDateTime(txtCalender1.Text); DateTime dateEnd = Convert.ToDateTime(txtCalender2.Text); if (lblControl.Text == "Okunmayan") { ListMessage.DataSource = (from v in db.Visitor where v.Readed == false && v.SendTime >= dateStart && v.SendTime <= dateEnd orderby v.SendTime descending select new { ID = v.ID, FullName = v.FullName, Subject = v.Subject, SendTime = v.SendTime, Readed = v.Readed, Message = (v.Message.Length > 50) ? v.Message.Substring(0, 149) : v.Message }).ToList(); ListMessage.DataBind(); } else if (lblControl.Text == "Okunan") { ListMessage.DataSource = (from v in db.Visitor where v.Readed == true && v.SendTime >= dateStart && v.SendTime <= dateEnd orderby v.SendTime descending select new { ID = v.ID, FullName = v.FullName, Subject = v.Subject, SendTime = v.SendTime, Readed = v.Readed, Message = (v.Message.Length > 50) ? v.Message.Substring(0, 149) : v.Message }).ToList(); ListMessage.DataBind(); } else { ListMessage.DataSource = (from v in db.Visitor where v.SendTime >= dateStart && v.SendTime <= dateEnd orderby v.SendTime descending select new { ID = v.ID, FullName = v.FullName, Subject = v.Subject, SendTime = v.SendTime, Readed = v.Readed, Message = (v.Message.Length > 50) ? v.Message.Substring(0, 149) : v.Message }).ToList(); ListMessage.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { ListMessage.DataSource = (from v in db.Visitor orderby v.SendTime descending select new { ID = v.ID, FullName = v.FullName, Subject = v.Subject, SendTime = v.SendTime, Readed = v.Readed, Message = (v.Message.Length > 50) ? v.Message.Substring(0, 49) + "..." : v.Message }).ToList(); ListMessage.DataBind(); ((Master)this.Master).Path = "Ziyaretçi"; ((Master)this.Master).PathLink = "VisitorPage.aspx"; }
protected void btnOkunan_Click(object sender, EventArgs e) { ListMessage.DataSource = (from v in db.Visitor where v.Readed == true orderby v.SendTime descending select new { ID = v.ID, FullName = v.FullName, Subject = v.Subject, SendTime = v.SendTime, Readed = v.Readed, Message = (v.Message.Length > 50) ? v.Message.Substring(0, 149) : v.Message }).ToList(); ListMessage.DataBind(); lblControl.Text = "Okunan"; }