public ActionResult ToInsert(string datas)
        {
            var scores = JsonSerializer.Deserialize <Score[]>(datas);

            foreach (var i in scores)
            {
                CProductRank rank = new CProductRank();
                rank.fRank           = i.score;
                rank.fComment        = i.message;
                rank.fSubmitDataTime = DateTime.UtcNow.AddHours(08);
                rank.fDetailOrderIId = i.id;
                CProductRankFactory.fn評價新增(rank);

                var a = CDetailOrderFactory.fn訂單明細查詢().Where(n => n.fDetailOrderIId == i.id).ToList();

                CNotice c = new CNotice();
                c.fCategoryType   = "評價留言";
                c.fLink           = "超連結";
                c.fNoticeDatetime = DateTime.UtcNow.AddHours(08);
                c.fMemberId       = a.Single().fMemberSellerId;
                c.fNoticeContent  = "您的" + a.Single().fName + "以新增評價";
                CNoticeFactory.fn通知訂單訊息新增(c);
            }

            return(new ApiResult());
        }
        public string categorycharts(int fProductId, int fOrderId)
        {
            CDetailOrder detailOrder = CDetailOrderFactory.fn訂單明細查詢()
                                       .FirstOrDefault(d => d.fProductId == (int)fProductId);

            return("");
        }
        public ActionResult MyMoney(int fMemberId)
        {
            //登入的會員資訊
            CMember Member = (CMember)Session[CMemberSession.Session_Login_User];

            //防止未登入者進入
            if (Member == null)
            {
                return(RedirectToAction("../Member/Login"));
            }
            List <CIncome>      lsincome      = CIncomeFactory.fn公司收入查詢().Where(i => (i.fMemberId == Member.fMemberId && i.fIncomeCategory == "儲值") || (i.fMemberId == Member.fMemberId && i.fIncomeCategory == "獲利")).ToList();
            List <COrder>       lsorder       = COrderFactory.fn訂單查詢(Member).ToList();
            List <CDetailOrder> lsdetailorder = CDetailOrderFactory.fn訂單明細查詢().ToList();

            CMoneyVM MoneyVM = new CMoneyVM()
            {
                lsIncome      = lsincome,
                lsOrder       = lsorder,
                lsOrderDetail = lsdetailorder
            };

            return(PartialView("_MyMoney", MoneyVM));
        }
        public void ToOrder(int totalprice, int remain, int cartId)
        {
            CMember member = (CMember)Session[CMemberSession.Session_Login_User];//會員
            COrder  o      = new COrder();

            o.fPurchaseDate = DateTime.UtcNow.AddHours(08);
            o.fTotalPrice   = totalprice;
            o.fMemberId     = member.fMemberId;
            COrderFactory.fn訂單新增(o);

            CMemberFactory.fn會員更新點數(member, remain);

            CNotice c = new CNotice();

            c.fCategoryType   = "系統";
            c.fLink           = "超連結";
            c.fNoticeDatetime = DateTime.UtcNow.AddHours(08);
            c.fMemberId       = member.fMemberId;
            c.fNoticeContent  = "您的訂單已完成了";
            CNoticeFactory.fn通知訂單訊息新增(c);

            List <CCartProduct> CP = CCartProductFactory.fn購物車商品個人查詢(cartId).ToList();

            var f = CNoteFolderFactory.fn筆記資料夾查詢(member).Where(q => q.fFolderName == "未分類筆記").ToList();

            int orderid = COrderFactory.fn訂單查詢(member).LastOrDefault().fOrderId;

            foreach (var a in CP)
            {
                CDetailOrderFactory.fn訂單明細新增(orderid, a.fProductId);
                CNotice c1 = new CNotice();
                c1.fCategoryType   = "銷售";
                c1.fLink           = "超連結";
                c1.fNoticeDatetime = DateTime.UtcNow.AddHours(08);
                c1.fMemberId       = a.fMemberSellerId;
                c1.fNoticeContent  = "您的" + a.fName + "已被購買";
                CNoticeFactory.fn通知訂單訊息新增(c1);

                CIncome i1 = new CIncome();
                i1.fIncome          = a.fPrice;
                i1.fPaymentDateTime = DateTime.UtcNow.AddHours(08);
                i1.fIncomeCategory  = "獲利";
                i1.fMemberId        = a.fMemberSellerId;
                CIncomeFactory.fn公司獲利新增(i1);

                var     point  = CMemberFactory.fn會員查詢().Where(z => z.fMemberId == a.fMemberSellerId);
                int     point1 = (point.Single().fMoneyPoint) + a.fPrice;
                CMember cm1    = new CMember();
                cm1.fMemberId = point.Single().fMemberId;
                CMemberFactory.fn會員更新點數(cm1, point1);

                var t = CNoteFactory.fn私人筆記全部查詢().Where(q => q.fFolderId == f.Single().fFolderId).ToList();

                int t1 = t.Count();

                CNote n = new CNote();
                n.fNoteListName     = a.fName;
                n.fCreateDateTime   = DateTime.UtcNow.AddHours(08);
                n.fEditDateTime     = DateTime.UtcNow.AddHours(08);
                n.fNoteListLevel    = t1;
                n.fIsMyFavourite    = false;
                n.fIsTrash          = false;
                n.fFolderId         = f.Single().fFolderId;
                n.fJsonContent      = a.fContent;
                n.fTheShareLink     = null;
                n.fTheContactPerson = null;
                n.fHTMLContent      = "";
                CNoteFactory.fn訂單私人筆記新增(n);
            }

            CCartFactory.fn購物車個人更新(cartId);
        }