public ActionResult EditType(int ArticleTypeID)
        {
            RememberURL();
            if (!CheckIsLogin())
            {
                return(Redirect(res.Pageviews.PvMemberSignIn));
            }
            else
            {
                if (CheckIsAdmin(11))
                {
                    if (ArticleTypeID > 0)
                    {
                        GetStatusUser();
                        /*------Article-------*/
                        ViewBag.Active = "Article";
                        ArticleService        svArticle    = new ArticleService();
                        b2bArticleType        ArticleType  = svArticle.SelectData <b2bArticleType>("*", "IsDelete = 0 AND ArticleTypeID = " + ArticleTypeID, null, 0, 0, false).First();
                        List <b2bArticleType> ArticleTypes = svArticle.SelectData <b2bArticleType>("*", "IsDelete = 0 AND ArticleTypeID IN(5,7)", "ArticleTypeName ASC");
                        ViewBag.ArticleType  = ArticleType;
                        ViewBag.ArticleTypes = ArticleTypes;

                        /*------Company-List------*/
                        var svCompany = new CompanyService();
                        var Company   = svCompany.SelectData <b2bCompany>("CompID,CompName,IsDelete,CompLevel", "IsDelete = 0 AND CompLevel = 3", "CompName");
                        ViewBag.CompanyList = Company;

                        /*------Company-Name------*/
                        //var CompName = svCompany.SelectData<b2bCompany>("CompID,CompName", "CompID = " + Articles.CompID).First();
                        //ViewBag.CompName = CompName.CompName;

                        CompLevels();
                        UserStatus();

                        return(View());
                    }
                    else
                    {
                        return(Redirect("~/Admin/ArticleType/List"));
                    }
                }
                else
                {
                    return(Redirect(res.Pageviews.PvAccessDenied));
                }
            }
        }
        public ActionResult NewType(FormCollection form)
        {
            var ArticlesType   = new b2bArticleType();
            var emArticlesType = new emArticleType();
            int ArticleTypeID  = DataManager.ConvertToInteger(form["ArticleTypeID"]);

            #region set ค่า b2bArticleType
            //Set Default
            ArticlesType.RowFlag      = 1;
            ArticlesType.RowVersion   = 1;
            ArticlesType.CreatedBy    = "sa";
            ArticlesType.ModifiedBy   = "sa";
            ArticlesType.ModifiedDate = DateTimeNow;
            ArticlesType.CreatedDate  = DateTimeNow;
            // set Value
            ArticlesType.ImgPath         = form["ImgPath"];
            ArticlesType.ArticleTypeName = form["ArticleTypeName"];
            ArticlesType.ArticleTypeID   = ArticleTypeID;

            // new set
            ArticlesType.ListNo = DataManager.ConvertToInteger(form["ListNo"]);
            ArticlesType.IsShow = DataManager.ConvertToBool(form["IsShowArticle"]);
            #endregion

            #region Save b2bArticle
            ArticlesType = svArticle.SaveData <b2bArticleType>(ArticlesType, "ArticleTypeID");
            if (svArticle.IsResult)
            {
                emArticlesType.ArticleTypeName = ArticlesType.ArticleTypeName;
                emArticlesType.ArticleTypeID   = ArticlesType.ArticleTypeID;
                emArticlesType.ImgPath         = ArticlesType.ImgPath;

                // new save
                emArticlesType.ListNo = ArticlesType.ListNo;
                emArticlesType.IsShow = ArticlesType.IsShow;

                #region Save emArticle
                emArticlesType = svArticle.SaveData <emArticleType>(emArticlesType, "ArticleID");
                #endregion
            }
            #endregion

            return(Redirect("~/Admin/Article/ListType"));
        }