protected void Button1_Click( object sender , EventArgs e )
 {
     pbModule pm = new pbModule();
     string xsxh = XSXHTextBox.Text.Trim();
     if ( !pm.isValidString( xsxh ) )
     {
         messageLabel.Text = Resources.Resource.strNotValidString;
         return;
     }
     dbModule dm = new dbModule();
     string xsxm = dm.getXsxmByXh( xsxh );
     if ( xsxm.Equals( "error!" ) )
     {
         messageLabel.Text = Resources.Resource.strNotFoundString;
         return;
     }
     int syjhid = Convert.ToInt32( Request["ID"] );
     Security sec = Session["sec"] as Security;
     string shrid = sec.getUserCode();
     if ( dm.cfxk( syjhid , xsxh ) != 0 )//重复选课
     {
         messageLabel.Text = Resources.Resource.strDuplicateXKString;
         return;
     }
     dm.sqxk( syjhid , xsxh , shrid );
     Response.Redirect( Request.Url.AbsoluteUri );
 }
    protected void Button1_Click(object sender, EventArgs e)
    {
        pbModule pm = new pbModule();
        string xsxh = XSXHTextBox.Text.Trim();
        if (!pm.isValidString(xsxh))
        {
            messageLabel.Text = Resources.Resource.strNotValidString;
            return;
        }
        dbModule dm = new dbModule();
        string xsxm = dm.getXsxmByXh(xsxh);
        if (xsxm.Equals("error!"))
        {
            messageLabel.Text = Resources.Resource.strNotFoundString;
            return;
        }
        string xslb = dm.getXslbByXh(xsxh);

        string yqlb = DetailsView1.Rows[5].Cells[1].Text;
        int syjhid = Convert.ToInt32(Request["ID"]);
        Security sec = Session["sec"] as Security;
        string shrid = sec.getUserCode(); if ( dm.cfxk( syjhid , xsxh ) != 0 )//重复选课
        {
            messageLabel.Text = Resources.Resource.strDuplicateXKString;
            return;
        }
         if (xslb.Trim().Equals(yqlb) || yqlb.Equals("不限"))
         {
             dm.sqxk(syjhid ,xsxh ,shrid);

             messageLabel.Text = "学生:" + xsxm + "已经添加!";
         }
         else
         {
             messageLabel.Text = "学生类别:" + xslb + "与实验要求类别:" + yqlb + "不一致,无法添加该学生:" + xsxm;
             return;
         }
    }
Пример #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     Security s = Session["sec"] as Security;
     if (s == null)
     {
         Response.Redirect("error.aspx");
     }
     if (!IsPostBack)
     {
         dbModule dm = new dbModule();
         int syjhid = Convert.ToInt32(Request["ID"]);
         Security sec = Session["sec"] as Security;
         string sqrid = sec.getUserCode();
         string shrid = "admin";
         if (dm.cfxk(syjhid,sqrid)!=0)//重复选课
         {
             messageLabel.Text = Resources.Resource.strDuplicateXKString;
             return;
         }
         if ( dm.xkym( syjhid ) != 0 )//选课已满
         {
             messageLabel.Text = Resources.Resource.strFullString;
             return;
         }
         if (ConfigurationManager.AppSettings["wxsh"] == "1")
         {
             int i = dm.sqxk( syjhid , sqrid , shrid );
             if ( i == 1 )
             {
                 messageLabel.Text = Resources.Resource.strOperateSuccess;
             }
             else
             {
                 messageLabel.Text = Resources.Resource.strOperateFailed;
             }
         }
     }
 }