Example #1
0
        public ActionResult MyNote(int?FolderId)
        {
            if (Session[CMemberSession.Session_Login_User] == null)//防止未登入者進入筆記系統
            {
                return(RedirectToAction("../Member/Login"));
            }

            CMember member = (CMember)Session[CMemberSession.Session_Login_User];//會員
            //查詢未分類筆記
            CNoteFolder defaultFolder = CNoteFolderFactory.fn筆記資料夾查詢(member)
                                        .FirstOrDefault(f => f.fFolderName == "未分類筆記");
            List <CNote> lsDefaultNote = CNoteFactory.fn私人筆記查詢(defaultFolder)
                                         .ToList();

            //網址未輸入資料夾ID,轉到未分類筆記
            if (FolderId == null)
            {
                return(View("MyNote", "_Layout", lsDefaultNote));
            }
            //查詢筆記資料夾
            CNoteFolder myFolder = CNoteFolderFactory.fn筆記資料夾查詢(member)
                                   .FirstOrDefault(f => f.fFolderId == (int)FolderId);

            //網址輸入不存在的資料夾ID,轉到未分類筆記
            if (myFolder == null)
            {
                return(View("MyNote", "_Layout", lsDefaultNote));
            }
            //查詢所有筆記
            List <CNote> lsNote = CNoteFactory.fn私人筆記查詢(myFolder)
                                  .ToList();

            //轉到筆記頁面
            return(View("MyNote", "_Layout", lsNote));
        }
Example #2
0
        // GET: Note
        public ActionResult Index()
        {
            if (Session[CMemberSession.Session_Login_User] == null)//防止未登入者進入筆記系統
            {
                return(RedirectToAction("../Member/Login"));
            }
            CMember member = (CMember)Session[CMemberSession.Session_Login_User];//會員
            //查詢所有的筆記資料夾
            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)
                                        .ToList();
                lsNotefolderVM.Add(new CNoteFolderViewModel()
                {
                    fFolderId   = folder.fFolderId,
                    fFolderName = folder.fFolderName,
                    fMemberId   = folder.fMemberId,
                    lsNote      = myLsNote
                });
            }

            return(View("Index", "_Layout", lsNotefolderVM));
        }
Example #3
0
        public int AddTemplate(int FolderId, string TxtNewNoteName, string Content)
        {
            CMember member = (CMember)Session[CMemberSession.Session_Login_User];//會員
            //查詢筆記資料夾
            CNoteFolder myFolder = CNoteFolderFactory.fn筆記資料夾查詢(member)
                                   .FirstOrDefault(f => f.fFolderId == FolderId);
            int   level  = CNoteFactory.fn私人筆記查詢(myFolder).Where(n => n.fIsTrash == false).Count();
            CNote myNote = new CNote()
            {
                fCreateDateTime   = DateTime.UtcNow.AddHours(08),
                fEditDateTime     = DateTime.UtcNow.AddHours(08),
                fFolderId         = FolderId,
                fIsMyFavourite    = false,
                fIsTrash          = false,
                fHTMLContent      = "",
                fJsonContent      = Content,
                fNoteListLevel    = level,
                fNoteListName     = TxtNewNoteName,
                fTheContactPerson = null,
                fTheShareLink     = null
            };

            int noteid = CNoteFactory.fn私人筆記新增(myFolder, myNote);

            return(noteid);
        }
Example #4
0
        public ActionResult DeleteFolder(int FolderId)
        {
            CMember member = (CMember)Session[CMemberSession.Session_Login_User];//會員
            //查詢筆記資料夾
            CNoteFolder myFolder = CNoteFolderFactory.fn筆記資料夾查詢(member)
                                   .FirstOrDefault(f => f.fFolderId == FolderId);

            CNoteFolderFactory.fn筆記資料夾刪除(myFolder, member);

            //查詢所有的筆記資料夾
            List <CNoteFolder> lsFolder = CNoteFolderFactory.fn筆記資料夾查詢(member)
                                          .ToList();
            //筆記資料夾包含筆記的列表
            List <CNoteFolderViewModel> lsNotefolderVM = new List <CNoteFolderViewModel>();

            //讀取筆記資料夾內的筆記
            foreach (var folder in lsFolder)
            {
                List <CNote> myLsNote = CNoteFactory.fn私人筆記查詢(folder)
                                        .ToList();
                lsNotefolderVM.Add(new CNoteFolderViewModel()
                {
                    fFolderId   = folder.fFolderId,
                    fFolderName = folder.fFolderName,
                    fMemberId   = folder.fMemberId,
                    lsNote      = myLsNote
                });
            }

            return(PartialView("_TrashView", lsNotefolderVM));
            //return "資料夾刪除成功!";
        }
Example #5
0
        public string SearchFavor(int FolderId, int NoteId)
        {
            CMember member = (CMember)Session[CMemberSession.Session_Login_User];//會員
            //查詢筆記資料夾
            CNoteFolder myFolder = CNoteFolderFactory.fn筆記資料夾查詢(member)
                                   .FirstOrDefault(f => f.fFolderId == (int)FolderId);
            //查詢指定筆記內容
            CNote myNote = CNoteFactory.fn私人筆記查詢(myFolder)
                           .FirstOrDefault(n => n.fNoteId == NoteId && n.fIsTrash == false && n.fIsMyFavourite == true);

            return(myNote.fJsonContent);
        }
Example #6
0
        public ActionResult SearchVersion(int FolderId, int NoteId)
        {
            CMember member = (CMember)Session[CMemberSession.Session_Login_User];//會員
            //查詢筆記資料夾
            CNoteFolder myFolder = CNoteFolderFactory.fn筆記資料夾查詢(member)
                                   .FirstOrDefault(f => f.fFolderId == (int)FolderId);
            //查詢指定筆記內容
            CNote myNote = CNoteFactory.fn私人筆記查詢(myFolder)
                           .FirstOrDefault(n => n.fNoteId == NoteId && n.fIsTrash == false);
            List <CVersion> lsVersion = CVersionFactory.fn筆記版本控制查詢(myNote);

            return(PartialView("_SearchVersionView", lsVersion));
        }
        public ActionResult MyProduct()
        {
            //登入的會員資訊
            CMember member = (CMember)Session[CMemberSession.Session_Login_User];

            //防止未登入者進入
            if (member == null)
            {
                return(RedirectToAction("../Member/Login"));
            }

            //會員販售的商品
            List <CProductPicture> MyProduct = CProductPictureFactory.fn商品圖片查詢().Where(p => p.fTheRemovedDate == null && p.fMemberSellerId == member.fMemberId).DistinctBy(p => p.fProductId).OrderBy(p => p.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).ToList();
                lsNotefolderVM.Add(new CNoteFolderViewModel()
                {
                    fFolderId   = folder.fFolderId,
                    fFolderName = folder.fFolderName,
                    fMemberId   = folder.fMemberId,
                    lsNote      = myLsNote
                });
            }
            ;

            //商品類別給後面下拉式選單用
            List <CProductCategory> lsProductCategory = CProductCategoryFactory.fn商品類別查詢().ToList();

            ViewBag.Categories = new MultiSelectList(lsProductCategory, "fCategoryId", "fCategoryName");

            List <CProductCompare> lsproductcategory = CProductCompareFactory.fn商品類別對照查詢().Where(m => m.fMemberSellerId == member.fMemberId).ToList();

            CShoppingAccountCenterVM ShoppingAccountCenter = new CShoppingAccountCenterVM()
            {
                lsNotefolderVM    = lsNotefolderVM,
                lsCategory        = lsProductCategory,
                lsProductPicture  = MyProduct,
                lsCategoryCompare = lsproductcategory
            };

            return(PartialView("_MyProduct", ShoppingAccountCenter));
        }
Example #8
0
        public string NoteRename(int FolderId, int NoteId, string NoteName)
        {
            CMember member = (CMember)Session[CMemberSession.Session_Login_User];//會員
            //查詢筆記資料夾
            CNoteFolder myFolder = CNoteFolderFactory.fn筆記資料夾查詢(member)
                                   .FirstOrDefault(f => f.fFolderId == FolderId);
            //查詢指定筆記內容
            CNote myNote = CNoteFactory.fn私人筆記查詢(myFolder)
                           .FirstOrDefault(n => n.fNoteId == NoteId);

            myNote.fNoteListName = NoteName;
            myNote.fEditDateTime = DateTime.UtcNow.AddHours(08);
            CNoteFactory.fn私人筆記更新(myNote);
            return("筆記已重新命名!");
        }
