protected void btnSubmit_Click(object sender, EventArgs e) { string startTime = this.fdate.Text; string endTime = this.tdate.Text; DataTable dt = new DataTable(); string param = string.Empty; if (!string.IsNullOrEmpty(startTime) && !string.IsNullOrEmpty(endTime)) { if (DateTime.Parse(startTime).CompareTo(DateTime.Parse(endTime)) > 0) { Common.yvonYmPrompt.AlertError("Start time than end time !", this.Page, "cleanyvon"); return; } param = string.Format(" and date between '{0}' and '{1}';", startTime,endTime); } else if (string.IsNullOrEmpty(startTime) && !string.IsNullOrEmpty(endTime)) { param = string.Format(" and date <= '{0}';", endTime); } else if (!string.IsNullOrEmpty(startTime) && string.IsNullOrEmpty(endTime)) { param = string.Format(" and date >= '{0}';", startTime); } dt = new AdminBLL().getMessageList(param); this.GridView1.DataSource = dt; this.GridView1.DataBind(); }
private void LoadMessage() { DataTable dt = new AdminBLL().getMessageList(";"); if (dt.Rows.Count > 0) { Message = dt.Rows[0]["message"].ToString(); } string param = string.Format(" and owner='{0}';", lblUserName.Text); dt = new AdminBLL().getMessageList(param); if (null != dt) { Count = dt.Rows.Count; } }
private void BindMessageSource() { DataTable dt = new DataTable(); if (!string.IsNullOrEmpty(Request.QueryString["userName"])) { string param = string.Format(" and owner='{0}';", Request.QueryString["userName"]); dt = new AdminBLL().getMessageList(param); } else { dt = new AdminBLL().getMessageList(";"); } this.GridView1.DataSource = dt; this.GridView1.DataBind(); }