📄 dutysearchmain.aspx.cs
字号:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
//该源码下载自www.51aspx.com(51aspx.com)
public partial class DutySearchMain : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
// bindDuty();
}
}
private void bindDuty()
{
if (DutyDao.dsDuty(DateTime.Parse(this.TextBox1.Text), DateTime.Parse(this.TextBox2.Text)) == null || (DutyDao.dsDuty(DateTime.Parse(this.TextBox1.Text), DateTime.Parse(this.TextBox2.Text))).Tables[0].Rows.Count == 0)
{
this.Label2.Visible = true;
this.GridView1.Visible = false;
}
else
{
this.Label2.Visible = false;
this.GridView1.Visible = true;
this.GridView1.DataSource = DutyDao.dsDuty(DateTime.Parse(this.TextBox1.Text), DateTime.Parse(this.TextBox2.Text));
this.GridView1.DataBind();
}
}
protected void Button1_Click(object sender, EventArgs e)
{
DateTime begin = DateTime.Today;
DateTime end = DateTime.Today;
bool flag = true;
try
{
begin = DateTime.Parse(this.TextBox1.Text);
}
catch
{
flag = false;
this.Label1.Text = "开始日期格式不正确";
}
try
{
end = DateTime.Parse(this.TextBox2.Text);
}
catch
{
flag = false;
this.Label1.Text = "结束日期格式不正确";
}
if (flag)
{
this.Label1.Text = "";
// DutyDao.dsDuty(begin,end);
bindDuty();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -