Exemple #1
0
 protected void btnSubmit_Click(object sender, EventArgs e)
 {
     Model.BorTable mBrt = new Model.BorTable();
     try
     {
         if (BorPassword.Text == BorPass.Text)
         {
             mBrt.BorId       = int.Parse(BorId.Text);
             mBrt.BorName     = BorName.Text;
             mBrt.BorClass    = BorClass.Text;
             mBrt.BorTitle    = BorTitle.Text;
             mBrt.BorLoss     = "否";
             mBrt.BorPassword = BorPassword.Text;
             Bll.BorTable bBrt = new Bll.BorTable();
             if (bBrt.insert(mBrt))
             {
                 Response.Write("<script>alert('添加成功!')</script>");
             }
             else
             {
                 Response.Write("<script>alert('添加失败!')</script>");
             }
         }
         else
         {
             Response.Write("<script>alert('两次密码不一致!')</script>");
         }
     }
     catch
     {
         Response.Write("<script>alert('添加失败!')</script>");
     }
 }
 protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
 {
     Bll.BorTable   bBor = new Bll.BorTable();
     Model.BorTable mBor = new Model.BorTable();
     mBor.ID          = Convert.ToInt32(GridView1.Rows[e.RowIndex].Cells[0].Text.Trim());
     mBor.BorId       = Convert.ToInt32(((TextBox)(GridView1.Rows[e.RowIndex].Cells[1].Controls[0])).Text.ToString().Trim());
     mBor.BorName     = ((TextBox)(GridView1.Rows[e.RowIndex].Cells[2].Controls[0])).Text.ToString().Trim();
     mBor.BorClass    = ((TextBox)(GridView1.Rows[e.RowIndex].Cells[3].Controls[0])).Text.ToString().Trim();
     mBor.BorTitle    = ((TextBox)(GridView1.Rows[e.RowIndex].Cells[4].Controls[0])).Text.ToString().Trim();
     mBor.BorLoss     = ((TextBox)(GridView1.Rows[e.RowIndex].Cells[5].Controls[0])).Text.ToString().Trim();
     mBor.BorPassword = ((TextBox)(GridView1.Rows[e.RowIndex].Cells[6].Controls[0])).Text.ToString().Trim();
     bBor.update(mBor, GridView1.Rows[e.RowIndex].Cells[0].Text.Trim());
     GridView1.EditIndex = -1;
     this.bind();
 }