程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> C語言 >> C++ >> C++入門知識 >> TreeGrid-無限制樹形GUCD

TreeGrid-無限制樹形GUCD

編輯:C++入門知識

HTML:


[html] <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Source.aspx.cs" Inherits="DzPlatForm.CRM.Property.Source" %> 
 
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head runat="server"> 
    <title>來源配置</title> 
    <link rel="stylesheet" type="text/css" href="resources/css/main.css" /> 
    <ext:ResourcePlaceHolder ID="ResourcePlaceHolder1" runat="server" Mode="Script" /> 
    <ext:ResourcePlaceHolder ID="ResourcePlaceHolder2" Mode="Style" runat="server"> 
        <script src="../../Scripts/am.js" type="text/javascript"></script> 
    </ext:ResourcePlaceHolder> 
</head> 
<body> 
    <form id="form1" runat="server"> 
    <ext:ResourceManager ID="ResourceManager1" runat="server" /> 
    <ext:TreeGrid ID="TreeGrid1" runat="server" UseArrows="true" Animate="true" AutoHeight="true" 
        AutoScroll="true" ForceLayout="true" Collapsed="false"> 
        <Columns> 
            <ext:TreeGridColumn Header="來源名稱" Width="300" DataIndex="Name"> 
            </ext:TreeGridColumn> 
            <ext:TreeGridColumn Header="父節點" DataIndex="ParentId" Hidden="true" > 
            </ext:TreeGridColumn> 
        </Columns> 
        <TopBar> 
            <ext:Toolbar ID="Toolbar1" runat="server"> 
                <Items> 
                    <ext:SplitButton ID="SplitButton1" runat="server" Text="新建來源" Icon="Add"> 
                        <Menu> 
                            <ext:Menu ID="Menu1" runat="server"> 
                                <Items> 
                                    <ext:MenuItem ID="menuAdd" runat="server" Text="新建頂層來源" Icon="Add"> 
                                        <DirectEvents> 
                                            <Click OnEvent="Menu_Click"> 
                                                <EventMask ShowMask="true" /> 
                                                <ExtraParams> 
                                                    <ext:Parameter Name="Item" Value="menuAdd" Mode="Value" /> 
                                                </ExtraParams> 
                                            </Click> 
                                        </DirectEvents> 
                                    </ext:MenuItem> 
                                    <ext:MenuItem ID="menuAddSubitem" runat="server" Text="新建當前選中子來源" Icon="DatabaseAdd"> 
                                        <DirectEvents> 
                                            <Click OnEvent="Menu_Click"> 
                                                <EventMask ShowMask="true" /> 
                                                <ExtraParams> 
                                                    <ext:Parameter Name="Item" Value="menuAddSubitem" Mode="Value" /> 
                                                </ExtraParams> 
                                            </Click> 
                                        </DirectEvents> 
                                    </ext:MenuItem> 
                                </Items> 
                            </ext:Menu> 
                        </Menu> 
                    </ext:SplitButton> 
                    <ext:Button ID="Button1" runat="server" Text="修改" Icon="DatabaseEdit"> 
                        <DirectEvents> 
                            <Click OnEvent="Menu_Click"> 
                                <EventMask ShowMask="true" Msg="修改..." MinDelay="500" /> 
                                <ExtraParams> 
                                    <ext:Parameter Name="Item" Value="menuEdit" Mode="Value" /> 
                                </ExtraParams> 
                            </Click> 
                        </DirectEvents> 
                    </ext:Button> 
                    <ext:Button ID="Button3" runat="server" Text="刪除" Icon="DatabaseDelete"> 
                        <Listeners> 
                            <Click Handler="DeleteNodeForTree2(#{TreeGrid1},#{txtValue});" /> 
                        </Listeners> 
                    </ext:Button> 
                </Items> 
            </ext:Toolbar> 
        </TopBar> 
        <Listeners> 
            <Click Handler="Ext.net.DirectMethods.ClickCurrentNode(node.attributes.Id+'|'+node.attributes.Name+'|'+node.attributes.ParentId)" /> 
        </Listeners> 
    </ext:TreeGrid> 
    <ext:Window ID="winMenuAdd" runat="server" Icon="Table" Closable="true" Title="" 
        AutoHeight="true" Width="450" Resizable="false" BodyStyle="background-color:#fff;" 
        Padding="15" Layout="FormLayout" ForceLayout="true" Hidden="true" Modal="true"> 
        <Items> 
            <ext:TextField ID="txt_Menu_Name_varchar2" runat="server" Width="220" FieldLabel="來源名稱" 
                LabelStyle="margin:5px 0 5 0;" StyleSpec="margin:5px 0 5 0;" /> 
            <ext:TextField ID="txt_Menu_ParentID_number" runat="server" Enabled="false" Width="220" 
                FieldLabel="父節點編號" LabelStyle="margin:5px 0 5 0;" StyleSpec="margin:5px 0 5 0;" 
                Text="-1" Hidden="true" /> 
            <ext:Hidden ID="txtValue" runat="server" Text="" /> 
            <ext:Hidden ID="txtType" runat="server" Text="add" /> 
        </Items> 
        <Buttons> 
            <ext:Button ID="btn_save" runat="server" Text="保存" Icon="Disk"> 
                <Listeners> 
                    <Click Handler="AddNodeForTree(#{TreeGrid1});" /> 
                </Listeners> 
            </ext:Button> 
        </Buttons> 
    </ext:Window> 
    </form> 
