Пример #1
0
 /// <summary>
 /// 删除留言
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void Button2_Click(object sender, EventArgs e)
 {
     Business.Users.Competence thecom = new Business.Users.Competence();
     if (thecom.isCompetence("" + Session["LoginStudentXH"] + "", "41") == "")
     {
         SqlCommand sqlcom;
         for (int i = 0; i <= GridView1.Rows.Count - 1; i++)
         {
             CheckBox cbox = (CheckBox)GridView1.Rows[i].FindControl("CheckBox1");
             if (cbox.Checked == true)
             {
                 string sqlstr = "delete from Guest where ID='" + GridView1.DataKeys[i].Value + "'";
                 sqlcom = new SqlCommand(sqlstr, cn);
                 cn.Open();
                 sqlcom.ExecuteNonQuery();
                 cn.Close();
             }
         }
         Showdata();
     }
     else
     {
         Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", @"<script>alert('" + thecom.isCompetence("" + Session["LoginStudentXH"] + "", "41") + "!');</script>");
     }
 }
Пример #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
               {
            Business.Users.Competence thecom = new Business.Users.Competence();
            DataTable comlisr = thecom.GetCompetenceList();
            this.ListView2.DataSource = comlisr;
            this.DataBind();

               Business.Users.Role therole = new Business.Users.Role();
               DataTable role= therole.GetRoleList();

               for (int i = 0; i < this.ListView2.Items.Count; i++)
               {
               DataTable userrole = therole.GetRoleCompetenceList("" + Session["UserRoleCompetenceEditXH"].ToString() + "");//班主任
               for (int j = 0; j < userrole.Rows.Count; j++)
               {
                   string comID = userrole.Rows[j]["CompetenceID"].ToString();
                   if (comID == ((Label)this.ListView2.Items[i].Controls[0].FindControl("Label1")).Text)
                   {
                       ((CheckBox)this.ListView2.Items[i].Controls[0].FindControl("CheckBox1")).Checked = true;
                   }
               }
               }}
        }
