Пример #1
0
        //[ValidateAntiForgeryToken]
        #region 使用者自行設定個人資料
        public ActionResult UserSetting()
        {
            if (Session["UserID"] != null)
            {
                string UserID           = string.Empty;
                string accountCoverPath = string.Empty;
                string indexCoverPath   = string.Empty;

                UserID = Session["UserID"].ToString();
                #region  人資料設定
                Vw_Account Account = AccountModel.getVwAccountByID(UserID);
                Account.Password = string.Empty;

                if (Account.CoverSN == 0)
                {
                    accountCoverPath = "../Content/img/icon/questionMark.png";
                }
                else
                {
                    accountCoverPath = Account.PicPath + "/Scaling/" + @Account.PicName;
                }

                ViewBag.accountCoverPath = accountCoverPath;
                ViewBag.Account          = Account;
                #endregion

                #region 首頁資料設定
                int SN = AccountModel.getAccountByID(UserID).SN;
                if (UserIndexSettingMode.getUserIndexSettingBySN(SN) == null)
                {
                    Rio_UserIndexSetting userSetting = new Rio_UserIndexSetting();
                    userSetting.AccountSN = SN;
                    userSetting.Title     = UserID;
                    userSetting.SubTitle  = "Index";
                    userSetting.CoverSN   = 0;

                    UserIndexSettingMode.Insert(userSetting);
                }
                Vw_UserIndexSetting indexSetting = UserIndexSettingMode.getVwUserIndexSettingBySN(SN);

                if (indexSetting.CoverSN == 0)
                {
                    indexCoverPath = "../Content/img/Froncover/indexcover.png";
                }
                else
                {
                    indexCoverPath = indexSetting.CoverPicPath + "/" + indexSetting.CoverName;
                }

                ViewBag.indexCoverPath = indexCoverPath;
                ViewBag.IndexSetting   = indexSetting;
                #endregion
                return(View());
            }

            return(RedirectToAction("Login"));
        }
Пример #2
0
        public ActionResult RioAccountRegister(string ID, string Password, string Name, string AccountContent)
        {
            #region Google reCAPTCHA驗證
            var    response  = Request["g-recaptcha-response"];
            string secretKey = "6LdrUTgUAAAAAC-zzRKYaXa4KjCJSon9K6K9gaJr";
            var    client    = new WebClient();
            var    result    = client.DownloadString(string.Format("https://www.google.com/recaptcha/api/siteverify?secret={0}&response={1}", secretKey, response));
            var    obj       = JObject.Parse(result);
            var    status    = (bool)obj.SelectToken("success");
            #endregion

            if (status == true)
            {
                Vw_Account Account = AccountModel.getVwAccountByID(ID);
                if (Account == null)
                {
                    if (!ID.Equals(string.Empty) && !Password.Equals(string.Empty) && !Name.Equals(string.Empty))
                    {
                        Rio_Account rio_Account = new Rio_Account();
                        string      createID    = "UserRegister";
                        DateTime    dt          = DateTime.Now;

                        rio_Account.ID             = ID;
                        rio_Account.Name           = Name;
                        rio_Account.Password       = App_Code.Coding.stringToSHA512(Password);
                        rio_Account.AccountContent = AccountContent;
                        rio_Account.Email          = string.Empty;
                        rio_Account.PicSN          = 0;

                        rio_Account.CreateID   = createID;
                        rio_Account.CreateName = createID;
                        rio_Account.ModifyID   = createID;
                        rio_Account.ModifyName = createID;
                        rio_Account.CreateDate = dt;
                        rio_Account.ModifyDate = dt;

                        rio_Account.IsEnable = true;
                        rio_Account.IsDelete = false;

                        AccountModel.Insert(rio_Account);

                        HttpContext.Session["UserID"]  = ID;
                        HttpContext.Session["IsLogin"] = "******";
                    }
                }
                else
                {
                    ModelState.AddModelError("ID", "已有相同帳號。");
                }
            }
            return(View());
        }
Пример #3
0
        // GET: Rio_Account/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            int SN = 0;

            int.TryParse(id.ToString(), out SN);
            Vw_Account rio_Account = AccountModel.getVwAccount(SN);

            if (rio_Account == null)
            {
                return(HttpNotFound());
            }
            return(View(rio_Account));
        }
Пример #4
0
        public ActionResult Index()
        {
            int    SN     = 0;
            string userID = string.Empty;

            if (Request.QueryString.Get("vid") != null)
            {
                userID = Request.QueryString.Get("vid").ToString();
            }
            Vw_Account rioAccount = AccountModel.getVwAccountByID(userID);

            if (rioAccount != null)
            {
                int.TryParse(rioAccount.SN.ToString(), out SN);

                //使用者設定
                ViewBag.userSetting       = UserIndexSettingMode.getVwUserIndexSettingBySN(SN);
                ViewBag.indexAccountCover = rioAccount.PicPath + rioAccount.PicName;

                //系統相簿、圖片、文件總數
                ViewBag.albumCount = AlbumModel.getUsertVwAlbumEnableListByID(userID).Where(o => o.IsEnable == true).Count();
                ViewBag.picCount   = PicModel.getUserPicEnableByID(userID).Count();
                ViewBag.docCount   = DocModel.getUserDocEnableListByID(userID).Count();

                //系統預覽
                ViewBag.preViewAlbum = AlbumModel.getPreViewAlbumListByID(userID);
                ViewBag.preViewPic   = PicModel.getPreViewPicListByID(userID);
                ViewBag.preViewDoc   = DocModel.getPreviewDocListByID(userID);

                if (Session["UserSN"] != null)
                {
                    int userSN = 0;
                    int.TryParse(Session["UserSN"].ToString(), out userSN);

                    //是否Track
                    ViewBag.userTrack = UserTrackModel.getUserTrackBySN(userSN, SN);

                    //未閱讀通知數量
                    Session["notReadNoticeCount"] = NoticeModel.getNotReadNoticeCountByTrackSN(userSN);
                }
            }
            return(View());
        }
Пример #5
0
        public ActionResult fbLogin(string id, string name, string email)
        {
            if (email != null)
            {
                Vw_Account account = AccountModel.getVwAccountByFBEmail(email);
                if (account == null)
                {
                    Rio_Account rio_Account = saveFBAccount(email, name);                       //註冊新帳號
                    int         accountSN   = AccountModel.getVwAccountByID(rio_Account.ID).SN; // get帳號SN
                    saveFacebookAccount(accountSN, email, id, name);                            //加入FB使用者資訊(id, name, email)
                    Session["UserSN"] = accountSN;
                    Session["UserID"] = rio_Account.ID;
                }
                else
                {
                    Session["UserSN"] = account.SN;
                    Session["UserID"] = account.ID;
                }
            }

            return(RedirectToAction("Login"));
        }