public ActionResult Create(Suggestion suggestion) { try { suggestion.SuggestByUserId = SessionData.UserId; SuggestionsLogic.InsertNewSuggestion(suggestion); if (SessionData.UserRole == UserRoles.Employee) { return(PartialView("JavascriptRedirect", new JavascriptRedirectModel("/Employees/Index"))); } else { return(PartialView("JavascriptRedirect", new JavascriptRedirectModel("/Suggestions/Index"))); } } catch (Exception e) { LogsLogic.InsertLog(new Log() { Message = e.Message, StackTrace = e.StackTrace, StoryName = "ManagementProject/Suggestions/Create(Post)", Parameters = new JavaScriptSerializer().Serialize(suggestion) }); return(PartialView("CreatePartial", suggestion)); } }
public ActionResult Edit(Client client) { if (ModelState.IsValid) { try { if (Session["PublicImageUrl"] != null) { client.ImgUrl = Session["PublicImageUrl"].ToString(); } ClientsLogic.UpdateClient(client); Session["PublicImageUrl"] = ""; return(RedirectToAction("Index")); } catch (Exception e) { LogsLogic.InsertLog(new Log() { Message = e.Message, StackTrace = e.StackTrace, StoryName = "MoreHolidays/Clients/Edit(Post)", }); Session["PublicImageUrl"] = ""; return(View(client)); } } return(View(client)); }
public ActionResult GeneralError(string errorMessage = null, string parameter = null) { string path = ""; if (errorMessage != null) { if (Request.UrlReferrer != null) { path = Request.UrlReferrer.AbsolutePath; } } ReloadURLModel Model = new ReloadURLModel { URL = path, Message = errorMessage }; if (errorMessage == null) { errorMessage = "An Error Occured"; } LogsLogic.InsertLog(new Log() { Message = errorMessage, StoryName = path, Parameters = parameter }); return(View(Model)); }
public ActionResult Create(Item model) { if (ModelState.IsValid) { try { model.CreateDate = DateTimeHelper.Today(); Item item = ItemsLogic.InsertNewItem(model); ItemsLogic.InsertSprintItem(new SprintItem { ItemId = item.Id, SprintId = StoriesFilterSession.sprintId }); return(PartialView("JavascriptRedirect", new JavascriptRedirectModel("/Items/StoryItems?storyId=" + model.StoryId))); } catch (Exception e) { LogsLogic.InsertLog(new Log() { Message = e.Message, StackTrace = e.StackTrace, StoryName = "ManagementProject/Items/Create(Post)", Parameters = new JavaScriptSerializer().Serialize(model) }); return(PartialView(model)); } } return(PartialView(model)); }
public ActionResult Edit(int id) { Item model = new Item(); try { model = ItemsLogic.GetItemById(id); model.Succeeded = true; } catch (Exception e) { model = new Item { Succeeded = false, ErrorMessage = e.Message, }; LogsLogic.InsertLog(new Log() { Message = e.Message, StackTrace = e.StackTrace, StoryName = "ManagementProject/Items/Edit(Get)", Parameters = "id=" + id }); } return(PartialView("Edit", model)); }
public ActionResult CreateWorkFromHome(int userId = 0) { WorkFromHomeModel model = new WorkFromHomeModel(); try { if (userId == 0) { userId = SessionData.UserId; } bool isAdmin = SessionData.UserRole == UserRoles.Admin ? true : false; model = WorkFromHomeLogic.CreateWorkFomHomeModel(isAdmin, userId); if (!model.Succeeded) { ModelState.AddModelError("ErrorMessage", model.ErrorMessage); } } catch (Exception e) { LogsLogic.InsertLog(new Log() { Message = e.Message, StackTrace = e.StackTrace, StoryName = "ManagementProject/EmployeeVacations/WorkFromHomeRequest(Get)", }); } return(PartialView(model)); }
public ActionResult Create(Project project) { if (ModelState.IsValid) { try { project.CreatorId = SessionData.UserId; project.CreateDate = DateTimeHelper.Today(); project.UpdateDate = DateTimeHelper.Today(); ProjectsLogic.InsertNewProject(project); return(RedirectToAction("Index", "Home")); } catch (Exception e) { LogsLogic.InsertLog(new Log() { Message = e.Message, StackTrace = e.StackTrace, StoryName = "ManagementProject/Projects/Create(Post)", Parameters = new JavaScriptSerializer().Serialize(project) }); return(View(project)); } } return(View(project)); }
public ActionResult CreateWorkFromHome(WorkFromHomeModel model) { try { if (!model.Succeeded) { ModelState.AddModelError("ErrorMessage", model.ErrorMessage); return(PartialView(model)); } model = WorkFromHomeLogic.CheckWrokFromHomeRequestModel(model); if (model.Succeeded) { WorkFromHomeLogic.InsertNewWrokFromHomeRequest(model); string url = Roles.IsUserInRole("Admin") ? "/Users/DeveloperIndex" : "/Employees/Index"; return(PartialView("JavascriptRedirect", new JavascriptRedirectModel(url))); } } catch (Exception e) { LogsLogic.InsertLog(new Log() { Message = e.Message, StackTrace = e.StackTrace, StoryName = "ManagementProject/EmployeeVacations/WorkFromHomeRequest(Post)", }); } return(PartialView(model)); }
public ActionResult EmployeeWorkFromHomeDaysList(int?pageNumber, int statusId, int?employeeUserId) { var page = pageNumber ?? 0; List <RequestFromHomeDayDetails> model = new List <RequestFromHomeDayDetails>(); try { if (Roles.IsUserInRole("Admin")) { model = WorkFromHomeLogic.GetEmployeeWorkFromHomeDaysList(page, statusId); } else { model = WorkFromHomeLogic.GetEmployeeWorkFromHomeDaysList(page, statusId, SessionData.UserId); } } catch (Exception e) { LogsLogic.InsertLog(new Log() { Message = e.Message, StackTrace = e.StackTrace, StoryName = "ManagementProject/WorkFromHome/EmployeeWorkFromHomeDaysList", Parameters = "pageNumber= " + pageNumber.ToString() + "statusId= " + statusId + " & employeeUserId= " + employeeUserId }); } return(PartialView("EmployeeWorkFromHomeDaysList", model)); }
public ActionResult Edit(OccasionVacation model) { model.ErrorMessage = "Item Not Update Please Try Again!"; if (ModelState.IsValid) { try { bool isUpdate = OccasionVacationsLogic.UpdateOccasionVacation(model); if (isUpdate) { return(RedirectToAction("Index", VacationYearsLogic.GetVacationYear(model.VacationYearId))); } } catch (Exception e) { LogsLogic.InsertLog(new Log() { Message = e.Message, StackTrace = e.StackTrace, StoryName = "ManagmentProject/OccasionVacations/Edit(Post)" }); } } return(View(model)); }
public ActionResult Suggest(CreateSuggestionModel model) { try { if (ModelState.IsValid) { model.Suggestion.SuggestByUserId = SessionData.UserId; SuggestionsLogic.InsertNewSuggestion(model.Suggestion); return(PartialView("JavascriptRedirect", new JavascriptRedirectModel("/Developer/Index"))); } CreateSuggestionModel SuggestionModel = SuggestionsLogic.UpdateProjectsList(model); return(PartialView("SuggestPartial", SuggestionModel)); } catch (Exception e) { LogsLogic.InsertLog(new Log() { Message = e.Message, StackTrace = e.StackTrace, StoryName = "ManagementProject/Suggestions/Suggest(Post)", Parameters = new JavaScriptSerializer().Serialize(model) }); return(PartialView("SuggestPartial", model)); } }
public ClientMenuHandler(LogsLogic logs, Socket clientSocket, Socket notificationSocket, StudentLogic studentLogicHandler, CourseLogic courseLogicHandler, ref List <Utils.StudentSocket> pClients) { Protocol = new Protocol(); ClientSocket = clientSocket; NotificationSocket = notificationSocket; studentLogic = studentLogicHandler; courseLogic = courseLogicHandler; clients = pClients; Logs = logs; }
public ActionResult Index() { try { if (SessionData.UserRole == UserRoles.Employee) { Attendance attendance = AttendancesLogic.GetLastSignByUserId(SessionData.UserId); if (attendance == null) { DateTime serverTime = DateTimeHelper.Today(); if (serverTime.Hour >= 12) { return(RedirectToAction("Index", "Employees")); } else { return(RedirectToAction("UserSign", "Attendances")); } } List <StandUpMeetingDetails> model = StandUpMeetingsLogic.GetTodayStandUpMeeting(SessionData.UserId); if (model.Count == 0) { return(RedirectToAction("Create", "StandUpMeet")); } return(RedirectToAction("Index", "Employees")); } else { HomeIndexModel model = new HomeIndexModel(); model.Projects = ProjectsLogic.GetProjectlist(); List <Sprint> sprints = SprintsLogic.GetAllSprints(); model.PreviousSprint = sprints.FindLast(a => a.PreviousSprint); model.CurrentSprint = sprints.Find(a => a.CurrentSprint); model.FutureSprint = sprints.Find(a => a.FutureSprint); model.CanCreateSprint = !sprints.Any(a => a.FutureSprint); return(View(model)); } } catch (Exception e) { LogsLogic.InsertLog(new Log() { Message = e.Message, StackTrace = e.StackTrace, StoryName = "ManagementProject/Projects/GetProjectlist", }); return(RedirectToAction("GeneralError", "Error", new { ErrorMessage = Error.ServerNotRespond })); } }
public ActionResult Create(StoryCreateModel storyModel, FormCollection collection) { if (ModelState.IsValid) { try { Story model = new Story() { ProjectId = storyModel.ProjectId, Exist = false, sprintId = StoriesFilterSession.sprintId }; if (storyModel.selectedType == 1) { model.Exist = true; model.Name = collection["search"].ToString(); } else { model.Name = collection["NewStory"].ToString(); } model.CreatorId = SessionData.UserId; model.CreateDate = DateTimeHelper.Today(); StoriesDetails newStory = StoriesLogic.InsertNewStory(model); if (newStory != null) { StoriesFilter story = StoriesFilterSession; story.AllStories.Add(newStory); StoriesFilterSession = story; } if (newStory == null && storyModel.selectedType == 2) { // return pop up to set option for create with the same name } } catch (Exception e) { LogsLogic.InsertLog(new Log() { Message = e.Message, StackTrace = e.StackTrace, StoryName = "ManagementProject/Stories/Create(Post)", Parameters = new JavaScriptSerializer().Serialize(storyModel) }); } } return(RedirectToAction("StoriesList", new { projectId = storyModel.ProjectId })); }
public void SetCurrent() { try { SprintsLogic.SetCurrent(); } catch (Exception e) { LogsLogic.InsertLog(new Log() { Message = e.Message, StackTrace = e.StackTrace, StoryName = "ManagementProject/Sprints/SetCurrent" }); } }
public ActionResult Create(DataMapping.Entities.UserProfile User) { if (ModelState.IsValid) { try { if (Session["PublicImageUrl"] != null) { User.ProfilePictureUrl = Session["PublicImageUrl"].ToString(); } else { User.ProfilePictureUrl = null; } WebSecurity.CreateUserAndAccount(User.UserName, User.Password); if (User.RolesId == 1) { DataMapping.Entities.UserProfile userModel = AdminLogic.GetAdminByName(User.UserName); AdminLogic.UpdateAdminById(User, userModel.UserId); } Session["PublicImageUrl"] = ""; return(RedirectToAction("Index", new { roleId = User.RolesId })); // return PartialView("JavascriptRedirect", new JavascriptRedirectModel("/Home/Index")); } catch (Exception e) { LogsLogic.InsertLog(new Log() { Message = e.Message, StackTrace = e.StackTrace, StoryName = "MoreHolidays/Users/Create(Post)" }); Session["PublicImageUrl"] = ""; return(View()); } //Parameters = new JavaScriptSerializer().Serialize(project) } Session["PublicImageUrl"] = ""; return(View()); }
public ActionResult SetSignOutToAll() { try { AttendancesLogic.SignOutToAllUsers(); } catch (Exception e) { LogsLogic.InsertLog(new Log() { Message = e.Message, StackTrace = e.StackTrace, StoryName = "ManagementProject/Attendances/SetSignOutToAll" }); } return(RedirectToAction("Index")); }
public ActionResult Delete(int id) { try { VacationYearsLogic.DeleteVacationYear(id); } catch (Exception e) { LogsLogic.InsertLog(new Log() { Message = e.Message, StackTrace = e.StackTrace, StoryName = "ManagmentProject/VacationTypes/Delete", Parameters = "id=" + id }); } return(RedirectToAction("Current")); }
public ActionResult Delete(int vacationYearId, int occasionVacationId) { try { OccasionVacationsLogic.DeleteOccasionVacation(occasionVacationId); } catch (Exception e) { LogsLogic.InsertLog(new Log() { Message = e.Message, StackTrace = e.StackTrace, StoryName = "ManagmentProject/OccasionVacations/Delete", Parameters = "id=" + vacationYearId }); } return(RedirectToAction("Index", VacationYearsLogic.GetVacationYear(vacationYearId)));/////////////////// }
public ActionResult Delete(int userId, int projectId) { try { UsersProjectLogic.DeleteUserFromProject(userId, projectId); } catch (Exception e) { LogsLogic.InsertLog(new Log() { Message = e.Message, StackTrace = e.StackTrace, StoryName = "ManagementProject/UserProjects/Delete", Parameters = "userId=" + userId + "& projectId=" + projectId }); } return(RedirectToAction("UserProjectsListDetails", new { projectId = projectId })); }
public ActionResult Delete(int id) { try { SolutionsLogic.DeleteSolution(id); } catch (Exception e) { LogsLogic.InsertLog(new Log() { Message = e.Message, StackTrace = e.StackTrace, StoryName = "MoreHolidays/Solutions/Delete", Parameters = "id=" + id }); } return(RedirectToAction("Index")); }
public ActionResult DeleteAllLogsWithStoryName(string storyName) { try { LogsDataLogic.DeleteLogsByStoryName(storyName); } catch (Exception e) { LogsLogic.InsertLog(new Log() { Message = e.Message, StoryName = "MoreHolidays/LogsController/DeleteAllLogsWithStoryName", Parameters = "storyName =" + storyName, StackTrace = e.StackTrace }); } return(RedirectToAction("Index")); }
public ActionResult Delete(int id) { try { LogsDataLogic.DeleteLogB(id); } catch (Exception e) { LogsLogic.InsertLog(new Log() { Message = e.Message, StoryName = "MoreHolidays/LogsController/Delete", Parameters = "id =" + id.ToString(), StackTrace = e.StackTrace }); } return(RedirectToAction("Index")); }
public ActionResult Delete(int id, int RoleId, bool isLocked) { try { AdminLogic.DeleteAdmin(id, isLocked); } catch (Exception e) { LogsLogic.InsertLog(new Log() { Message = e.Message, StackTrace = e.StackTrace, StoryName = "MoreHolidays/Users/Delete", Parameters = "id=" + id }); } return(RedirectToAction("Index", new { roleId = RoleId })); }
public ActionResult Delete(int id) { try { //ItemsLogic.DeleteItem(id); } catch (Exception e) { LogsLogic.InsertLog(new Log() { Message = e.Message, StackTrace = e.StackTrace, StoryName = "ManagmentProject/Items/Delete", Parameters = "id=" + id }); } return(RedirectToAction("StorySprint", "Stories", new { projectId = StoriesFilterSession.projectId })); }
public ActionResult Delete(int id) { try { ProjectsLogic.DeleteProject(id); } catch (Exception e) { LogsLogic.InsertLog(new Log() { Message = e.Message, StackTrace = e.StackTrace, StoryName = "ManagementProject/Projects/Delete", Parameters = "id=" + id }); } return(RedirectToAction("Index", "Home")); }
public ActionResult SetSignOut(int id) { try { AttendancesLogic.UpdateAttendance(id); } catch (Exception e) { LogsLogic.InsertLog(new Log() { Message = e.Message, StackTrace = e.StackTrace, StoryName = "ManagementProject/Attendances/SetSignOut", Parameters = "id= " + id.ToString() }); } return(RedirectToAction("Index")); }
public ActionResult Create(EmployeeUsersDetails model) { if (ModelState.IsValid) { try { DateTime BirthDate = new DateTime(model.year, model.Month, model.day); model.ImgURL = SessionData.ImgUrl; WebSecurity.CreateUserAndAccount(model.UserName, model.PassWord, new { Address = model.Address, Phone1 = model.Phone1, Phone2 = model.Phone2, Email = model.Email, FirstName = model.FirstName, LastName = model.LastName, BirthDate = BirthDate, ProfilePictureUrl = model.ImgURL, Name = model.FirstName + " " + model.LastName, }); EmployeesLogic.InsertNewEmployee(model); if (model.RoleId == 8) { return(RedirectToAction("DeveloperIndex")); } return(RedirectToAction("Index", new { roleId = model.RoleId })); } catch (MembershipCreateUserException e) { LogsLogic.InsertLog(new Log() { Message = e.Message, StackTrace = e.StackTrace, StoryName = "ManagmentProject/Users/Create(Get)", Parameters = new JavaScriptSerializer().Serialize(model) }); ModelState.AddModelError("UserName", ErrorCodeToString(e.StatusCode)); } } return(View(model)); }
public ActionResult OnlineUser() { OnlineUserModel model = new OnlineUserModel(); try { model = EmployeesLogic.GetOnlineUsers(); } catch (Exception e) { LogsLogic.InsertLog(new Log() { Message = e.Message, StackTrace = e.StackTrace, StoryName = "ManagementProject/Employees/OnlineUser" }); } return(View(model)); }
public ActionResult Finish(int id, int statusId, int userId) { try { EmployeeVacationsLogic.ChangeStatus(id, EVacationStatus.Finished); } catch (Exception e) { LogsLogic.InsertLog(new Log() { Message = e.Message, StackTrace = e.StackTrace, StoryName = "ManagementProject/EmployeeVacations/Finish", Parameters = "id=" + id + "& statusId=" + statusId + "& userId=" + userId }); return(RedirectToAction("GeneralError", "Error", new { ErrorMessage = Error.ServerNotRespond })); } return(RedirectToAction("Index", new { statusId = statusId, userId = userId })); }