Example #1
0
        public bool CheckMemberPackage(int CompID, int CompLevel)
        {
            var IsShow = false;

            if (CompLevel == 1)
            {
                var sqlwhere = "RowFlag > 0 AND (OrderStatus = 'N' OR OrderStatus = 'W' ) AND CompID =" + CompID + " AND PackageID = 3";
                var count    = CountData <view_OrderDetail>(" * ", sqlwhere);
                if (count > 0)
                {
                    IsShow = false;
                }
                else
                {
                    IsShow = true;
                }
            }
            else if (CompLevel == 3)
            {
                var svCompany = new Company.CompanyService();
                if (svCompany.ValidateExpireDate(CompID))
                {
                    IsShow = true;
                    // renew member package
                }
                else
                {
                    IsShow = false;
                }
            }
            return(IsShow);
        }
Example #2
0
        public bool UpdateBuyleadCount(int CompID)
        {
            var svBuylead = new Buylead.BuyleadService();
            var sqlWhere  = svBuylead.CreateWhereAction(BuyleadAction.FrontEnd, CompID);
            var count     = CountData <view_BuyLead>(" * ", sqlWhere);
            var svCompany = new Company.CompanyService();

            IsResult = svCompany.UpdateByCondition <b2bCompany>(" BuyLeadCount = " + count, "CompID = " + CompID);
            return(IsResult);
        }
Example #3
0
        public bool UpdateProductCount(int CompID)
        {
            var svProduct = new Product.ProductService();
            var sqlWhere  = svProduct.CreateWhereAction(ProductAction.FrontEnd, CompID);
            var count     = CountData <view_SearchProduct>(" * ", sqlWhere);
            var svCompany = new Company.CompanyService();

            IsResult = svCompany.UpdateByCondition <b2bCompany>(" ProductCount = " + count, "CompID = " + CompID);
            return(IsResult);
        }
Example #4
0
        public ActionResult EditBlog(FormCollection form)
        {
            var Articles  = new b2bArticle();
            var svCompany = new Company.CompanyService();

            if (!string.IsNullOrEmpty(form["ArticleID"]))
            {
                Articles = svCompany.SelectData <b2bArticle>("*", " IsDelete = 0 AND ArticleID =" + form["ArticleID"]).First();
            }
            return(Json(new { ArticleID = Articles.ArticleID, CompID = Articles.CompID, RowVersion = Articles.RowVersion, ArticleTypeID = Articles.ArticleTypeID, ArticleName = Articles.ArticleName, pageTitle = Articles.PageTitle, ImgPath = Articles.ImgPath, Description = Articles.Description, ShortDescription = Articles.ShortDescription }));
        }
Example #5
0
        public bool Delete(List <int> QuotationID)
        {
            var svCompany = new Company.CompanyService();

            //var Contains = SQLWhereListInt(QuotationID, "QuotationID");
            IsResult = UpdateByCondition <b2bQuotation>(" IsDelete = 1", " QuotationID = " + QuotationID);

            // IsResult = svCompany.UpdateQuotationCount(ToCompID);

            return(IsResult);
        }