Example #9
0
        public string Update(int FolderId, int NoteId, string JsonContent)
        {
            CMember member = (CMember)Session[CMemberSession.Session_Login_User];//會員
            //查詢筆記資料夾
            CNoteFolder myFolder = CNoteFolderFactory.fn筆記資料夾查詢(member)
                                   .FirstOrDefault(f => f.fFolderId == FolderId);
            //查詢指定筆記內容
            CNote myNote = CNoteFactory.fn私人筆記查詢(myFolder)
                           .FirstOrDefault(n => n.fNoteId == NoteId);

            myNote.fJsonContent  = JsonContent;
            myNote.fEditDateTime = DateTime.UtcNow.AddHours(08);
            CNoteFactory.fn私人筆記更新(myNote);
            return("筆記更新成功");
        }
        //修改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));
        }
Example #11
0
        public string MoveOutTrash(int FolderId, int NoteId)
        {
            CMember member = (CMember)Session[CMemberSession.Session_Login_User];//會員

            CNoteFolder m原筆記資料夾 = CNoteFolderFactory.fn筆記資料夾查詢(member)
                                  .FirstOrDefault(f => f.fFolderId == FolderId);

            CNote myNote = CNoteFactory.fn私人筆記查詢(m原筆記資料夾)
                           .FirstOrDefault(n => n.fNoteId == NoteId);

            myNote.fIsTrash = false;

            CNoteFactory.fn私人筆記更新(myNote);

            return("筆記還原!");
        }
Example #12
0
        public string UpdateFavor(int FolderId, int NoteId, bool IsFavor)
        {
            CMember member = (CMember)Session[CMemberSession.Session_Login_User];//會員
            //查詢筆記資料夾
            CNoteFolder myFolder = CNoteFolderFactory.fn筆記資料夾查詢(member)
                                   .FirstOrDefault(f => f.fFolderId == FolderId);
            //查詢指定筆記內容
            CNote myNote = CNoteFactory.fn私人筆記查詢(myFolder)
                           .FirstOrDefault(n => n.fNoteId == NoteId);

            myNote.fIsMyFavourite = IsFavor;
            myNote.fEditDateTime  = DateTime.UtcNow.AddHours(08);
            CNoteFactory.fn私人筆記更新(myNote);

            return("我的最愛筆記已更新!");
        }
Example #13
0
        public ActionResult MoveToTrash(int FolderId, int NoteId)
        {
            CMember member = (CMember)Session[CMemberSession.Session_Login_User];//會員

            CNoteFolder m原筆記資料夾 = CNoteFolderFactory.fn筆記資料夾查詢(member)
                                  .FirstOrDefault(f => f.fFolderId == FolderId);
            CNoteFolder m未分類筆記 = CNoteFolderFactory.fn筆記資料夾查詢(member)
                                 .FirstOrDefault(f => f.fFolderName == "未分類筆記");

            CNote myNote = CNoteFactory.fn私人筆記查詢(m原筆記資料夾)
                           .FirstOrDefault(n => n.fNoteId == NoteId);

            myNote.fIsTrash  = true;
            myNote.fFolderId = m未分類筆記.fFolderId;

            CNoteFactory.fn私人筆記更新(myNote);

            //查詢所有的筆記資料夾
            List <CNoteFolder> lsFolder = CNoteFolderFactory.fn筆記資料夾查詢(member)
                                          .ToList();
            //筆記資料夾包含筆記的列表
            List <CNoteFolderViewModel> lsNotefolderVM = new List <CNoteFolderViewModel>();

            //讀取筆記資料夾內的筆記
            foreach (var folder in lsFolder)
            {
                List <CNote> myLsNote = CNoteFactory.fn私人筆記查詢(folder)
                                        .ToList();
                lsNotefolderVM.Add(new CNoteFolderViewModel()
                {
                    fFolderId   = folder.fFolderId,
                    fFolderName = folder.fFolderName,
                    fMemberId   = folder.fMemberId,
                    lsNote      = myLsNote
                });
            }

            return(PartialView("_TrashView", lsNotefolderVM));
            //return "筆記移到垃圾桶!";
        }