예제 #1
0
    protected void Page_Load( object sender , EventArgs e )
    {
        Security s = Session["sec"] as Security;
        if (s == null)
        {
            Response.Redirect("error.aspx");
        }
        if (!IsPostBack)
        {
            SYSDS.SelectCommand = "SELECT [ID], [SYMC] FROM [V_SYJBXXB] where kcid in (select kcid from v_gly_sys_kc where glyid='" + s.getUserCode() + "') ORDER BY [SYMC]";
            sysSDS.SelectCommand = "SELECT [ID], [SYSDD] FROM [T_SYSXXB] WHERE id in (select sysid from v_gly_sys_kc where glyid='" + s.getUserCode() + "') and  ([ID] <> @ID) ORDER BY [SYSDD]";
            for (int i = 1; i <= 7; i++)
            {
                for (int j = 1; j <= 7; j++)
                {
                    Table1.Rows[i].Cells[j].Text = "&nbsp";
                }
            }
            string ap = Request["ap"];
            if (ap == null || ap == "") ap = "0";
            if (ap.Equals("1"))
            {//安排实验
                dbModule dm = new dbModule();
                int sysid = Convert.ToInt32(Session["sysid"]);
                int syid = Convert.ToInt32(Session["syid"]);
                string syjsid = Session["syjsid"] as string;
                int syrs = Convert.ToInt32(Session["syrs"]);
                string sybh = Session["sybh"] as string;
                string syxn = Session["syxn"] as string;
                int syxq = Convert.ToInt32(Session["syxq"]);
                int syz = Convert.ToInt32(Session["syz"]);
                int syxingq = Convert.ToInt32(Request["syxingq"]);
                int syks = Convert.ToInt32(Request["syks"]);
                int i = dm.addSyjh(syid, sybh, syjsid, sysid, syrs, syxn, syxq, syz, syxingq, syks);
                syrsTxt.Text = syrs.ToString();
                sybhTXT.Text = sybh;
                xnDDL.DataBind();
                ListItem li1 = xnDDL.Items.FindByValue(syxn);
                if (li1 != null)
                {
                    li1.Selected = true;
                }
                xqDDL.DataBind();
                ListItem li2 = xqDDL.Items.FindByValue(syxq.ToString());
                if (li2 != null)
                {
                    li2.Selected = true;
                }
                zDDL.DataBind();
                ListItem li3 = zDDL.Items.FindByValue(syz.ToString());
                if (li3 != null)
                {
                    li3.Selected = true;
                }
                sysDDL.DataBind();
                ListItem li4 = sysDDL.Items.FindByValue(sysid.ToString());
                if (li4 != null)
                {
                    li4.Selected = true;
                }

                syjsDDL.DataBind();
                ListItem li5 = syjsDDL.Items.FindByValue(syjsid);
                if (li5 != null)
                {
                    li5.Selected = true;
                }
                syDDL.DataBind();
                ListItem li6 = syDDL.Items.FindByValue(syid.ToString());
                if (li6 != null)
                {
                    li6.Selected = true;
                }
                Button1_Click(this, new EventArgs());
            }
            else if (ap.Equals("2"))
            {
                string syjhid = Request["syjhid"];
                int sysid = Convert.ToInt32(Session["sysid"]);
                string syxn = Session["syxn"] as string;
                int syxq = Convert.ToInt32(Session["syxq"]);
                int syz = Convert.ToInt32(Session["syz"]);
                dbModule dm = new dbModule();
                int i = dm.delSyjh(Convert.ToInt32(syjhid));
                if (i == 0)
                {
                    Response.Write("");
                    Button1_Click(this, new EventArgs());
                }
                else
                {
                    xnDDL.DataBind();
                    ListItem li1 = xnDDL.Items.FindByValue(syxn);
                    if (li1 != null)
                    {
                        li1.Selected = true;
                    }
                    xqDDL.DataBind();
                    ListItem li2 = xqDDL.Items.FindByValue(syxq.ToString());
                    if (li2 != null)
                    {
                        li2.Selected = true;
                    }
                    zDDL.DataBind();
                    ListItem li3 = zDDL.Items.FindByValue(syz.ToString());
                    if (li3 != null)
                    {
                        li3.Selected = true;
                    }
                    sysDDL.DataBind();
                    ListItem li4 = sysDDL.Items.FindByValue(sysid.ToString());
                    if (li4 != null)
                    {
                        li4.Selected = true;
                    }
                    Button1_Click(this, new EventArgs());
                }
            }
        }
    }