Example #6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>



        #region Delete
        public bool Delete(List <int> FavSupplierID, int LogonCompID)
        {
            var svCompany = new Company.CompanyService();

            var Contains = SQLWhereListInt(FavSupplierID, "FavSupplierID");

            UpdateByCondition <b2bFavCompany>(" IsDelete = 1   ", " CompID = " + LogonCompID + " AND " + Contains);

            IsResult = svCompany.UpdateProductCount(LogonCompID);

            return(IsResult);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>



        #region Delete
        public bool Delete(List <int> BuyleadID, int CompID)
        {
            var svCompany = new Company.CompanyService();

            var Contains = SQLWhereListInt(BuyleadID, "BuyleadID");

            UpdateByCondition <b2bFavBuylead>(" IsDelete = 1   ", "CompID = " + CompID + " AND " + Contains);

            IsResult = svCompany.UpdateBuyleadCount(CompID);

            return(IsResult);
        }
Example #8
0
        public bool MoveToJunk(List <int> BuyleadID, List <int> CateLV1, List <int> CateLV2, List <int> CateLV3, int CompID)
        {
            var svCompany = new Company.CompanyService();

            var Contains = SQLWhereListInt(BuyleadID, "BuyleadID");

            UpdateByCondition <b2bBuylead>(" IsJunk = 1 , ListNo = 0 ", " CompID = " + CompID + " AND " + Contains);

            IsResult = svCompany.UpdateBuyleadCount(CompID);
            UpdateBuyleadCountInCategories(CateLV1, CateLV2, CateLV3);

            return(IsResult);
        }
        public bool MoveToJunk(List <int> ProductID, List <int> CateLV1, List <int> CateLV2, List <int> CateLV3, int CompID)
        {
            var svCompany = new Company.CompanyService();

            var Contains = SQLWhereListInt(ProductID, "ProductID");

            UpdateByCondition <b2bProduct>(" ModifiedDate  = GETDATE()  , IsJunk = 1 , ListNo = 0 ", " CompID = " + CompID + " AND " + Contains);

            IsResult = svCompany.UpdateProductCount(CompID);
            UpdateProductCountInCategories(CateLV1, CateLV2, CateLV3);
            UpdateProductCountInCompany(CompID);

            return(IsResult);
        }
Example #10
0
        public ActionResult Blog(FormCollection form)
        {
            var svCompany = new Company.CompanyService();
            var svArticle = new ArticleService();

            SelectList_PageSize();
            List <view_b2bArticle> Blogs;

            SetPager(form);
            if (!string.IsNullOrEmpty(form["SearchBlog"]))
            {
                var ArticleTypeID = "";
                if (form["SearchType"] == "ArticleName")
                {
                    Blogs = svCompany.SelectData <view_b2bArticle>("*", "IsDelete = 0 and ArticleName LIKE N'%" + form["SearchBlog"] + "%' and CompID = " + LogonCompID, null, (int)ViewBag.PageIndex, (int)ViewBag.PageSize);
                }
                else
                {
                    var articletype = svArticle.SelectData <b2bArticleType>("ArticleTypeID,ArticleTypeName", "ArticleTypeName LIKE N'%" + form["SearchBlog"] + "%'");
                    foreach (var it in (List <b2bArticleType>)articletype)
                    {
                        ArticleTypeID = ArticleTypeID + "ArticleTypeID = " + it.ArticleTypeID.ToString() + " or ";
                    }
                    if (ArticleTypeID != "")
                    {
                        ArticleTypeID = ArticleTypeID.Substring(0, ArticleTypeID.Length - 4);
                        Blogs         = svCompany.SelectData <view_b2bArticle>("*", "IsDelete = 0 and (" + ArticleTypeID + ") and CompID = " + LogonCompID, null, (int)ViewBag.PageIndex, (int)ViewBag.PageSize);
                    }
                    else
                    {
                        Blogs = svCompany.SelectData <view_b2bArticle>("*", "IsDelete = 0 and ArticleType = 0 and CompID = " + LogonCompID, null, (int)ViewBag.PageIndex, (int)ViewBag.PageSize);
                    }
                }
            }
            else
            {
                Blogs = svCompany.SelectData <view_b2bArticle>("*", "IsDelete = 0 and CompID = " + LogonCompID, null, (int)ViewBag.PageIndex, (int)ViewBag.PageSize);
            }


            ViewBag.Blogs     = Blogs;
            ViewBag.TotalPage = svCompany.TotalPage;
            ViewBag.TotalRow  = svCompany.TotalRow;
            return(PartialView("MyB2B/Company/Grid/BlogGrid"));
        }
Example #11
0
        public bool Delete(List <int> BuyleadID, List <int> CateLV1, List <int> CateLV2, List <int> CateLV3, int CompID = 0)
        {
            var svCompany  = new Company.CompanyService();
            var svCategory = new Category.CategoryService();

            var sqlWhere = SQLWhereListInt(BuyleadID, "BuyleadID");

            if (CompID > 0)
            {
                sqlWhere += " AND CompID = " + CompID;
            }

            UpdateByCondition <b2bBuylead>(" IsDelete = 1   , ListNo = 0 ", sqlWhere);

            if (CompID > 0)
            {
                IsResult = svCompany.UpdateBuyleadCount(CompID);
            }
            UpdateBuyleadCountInCategories(CateLV1, CateLV2, CateLV3);

            return(IsResult);
        }
        public bool Delete(int ProductID, int CateLV1, int CateLV2, int CateLV3, int CompID = 0)
        {
            var svCompany  = new Company.CompanyService();
            var svCategory = new Category.CategoryService();

            var sqlWhere = "ProductID = " + ProductID;

            if (CompID > 0)
            {
                sqlWhere += " AND CompID = " + CompID;
            }

            UpdateByCondition <b2bProduct>(" ModifiedDate  = GETDATE()  , IsDelete = 1   , ListNo = 0  ", sqlWhere);
            if (CompID > 0)
            {
                IsResult = svCompany.UpdateProductCount(CompID);
            }
            UpdateProductCountInCategories(CateLV1, CateLV2, CateLV3);
            UpdateProductCountInCompany(CompID);


            return(IsResult);
        }
Example #13
0
        public bool SaveBlog(FormCollection form)
        {
            int objState   = DataManager.ConvertToInteger(form["objState"]);//objState 1 คือ insert objState 2 คือ update
            var Articles   = new b2bArticle();
            var emArticles = new emArticle();
            var svMember   = new Common.MemberService();
            var svCompany  = new Company.CompanyService();

            if (objState == 2)// update
            {
                Articles = svCompany.SelectData <b2bArticle>("*", " ArticleID = " + form["ArticleID"] + " AND RowVersion = " + form["RowVersion"]).First();
            }

            #region set ค่า b2bArticle
            var ArticleImgPath = Articles.ImgPath;
            Articles.CompID           = DataManager.ConvertToInteger(LogonCompID);
            Articles.ArticleName      = form["ArticleName"];
            Articles.ArticleTypeID    = DataManager.ConvertToInteger(form["ArticleTypeID"]);
            Articles.Description      = ReplaceText(form["Description"]);
            Articles.ShortDescription = ReplaceText(form["ShortDescription"]);
            Articles.ImgPath          = form["ImgPath"];
            Articles.PageTitle        = form["PageTitle"];
            if (objState == 2)// update
            {
                Articles.RowVersion   = DataManager.ConvertToShort(Articles.RowVersion + 1);
                emArticles.RowVersion = DataManager.ConvertToShort(emArticles.RowVersion + 1);
            }
            else
            {
                Articles.ViewCount    = 0;
                Articles.RowFlag      = 1;
                Articles.RowVersion   = 1;
                Articles.CreatedBy    = "sa";
                Articles.ModifiedBy   = "sa";
                Articles.ModifiedDate = DateTime.Now;
                Articles.CreatedDate  = DateTime.Now;
            }
            #endregion

            #region Save b2bArticle
            Articles = svCompany.SaveData <b2bArticle>(Articles, "ArticleID");
            if (svCompany.IsResult)
            {
                if (objState == 2)// update
                {
                    emArticles.RowVersion = Articles.RowVersion;
                }
                else
                {
                    emArticles.CompID           = DataManager.ConvertToInteger(Request.Cookies[res.Common.lblWebsite].Values["emCompID"]);
                    emArticles.ArticleName      = Articles.ArticleName;
                    emArticles.ArticleTypeID    = Articles.ArticleTypeID;
                    emArticles.Description      = Articles.Description;
                    emArticles.ShortDescription = Articles.ShortDescription;
                    emArticles.ImgPath          = Articles.ImgPath;
                    emArticles.PageTitle        = Articles.PageTitle;
                    emArticles.ViewCount        = Articles.ViewCount;
                }

                #region Save emArticle
                emArticles = svMember.SaveData <emArticle>(emArticles, "ArticleID");
                #endregion

                if (svCompany.IsResult && svMember.IsResult)
                {
                    #region SaveArticleImg
                    if (!string.IsNullOrEmpty(form["ImgPath"]))
                    {
                        if (Articles.ImgPath != ArticleImgPath)
                        {
                            imgManager             = new FileHelper();
                            imgManager.DirPath     = "Article/" + LogonCompID + "/" + Articles.ArticleID;
                            imgManager.DirTempPath = "Temp/Article/" + LogonCompID;
                            imgManager.ImageName   = form["ImgPath"];
                            //imgManager.ImageThumbName = "Thumb_" + form["ImgPath"];
                            imgManager.FullHeight  = 0;
                            imgManager.FullWidth   = 0;
                            imgManager.ThumbHeight = 150;
                            imgManager.ThumbWidth  = 150;

                            imgManager.SaveImageFromTemp();
                        }
                    }
                    #endregion
                }
            }
            #endregion

            return(svCompany.IsResult);
        }