示例#1
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);
        }
示例#2
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));
        }
示例#3
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 "資料夾刪除成功!";
        }
示例#4
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));
        }
示例#5
0
        public string FolderRename(int FolderId, string FolderName)
        {
            CMember member = (CMember)Session[CMemberSession.Session_Login_User];//會員
            //查詢筆記資料夾
            CNoteFolder myFolder = CNoteFolderFactory.fn筆記資料夾查詢(member)
                                   .FirstOrDefault(f => f.fFolderId == FolderId);

            myFolder.fFolderName = FolderName;
            CNoteFolderFactory.fn筆記資料夾更新(myFolder);
            return("資料夾重新命名成功!");
        }
示例#6
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);
        }
示例#7
0
        public int AddNoteFolder(string TxtNewFolderName)
        {
            CMember     member   = (CMember)Session[CMemberSession.Session_Login_User];//會員
            CNoteFolder myFolder = new CNoteFolder()
            {
                fMemberId   = member.fMemberId,
                fFolderName = TxtNewFolderName
            };
            int folderid = CNoteFolderFactory.fn筆記資料夾新增(member, myFolder);

            return(folderid);
        }
示例#8
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));
        }
示例#10
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("筆記更新成功");
        }
示例#11
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("筆記已重新命名!");
        }
        //修改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));
        }
示例#13
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("筆記還原!");
        }
示例#14
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("我的最愛筆記已更新!");
        }
示例#15
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 "筆記移到垃圾桶!";
        }
示例#16
0
        public string SignIn(CMember m, CNotice c)
        {
            List <CMember> SELECTMember = CMemberFactory.fn會員查詢();
            CMember        member       = SELECTMember.FirstOrDefault(n => n.fAccount == m.fAccount);
            var            data         = "";

            if (member == null)
            {
                string str = m.fPassword + "QAQ";
                var    md5 = CMemberFactory.MD5驗證碼新增(str);
                m.fMoneyPoint        = 100;
                m.fPhoto             = "../Image/MemberImage/Member.jpg";
                m.fRegisterDateTime  = DateTime.UtcNow.AddHours(08);
                m.fLastLoginDateTime = DateTime.UtcNow.AddHours(08);
                m.fIsVIP             = false;
                m.fIsBanned          = false;
                m.fThePasswordURL    = md5;
                m.fTheAddress        = m.fCity + m.fTown + m.fTheAddress;
                CMemberFactory.fn會員新增(m);
                //會員註冊訊息新增---------------------------------------------------------------\\
                List <CMember> SELECTMember2 = CMemberFactory.fn會員查詢();
                CMember        member2       = SELECTMember2.FirstOrDefault(n => n.fAccount == m.fAccount);
                c.fNoticeDatetime = DateTime.UtcNow.AddHours(08);
                c.fNoticeContent  = m.fFirstName + m.fLastName + "歡迎加入Notedge!";
                c.fCategoryType   = "系統";
                c.fLink           = "我是超連結";
                c.fMemberId       = member2.fMemberId;
                CNoticeFactory.fn通知訊息新增(member2, c);
                //會員註冊新增未分類筆記----------------------------------------------------------\\
                CNoteFolderFactory.fn建立預設筆記資料夾(member2);
                data = "新增成功";
                return(data);
            }
            else
            {
                data            = "新增失敗";
                ViewBag.Message = "信箱與人重複,請重新輸入";
                return(data);
            }
        }
        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);
        }