挂号控件 未完成版

public partial class Default6 : System.Web.UI.Page
{
    HP hp = new HP();
    protected void Page_Load(object sender, EventArgs e)
    {
        string[] a = new string[8];
        string[] b = new string[8];
        for (int i = 0; i < 8; i++)
        {
            a[i] = date(System.DateTime.Now.AddDays(i));
            b[i] = dateR(System.DateTime.Now.AddDays(i));
        }
        DataSet ds = null;
        string sql = " select doctorname," + a[1] + "," + a[2] + "," + a[3] + "," + a[4] + "," + a[5] + "," + a[6] + "," + a[7] + " from 医生出诊时间表 ";//sql语句,然后用它自动绑定GridView  
        ds= hp.ReturnDataSet(sql, "医生出诊时间表");
        GridView1.DataSource = ds;
        //string[] lic = GridView1.DataKeys;
       
        //string Ywbm = GridView1.DataKeys[e.RowIndex].Values[0].ToString();
       // GridView1.Columns[1].HeaderText = b[1] + a[1];

        HyperLinkField hypfield1 = new HyperLinkField();
        hypfield1.ShowHeader = true;
        hypfield1.HeaderText = b[1] + a[1];
        hypfield1.DataTextField = a[1];
        hypfield1.NavigateUrl = ("CreateUser.aspx?td=" + b[1] + ",id=" + a[2] + "");
        GridView1.Columns.Add(hypfield1);

        HyperLinkField hypfield2 = new HyperLinkField();
        hypfield2.ShowHeader = true;
        hypfield2.HeaderText = b[2] + a[2];
        hypfield2.DataTextField = a[2];
        hypfield2.NavigateUrl = ("CreateUser.aspx?td=" + b[2] + ",id=" + a[2] + "");
        GridView1.Columns.Add(hypfield2);

        HyperLinkField hypfield3 = new HyperLinkField();
        hypfield3.ShowHeader = true;
        hypfield3.HeaderText = b[3] + a[3];
        hypfield3.DataTextField = a[3];
        hypfield3.NavigateUrl = ("CreateUser.aspx?td=" + b[3] + ",id=" + a[2] + "");
        GridView1.Columns.Add(hypfield3);

        HyperLinkField hypfield4 = new HyperLinkField();
        hypfield4.ShowHeader = true;
        hypfield4.HeaderText = b[4] + a[4];
        hypfield4.DataTextField = a[4];
        hypfield4.NavigateUrl = ("CreateUser.aspx?td=" + b[4] + ",id=" + a[2] + "");
        GridView1.Columns.Add(hypfield4);

        HyperLinkField hypfield5 = new HyperLinkField();
        hypfield5.ShowHeader = true;
        hypfield5.HeaderText = b[5] + a[5];
        hypfield5.DataTextField = a[5];
        hypfield5.NavigateUrl = ("CreateUser.aspx?td=" + b[5] + ",id=" + a[2] + "");
        GridView1.Columns.Add(hypfield5);

        HyperLinkField hypfield6 = new HyperLinkField();
        hypfield6.ShowHeader = true;
        hypfield6.HeaderText = b[6] + a[6];
        hypfield6.DataTextField = a[6];
        hypfield6.NavigateUrl = ("CreateUser.aspx?td=" + b[6] + ",id=" + a[2] + "");
        GridView1.Columns.Add(hypfield6);

        HyperLinkField hypfield7 = new HyperLinkField();
        hypfield7.ShowHeader = true;
        hypfield7.HeaderText = b[7] + a[7];
        hypfield7.DataTextField = a[7];
        hypfield7.NavigateUrl = ("CreateUser.aspx?td=" + b[7] + ",id=" + a[2] + "");
        GridView1.Columns.Add(hypfield7);


        GridView1.DataBind();

    }

    protected void GridView1_DataBound(object sender, GridViewRowEventArgs e)
    {
       
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
         
        }
    }
    private string date(DateTime d)
    {
        string str = d.DayOfWeek.ToString();
        string dates = "";
        switch (str)
        {
            case "Monday": dates = "星期一"; break;
            case "Tuesday": dates = "星期二"; break;
            case "Wednesday": dates = "星期三"; break;
            case "Thursday": dates = "星期四"; break;
            case "Friday": dates = "星期五"; break;
            case "Saturday": dates = "星期六"; break;
            case "Sunday": dates = "星期日"; break;
        }
        return dates;
    }

    private string dateR(DateTime r)
    {
        string str = r.ToLongDateString();
       
        return str;
    }

    protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
    {

    }


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值