/// <summary> /// 保存 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSave_Click(Object sender, EventArgs e) { //HtmlDocument _xml = new HtmlDocument(); //_xml.LoadHtml(Content.Text); //HtmlNode form = _xml.DocumentNode.SelectSingleNode("//form"); //if (form == null) //{ // Alert(Label1, "没有发现表单!", "line1px_2"); // return; //} //HtmlAttributeCollection att = form.Attributes; //if (att["name"] == null || String.IsNullOrEmpty(att["name"].Value)) //{ // Alert(Label1, "表单名字未设置!", "line1px_2"); // return; //} //String name = att["name"].Value; if (IsEdit) { CurrentForm = CurrentForms.Find(a => { return(a.ID == EditID); }); } else { CurrentForm = new TableFormItem { ID = Guid.NewGuid() }; CurrentForms.Add(CurrentForm); } this.GetFormValue <TableFormItem>(CurrentForm); TableForm.SaveForms(); Alert(Label1, "保存成功!", "line1px_3"); }
/// <summary> /// 列表事件 /// </summary> /// <param name="source"></param> /// <param name="e"></param> protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e) { if (e.CommandName == "del") { Guid id = Guid.Parse(((HtmlInputCheckBox)e.Item.FindControl("id")).Value); TableFormItem frm = CurrentForms.Find(a => { return(a.ID == id); }); if (id != null) { CurrentForms.Remove(frm); TableForm.SaveForms(); } this.BindData(); } }
/// <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; } }
/// <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"]); if (arguments == -1) { List <TableForm> list = new List <TableForm>(); foreach (RepeaterItem item in Repeater1.Items) { HtmlInputCheckBox chk = item.FindControl("id") as HtmlInputCheckBox; if (chk.Checked) { var frm = CurrentForms.Find(a => { return(a.ID == Guid.Parse(chk.Value)); }); if (frm != null) { CurrentForms.Remove(frm); } } } TableForm.SaveForms(); this.BindData(); } }
/// <summary> /// 列表事件 /// </summary> /// <param name="source"></param> /// <param name="e"></param> protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e) { String id = ((HtmlInputCheckBox)e.Item.FindControl("ID")).Value; if (e.CommandName == "del") { Guid tabid = Guid.Parse(id); var tab = CurrentTables.Find(a => { return(a.ID == tabid); }); if (tab != null) { String sql = "DROP TABLE " + tab.TableName; db.ExecuteCommand(sql); CurrentTables.Remove(tab); SiteTable.SaveTables(CurrentTables); } var frm = TableForm.TableForms.Find(a => { return(a.TableID == tabid); }); if (frm != null) { TableForm.TableForms.Remove(frm); TableForm.SaveForms(); } this.BindData(); } }