public ActionResult AvatarDialog()
        {
            var model = new ProfileManagementModels.AvatarSectionViewModel();

            model.AvatarSource = userBLL.AvatarInfoForWizardBLL(UserLoginData.GetSessionID(Session["UserLoggedIn"]));
            return(PartialView("_AvatarDialog", model));
        }
        public IEnumerable <FolderListModelView> FillFoldersThumbnail()
        {
            try
            {
                List <FolderListModelView> model = new List <FolderListModelView>();
                var folders = folderBLL.GetAllFoldersBLL(UserLoginData.GetSessionID(Session["UserLoggedIn"]));

                foreach (var folder in folders)
                {
                    model.Add(
                        new FolderListModelView()
                    {
                        FolderID     = folder.FolderID,
                        Name         = folder.Name,
                        Details      = folder.Details,
                        LastModified = folder.LastModified
                    });
                }

                return(model);
            }
            catch
            {
                throw;
            }
        }
예제 #3
0
        public ActionResult Create(CreateNoteModelView model)
        {
            try
            {
                int userID = UserLoginData.GetSessionID(Session["UserLoggedIn"]);

                if (!ModelState.IsValid)
                {
                    this.PrepareModelToCreateNote(userID, ref model);
                    return(View(model));
                }

                int folderAuxID = 0;
                noteBLL.CreateNoteBLL(
                    userID,
                    model.Title,
                    model.Details,
                    model.ExpirationDate,
                    model.Starred,
                    model.FolderSelected,
                    model.HourSelected,
                    model.MinuteSelected,
                    model.TimeTableSelected,
                    ref folderAuxID
                    );

                return(RedirectToAction("NotesList", "Folder", new { folderID = folderAuxID }));
            }
            catch (Exception ex)
            {
                TempData["error"] = ex.Message;
                this.PrepareModelToCreateNote(UserLoginData.GetSessionID(Session["UserLoggedIn"]), ref model);
                return(View(model));
            }
        }
        public ActionResult PersonalMessageDialog()
        {
            int userID       = UserLoginData.GetSessionID(Session["UserLoggedIn"]);
            var model        = new ProfileManagementModels.PersonalPhraseViewModel();
            var dataForModel = userBLL.PhraseInfoForWizardDAL(userID);

            model.PersonalPhrase = dataForModel[0];
            model.PhraseColor    = dataForModel[1];
            return(PartialView("_PersonalMessageDialog", model));
        }
 public ActionResult Remove(int folderID)
 {
     try
     {
         folderBLL.RemoveFolderBLL(UserLoginData.GetSessionID(Session["UserLoggedIn"]), folderID);
         return(Json(new { Path = "/Folder/List" }, JsonRequestBehavior.DenyGet));
     }
     catch (Exception ex)
     {
         return(this.ManageException(ex, null, null, true));
     }
 }
 public ActionResult ProfileManagement()
 {
     try
     {
         int userID = UserLoginData.GetSessionID(Session["UserLoggedIn"]);
         return(View(new ProfileManagementModels(userBLL.GetUserInformation(userID))));
     }
     catch (Exception ex)
     {
         return(this.ManageException(ex, "Index", "Home"));
     }
 }
 public ActionResult UploadAvatar(HttpPostedFileBase UploadAvatar)
 {
     try
     {
         int userID = UserLoginData.GetSessionID(Session["UserLoggedIn"]);
         userBLL.ChangeAvatar(UploadAvatar, userID);
         return(RedirectToAction("ProfileManagement"));
     }
     catch (Exception ex)
     {
         return(this.ManageException(ex, "ProfileManagement"));
     }
 }
예제 #8
0
 public ActionResult List()
 {
     try
     {
         int userID = UserLoginData.GetSessionID(Session["UserLoggedIn"]);
         return(View(new ClassifiedQueryableNotes(noteBLL.GetDataForNoteList(userID))));
     }
     catch (Exception ex)
     {
         TempData["error"] = ex.Message;
         return(Redirect(Request.UrlReferrer.AbsolutePath));
     }
 }
        public string WizardComplete(WizardModel model)
        {
            if (model.personalMessage.phrase.Length > 140)
            {
                Response.StatusCode = (int)System.Net.HttpStatusCode.Conflict;
                return("El mensaje personal superó los 140 caracteres.");
            }

            int userID = UserLoginData.GetSessionID(Session["UserLoggedIn"]);

            userBLL.UpdateAvatar(model.avatarImg, userID);
            userBLL.ChangePersonalPhrase(userID, model.personalMessage.phrase, model.personalMessage.color);

            return("Cambios guardados.");
        }
 public ActionResult NotesList(int folderID)
 {
     try
     {
         int userID = UserLoginData.GetSessionID(Session["UserLoggedIn"]);
         ContentInFolderModelView model = new ContentInFolderModelView(folderBLL.GetFolderDataBLL(folderID),
                                                                       folderBLL.GetNotesInFolderBLL(userID, folderID));
         return(View(model));
     }
     catch (Exception ex)
     {
         TempData["error"] = ex.Message;
         return(RedirectToAction("List"));
     }
 }
 public ActionResult ChangeFolderPartial(int folderID, string folderName, int noteID)
 {
     try
     {
         ChangeFolderModelView model = new ChangeFolderModelView();
         model.FolderID        = folderID;
         model.NoteID          = noteID;
         model.CurrentFolder   = folderName;
         model.FoldersComboBox = folderBLL.GetFoldersOfUserBLL(UserLoginData.GetSessionID(Session["UserLoggedIn"]));
         return(PartialView("_ChangeFolder", model));
     }
     catch (Exception ex)
     {
         return(RedirectToAction("InternalServerError", "Error", new { error = ex.Message }));
     }
 }
예제 #12
0
 public ActionResult Create(string toFolder)
 {
     try
     {
         int userID = UserLoginData.GetSessionID(Session["UserLoggedIn"]);
         CreateNoteModelView model = new CreateNoteModelView();
         this.PrepareModelToCreateNote(userID, ref model, Server.UrlDecode(toFolder));
         return(View(model));
     }
     catch (Exception ex)
     {
         return(RedirectToAction("InternalServerError", "Error", new {
             error = ex.InnerException is SqlException ? ex.InnerException.Message : ex.Message
         }));
     }
 }
        public ActionResult Edit(EditFolderModelView model)
        {
            if (!ModelState.IsValid)
            {
                return(PartialView("_EditFolder", model));
            }

            try
            {
                folderBLL.EditFolderBLL(UserLoginData.GetSessionID(Session["UserLoggedIn"]), model.FolderID, model.Name, model.Details);
                return(Redirect(Request.UrlReferrer.AbsolutePath));
            }
            catch (Exception ex)
            {
                TempData["error"] = ex.Message;
                return(Redirect(Request.UrlReferrer.AbsolutePath));
            }
        }
        public ActionResult ChangePassword(ProfileManagementModels.ChangePasswordSectionViewModel model)
        {
            try
            {
                int userID = UserLoginData.GetSessionID(Session["UserLoggedIn"]);
                if (ModelState.IsValid)
                {
                    userBLL.ChangePassword(userID, model.CurrentPassword, model.NewPassword);
                    return(RedirectToAction("ProfileManagement"));
                }

                return(View("ProfileManagement", new ProfileManagementModels(userBLL.GetUserInformation(userID), model)));
            }
            catch (Exception ex)
            {
                return(this.ManageException(ex, "ProfileManagement"));
            }
        }
        public ActionResult PersonalPhrase(ProfileManagementModels.PersonalPhraseViewModel model, string pColor)
        {
            try
            {
                int userID = UserLoginData.GetSessionID(Session["UserLoggedIn"]);
                if (ModelState.IsValid)
                {
                    userBLL.ChangePersonalPhrase(userID, model.PersonalPhrase, pColor);
                    return(RedirectToAction("ProfileManagement"));
                }

                return(View("ProfileManagement", new ProfileManagementModels(userBLL.GetUserInformation(userID), model)));
            }
            catch (Exception ex)
            {
                return(this.ManageException(ex, "ProfileManagement"));
            }
        }
        public string StoreTempAvatar()
        {
            try
            {
                if (System.Web.HttpContext.Current.Request.Files.AllKeys.Any())
                {
                    int userID = UserLoginData.GetSessionID(Session["UserLoggedIn"]);
                    var pic    = System.Web.HttpContext.Current.Request.Files["TempFile"];
                    return(userBLL.TemporaryAvatarBLL(pic, Server, userID));
                }
            }
            catch (Exception ex)
            {
                Response.StatusCode = (int)System.Net.HttpStatusCode.Conflict;
                return(ex.Message);
            }

            return(null);
        }
        public ActionResult Create(CreateFolderModelView model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    int userID = UserLoginData.GetSessionID(Session["UserLoggedIn"]);
                    folderBLL.CreateFolderBLL(userID, model.Name, model.Details);
                    return(Redirect(Request.UrlReferrer.AbsolutePath));
                }

                return(PartialView("_CreateFolder", model));
            }
            catch (Exception ex)
            {
                TempData["error"] = ex.Message;
                return(Redirect(Request.UrlReferrer.AbsolutePath));
            }
        }