Пример #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["LoginUserXH"].ToString() == "")
            {
                Response.Redirect("Login.aspx");
            }
            if (!Page.IsPostBack)
            {
                Business.Users.Competence thecom = new Business.Users.Competence();
                DataTable comlisr = thecom.GetCompetenceList();
                this.ListView2.DataSource = comlisr;
                this.DataBind();

                Business.Users.Role therole = new Business.Users.Role();
                DataTable           role    = therole.GetRoleList();


                for (int i = 0; i < this.ListView2.Items.Count; i++)
                {
                    DataTable userrole = therole.GetRoleCompetenceList("" + Session["UserRoleCompetenceEditXH"].ToString() + "");//班主任
                    for (int j = 0; j < userrole.Rows.Count; j++)
                    {
                        string comID = userrole.Rows[j]["CompetenceID"].ToString();
                        if (comID == ((Label)this.ListView2.Items[i].Controls[0].FindControl("Label1")).Text)
                        {
                            ((CheckBox)this.ListView2.Items[i].Controls[0].FindControl("CheckBox1")).Checked = true;
                        }
                    }
                }
            }
        }
        protected void LinkButton1_Click(object sender, EventArgs e)//删除
        {
            Business.Users.Competence thecom = new Business.Users.Competence();
            string qx = thecom.isCompetence("" + Session["LoginStudentXH"].ToString() + "", "52");

            if (qx == "")
            {
                string     ID  = ((Label)((LinkButton)sender).Parent.Parent.Controls[0].FindControl("Label1")).Text;
                SqlCommand cmd = new SqlCommand("delete MainPage where ID=" + ID + "", cn);
                try
                {
                    cn.Open();
                    cmd.ExecuteNonQuery();
                    setdata(this.DropDownList1.SelectedValue);
                }
                catch (Exception ex)
                {
                    Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", @"<script>alert(‘" + ex.Message + "');</script>");
                }
                finally
                {
                    cn.Close();
                }
            }
            else
            {
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", @"<script>alert('你没有权限,如有疑问,请与管理员联系!');</script>");
            }
        }
 protected void Button5_Click(object sender, EventArgs e)
 {
     Business.Users.Competence thecom = new Business.Users.Competence();
     if (thecom.isCompetence("" + Session["LoginStudentXH"] + "", "22") == "")
     {
         Response.Redirect("ZHLH.aspx");;
     }
     else
     {
         Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", @"<script>alert('" + thecom.isCompetence("" + Session["LoginStudentXH"] + "", "22") + "');</script>");
     }
 }
Пример #6
0
 protected void Button3_Click(object sender, EventArgs e)
 {
     Business.Users.Competence thecom = new Business.Users.Competence();
     if (thecom.isCompetence("" + Session["LoginUserXH"].ToString() + "", "15") == "")
     {
         Session["UserRoleCompetenceEditXH"] = ((Label)((Button)sender).FindControl("Label1")).Text;
        Response.Redirect("RoleCompetenceEdit.aspx");
     }
     else
     {
         Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", @"<script>alert('" + thecom.isCompetence("" + Session["UserRoleEditXH"].ToString() + "", "15") + "');</script>");
     }
 }
 protected void Button3_Click(object sender, EventArgs e)
 {
     Business.Users.Competence thecom = new Business.Users.Competence();
     if (thecom.isCompetence("" + Session["LoginUserXH"].ToString() + "", "15") == "")
     {
         Session["UserRoleCompetenceEditXH"] = ((Label)((Button)sender).FindControl("Label1")).Text;
         Response.Redirect("RoleCompetenceEdit.aspx");
     }
     else
     {
         Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", @"<script>alert('" + thecom.isCompetence("" + Session["UserRoleEditXH"].ToString() + "", "15") + "');</script>");
     }
 }
Пример #8
0
 protected void LinkButton2_Click(object sender, EventArgs e)
 {
     Business.Users.Competence thecom = new Business.Users.Competence();
     string qx = thecom.isCompetence("" + Session["LoginStudentXH"] + "", "63");
     if (qx == "")
     {
         Response.Redirect("TimeTJ.aspx");
     }
     else
     {
         Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", @"<script>alert('" + qx + "');</script>");
     }
 }
Пример #9
0
        protected void Button2_Click(object sender, EventArgs e)
        {
            Business.Users.Competence thecom = new Business.Users.Competence();
            string qx = thecom.isCompetence("" + Session["LoginStudentXH"].ToString() + "", "17");

            if (qx == "")
            {
                Response.Redirect("MainContentSelect.aspx");
            }
            else
            {
                Response.Write("<script>alert('你没有权限,如有疑问请与管理员联系!');window.location.href ='Main_Manage.aspx'</script>");
            }
        }
Пример #10
0
 /// <summary>
 /// 用户角色分配
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void LinkButton2_Click(object sender, EventArgs e)
 {
     Business.Users.Competence qx = new Business.Users.Competence();
     //角色分配的权限
     string logingxh = Session["LoginUserXH"].ToString();
     if (qx.isCompetence("" + logingxh + "", "14") == "")
     {
             Session["UserRoleEditXH"] = ((GridViewRow)((LinkButton)sender).Parent.Parent).Cells[0].Text;
             Response.Redirect("UserRoleEdit.aspx");
     }
     else
     {
         Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", @"<script>alert('" + qx.isCompetence("" + Session["LoginUserXH"] + "", "14") + "');</script>");
     }
 }
Пример #11
0
        /// <summary>
        /// 用户角色分配
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void LinkButton2_Click(object sender, EventArgs e)
        {
            Business.Users.Competence qx = new Business.Users.Competence();
            //角色分配的权限
            string logingxh = Session["LoginUserXH"].ToString();

            if (qx.isCompetence("" + logingxh + "", "14") == "")
            {
                Session["UserRoleEditXH"] = ((GridViewRow)((LinkButton)sender).Parent.Parent).Cells[0].Text;
                Response.Redirect("UserRoleEdit.aspx");
            }
            else
            {
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", @"<script>alert('" + qx.isCompetence("" + Session["LoginUserXH"] + "", "14") + "');</script>");
            }
        }
Пример #12
0
        protected void LinkButton5_Click(object sender, EventArgs e)
        {
            Business.Users.Competence thecom = new Business.Users.Competence();
            string qx = thecom.isCompetence("" + Session["LoginStudentXH"] + "", "61");

            if (qx == "")
            {
                string id = ((Label)((LinkButton)sender).Parent.Parent.Controls[0].FindControl("Label1")).Text;
                Session["id"] = id;
                Response.Redirect("XG.aspx");
            }
            else
            {
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", @"<script>alert('" + qx + "');</script>");
            }
        }
Пример #13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string act = null;
                try
                {
                    act = Session["LoginStudentXM"].ToString();
                }
                catch
                {
                    this.divmanage.Visible = false;
                    //Response.Write("<script>alert('请先登录!');window.href ='http://computer2011.apphb.com/default.aspx'</script>");
                    Response.Write("<script>alert('请先登录!');window.location.href ='IndexPage.aspx'</script>");
                    return;
                    // Response.Write("<script>alert('请先登录!');window.location.href ='http://computer2011.apphb.com/default.aspx'</script>");
                    // return;
                }

                //if (act != null)
                //{
                Business.Users.Competence thecom = new Business.Users.Competence();
                string qx = thecom.isCompetence("" + Session["LoginStudentXH"].ToString() + "", "17");
                if (qx == "")
                {
                    SqlDataAdapter da = new SqlDataAdapter("select * from DM_LB", cn);
                    DataSet        ds = new DataSet();
                    cn.Open();
                    da.Fill(ds, "TitleType");
                    cn.Close();
                    this.DropDownList1.DataSource     = ds.Tables["TitleType"].DefaultView;
                    this.DropDownList1.DataValueField = ds.Tables["TitleType"].Columns[0].ColumnName;
                    this.DropDownList1.DataTextField  = ds.Tables["TitleType"].Columns[1].ColumnName;
                    this.DropDownList1.DataBind();
                }
                else
                {
                    this.divmanage.Visible = false;
                    Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", @"<script>alert('你没有权限,如有疑问,请与管理员联系!');</script>");
                }
                //}
            }

            //{
            //    this.divmanage.Visible = false;
            //    Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", @"<script>alert('请先登录!');</script>");
        }
