public void CountQuotation()
        {
            var svQuotation = new QuotationService();

            ViewBag.Inbox      = svQuotation.CountData <b2bQuotation>("*", "( IsDelete = 0 ) AND (IsRead = 'False') AND (IsOutBox = 'False')  AND (IsRead = 0) AND (ToCompID = " + LogonCompID + ")");
            ViewBag.Importance = svQuotation.CountData <b2bQuotation>("*", "( ToCompID = " + LogonCompID + " AND IsOutBox = 0 AND IsDelete = 0 AND  IsImportance = 1 ) OR (FromCompID = " + LogonCompID + " AND IsOutBox = 1 AND IsDelete = 0 AND  IsImportance = 1 )");
            ViewBag.Sentbox    = svQuotation.CountData <b2bQuotation>("*", "( IsDelete = 0 AND  IsOutbox = 1 AND FromCompID = " + LogonCompID + " )");
        }
        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));
        }