예제 #18
0
        public ActionResult StarTask(int folderID, int noteID, bool inFolder)
        {
            try
            {
                noteBLL.StarTaskBLL(noteID);
                int userID = UserLoginData.GetSessionID(Session["UserLoggedIn"]);

                if (inFolder)
                {
                    return(PartialView("~/Views/Folder/_NotesInFolder.cshtml", new ClassifiedNotes(new FolderBLL().GetNotesInFolderBLL(userID, folderID))));
                }

                return(PartialView("_ListOfNotes", new ClassifiedQueryableNotes(noteBLL.GetDataForNoteList(userID))));
            }
            catch (Exception ex)
            {
                return(RedirectToAction("InternalServerError", "Error", new { error = ex.Message }));
            }
        }
예제 #19
0
 public ActionResult SetDatetimeEvent(ChangeDatetimeEventModel model)
 {
     try
     {
         int userID = UserLoginData.GetSessionID(Session["UserLoggedIn"]);
         noteBLL.ChangeDatetimeEventBLL(model.CurrentDate, model.HourSelected, model.MinuteSelected, model.TimeTableSelected, model.ID_Note, userID);
         if (model.InFolder)
         {
             return(PartialView("~/Views/Folder/_NotesInFolder.cshtml", new ClassifiedNotes(new FolderBLL().GetNotesInFolderBLL(userID, model.ID_Folder))));
         }
         else
         {
             return(PartialView("_ListOfNotes", new ClassifiedQueryableNotes(noteBLL.GetDataForNoteList(userID))));
         }
     }
     catch (Exception ex)
     {
         return(RedirectToAction("InternalServerError", "Error", new { error = ex.Message }));
     }
 }
예제 #20
0
        public ActionResult CheckExpiredEventsPartial(FireAlarmModel model)
        {
            try
            {
                if (model.EncryptedCookie == null)
                {
                    model.EncryptedCookie = new UserBLL().GetEncryptedUserID(UserLoginData.GetSessionID(Session["UserLoggedIn"]));
                }

                var expiredList = noteBLL.CheckExpiredEventsBLL(model.EncryptedCookie);

                if (expiredList.Count() >= 1)
                {
                    return(Json(new { list = true, render = RenderViewToString("_FireAlarmDialog", expiredList) }));
                }

                return(Json(new { list = false }));
            }
            catch (Exception ex)
            {
                return(RedirectToAction("InternalServerError", "Error", new { error = ex.Message }));
            }
        }
        public ActionResult ChangeFolder(ChangeFolderModelView model)
        {
            try
            {
                int userID = UserLoginData.GetSessionID(Session["UserLoggedIn"]);
                folderBLL.ChangeFolderBLL(model.NoteID, userID, model.FolderSelected);
                string controller = (Request.UrlReferrer.AbsolutePath.Split('/'))[2];

                switch (controller)
                {
                case "Folder":
                    return(PartialView("_NotesInFolder", new ClassifiedNotes(folderBLL.GetNotesInFolderBLL(userID, model.FolderID))));

                case "Note":
                    return(PartialView("~/Views/Note/_ListOfNotes.cshtml", new Models.NoteModels.ClassifiedQueryableNotes(new NoteBLL().GetDataForNoteList(userID))));

                default: throw new HttpException("Error desconocido. Vuelva a intentarlo.");
                }
            }
            catch (Exception ex)
            {
                return(RedirectToAction("InternalServerError", "Error", new { error = ex.Message }));
            }
        }
        public ActionResult ProfileWizard()
        {
            int userID = UserLoginData.GetSessionID(Session["UserLoggedIn"]);

            return(View(new ProfileManagementModels(userBLL.GetUserInformation(userID))));
        }