Пример #14
0
        protected void LinkButton1_Click(object sender, EventArgs e)
        {
            Business.Users.Competence thecom = new Business.Users.Competence();
            string qx = thecom.isCompetence("" + Session["LoginStudentXH"] + "", "60");

            if (qx == "")
            {
                string         id    = ((Label)((LinkButton)sender).Parent.Parent.Controls[0].FindControl("Label1")).Text;
                DataTable      table = new DataTable();
                SqlDataAdapter da    = new SqlDataAdapter("select kq.Sno,name ,kqlb from kq,Student,kqlb where kq.Sno=Student.Sno and kq.kqID=kqlb.kqID and kq.ID='" + id + "' order by kq.sno", cn);
                da.Fill(table);
                this.GridViewXQ.DataSource = table;
                this.GridViewXQ.DataBind();
                this.GridViewXQ.Visible = true;
            }
            else
            {
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", @"<script>alert('" + qx + "');</script>");
            }
        }
Пример #15
0
 /// <summary>
 /// 禁止登录
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void LinkButton3_Click1(object sender, EventArgs e)
 {
     try
     {
         string xh = ((GridViewRow)((LinkButton)sender).Parent.Parent).Cells[0].Text;
         Business.Users.Competence qx = new Business.Users.Competence();
         //删除用户权限
         if (qx.isCompetence("" + Session["LoginUserXH"] + "", "11") == "")
         {
             Business.Users.User jzuser = new Business.Users.User();
             jzuser.JZUser("" + Session["LoginUserXH"] + "");
             DataShow();
         }
         else
         {
             Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", @"<script>alert('" + qx.isCompetence("" + Session["LoginUserXH"] + "", "11") + "');</script>");
         }
     }
     catch
     {
         Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", @"<script>alert('操作失败!');</script>");
     }
 }
Пример #16
0
        protected void delLinkButton_Click(object sender, EventArgs e)
        {
            Business.Users.Competence thecom = new Business.Users.Competence();
            string qx = thecom.isCompetence("" + Session["LoginStudentXH"] + "", "30");

            if (qx == "")
            {
                string id = ((Label)((LinkButton)sender).Parent.Parent.Controls[0].FindControl("Label1")).Text;
                Session["id"] = id;

                cmd             = new SqlCommand();
                cmd.Connection  = cn;
                cmd.CommandText = "EXEC DELETE_wj  '" + id + "'";
                cn.Open();
                cmd.ExecuteNonQuery();
                cn.Close();
                Response.Redirect("/WJSC.aspx");
            }
            else
            {
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", @"<script>alert('" + qx + "');</script>");
            }
        }
Пример #17
0
 /// <summary>
 /// 登录验证
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void Button1_Click(object sender, EventArgs e)
 {
     Business.Users.User loginnuer = new Business.Users.User();
     Business.Users.User theuser   = loginnuer.UserLogin("" + this.TextBoxXH.Text + "", "" + this.TextBoxPWD.Text + "");
     if (theuser == null)
     {
         Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", @"<script>alert('登录失败,学号或密码错误!');</script>");
     }
     else
     {
         Business.Users.Competence thecom = new Business.Users.Competence();
         string qx = thecom.isCompetence("" + this.TextBoxXH.Text + "", "10");
         if (qx == "")
         {
             Session["LoginUserXH"] = "" + this.TextBoxXH.Text + "";
             Response.Redirect("UserMain.aspx");
         }
         else
         {
             Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", @"<script>alert('" + qx + "');</script>");
         }
     }
 }
