예제 #1
0
    protected void GVComputer_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (Request.Cookies[LearnSite.Common.CookieHelp.teaCookieNname] != null)
        {
            if (e.CommandName.Equals("Lock"))
            {
                string myPid = e.CommandArgument.ToString();
                LearnSite.BLL.Computers cbll = new LearnSite.BLL.Computers();
                cbll.UpLock(Int32.Parse(myPid));
                System.Threading.Thread.Sleep(500);
                showIpMachine();
            }
            if (e.CommandName.Equals("Del"))
            {
                string myPid = e.CommandArgument.ToString();
                LearnSite.BLL.Computers cbll = new LearnSite.BLL.Computers();
                cbll.Delete(Int32.Parse(myPid));
                System.Threading.Thread.Sleep(500);
                showIpMachine();
            }
            if (e.CommandName.Equals("Upd"))
            {
                string myPid = e.CommandArgument.ToString();
                int    i     = ((GridViewRow)((Button)e.CommandSource).NamingContainer).RowIndex;
                //(该方法不需要html中的绑定,取id.刚刚看到的,加上来,好方法.......)

                TextBox tb = (TextBox)GVComputer.Rows[i].FindControl("TextBoxp");
                LearnSite.BLL.Computers cbll = new LearnSite.BLL.Computers();
                cbll.UpdateByPid(Int32.Parse(myPid), tb.Text.Trim());
                System.Threading.Thread.Sleep(500);
                showIpMachine();
            }
            if (e.CommandName.Equals("Can"))
            {
                System.Threading.Thread.Sleep(500);
                showIpMachine();
            }
        }
        else
        {
            string ch = "请登录后执行操作!";
            LearnSite.Common.WordProcess.Alert(ch, this.Page);
        }
    }