예제 #1
0
    // 카테고리를 아래로 이동
    protected void btnDown_Click(object sender, ImageClickEventArgs e)
    {
        int  currentIndex = lbCategory.SelectedIndex;
        bool result       = false;

        if (!ListBoxSelectedCheck(sender))
        {
            return;
        }

        CategoryNodeValue nodeValue = CategoryNodeValue.Parse(lbCategory.SelectedValue);

        if (nodeValue.CategoryStep == 2)
        {
            result = CategoryManager.GetInstance().UpdateMoveCategoryChildNode(nodeValue, "down");
        }
        else
        {
            CategoryManager.GetInstance().UpdateMoveCategoryNode(nodeValue, "down");
        }

        init();
        bind();

        lbCategory.SelectedIndex = currentIndex;
        if (result)
        {
            lbCategory.SelectedIndex++;
        }

        lbCategory_SelectedIndexChanged(sender, e);
    }
예제 #2
0
        /// <summary>
        /// 카테고리 구룹을 이동한다.
        /// </summary>
        /// <param name="node">Node</param>
        /// <param name="mode">모드 up, down</param>
        /// <returns></returns>
        public static bool UpdateMoveCategoryNode(CategoryNodeValue node, string mode)
        {
            SqlParameter[] param =
            {
                CreateInParam("@ID",    SqlDbType.Int,      4, node.CategoryID),
                CreateInParam("@Group", SqlDbType.Int,      4, node.CategoryGroup),
                CreateInParam("@Step",  SqlDbType.Int,      4, node.CategoryStep),
                CreateInParam("@Order", SqlDbType.Int,      4, node.CategoryOrder),
                CreateInParam("@Mode",  SqlDbType.VarChar, 10, mode),
                CreateReturnValue(),
            };
            SqlCommand cmd = GetSpCommand("UBI_UpdateMoveCategoryNode", param, IsolationLevel.Serializable);

            try
            {
                cmd.ExecuteNonQuery();

                int result = (int)cmd.Parameters["@ReturnValue"].Value;
                ReleaseCommandWithCommit(cmd);

                return((result == 1) ? true : false);
            }
            catch
            {
                ReleaseCommandWithRollback(cmd);

                return(false);
            }
        }
예제 #3
0
        /// <summary>
        /// 새로운 카테고리를 추가한다.
        /// </summary>
        /// <param name="title">추가될 카테고리 타이틀</param>
        /// <param name="node">노드</param>
        /// <param name="mode">1:루트 2:자식 카테고리</param>
        public static void InsertNewCategory(string title, CategoryNodeValue node, int mode)
        {
            SqlParameter[] param =
            {
                CreateInParam("@Title", SqlDbType.VarChar, 50, title),
                CreateInParam("@LCode", SqlDbType.Int,      4, node.CategoryLCode),
                CreateInParam("@MCode", SqlDbType.Int,      4,                 -1),
                CreateInParam("@Group", SqlDbType.Int,      4, node.CategoryGroup),
                CreateInParam("@Step",  SqlDbType.Int,      4, node.CategoryStep),
                CreateInParam("@Order", SqlDbType.Int,      4, node.CategoryOrder),
                CreateInParam("@Mode",  SqlDbType.Int,      4, mode)
            };

            SqlCommand cmd = GetSpCommand("UBI_InsertNewCategory", param, IsolationLevel.ReadUncommitted);

            try
            {
                cmd.ExecuteNonQuery();
                ReleaseCommandWithCommit(cmd);
            }
            catch
            {
                ReleaseCommandWithRollback(cmd);
            }
        }
예제 #4
0
    // 새 카테고리 추가
    protected void btnNewCategory_Click(object sender, ImageClickEventArgs e)
    {
        CategoryNodeValue nodeValue = new CategoryNodeValue(-1, -1, -1, -1, -1);

        CategoryManager.GetInstance().InsertNewCategory("Umc Category", nodeValue, 1);

        init();
        bind();
    }