Пример #18
0
        /// <summary>
        /// 登录验证
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Button1_Click(object sender, EventArgs e)
        {
            Business.Users.User loginnuer = new Business.Users.User();
            Business.Users.User theuser = loginnuer.Login("" + this.TextBoxXH.Text + "", "" + this.TextBoxPWD.Text + "");
            if (theuser == null)
            {
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", @"<script>alert('登录失败,学号或密码错误!');</script>");
            }
            else
            {
                Business.Users.Competence thecom = new Business.Users.Competence();
            string qx = thecom.isCompetence("" + this.TextBoxXH.Text + "", "10");
            if (qx == "")
            {
                Session["LoginUserXH"] = "" + this.TextBoxXH.Text + "";
                Response.Redirect("UserManage.aspx");
            }
            else
            {
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", @"<script>alert('" + qx + "');</script>");
            }

            }
        }
Пример #19
0
        //提交按钮
        protected void tjButton_Click(object sender, EventArgs e)
        {
            Business.Users.Competence thecom = new Business.Users.Competence();
            string qx = thecom.isCompetence("" + Session["LoginStudentXH"] + "", "31");

            if (qx == "")
            {
                DataTable  table3 = new DataTable();
                string     id     = Session["id"].ToString();
                SqlCommand cmd    = new SqlCommand();
                cmd.Connection  = cn;
                cmd.CommandText = "Select sno,wjh from Tongji where sno='" + Session["LoginStudentXH"].ToString() + "' and wjh=@wjh";
                cmd.CommandType = System.Data.CommandType.Text;
                cmd.Parameters.Add("@sno", SqlDbType.NVarChar, 12);
                cmd.Parameters.Add("@wjh", SqlDbType.NChar, 12);
                cmd.Parameters["@sno"].Value = Session["LoginStudentXH"];
                cmd.Parameters["@wjh"].Value = id;
                try
                {
                    cn.Open();
                    SqlDataAdapter da3 = new SqlDataAdapter();
                    da3.SelectCommand = cmd;
                    da3.Fill(table3);

                    if (table3.Rows.Count > 0)
                    {
                        Response.Redirect("/noTj.aspx");
                    }
                    else
                    {
                        SqlCommand cmd1 = new SqlCommand("INSERT INTO TongJi(sno,Wjh) VALUES ('" + Session["LoginStudentXH"] + "','" + id + "')", cn);
                        cmd1.ExecuteNonQuery();
                        DataTable      table = new DataTable();
                        SqlDataAdapter da    = new SqlDataAdapter("select tm,th from Tm where wjh='" + id + "'", cn);
                        da.Fill(table);
                        for (int i = 0; i < table.Rows.Count; i++)
                        {
                            string         tmid    = table.Rows[i][1].ToString();//题号
                            SqlDataAdapter da1     = new SqlDataAdapter("select choice,tixing,ID,Number from choice,Tm where choice.th='" + tmid + "' and Tm.th='" + tmid + "'", cn);
                            DataTable      xmtable = new DataTable();
                            da1.Fill(xmtable);
                            for (int j = 0; j < xmtable.Rows.Count; j++)
                            {
                                string xxid = xmtable.Rows[j][2].ToString();
                                bool   xz   = false;                      // 选项被选中为true
                                if (xmtable.Rows[j][1].ToString() == "0") //tixing为0的时候为单项选择
                                {
                                    var radio = Request.Form[tmid];
                                    xz = radio != null && radio.Equals(xxid);
                                }
                                else
                                {
                                    var box = Request.Form[xxid];
                                    xz = box != null;
                                }
                                if (xz)
                                {
                                    SqlCommand com = new SqlCommand("update choice set Number = Number + 1 where ID = " + xxid, cn);
                                    com.ExecuteNonQuery();
                                }
                            }
                        }
                        Response.Redirect("/successTj.aspx");
                    }
                }
                finally
                {
                    cn.Close();
                }
            }
            else
            {
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", @"<script>alert('" + qx + "');</script>");
            }
        }
Пример #20
0
 /// <summary>
 /// 禁止用
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void LinkButton3_Click(object sender, EventArgs e)
 {
     try
     {
         string xh = ((GridViewRow)((LinkButton)sender).Parent.Parent).Cells[0].Text;
         Business.Users.Competence qx = new Business.Users.Competence();
         //删除用户权限
         if (qx.isCompetence("" + Session["LoginUserXH"] + "", "11") == "")
         {
             Business.Users.User jzuser = new Business.Users.User();
             jzuser.JZUser("" + Session["LoginUserXH"] + "");
             DataShow();
         }
         else
         {
             Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", @"<script>alert('" + qx.isCompetence("" + Session["LoginUserXH"] + "", "11") + "');</script>");
         }
     }
     catch
     {
         Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", @"<script>alert('操作失败!');</script>");
     }
 }