</body> 
</html> 

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Source.aspx.cs" Inherits="DzPlatForm.CRM.Property.Source" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>來源配置</title>
    <link rel="stylesheet" type="text/css" href="resources/css/main.css" />
    <ext:ResourcePlaceHolder ID="ResourcePlaceHolder1" runat="server" Mode="Script" />
    <ext:ResourcePlaceHolder ID="ResourcePlaceHolder2" Mode="Style" runat="server">
        <script src="../../Scripts/am.js" type="text/javascript"></script>
    </ext:ResourcePlaceHolder>
</head>
<body>
    <form id="form1" runat="server">
    <ext:ResourceManager ID="ResourceManager1" runat="server" />
    <ext:TreeGrid ID="TreeGrid1" runat="server" UseArrows="true" Animate="true" AutoHeight="true"
        AutoScroll="true" ForceLayout="true" Collapsed="false">
        <Columns>
            <ext:TreeGridColumn Header="來源名稱" Width="300" DataIndex="Name">
            </ext:TreeGridColumn>
            <ext:TreeGridColumn Header="父節點" DataIndex="ParentId" Hidden="true" >
            </ext:TreeGridColumn>
        </Columns>
        <TopBar>
            <ext:Toolbar ID="Toolbar1" runat="server">
                <Items>
                    <ext:SplitButton ID="SplitButton1" runat="server" Text="新建來源" Icon="Add">
                        <Menu>
                            <ext:Menu ID="Menu1" runat="server">
                                <Items>
                                    <ext:MenuItem ID="menuAdd" runat="server" Text="新建頂層來源" Icon="Add">
                                        <DirectEvents>
                                            <Click OnEvent="Menu_Click">
                                                <EventMask ShowMask="true" />
                                                <ExtraParams>
                                                    <ext:Parameter Name="Item" Value="menuAdd" Mode="Value" />
                                                </ExtraParams>
                                            </Click>
                                        </DirectEvents>
                                    </ext:MenuItem>
                                    <ext:MenuItem ID="menuAddSubitem" runat="server" Text="新建當前選中子來源" Icon="DatabaseAdd">
                                        <DirectEvents>
                                            <Click OnEvent="Menu_Click">
                                                <EventMask ShowMask="true" />
                                                <ExtraParams>
                                                    <ext:Parameter Name="Item" Value="menuAddSubitem" Mode="Value" />
                                                </ExtraParams>
                                            </Click>
                                        </DirectEvents>
                                    </ext:MenuItem>
                                </Items>
                            </ext:Menu>
                        </Menu>
                    </ext:SplitButton>
                    <ext:Button ID="Button1" runat="server" Text="修改" Icon="DatabaseEdit">
                        <DirectEvents>
                            <Click OnEvent="Menu_Click">
                                <EventMask ShowMask="true" Msg="修改..." MinDelay="500" />
                                <ExtraParams>
                                    <ext:Parameter Name="Item" Value="menuEdit" Mode="Value" />
                                </ExtraParams>
                            </Click>
                        </DirectEvents>
                    </ext:Button>
                    <ext:Button ID="Button3" runat="server" Text="刪除" Icon="DatabaseDelete">
                        <Listeners>
                            <Click Handler="DeleteNodeForTree2(#{TreeGrid1},#{txtValue});" />
                        </Listeners>
                    </ext:Button>
                </Items>
            </ext:Toolbar>
        </TopBar>
        <Listeners>
            <Click Handler="Ext.net.DirectMethods.ClickCurrentNode(node.attributes.Id+'|'+node.attributes.Name+'|'+node.attributes.ParentId)" />
        </Listeners>
    </ext:TreeGrid>
    <ext:Window ID="winMenuAdd" runat="server" Icon="Table" Closable="true" Title=""
        AutoHeight="true" Width="450" Resizable="false" BodyStyle="background-color:#fff;"
        Padding="15" Layout="FormLayout" ForceLayout="true" Hidden="true" Modal="true">
        <Items>
            <ext:TextField ID="txt_Menu_Name_varchar2" runat="server" Width="220" FieldLabel="來源名稱"
                LabelStyle="margin:5px 0 5 0;" StyleSpec="margin:5px 0 5 0;" />
            <ext:TextField ID="txt_Menu_ParentID_number" runat="server" Enabled="false" Width="220"
                FieldLabel="父節點編號" LabelStyle="margin:5px 0 5 0;" StyleSpec="margin:5px 0 5 0;"
                Text="-1" Hidden="true" />
            <ext:Hidden ID="txtValue" runat="server" Text="" />
            <ext:Hidden ID="txtType" runat="server" Text="add" />
        </Items>
        <Buttons>
            <ext:Button ID="btn_save" runat="server" Text="保存" Icon="Disk">
                <Listeners>
                    <Click Handler="AddNodeForTree(#{TreeGrid1});" />
                </Listeners>
            </ext:Button>
        </Buttons>
    </ext:Window>
    </form>