예제 #5
0
    // 삭제 버튼
    protected void btnRemove_Click(object sender, ImageClickEventArgs e)
    {
        if (!ListBoxSelectedCheck(sender))
        {
            return;
        }

        CategoryNodeValue nodeValue = CategoryNodeValue.Parse(lbCategory.SelectedValue);

        CategoryManager.GetInstance().RemoveCategoryNode(nodeValue);

        init();
        bind();
    }
예제 #6
0
    // 등록 버튼
    protected void btnCategoryRegist_Click(object sender, ImageClickEventArgs e)
    {
        if (!ListBoxSelectedCheck(sender))
        {
            return;
        }

        CategoryNodeValue nodeValue = CategoryNodeValue.Parse(lbCategory.SelectedValue);
        string            title     = txtCategoryTitle.Text;
        int lCode = int.Parse(ddlCategoryL.SelectedValue);
        int mCode = int.Parse(ddlCategoryM.SelectedValue);
        int group = int.Parse(ddlCategory.SelectedValue);

        CategoryManager.GetInstance().UpdateCategoryNodeValue(title, nodeValue, lCode, mCode, group);

        init();
        bind();
    }
예제 #7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string           nodeValue = GetParamString("nodeValue");
        string           date      = GetParamString("date");
        ArticleBindModel bindModel = null;

        if (nodeValue != null)
        {
            CategoryNodeValue CurrentCategoryNodeValue = CategoryNodeValue.Parse(nodeValue);
            bindModel = ArticleManager.GetInstance().GetArticleList(CurrentCategoryNodeValue);
        }
        else if (date != null)
        {
            bindModel = ArticleManager.GetInstance().GetArticleList(date);
        }

        dlCategory.DataSource = (ArticleBindModel)bindModel;
        dlCategory.DataBind();
    }
예제 #8
0
    // 자식 카테고리 추가
    protected void btnLine_Click(object sender, ImageClickEventArgs e)
    {
        int currentIndex = lbCategory.SelectedIndex;

        if (!ListBoxSelectedCheck(sender))
        {
            return;
        }

        CategoryNodeValue nodeValue = CategoryNodeValue.Parse(lbCategory.SelectedValue);
        string            title     = txtCategoryTitle.Text;

        nodeValue.CategoryStep = 2;
        CategoryManager.GetInstance().InsertNewCategory("Umc Child Category", nodeValue, 2);

        init();
        bind();

        lbCategory.SelectedIndex = currentIndex;
        lbCategory_SelectedIndexChanged(sender, e);
    }
예제 #9
0
        /// <summary>
        /// 카테고리를 삭제한다.
        /// </summary>
        /// <param name="node"></param>
        /// <returns></returns>
        public static bool RemoveCategoryNode(CategoryNodeValue node)
        {
            SqlParameter[] param =
            {
                CreateInParam("@ID",    SqlDbType.Int, 4, node.CategoryID),
                CreateInParam("@Step",  SqlDbType.Int, 4, node.CategoryStep),
                CreateInParam("@Group", SqlDbType.Int, 4, node.CategoryGroup)
            };

            SqlCommand cmd = GetSpCommand("UBI_RemoveCategoryNode", param, IsolationLevel.Serializable);

            try
            {
                cmd.ExecuteNonQuery();
                ReleaseCommandWithCommit(cmd);
                return(true);
            }
            catch
            {
                ReleaseCommandWithRollback(cmd);
                return(false);
            }
        }
예제 #10
0
        /// <summary>
        /// 카테고리 정보를 수정한다.
        /// </summary>
        /// <param name="title">타이틀</param>
        /// <param name="node">노드</param>
        /// <param name="lCode">대분류</param>
        /// <param name="mCode">중분류</param>
        /// <param name="parent">카테고리 부모</param>
        public static void UpdateCategoryNodeValue(string title, CategoryNodeValue node, int lCode, int mCode, int newGroup)
        {
            SqlParameter[] param =
            {
                CreateInParam("@ID",       SqlDbType.Int,      4, node.CategoryID),
                CreateInParam("@Title",    SqlDbType.VarChar, 50, title),
                CreateInParam("@LCode",    SqlDbType.Int,      4, lCode),
                CreateInParam("@MCode",    SqlDbType.Int,      4, mCode),
                CreateInParam("@NewGroup", SqlDbType.Int,      4, newGroup)
            };

            SqlCommand cmd = GetSpCommand("UBI_UpdateCategoryNodeValue", param, IsolationLevel.ReadUncommitted);

            try
            {
                cmd.ExecuteNonQuery();
            }
            catch
            {
                ReleaseCommandWithRollback(cmd);
            }

            ReleaseCommandWithCommit(cmd);
        }
