⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cyth_search.aspx.cs

📁 退书管理系统
💻 CS
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using System.Text.RegularExpressions;

public partial class cyth_search : System.Web.UI.Page
{
    public static string i = "strat";
    public static DateTime thsj_s;
    public static DateTime thsj_e;
    public static DateTime qdsj_s;
    public static DateTime qdsj_e;
    protected void Page_Load(object sender, EventArgs e)
    {
        this.SmartNavigation = true;

    }
    protected void MessageBox(string Message)
    {
        Response.Write("<script language='javascript'>alert('" + Message + "')</script>");
    }
    protected void LinkButton1_Click(object sender, EventArgs e)
    {
        //this.Calendar1.Visible = true;
        i = "link1";
    }
    protected void LinkButton2_Click(object sender, EventArgs e)
    {
        //this.Calendar1.Visible = true;
        i = "link2";
    }
    protected void LinkButton3_Click(object sender, EventArgs e)
    {
        //this.Calendar1.Visible = true;
        i = "link3";
    }
    protected void LinkButton4_Click(object sender, EventArgs e)
    {
        //this.Calendar1.Visible = true;
        i = "link4";
    }
    protected void Calendar1_SelectionChanged(object sender, EventArgs e)
    {
    //    string day1;
    //    string month1;


    //    if (this.Calendar1.SelectedDate.Day < 10)
    //    {
    //        string a = this.Calendar1.SelectedDate.Day.ToString();
    //        day1 = "0" + a;

    //    }
    //    else
    //    {
    //        day1 = this.Calendar1.SelectedDate.Day.ToString();
    //    }

    //    if (this.Calendar1.SelectedDate.Month < 10)
    //    {
    //        string b = this.Calendar1.SelectedDate.Month.ToString();
    //        month1 = "0" + b;
    //    }
    //    else
    //    {
    //        month1 = this.Calendar1.SelectedDate.Day.ToString();
    //    }
    //    if (i == "link1")
    //    {
    //        this.Label1.Text = this.Calendar1.SelectedDate.Year.ToString() + month1 + day1;
    //        thsj_s = this.Calendar1.SelectedDate;

    //    }

    //    else if (i == "link2")
    //    {
    //        this.Label2.Text = this.Calendar1.SelectedDate.Year.ToString() + month1 + day1;
    //        thsj_e = this.Calendar1.SelectedDate;
    //    }

    //    else if (i == "link3")
    //    {
    //        this.Label3.Text = this.Calendar1.SelectedDate.Year.ToString() + month1 + day1;
    //        qdsj_s = this.Calendar1.SelectedDate;
    //    }
    //    else if (i == "link4") 
    //    {
    //        this.Label4.Text = this.Calendar1.SelectedDate.Year.ToString() + month1 + day1;
    //        qdsj_e = this.Calendar1.SelectedDate;
    //    }
    //    this.Calendar1.Visible = false;
    //    i = "start";
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        string thrq_b = this.TextBox2.Text.ToString();
        string thrq_e = this.TextBox3.Text.ToString();
        string qdsj_b = this.TextBox4.Text.ToString();
        string qdsj_e = this.TextBox5.Text.ToString();
        string hygs = this.TextBox1.Text.ToString();
        string sql1 = "select   *  from   [tuihuoguanli]   where     1=1";
        string sql = "";
        if (hygs.Trim() != string.Empty)
        {
            sql = sql + "and hygs like '%" + @hygs + "%'";
        }
        if (thrq_b.Trim() != string.Empty)
        {
            sql = sql + "and thrq>=@thrq_b ";
        }
        if (thrq_e.Trim() != string.Empty)
        {
            sql = sql + "and thrq<=@thrq_e ";
        }
        if (qdsj_b.Trim() != string.Empty)
        {
            sql = sql + "and qdsj>=@qdsj_b ";
        }
        if (qdsj_e.Trim() != string.Empty)
        {
            sql = sql + "and qdsj<=@qdsj_e ";
        }
        sql1 = sql1 + sql;
        SqlConnection conn1 = new SqlConnection((string)Application["connstr"]);
        conn1.Open();

        SqlDataAdapter adapter1 = new SqlDataAdapter(sql1, conn1);
        adapter1.SelectCommand.Parameters.Add("@hygs", SqlDbType.VarChar).Value = hygs;
        adapter1.SelectCommand.Parameters.Add("@thrq_b", SqlDbType.VarChar).Value = thrq_b;
        adapter1.SelectCommand.Parameters.Add("@thrq_e", SqlDbType.VarChar).Value = thrq_e;
        adapter1.SelectCommand.Parameters.Add("@qdsj_b", SqlDbType.VarChar).Value = qdsj_b;
        adapter1.SelectCommand.Parameters.Add("@qdsj_e", SqlDbType.VarChar).Value = qdsj_e;
      
        DataSet ds1 = new DataSet();
        adapter1.Fill(ds1, "tuihuoguanli");
        this.DataGrid1.DataSource = ds1.Tables["tuihuoguanli"].DefaultView;
        this.DataGrid1.DataBind();

        conn1.Close();
       Response.Write("<" + "script" + ">" + "window.parent.topFrame.locaton.reload();'" + "</" + "script" + ">");   

       
    }
    protected void LinkButton5_Click(object sender, EventArgs e)
    {
        this.Label1.Text = DBNull.Value.ToString();

    }
    protected void LinkButton6_Click(object sender, EventArgs e)
    {
        this.Label2.Text = DBNull.Value.ToString();
    }
    protected void LinkButton7_Click(object sender, EventArgs e)
    {
        this.Label3.Text = DBNull.Value.ToString();
    }
    protected void LinkButton8_Click(object sender, EventArgs e)
    {
        this.Label4.Text = DBNull.Value.ToString();
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -