Пример #1
0
        public void List_DoloadData(BuyleadAction action)
        {
            ViewBag.PageSize = 19;
            var svBuylead = new BuyleadService();

            sqlSelect = "BuyleadID,BuyleadName,BuyleadIMGPath,Remark,RowFlag,CompID,CateLV1,CateLV2,CateLV3,RowVersion";
            sqlWhere  = svBuylead.CreateWhereAction(action) + " AND ListNo = 0 ";

            sqlOrderBy = " ModifiedDate DESC ";

            #region DoWhereCause
            sqlWhere += svBuylead.CreateWhereCause(LogonCompID, ViewBag.TextSearch, (int)ViewBag.PStatus,
                                                   (int)ViewBag.CateLevel, (int)ViewBag.CateID);

            if (!string.IsNullOrEmpty(ViewBag.Period))
            {
                sqlWhere += SQLWhereDateTimeFromPeriod(ViewBag.Period, "ModifiedDate");
            }
            #endregion

            var Buyleads = svBuylead.SelectData <b2bBuylead>(sqlSelect, sqlWhere, sqlOrderBy, (int)ViewBag.PageIndex, (int)ViewBag.PageSize);
            ViewBag.Buyleads    = Buyleads;
            ViewBag.LogonCompID = LogonCompID;
            ViewBag.TotalRow    = svBuylead.TotalRow;
            ViewBag.TotalPage   = svBuylead.TotalPage;
        }
Пример #2
0
        //
        // GET: /Admin/ApproveBuylead/
        public void List_DoloadData(BuyleadAction action)
        {
            var    svBuylead = new BuyleadService();
            string sqlSelect, sqlWhere, sqlOrderBy = "";

            sqlSelect = "BuyleadID,BuyleadName,BuyleadEmail,RowFlag,CompID,CompName,RowVersion,Remark,CateLV1,CateLV2,CateLV3,Modifieddate,CreatedDate,AdminCode,CompCode,CreatedBy,ModifiedBy,CategoryType";
            sqlWhere  = svBuylead.CreateWhereAction(action) + " ";

            sqlOrderBy = " CreatedDate DESC ";

            #region DoWhereCause
            sqlWhere += svBuylead.CreateWhereCause(0, "", (int)ViewBag.PStatus);
            sqlWhere += svBuylead.CreateWhereSearchBy(ViewBag.TextSearch, ViewBag.SearchType);

            if (!string.IsNullOrEmpty(ViewBag.Period))
            {
                sqlWhere += SQLWhereDateTimeFromPeriod(ViewBag.Period, "CreatedDate");
            }
            #endregion

            var Buyleads = svBuylead.SelectData <view_SearchBuylead>(sqlSelect, sqlWhere, sqlOrderBy, (int)ViewBag.PageIndex, (int)ViewBag.PageSize);
            ViewBag.Buyleads    = Buyleads;
            ViewBag.LogonCompID = LogonCompID;
            ViewBag.TotalRow    = svBuylead.TotalRow;
            ViewBag.TotalPage   = svBuylead.TotalPage;
        }
        public ActionResult GetBuyleadName(string query)
        {
            svBuylead = new BuyleadService();

            SqlWhere  = svBuylead.CreateWhereAction(BuyleadAction.FrontEnd, 0);
            SqlWhere += svBuylead.CreateWhereCause(0, query, 0, 1, 0, 0, 0, 0);
            SqlWhere += " AND (convert(nvarchar(20), BuyleadExpDate,112) > '" + DateTime.Today.ToString("yyyyMMdd", new System.Globalization.CultureInfo("en-US")) + "')";

            var b2bBuyleads = svBuylead.SelectData <view_BuyLead>("BuyleadName", SqlWhere, "BuyleadName");
            var BuyleadName = b2bBuyleads.Select(it => it.BuyleadName).ToList();

            return(Json(BuyleadName));
        }
        public void GetStatusByCompID(int CompID)
        {
            var svBuylead = new BuyleadService();

            string sqlwhere  = svBuylead.CreateWhereAction(BuyleadAction.Junk, CompID);
            var    CountJunk = svBuylead.CountData <b2bBuylead>("BuyleadID", sqlwhere);

            ViewBag.CountJunk = CountJunk;

            sqlwhere = svBuylead.CreateWhereAction(BuyleadAction.BackEnd, CompID) + " AND ListNo = 0 ";
            var CountBuylead = svBuylead.CountData <b2bBuylead>("BuyleadID", sqlwhere);

            ViewBag.CountBuylead = CountBuylead;

            sqlwhere = svBuylead.CreateWhereAction(BuyleadAction.All, CompID);
            var CountAllitem = svBuylead.CountData <b2bBuylead>("BuyleadID", sqlwhere);

            ViewBag.CountAllitem = CountAllitem;

            sqlwhere += svBuylead.CreateWhereCause(0, "", 4);
            var CountBuyleadApprove = svBuylead.CountData <view_BuyLead>("BuyleadID", sqlwhere);

            ViewBag.CountBuyleadApprove = CountBuyleadApprove;
        }