</body>
</html>
CS:


[csharp]  using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Web; 
using System.Web.UI; 
using System.Web.UI.WebControls; 
using Ext.Net; 
using DzPlatForm.Control; 
using System.Data; 
using DzPlatForm.DBUtility; 
namespace DzPlatForm.CRM.Property 

    public partial class Source : System.Web.UI.Page 
    { 
        protected void Page_Load(object sender, EventArgs e) 
        { 
            if (!X.IsAjaxRequest) 
            { 
                Session["utype"] = 1; 
                this.BuildTree(TreeGrid1.Root); 
 
            } 
        } 
        /// <summary>  
        /// 初始化樹形列表  
        /// </summary>  
        /// <param name="nodes"></param>  
        /// <returns></returns>  
        private Ext.Net.TreeNodeCollection BuildTree(Ext.Net.TreeNodeCollection nodes) 
        { 
 
            if (Session["utype"] == null) 
            { 
                Response.Redirect("Login.aspx"); 
                return null; 
            } 
            else 
            { 
 
                string sql = "SELECT  [Id],[ParentId],[Name] FROM [OA].[dbo].[CustomerSource] "; 
 
                TreeTableControl treeTable = new TreeTableControl(); 
 
                DataTable dt = DbHelperSQL.ExecuteDT(sql, null); 
                Ext.Net.TreeNode tvn = treeTable.BindTableTree(dt); 
                nodes.Add(tvn); 
                return nodes; 
            } 
 
        } 
        /// <summary>  
        /// 刷新樹形列表  
        /// </summary>  
        /// <returns></returns>  
        [DirectMethod] 
        public string RefreshMenu() 
        { 
            TreeGrid1.Root.Clear(); 
            Ext.Net.TreeNodeCollection nodes = this.BuildTree(TreeGrid1.Root); 
            return nodes.ToJson(); 
        } 
        /// <summary>  
        /// 操作集合  
        /// </summary>  
        /// <param name="sender"></param>  
        /// <param name="e"></param>  
        protected void Menu_Click(object sender, DirectEventArgs e) 
        { 
            string item = e.ExtraParams.GetParameter("Item").Value; 
            string[] strValue = txtValue.Text.Split('|'); 
            switch (item) 
            { 
                case "menuAddSubitem": 
                    if (strValue.Length <= 1) 
                    
                        Notification.Show(new NotificationConfig 
                        { 
                            Title = "客戶來源管理", 
                            Icon = Icon.Information, 
                            Html = "未選擇記錄" 
                        }); 
                    else 
                    { 
                        txt_Menu_Name_varchar2.Text = ""; 
                        this.txt_Menu_ParentID_number.Text = strValue[0]; 
                        txtType.Text = "add"; 
                        this.winMenuAdd.Title = "新建子客戶來源"; 
                        this.winMenuAdd.Show(); 
                    } 
                    break; 
                case "menuAdd": 
                    txt_Menu_Name_varchar2.Text = ""; 
 
 
                    this.txt_Menu_ParentID_number.Text = "-1"; 
                    this.winMenuAdd.Title = "新建客戶來源"; 
                    txtType.Text = "add"; 
                    this.winMenuAdd.Show(); 
                    break; 
                case "menuEdit": 
                    if (strValue.Length <= 1) 
                        Notification.Show(new NotificationConfig 
                        { 
                            Title = "客戶來源管理", 
                            Icon = Icon.Information, 
                            Html = "未選擇記錄" 
                        }); 
 
 
                    else 
                    { 
                        txt_Menu_Name_varchar2.Text = strValue[1]; 
 
                        this.txt_Menu_ParentID_number.Text = strValue[2]; 
 
                        txtType.Text = "edit"; 
                        this.winMenuAdd.Title = "菜單修改"; 
                        this.winMenuAdd.Show(); 
                    } 
                    break; 
                case "menuDelete": 
                    if (strValue.Length <= 1) 
                    { 
                        Notification.Show(new NotificationConfig 
                        { 
                            Title = "客戶來源管理", 
                            Icon = Icon.Information, 
                            Html = "未選擇記錄" 
                        }); 
                    } 
                    else 
                    { 
                        this.Delete(); 
                    } 
                    break; 
 
 
            } 
 
        } 
        [DirectMethod] 
        public void ClickCurrentNode(string name) 
        { 
            txtValue.Text = name; 
        } 
        /// <summary>  
        /// 保存  
        /// </summary>  
        /// <returns></returns>  
        [DirectMethod] 
        public string Save() 
        { 
            string name = this.txt_Menu_Name_varchar2.Text; 
            string pid = this.txt_Menu_ParentID_number.Text; 
            MenuInfo menu = new MenuInfo(); 
            menu.Name = name; 
            menu.Pid = pid; 
            bool bl = false; 
            string sql = ""; 
            if (txtType.Text == "add") 
            { 
                sql = "insert into [CustomerSource] (Name,ParentId) values ('" + menu.Name + "'," + menu.Pid + ")"; 
                int res = DbHelperSQL.ExecuteSql(sql, null); 
                if (res > 0) 
                    bl = true; 
            } 
            else 
            { 
                string[] strValue = txtValue.Text.Split('|'); 
                menu.Id = strValue[0]; 
                sql = "update CustomerSource set Name='" + menu.Name + "' " + " where Id=" + menu.Id + " "; 
                int res = DbHelperSQL.ExecuteSql(sql, null); 
                if (res > 0) 
                    bl = true; 
            } 
            if (bl) 
            { 
                txt_Menu_Name_varchar2.Text = ""; 
 
                Notification.Show(new NotificationConfig 
                { 
                    Title = "客戶來源管理", 
                    Icon = Icon.Information, 
                    Html = "保存成功" 
                }); 
 
 
 
 
                winMenuAdd.Hide(); 
                string rtn = RefreshMenu(); 
                return rtn; 
 
            } 
            else 
            { 
 
                Notification.Show(new NotificationConfig 
                { 
                    Title = "客戶來源管理", 
                    Icon = Icon.Information, 
                    Html = "保存失敗" 
                }); 
                return this.TreeGrid1.Root.ToJson(); 
            } 
            this.txtValue.Text = ""; 
        } 
        /// <summary>  
        /// 刪除  
        /// </summary>  
        /// <returns></returns>  
        [DirectMethod] 
        public string Delete() 
        { 
            string[] strValue = txtValue.Text.Split('|'); 
            string id = strValue[0]; 
            string ssql = "select Id from [CustomerSource] where ParentId=" + id + ""; 
            DataTable dt = DbHelperSQL.ExecuteDT(ssql, null); 
            if (dt.Rows.Count > 0) 
            { 
 
                Notification.Show(new NotificationConfig 
                { 
                    Title = "客戶來源管理", 
                    Icon = Icon.Information, 
                    Html = "存在根節點,請先刪除下級!" 
                }); 
 
            } 
            else 
            { 
                string sql = "delete from CustomerSource where Id=" + id + ""; 
                int res = DbHelperSQL.ExecuteSql(sql, null); 
                bool success = false; 
                if (res > 0) 
                    success = true; 
                if (success) 
                { 
 
                    Notification.Show(new NotificationConfig 
                    { 
                        Title = "客戶來源管理", 
                        Icon = Icon.Information, 
                        Html = "刪除成功" 
                    }); 
 
                } 
                else 
                { 
 
                    Notification.Show(new NotificationConfig 
                    { 
                        Title = "客戶來源管理", 
                        Icon = Icon.Information, 
                        Html = "刪除失敗" 
                    }); 
 
                } 
 
                this.txtValue.Text = ""; 
            } 
            return RefreshMenu(); 
        } 
    } 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Ext.Net;
