Пример #1
0
 /// <summary>
 /// 初始化
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void Page_Load(object sender, EventArgs e)
 {
     CurrentTables = SiteTable.Tables;
     if (!IsPostBack)
     {
         if (CurrentTables == null || CurrentTables.Count == 0)
         {
             SiteTable.RefreshTable();
         }
         BindData();
     }
 }
Пример #2
0
        /// <summary>
        /// 批量删除 刷新表结构
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            Int32 arguments = Convert.ToInt32(Request.Form["__EVENTARGUMENT"]);

            switch (arguments)
            {
            case 1:
                SiteTable.RefreshTable();
                this.BindData();
                break;

            case -1:
                List <SiteTable> list = new List <SiteTable>();
                foreach (RepeaterItem item in Repeater1.Items)
                {
                    HtmlInputCheckBox chk = item.FindControl("id") as HtmlInputCheckBox;
                    if (chk.Checked)
                    {
                        var tabid = Guid.Parse(chk.Value);
                        var tab   = CurrentTables.Find(a => { return(a.ID == tabid); });
                        if (tab != null)
                        {
                            String sql = "DROP TABLE " + tab.TableName;
                            db.ExecuteCommand(sql);
                            CurrentTables.Remove(tab);
                        }
                        var frm = TableForm.TableForms.Find(a => { return(a.TableID == tabid); });
                        if (frm != null)
                        {
                            TableForm.TableForms.Remove(frm);
                            TableForm.SaveForms();
                        }
                    }
                }
                SiteTable.SaveTables(CurrentTables);
                this.BindData();
                break;
            }
        }