Exemplo n.º 1
0
        public string Search(int FolderId, int NoteId)
        {
            CMember member = (CMember)Session[CMemberSession.Session_Login_User];//會員
            //查詢指定筆記內容
            CNote myNote = CNoteFactory.fn私人筆記全部查詢()
                           .FirstOrDefault(n => n.fNoteId == NoteId && n.fIsTrash == false);

            return(myNote.fJsonContent);
        }
Exemplo n.º 2
0
        public string AddVersion(int NoteId)
        {
            CMember member = (CMember)Session[CMemberSession.Session_Login_User];//會員

            //查詢指定筆記內容
            CNote myNote = CNoteFactory.fn私人筆記全部查詢()
                           .FirstOrDefault(n => n.fNoteId == NoteId);

            myNote.fEditDateTime = DateTime.UtcNow.AddHours(08);
            CVersionFactory.fn筆記版本控制新增(myNote);

            return("版本紀錄新增成功!");
        }
Exemplo n.º 3
0
        public string UpdateVersion(int NoteId, string JsonContent)
        {
            CMember member = (CMember)Session[CMemberSession.Session_Login_User];//會員

            //查詢指定筆記內容
            CNote myNote = CNoteFactory.fn私人筆記全部查詢()
                           .FirstOrDefault(n => n.fNoteId == NoteId);

            myNote.fJsonContent  = JsonContent;
            myNote.fEditDateTime = DateTime.UtcNow.AddHours(08);
            CNoteFactory.fn私人筆記更新(myNote);
            return("筆記更新成功");
        }
Exemplo n.º 4
0
        public string UpdateNoteLevel(int FolderId, int NoteId, int Level)
        {
            CMember member = (CMember)Session[CMemberSession.Session_Login_User];//會員

            CNote myNote = CNoteFactory.fn私人筆記全部查詢()
                           .FirstOrDefault(n => n.fNoteId == NoteId);

            //if(myNote.fFolderId == FolderId && myNote.fNoteId == NoteId && myNote.fNoteListLevel == Level)
            //    return myNote.fNoteListName + " 筆記順序更新成功!";
            myNote.fFolderId      = FolderId;
            myNote.fNoteListLevel = Level;
            CNoteFactory.fn私人筆記更新(myNote);
            return(myNote.fNoteListName + " 筆記順序更新成功!");
        }
        //修改GET抓取JSON資料
        //string myProductContent;
        public JsonResult EditProduct(int?fProductId)
        {
            //登入的會員資訊
            CMember member = (CMember)Session[CMemberSession.Session_Login_User];
            //防止未登入者進入

            CProduct myProduct = CProductFactory.fn商品查詢().FirstOrDefault(p => p.fProductId == fProductId);

            List <CProductPicture> lsMyProductPicture = CProductPictureFactory.fn商品圖片查詢().Where(p => p.fProductId == fProductId).ToList();

            List <CProductCompare> lsProductCategory = CProductCompareFactory.fn商品類別對照查詢().Where(c => c.fProductId == fProductId).ToList();
            List <CNoteFolder>     lsFolder          = CNoteFolderFactory.fn筆記資料夾查詢(member).ToList();

            //筆記資料夾包含筆記的列表
            List <CNoteFolderViewModel> lsNotefolderVM = new List <CNoteFolderViewModel>();

            //讀取筆記資料夾內的筆記
            foreach (var folder in lsFolder)
            {
                List <CNote> myLsNote = CNoteFactory.fn私人筆記查詢(folder).OrderBy(n => n.fNoteListLevel).Where(n => n.fJsonContent == myProduct.fContent).ToList();
                lsNotefolderVM.Add(new CNoteFolderViewModel()
                {
                    fFolderId   = folder.fFolderId,
                    fFolderName = folder.fFolderName,
                    fMemberId   = folder.fMemberId,
                    lsNote      = myLsNote
                });
            }
            CNote mynote = CNoteFactory.fn私人筆記全部查詢().FirstOrDefault(n => n.fJsonContent == myProduct.fContent);

            CShoppingAccountCenterVM ShoppingAccountCenter = new CShoppingAccountCenterVM()
            {
                lsCategoryCompare = lsProductCategory,
                lsProductPicture  = lsMyProductPicture,
                Product           = myProduct,
                lsNotefolderVM    = lsNotefolderVM,
                NoteId            = mynote.fNoteId
                                    //Content = myProductContent,
            };

            string value = string.Empty;

            value = JsonConvert.SerializeObject(ShoppingAccountCenter, Formatting.Indented, new JsonSerializerSettings
            {
                ReferenceLoopHandling = ReferenceLoopHandling.Ignore
            });
            return(Json(value, JsonRequestBehavior.AllowGet));
        }
        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);
        }