예제 #11
0
        /// <summary>
        /// 카테고리의 아티클 리스트를 가져온다
        /// </summary>
        /// <param name="node"></param>
        /// <returns></returns>
        public static ArticleBindModel GetArticleList(CategoryNodeValue node)
        {
            SqlParameter[] param =
            {
                CreateInParam("@CategoryID",   SqlDbType.Int, 4, node.CategoryID),
                CreateInParam("@CategoryStep", SqlDbType.Int, 4, node.CategoryStep)
            };

            SqlCommand       cmd       = GetSpCommand("UBA_GetArticleListByCategoryID", param);
            SqlDataReader    reader    = cmd.ExecuteReader(CommandBehavior.CloseConnection);
            ArticleBindModel bindModel = new ArticleBindModel();

            try
            {
                while (reader.Read())
                {
                    ArticleModel model = new ArticleModel();

                    FillArticle(reader, model);

                    bindModel.Add(model);
                    model = null;
                }

                return(bindModel);
            }
            catch (Exception ex)
            {
                throw new UmcDataException("UBA_GetArticleListByCategoryID 프로시져 호출중 에러", ex);
            }
            finally
            {
                reader.Close();
                ReleaseCommand(cmd);
            }
        }
예제 #12
0
 protected void treeCategory_SelectedNodeChanged(object sender, EventArgs e)
 {
     ContentViewControl       = SnapConst.SNAP_TEMPLATE_CATEGORY;
     CurrentCategoryNodeValue = CategoryNodeValue.Parse(treeCategory.SelectedValue);
     Update();
 }
예제 #13
0
 /// <summary>
 /// 카테고리를 삭제한다.
 /// </summary>
 /// <param name="node"></param>
 /// <returns></returns>
 public bool RemoveCategoryNode(CategoryNodeValue node)
 {
     return(CategoryAccess.RemoveCategoryNode(node));
 }
예제 #14
0
 /// <summary>
 /// 카테고리 정보를 수정한다.
 /// </summary>
 /// <param name="title">타이틀</param>
 /// <param name="node">노드</param>
 /// <param name="lCode">대분류</param>
 /// <param name="mCode">중분류</param>
 /// <param name="parent">카테고리 부모</param>
 public void UpdateCategoryNodeValue(string title, CategoryNodeValue node, int lCode, int mCode, int newGroup)
 {
     CategoryAccess.UpdateCategoryNodeValue(title, node, lCode, mCode, newGroup);
 }
예제 #15
0
 /// <summary>
 /// 새로운 카테고리를 추가한다.
 /// </summary>
 /// <param name="title">추가될 카테고리 타이틀</param>
 /// <param name="node">노드</param>
 /// <param name="mode">1:루트 2:자식 카테고리</param>
 public void InsertNewCategory(string title, CategoryNodeValue node, int mode)
 {
     CategoryAccess.InsertNewCategory(title, node, mode);
 }
예제 #16
0
 /// <summary>
 /// 카테고리 구룹을 이동한다.
 /// </summary>
 /// <param name="node">Node</param>
 /// <param name="mode">모드 up, down</param>
 /// <returns></returns>
 public bool UpdateMoveCategoryNode(CategoryNodeValue node, string mode)
 {
     return(CategoryAccess.UpdateMoveCategoryNode(node, mode));
 }
예제 #17
0
 /// <summary>
 /// 카테고리의 아티클 리스트를 가져온다
 /// </summary>
 /// <param name="node"></param>
 /// <returns></returns>
 public ArticleBindModel GetArticleList(CategoryNodeValue node)
 {
     return(ArticleAccess.GetArticleList(node));
 }