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 );
 }
Ejemplo n.º 2
0
    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;
         }
    }