Ejemplo n.º 1
0
    protected void gvlist_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "del")
        {
            XYECOM.Business.Role r = new XYECOM.Business.Role();

            int err = r.Delete(Convert.ToInt32(gvlist.DataKeys[Convert.ToInt32(e.CommandArgument)].Value.ToString()));
            if (err == -2)
            {
                Alert("删除失败!", url);
            }
            else
            {
                gvDataBaind();
            }
        }
        else if (e.CommandName == "up")
        {

            XYECOM.Business.Role r = new XYECOM.Business.Role();
            this.key.Value = "2";
            this.hidUR_ID.Value = gvlist.DataKeys[Convert.ToInt32(e.CommandArgument)].Value.ToString();
            XYECOM.Model.RoleInfo Info = r.GetItem(Convert.ToInt32(gvlist.DataKeys[Convert.ToInt32(e.CommandArgument)].Value.ToString()));
            if (null != Info)
            {
                this.TextBox1.Text = Info.UR_Name;
            }

            r = null;
        }
    }
Ejemplo n.º 2
0
 protected void Button2_Click(object sender, EventArgs e)
 {
     XYECOM.Business.Role r = new XYECOM.Business.Role();
     XYECOM.Model.RoleInfo er = new XYECOM.Model.RoleInfo();
     er.UR_ID = Convert.ToInt16(this.hidUR_ID.Value);
     er.UR_Name = this.TextBox1.Text;
     int i = 0;
     i = r.Update(er);
     if (i >= 0)
     {
         this.ClientScript.RegisterClientScriptBlock(GetType(), "01", "<script>location.href='"+url+"';</script>");
         gvDataBaind();
     }
     else
     {
         Alert("修改失败!", url);
     }
 }
Ejemplo n.º 3
0
    protected void btnOk_ServerClick(object sender, EventArgs e)
    {
        XYECOM.Business.Role r = new XYECOM.Business.Role();
        XYECOM.Model.RoleInfo er = new XYECOM.Model.RoleInfo();
        er.UR_Name = this.txtName.Text;

        int err = r.Insert(er);
        if (err == -1)
        {
            Alert("该记录已存在!请重新输入信息!", url);
        }
        else if (err == -2)
        {
            Alert("添加失败!", url);
        }
        else
        {
            gvDataBaind();
        }
    }