Пример #5
0
        public void List_DoloadData(BuyleadAction action)
        {
            ViewBag.Title = res.Product.lblBuyleadList;
            string sqlSelect, sqlWhere, sqlOrderBy = "";
            var    svBuylead = new BuyleadService();

            sqlSelect = "BuyleadID,Qty,QtyUnit,ModifiedDate,BuyleadName,BuyleadNameEng,BuyleadExpDate,BuyleadType,CompBuyleadCount,CompID,CompName,CompLevel,BizTypeName,BizTypeOther,BuyleadImgPath,CateLV3,CategoryName,LogoImgPath";

            #region DoWhereCause
            sqlWhere  = svBuylead.CreateWhereAction(action);
            sqlWhere += svBuylead.CreateWhereCause(0, ViewBag.txtSearch, 0, 1, (int)ViewBag.CateID, (int)ViewBag.BuyleadType, 0, (int)ViewBag.ProvinceID);
            //var sqlwherein = "";
            //switch (res.Common.lblWebsite)
            //{
            //    case "B2BThai": sqlwherein = " AND CategoryType IN (1,2)"; break;
            //    case "AntCart": sqlwherein = " AND CategoryType IN (3)"; break;
            //    case "myOtopThai": sqlwherein = " AND CategoryType IN (5)"; break;
            //    case "AppstoreThai": sqlwherein = " AND CategoryType IN (6) "; break;
            //    default: sqlwherein = ""; break;
            //}
            //sqlWhere += sqlwherein;

            if (ViewBag.BuyleadExpDate != 0)
            {
                sqlWhere += " ";
            }
            else if (ViewBag.BuyleadNotExpDate != 0)
            {
                sqlWhere += " AND (convert(nvarchar(20), BuyleadExpDate,112) > '" + DateTime.Today.ToString("yyyyMMdd", new System.Globalization.CultureInfo("en-US")) + "')";
            }
            #endregion

            #region Order By
            if (ViewBag.BuyleadNotExpDate != 0)
            {
                sqlOrderBy = "CreatedDate DESC";
            }
            else
            {
                sqlOrderBy = "BuyleadExpDate DESC";
            }
            //if (ViewBag.CreatedDate != 0)
            //    if (ViewBag.CreatedDate == 1)
            //        sqlOrderBy = "CreatedDate DESC";
            #endregion

            #region query
            var Buyleads = svBuylead.SelectData <view_BuyLead>(sqlSelect, sqlWhere, sqlOrderBy, (int)ViewBag.PageIndex, (int)ViewBag.PageSize);
            ViewBag.Buyleads = Buyleads;
            if (ViewBag.txtSearch != "")
            {
                ViewBag.Title += ViewBag.txtSearch;
            }
            if (svBuylead.TotalRow > 0)
            {
                if ((int)ViewBag.CateID > 0)
                {
                    ViewBag.Title += " | " + Buyleads.First().CategoryName;
                }
                if ((int)ViewBag.ProvinceID > 0)
                {
                    ViewBag.Title += " | " + Buyleads.First().ProvinceName;
                }
            }
            ViewBag.Title          += " | " + res.Common.lblDomainShortName;
            ViewBag.MetaKeyword     = ViewBag.Title;
            ViewBag.MetaDescription = ViewBag.Title;
            ViewBag.TotalRow        = svBuylead.TotalRow;
            //if (svBuylead.TotalRow.ToString().Length > 2)
            //    ViewBag.TotalRow = String.Format("{0:0,0}", svBuylead.TotalRow);

            ViewBag.TotalPage = svBuylead.TotalPage;
            if (svBuylead.TotalPage.ToString().Length > 2)
            {
                ViewBag.TotalPage = String.Format("{0:0,0}", svBuylead.TotalPage);
            }
            #endregion

            //#region Buyer
            //string CateLV3 = string.Empty;
            //if (ViewBag.Buyleads != null)
            //{
            //    if (Buyleads.Count > 0)
            //    {
            //        for (int x = 0; x < Buyleads.Count; x++)
            //        {
            //            CateLV3 += Buyleads[x].CateLV3 + ",";
            //        }
            //        CateLV3 = CateLV3.Substring(0, CateLV3.Length - 1);
            //        var Buyer = svBuylead.SelectData<view_PurchaseComp>("*", "CateLV3 IN (" + CateLV3 + ") AND RowFlag IN(2,4) AND ProductCount > 0 ", "CompID",0,0);
            //        ViewBag.Buyer = Buyer;
            //    }
            //}
            //#endregion
        }