コード例 #1
0
        public DataTable ProductCategoryForEditSelectAll(
            string ProductCategoryID
            )
        {
            try
            {
                var dt   = new DataTable();
                var scon = new SqlConnection(connectionString);
                var cmd  = new SqlCommand("usp_ProductCategoryForEdit_SelectAll", scon);
                cmd.Parameters.AddWithValue("@ProductCategoryID", string.IsNullOrEmpty(ProductCategoryID) ? dbNULL : (object)ProductCategoryID);
                cmd.CommandType = CommandType.StoredProcedure;
                SqlParameter errorCodeParam = new SqlParameter("@ErrorCode", null);
                errorCodeParam.Size      = 4;
                errorCodeParam.Direction = ParameterDirection.Output;
                cmd.Parameters.Add(errorCodeParam);
                var sda = new SqlDataAdapter(cmd);
                sda.Fill(dt);

                if (errorCodeParam.Value.ToString() != "0")
                {
                    throw new Exception("Stored Procedure 'usp_ProductCategoryForEdit_SelectAll' reported the ErrorCode : " + errorCodeParam.Value.ToString());
                }

                Common oCommon = new Common();

                oCommon.RecursiveFillTree(dt, 0, "ParentID", "ProductCategoryName", "ProductCategoryID", "-");

                return(oCommon.Tree);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
コード例 #2
0
        public DataTable ProductCategorySelectAll(int parentID, int increaseLevelCount, string IsShowOnMenu, string IsShowOnHomePage)
        {
            try
            {
                var dt   = new DataTable();
                var scon = new SqlConnection(connectionString);
                var cmd  = new SqlCommand("usp_ProductCategory_SelectAll", scon);
                cmd.CommandType = CommandType.StoredProcedure;
                SqlParameter errorCodeParam = new SqlParameter("@ErrorCode", null);
                errorCodeParam.Size      = 4;
                errorCodeParam.Direction = ParameterDirection.Output;
                cmd.Parameters.Add(errorCodeParam);
                var sda = new SqlDataAdapter(cmd);
                sda.Fill(dt);

                if (errorCodeParam.Value.ToString() != "0")
                {
                    throw new Exception("Stored Procedure 'usp_ProductCategory_SelectAll' reported the ErrorCode : " + errorCodeParam.Value.ToString());
                }

                Common oCommon = new Common();

                oCommon.RecursiveFillTree(dt, parentID, "ParentID", "ProductCategoryName", "ProductCategoryID", increaseLevelCount, IsShowOnMenu, IsShowOnHomePage);

                return(oCommon.Tree);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
コード例 #3
0
        public DataTable MenuSelectAll(string MenuPositionID, string IsAvailable, string SeparatorCharacter)
        {
            try
            {
                var dt   = new DataTable();
                var scon = new SqlConnection(connectionString);
                var cmd  = new SqlCommand("usp_Menu_SelectAll", scon);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@MenuPositionID", string.IsNullOrEmpty(MenuPositionID) ? dbNULL : (object)MenuPositionID);
                cmd.Parameters.AddWithValue("@IsAvailable", string.IsNullOrEmpty(IsAvailable) ? dbNULL : (object)IsAvailable);

                SqlParameter errorCodeParam = new SqlParameter("@ErrorCode", null);
                errorCodeParam.Size      = 4;
                errorCodeParam.Direction = ParameterDirection.Output;
                cmd.Parameters.Add(errorCodeParam);
                var sda = new SqlDataAdapter(cmd);
                sda.Fill(dt);

                if (errorCodeParam.Value.ToString() != "0")
                {
                    throw new Exception("Stored Procedure 'usp_Menu_SelectAll' reported the ErrorCode : " + errorCodeParam.Value.ToString());
                }

                Common oCommon = new Common();

                oCommon.RecursiveFillTree(dt, 0, "ParentID", "MenuTitle", "MenuID", SeparatorCharacter);

                return(oCommon.Tree);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
コード例 #4
0
        public DataTable ArticleCategoryForEditSelectAll(
            string ArticleCategoryID
        )
        {
            try
            {
                var dt = new DataTable();
                var scon = new SqlConnection(connectionString);
                var cmd = new SqlCommand("usp_ArticleCategoryForEdit_SelectAll", scon);
                cmd.Parameters.AddWithValue("@ArticleCategoryID", string.IsNullOrEmpty(ArticleCategoryID) ? dbNULL : (object)ArticleCategoryID);
                cmd.CommandType = CommandType.StoredProcedure;
                SqlParameter errorCodeParam = new SqlParameter("@ErrorCode", null);
                errorCodeParam.Size = 4;
                errorCodeParam.Direction = ParameterDirection.Output;
                cmd.Parameters.Add(errorCodeParam);
                var sda = new SqlDataAdapter(cmd);
                sda.Fill(dt);

                if (errorCodeParam.Value.ToString() != "0")
                    throw new Exception("Stored Procedure 'usp_ArticleCategoryForEdit_SelectAll' reported the ErrorCode : " + errorCodeParam.Value.ToString());

                Common oCommon = new Common();

                oCommon.RecursiveFillTree(dt, 0, "ParentID", "ArticleCategoryName", "ArticleCategoryID", "-");

                return oCommon.Tree;
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
コード例 #5
0
        public DataTable ArticleCategorySelectAll(int parentID, int increaseLevelCount, string IsShowOnMenu, string IsShowOnHomePage)
        {
            try
            {
                var dt = new DataTable();
                var scon = new SqlConnection(connectionString);
                var cmd = new SqlCommand("usp_ArticleCategory_SelectAll", scon);
                cmd.CommandType = CommandType.StoredProcedure;
                SqlParameter errorCodeParam = new SqlParameter("@ErrorCode", null);
                errorCodeParam.Size = 4;
                errorCodeParam.Direction = ParameterDirection.Output;
                cmd.Parameters.Add(errorCodeParam);
                var sda = new SqlDataAdapter(cmd);
                sda.Fill(dt);

                if (errorCodeParam.Value.ToString() != "0")
                    throw new Exception("Stored Procedure 'usp_ArticleCategory_SelectAll' reported the ErrorCode : " + errorCodeParam.Value.ToString());

                Common oCommon = new Common();

                oCommon.RecursiveFillTree(dt, parentID, "ParentID", "ArticleCategoryName", "ArticleCategoryID", increaseLevelCount, IsShowOnMenu, IsShowOnHomePage);

                return oCommon.Tree;
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
コード例 #6
0
ファイル: Menu.cs プロジェクト: hungtien408/web-quanaotreem
        public DataTable MenuSelectAll(string MenuPositionID, string IsAvailable, string SeparatorCharacter)
        {
            try
            {
                var dt = new DataTable();
                var scon = new SqlConnection(connectionString);
                var cmd = new SqlCommand("usp_Menu_SelectAll", scon);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@MenuPositionID", string.IsNullOrEmpty(MenuPositionID) ? dbNULL : (object)MenuPositionID);
                cmd.Parameters.AddWithValue("@IsAvailable", string.IsNullOrEmpty(IsAvailable) ? dbNULL : (object)IsAvailable);

                SqlParameter errorCodeParam = new SqlParameter("@ErrorCode", null);
                errorCodeParam.Size = 4;
                errorCodeParam.Direction = ParameterDirection.Output;
                cmd.Parameters.Add(errorCodeParam);
                var sda = new SqlDataAdapter(cmd);
                sda.Fill(dt);

                if (errorCodeParam.Value.ToString() != "0")
                    throw new Exception("Stored Procedure 'usp_Menu_SelectAll' reported the ErrorCode : " + errorCodeParam.Value.ToString());

                Common oCommon = new Common();

                oCommon.RecursiveFillTree(dt, 0, "ParentID", "MenuTitle", "MenuID", SeparatorCharacter);

                return oCommon.Tree;
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }