Esempio n. 1
0
        public ActionResult QuotationTrade(FormCollection form)
        {
            SelectList_PageSize();
            SetPager(form);

            var svQuotation = new QuotationService();

            SqlSelect = " * ";

            int CompID = int.Parse(form["CompID"]);

            SQLWhere = svQuotation.CreateWhereAction(QuotationAction.Admin, CompID);

            var a = form["Period"];

            if (!string.IsNullOrEmpty(form["Period"]))
            {
                SQLWhere += SQLWhereDateTimeFromPeriod(form["Period"], "SendDate");
            }

            var Quotations = svQuotation.SelectData <view_Quotation>(SqlSelect, SQLWhere, "CreatedDate DESC", (int)ViewBag.PageIndex, (int)ViewBag.PageSize);

            ViewBag.TotalPage = svQuotation.TotalPage;
            ViewBag.TotalRow  = svQuotation.TotalRow;

            return(Json(new { Quotations = Quotations, PageIndex = (int)ViewBag.PageIndex, TotalRow = svQuotation.TotalRow, TotalPage = svQuotation.TotalPage, PageSize = (int)ViewBag.PageSize, }, JsonRequestBehavior.AllowGet));
        }
        public ActionResult QuotationList(FormCollection form)
        {
            SelectList_PageSize();
            SetPager(form);
            int CompID = LogonCompID;

            var svQuotation = new QuotationService();

            SqlSelect = "QuotationID,QuotationCode,FromCompID,ToCompID,CompanyName,ReqFirstName,ReqLastName,ReqEmail,SendDate,RowFlag,RowVersion,IsDelete,IsRead,IsOutbox,IsReject,IsImportance,QuotationStatus,FromCompName,ToCompName,CategoryType,WebID,FromWebID";
            SQLWhere  = svQuotation.CreateWhereAction(QuotationAction.Admin, 0);
            if (form["QuoStatus"] != "Q")
            {
                //Require Price
                SQLWhere += RSqlWhereQuotationSearchBy(int.Parse(form["SearchBy"]), form["SearchText"]);
            }
            else
            {
                //Quotation
                SQLWhere += QSqlWhereQuotationSearchBy(int.Parse(form["SearchBy"]), form["SearchText"]);
            }
            if (!string.IsNullOrEmpty(form["Period"]))
            {
                SQLWhere += SQLWhereDateTimeFromPeriod(form["Period"], "SendDate");
            }

            ViewBag.Quotations = svQuotation.SelectData <view_Quotation>(SqlSelect, SQLWhere, "CreatedDate DESC", (int)ViewBag.PageIndex, (int)ViewBag.PageSize);
            ViewBag.TotalPage  = svQuotation.TotalPage;
            ViewBag.TotalRow   = svQuotation.TotalRow;

            return(PartialView("UC/QuotationList"));
        }
        public ActionResult QuotationTrade(FormCollection form)
        {
            SelectList_PageSize();
            SetPager(form);

            var svQuotation = new QuotationService();

            SqlSelect = "QuotationID,QuotationCode,FromCompID,ToCompID,CompanyName,ReqFirstName,ReqLastName,ReqEmail,SendDate,RowFlag,RowVersion,IsDelete,IsRead,IsReject,IsImportance,ToCompName";

            int CompID = int.Parse(form["CompID"]);

            SQLWhere = svQuotation.CreateWhereAction(QuotationAction.Admin, CompID);

            if (!string.IsNullOrEmpty(form["Period"]))
            {
                SQLWhere += SQLWhereDateTimeFromPeriod(form["Period"], "SendDate");
            }

            var Quotations = svQuotation.SelectData <view_Quotation>(SqlSelect, SQLWhere, "CreatedDate DESC", (int)ViewBag.PageIndex, (int)ViewBag.PageSize);

            ViewBag.TotalPage = svQuotation.TotalPage;
            ViewBag.TotalRow  = svQuotation.TotalRow;

            return(Json(new { Quotations = Quotations, PageIndex = (int)ViewBag.PageIndex, TotalRow = svQuotation.TotalRow, TotalPage = svQuotation.TotalPage, PageSize = (int)ViewBag.PageSize, }, JsonRequestBehavior.AllowGet));
        }
Esempio n. 4
0
        public void CountQuotation()
        {
            string SQLWhere    = "";
            var    svQuotation = new QuotationService();
            var    svOrderPur  = new OrderPurchaseService();

            SQLWhere         = svQuotation.CreateWhereAction(QuotationAction.CountQuotation, LogonCompID);
            SQLWhere        += " AND (IsRead = 0)";
            ViewBag.QuoCount = svQuotation.SelectData <b2bQuotation>("QuotationID", SQLWhere, "QuotationID", 1, 0).Count;

            var SQLWhereList = svQuotation.CreateWhereAction(QuotationAction.BackEnd, LogonCompID);

            ViewBag.QuoCountList = svQuotation.SelectData <b2bQuotation>("QuotationID", SQLWhereList, "QuotationID", 1, 0).Count;

            SQLWhere         = svOrderPur.CreateWhereAction(OrderPurchaseAction.CountOrderPurchase, LogonCompID);
            ViewBag.CountOrP = svOrderPur.SelectData <OuikumOrderDetail>("OrDetailID", SQLWhere, "OrDetailID", 1, 0).Count;
        }
        public ActionResult sentboxrequest(int compid)
        {
            var svQuota  = new QuotationService();
            var sqlwhere = svQuota.CreateWhereAction(QuotationAction.Sentbox, compid);

            sqlwhere += " AND IsMatching = 0";
            var quotation  = new List <QuotationModel>();
            var quotations = svQuota.SelectData <view_Quotation>(" * ", sqlwhere);

            quotation = SetMappingQuotation(quotations);
            return(Json(new { quotation = quotation }, JsonRequestBehavior.AllowGet));
        }
        public ActionResult QuotationList()
        {
            GetStatusUser();
            RememberURL();
            if (!CheckIsLogin())
            {
                return(Redirect(res.Pageviews.PvMemberSignIn));
            }
            else
            {
                GetStatusUser();
                SetPager();
                var svQuotation = new QuotationService();
                ViewBag.Inbox      = svQuotation.CountData <b2bQuotation>("*", svQuotation.CreateWhereAction(QuotationAction.All));
                ViewBag.Importance = svQuotation.CountData <b2bQuotation>("*", svQuotation.CreateWhereAction(QuotationAction.Important));
                ViewBag.Sentbox    = svQuotation.CountData <b2bQuotation>("*", svQuotation.CreateWhereAction(QuotationAction.Sentbox));

                var svCompany   = new CompanyService();
                var DataCompany = svCompany.SelectData <view_Company>("CompID,ContactEmail,CompName", "CompID = " + LogonCompID, null, 1, 0, false).First();
                ViewBag.ContactEmail = DataCompany.ContactEmail;
                ViewBag.CompName     = DataCompany.CompName;
                return(View());
            }
        }
        public ActionResult countinfo(int compid)
        {
            MessageService   svMessage = new MessageService();
            QuotationService svQuota   = new QuotationService();

            #region count message unread
            var cntMsg = svMessage.CountData <emMessage>("*", svMessage.CreateWhereAction(MessageStatus.UnRead, compid));
            #endregion

            #region count matching unread
            var sqlwhere = svQuota.CreateWhereAction(QuotationAction.CountQuotation, compid);
            sqlwhere += "ANd isMatching = 1 ";
            var cntMatching = svQuota.CountData <b2bQuotation>("*", sqlwhere);
            #endregion

            #region count quotation unread
            sqlwhere  = svQuota.CreateWhereAction(QuotationAction.CountQuotation, compid);
            sqlwhere += "ANd isMatching = 0 ";
            #endregion

            var cntQuota = svQuota.CountData <b2bQuotation>("*", sqlwhere);

            return(Json(new { message = cntMsg, matching = cntMatching, quotation = cntQuota }, JsonRequestBehavior.AllowGet));
        }
Esempio n. 8
0
        public ActionResult Index()
        {
            //if (RedirectToProduction())
            //    return Redirect(UrlProduction);

            LoadProductShowcase();
            LoadHotProduct();
            LoadRecently();
            LoadCategory();
            LoadFeatureProduct();
            LoadRandomCompany();
            LoadRandomBanner();
            GetStatusUser();
            LoadDataBidProduct();
            LoadSuccessStory();
            GetEnumServiceType();
            //search
            LoadProvinces();
            LoadBiztype();

            #region CheckIsLogin
            if (CheckIsLogin())
            {
                MessageService       svMessage   = new MessageService();
                QuotationService     svQuotation = new QuotationService();
                OrderPurchaseService svOrderPur  = new OrderPurchaseService();
                string SQLWhere = "";

                string sqlwhere = svMessage.CreateWhereAction(MessageStatus.UnRead, LogonCompID);
                int    count    = svMessage.CountData <emMessage>("MessageID", sqlwhere);
                ViewBag.UnRead = count;

                SQLWhere         = svQuotation.CreateWhereAction(QuotationAction.CountQuotation, LogonCompID);
                ViewBag.CountQuo = svQuotation.SelectData <b2bQuotation>("QuotationID", SQLWhere, "QuotationID", 1, 0).Count;

                SQLWhere         = svOrderPur.CreateWhereAction(OrderPurchaseAction.CountOrderPurchase, LogonCompID);
                ViewBag.CountOrP = svOrderPur.SelectData <OuikumOrderDetail>("OrDetailID", SQLWhere, "OrDetailID", 1, 0).Count;
            }
            #endregion

            ViewBag.FBAccessToken = GetAppSetting("FBPageAccessToken");
            ViewBag.Page          = "Home";

            return(View());
        }
Esempio n. 9
0
        public void LoadDataBidProduct()
        {
            string SQLWhere    = "";
            var    svQuotation = new QuotationService();
            var    quotations  = new List <view_QuotationPublic>();

            if (MemoryCache.Default["loadbidproduct"] != null)
            {
                quotations = (List <view_QuotationPublic>)MemoryCache.Default["loadbidproduct"];
            }
            else
            {
                SQLWhere   = svQuotation.CreateWhereAction(QuotationAction.FrontEnd, 0);
                quotations = svQuotation.SelectData <view_QuotationPublic>("*", SQLWhere, "CreatedDate DESC", 1, 10);

                if (quotations != null && svQuotation.TotalRow > 0)
                {
                    MemoryCache.Default.Add("loadbidproduct", quotations, DateTime.Now.AddMinutes(5));
                }
                ;
            }

            ViewBag.Quotation = quotations;
        }
        public void List_DoloadBidProduct(string TextSearch, string SearchType, int?CateLV, int?PIndex, int?PSize)
        {
            int    PageIndex = (PIndex != null) ? (int)PIndex : 1;
            int    PageSize  = (PSize != null) ? (int)PSize : 20;
            string txtSearch = (TextSearch != null) ? TextSearch : "";
            string Type      = "";
            string Cate      = "";

            switch (SearchType)
            {
            case "Product":
                Type = " AND ProductName LIKE N'" + txtSearch + "%'";
                break;

            case "Buyer":
                Type = " AND CompanyName LIKE N'" + txtSearch + "%'";
                break;
            }
            var svQuotation = new QuotationService();
            var svCategory  = new CategoryService();

            SQLWhere  = svQuotation.CreateWhereAction(QuotationAction.FrontEnd, 0);
            SQLWhere += Type;
            if (CateLV > 0)
            {
                SQLWhere += " AND CateLV1 =" + CateLV;
            }
            //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;
            //}
            var SqlSelect = "";

            //if (Base.AppLang == "en-US")
            //    SqlSelect = "CategoryID,CategoryNameEng AS CategoryName,ParentCategoryPath,CategoryLevel";

            //else

            SqlSelect = "CategoryID,CategoryName,ParentCategoryPath,CategoryLevel";
            var SqlWhereCate = "CategoryLevel = 1 AND RowFlag = 1 AND IsDelete = 0 ";

            ViewBag.Category = svCategory.SelectData <b2bCategory>(SqlSelect, SqlWhereCate, "CategoryName", 0, 0);

            var QuotationList = svQuotation.SelectData <view_QuotationPublic>("*", SQLWhere, "CreatedDate DESC", PageIndex, PageSize);

            if (QuotationList.Count > 0)
            {
                ViewBag.Quotation = QuotationList;
            }
            ViewBag.TextSearch = TextSearch;
            ViewBag.PageIndex  = PageIndex;
            ViewBag.TotalRow   = svQuotation.TotalRow;
            ViewBag.TotalPage  = svQuotation.TotalPage;
            ViewBag.PageSize   = PSize;
        }