protected void gvResult_RowDeleting(object sender, GridViewDeleteEventArgs e)
 {
     try
     {
         this.dbo = new DB_OPT();
         this.dbo.Open();
         string str = this.gvResult.DataKeys[e.RowIndex].Value.ToString();
         this.drpim = new DataRowPowerItemDal();
         this.drpim.PK = str;
         this.drpim.Delete(this.dbo);
         this.ShowData("");
         Const.ShowMessage("删除成功!", this.Page);
     }
     catch (Exception exception)
     {
         Const.OpenErrorPage("删除失败!" + exception.Message, this.Page);
     }
     finally
     {
         this.dbo.Close();
     }
 }
 protected void btDo_Click(object sender, EventArgs e)
 {
     try
     {
         this.dbo = new DB_OPT();
         this.dbo.Open();
         this.drpim = new DataRowPowerItemDal();
         this.drpim.Name = this.txtname.Text.Trim();
         this.drpim.PowerCode = this.txtpowercode.Text.Trim();
         this.drpim.TableName = this.ddltablename.SelectedValue;
         string qxlist = "";
         string strwhere = "";
         this.GetStrWhere(out qxlist, out strwhere);
         this.drpim.Discription = this.txtDiscription.Text.Trim();
         this.drpim.QXList = qxlist;
         this.drpim.strWhere = strwhere;
         if (this.ifadd.Value == "0")
         {
             this.drpim.PK = this.pk.Value;
             this.drpim.Update(this.dbo);
             Const.DoSuccessOpen("修改成功!", this.Page);
         }
         else
         {
             this.drpim.Add(this.dbo);
             Const.DoSuccessOpen("添加成功!", this.Page);
         }
     }
     catch (Exception exception)
     {
         Const.OpenErrorPage("操作失败!" + exception.Message, this.Page);
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!this.Page.IsPostBack)
     {
         try
         {
             this.dbo = new DB_OPT();
             this.dbo.Open();
             this.ShowZDData();
             if ((base.Request.QueryString["type"] != null) && (base.Request.QueryString["type"].ToString() == "Update"))
             {
                 this.ifadd.Value = "0";
                 this.btDo.Text = "修改";
                 this.pk.Value = base.Request.QueryString["PK"].ToString();
                 this.drpim = new DataRowPowerItemDal();
                 this.drpim.PK = this.pk.Value;
                 this.drpim.GetModel(this.dbo);
                 this.SetValue(sender, e);
             }
             else
             {
                 this.ddltablename_SelectedIndexChanged(sender, e);
             }
         }
         catch (Exception exception)
         {
             Const.OpenErrorPage("获取数据失败,请联系管理员!" + exception.Message, this.Page);
         }
         finally
         {
             this.dbo.Close();
         }
     }
 }
 private void ShowData(string str)
 {
     try
     {
         this.dbo = new DB_OPT();
         this.dbo.Open();
         this.drpim = new DataRowPowerItemDal();
         DataSet set = this.pagesize.pagesize("*", "DataRowPowerItem", str, "PK", " order by PowerCode ", this.pageind, 10, out this.count);
         if (set != null)
         {
             this.gvResult.DataSource = set.Tables[0].DefaultView;
             this.gvResult.DataBind();
         }
     }
     catch (Exception exception)
     {
         Const.OpenErrorPage("获取数据失败,请联系管理员!" + exception.Message, this.Page);
     }
     finally
     {
         this.dbo.Close();
     }
 }
 public override DataRowPowerItemModel[] GetModels(DB_OPT dbo)
 {
     DataRowPowerItemModel[] modelArray = null;
     StringBuilder builder = new StringBuilder();
     builder.Append("select  ");
     builder.Append(" PK,Name,PowerCode,TableName,ColumnName,QXList,strWhere,ShowTJ,Discription ");
     builder.Append(" from db_DataRowPowerItem ");
     builder.Append(" where TableName='" + base.TableName + "'");
     DataSet set = dbo.BackDataSet(builder.ToString(), null);
     if (set.Tables[0].Rows.Count > 0)
     {
         modelArray = new DataRowPowerItemModel[set.Tables[0].Rows.Count];
         for (int i = 0; i < set.Tables[0].Rows.Count; i++)
         {
             modelArray[i] = new DataRowPowerItemModel();
             modelArray[i].Name = set.Tables[0].Rows[i]["Name"].ToString();
             modelArray[i].PowerCode = set.Tables[0].Rows[i]["PowerCode"].ToString();
             modelArray[i].TableName = set.Tables[0].Rows[i]["TableName"].ToString();
             modelArray[i].ColumnName = set.Tables[0].Rows[i]["ColumnName"].ToString();
             modelArray[i].ColumnName = set.Tables[0].Rows[i]["QXList"].ToString();
             modelArray[i].strWhere = set.Tables[0].Rows[i]["strWhere"].ToString();
             modelArray[i].ShowTJ = set.Tables[0].Rows[i]["ShowTJ"].ToString();
             modelArray[i].Discription = set.Tables[0].Rows[i]["Discription"].ToString();
         }
     }
     return modelArray;
 }