using DzPlatForm.Control;
using System.Data;
using DzPlatForm.DBUtility;
namespace DzPlatForm.CRM.Property
{
    public partial class Source : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!X.IsAjaxRequest)
            {
                Session["utype"] = 1;
                this.BuildTree(TreeGrid1.Root);

            }
        }
        /// <summary>
        /// 初始化樹形列表
        /// </summary>
        /// <param name="nodes"></param>
        /// <returns></returns>
        private Ext.Net.TreeNodeCollection BuildTree(Ext.Net.TreeNodeCollection nodes)
        {

            if (Session["utype"] == null)
            {
                Response.Redirect("Login.aspx");
                return null;
            }
            else
            {

                string sql = "SELECT  [Id],[ParentId],[Name] FROM [OA].[dbo].[CustomerSource] ";

                TreeTableControl treeTable = new TreeTableControl();

                DataTable dt = DbHelperSQL.ExecuteDT(sql, null);
                Ext.Net.TreeNode tvn = treeTable.BindTableTree(dt);
                nodes.Add(tvn);
                return nodes;
            }

        }
        /// <summary>
        /// 刷新樹形列表
        /// </summary>
        /// <returns></returns>
        [DirectMethod]
        public string RefreshMenu()
        {
            TreeGrid1.Root.Clear();
            Ext.Net.TreeNodeCollection nodes = this.BuildTree(TreeGrid1.Root);
            return nodes.ToJson();
        }
        /// <summary>
        /// 操作集合
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Menu_Click(object sender, DirectEventArgs e)
        {
            string item = e.ExtraParams.GetParameter("Item").Value;
            string[] strValue = txtValue.Text.Split('|');
            switch (item)
            {
                case "menuAddSubitem":
                    if (strValue.Length <= 1)
                  
                        Notification.Show(new NotificationConfig
                        {
                            Title = "客戶來源管理",
                            Icon = Icon.Information,
                            Html = "未選擇記錄"
                        });
                    else
                    {
                        txt_Menu_Name_varchar2.Text = "";
                        this.txt_Menu_ParentID_number.Text = strValue[0];
                        txtType.Text = "add";
                        this.winMenuAdd.Title = "新建子客戶來源";
                        this.winMenuAdd.Show();
                    }
                    break;
                case "menuAdd":
                    txt_Menu_Name_varchar2.Text = "";


                    this.txt_Menu_ParentID_number.Text = "-1";
                    this.winMenuAdd.Title = "新建客戶來源";
                    txtType.Text = "add";
                    this.winMenuAdd.Show();
                    break;
                case "menuEdit":
                    if (strValue.Length <= 1)
                        Notification.Show(new NotificationConfig
                        {
                            Title = "客戶來源管理",
                            Icon = Icon.Information,
                            Html = "未選擇記錄"
                        });


                    else
                    {
                        txt_Menu_Name_varchar2.Text = strValue[1];

                        this.txt_Menu_ParentID_number.Text = strValue[2];

                        txtType.Text = "edit";
                        this.winMenuAdd.Title = "菜單修改";
                        this.winMenuAdd.Show();
                    }
                    break;
                case "menuDelete":
                    if (strValue.Length <= 1)
                    {
                        Notification.Show(new NotificationConfig
                        {
                            Title = "客戶來源管理",
                            Icon = Icon.Information,
                            Html = "未選擇記錄"
                        });
                    }
                    else
                    {
                        this.Delete();
                    }
                    break;


            }

        }
        [DirectMethod]
        public void ClickCurrentNode(string name)
        {
            txtValue.Text = name;
        }
        /// <summary>
        /// 保存
        /// </summary>
        /// <returns></returns>
        [DirectMethod]
        public string Save()
        {
            string name = this.txt_Menu_Name_varchar2.Text;
            string pid = this.txt_Menu_ParentID_number.Text;
            MenuInfo menu = new MenuInfo();
            menu.Name = name;
            menu.Pid = pid;
            bool bl = false;
            string sql = "";
            if (txtType.Text == "add")
            {
                sql = "insert into [CustomerSource] (Name,ParentId) values ('" + menu.Name + "'," + menu.Pid + ")";
                int res = DbHelperSQL.ExecuteSql(sql, null);
                if (res > 0)
                    bl = true;
            }
            else
            {
                string[] strValue = txtValue.Text.Split('|');
                menu.Id = strValue[0];
                sql = "update CustomerSource set Name='" + menu.Name + "' " + " where Id=" + menu.Id + " ";
                int res = DbHelperSQL.ExecuteSql(sql, null);
                if (res > 0)
                    bl = true;
            }
            if (bl)
            {
                txt_Menu_Name_varchar2.Text = "";

                Notification.Show(new NotificationConfig
                {
                    Title = "客戶來源管理",
                    Icon = Icon.Information,
                    Html = "保存成功"
                });

 


                winMenuAdd.Hide();
                string rtn = RefreshMenu();
                return rtn;

            }
            else
            {

                Notification.Show(new NotificationConfig
                {
                    Title = "客戶來源管理",
                    Icon = Icon.Information,
                    Html = "保存失敗"
                });
                return this.TreeGrid1.Root.ToJson();
            }
            this.txtValue.Text = "";
        }
        /// <summary>
        /// 刪除
        /// </summary>
        /// <returns></returns>
        [DirectMethod]
        public string Delete()
        {
            string[] strValue = txtValue.Text.Split('|');
            string id = strValue[0];
            string ssql = "select Id from [CustomerSource] where ParentId=" + id + "";
            DataTable dt = DbHelperSQL.ExecuteDT(ssql, null);
            if (dt.Rows.Count > 0)
            {

                Notification.Show(new NotificationConfig
                {
                    Title = "客戶來源管理",
                    Icon = Icon.Information,
                    Html = "存在根節點,請先刪除下級!"
                });

            }
            else
            {
                string sql = "delete from CustomerSource where Id=" + id + "";
                int res = DbHelperSQL.ExecuteSql(sql, null);
                bool success = false;
                if (res > 0)
                    success = true;
                if (success)
                {

                    Notification.Show(new NotificationConfig
                    {
                        Title = "客戶來源管理",
                        Icon = Icon.Information,
                        Html = "刪除成功"
                    });

                }
                else
                {

                    Notification.Show(new NotificationConfig
                    {
                        Title = "客戶來源管理",
                        Icon = Icon.Information,
                        Html = "刪除失敗"
                    });

                }

                this.txtValue.Text = "";
            }
            return RefreshMenu();
        }
    }
}
效果:

 \
 


感謝心是走動的詞語的鼎力幫助和指導。

 

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved