コード例 #1
0
 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));
     }
 }
コード例 #2
0
        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));
        }
コード例 #3
0
        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));
        }
コード例 #4
0
 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));
 }
コード例 #5
0
        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));
        }
コード例 #6
0
        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));
        }
コード例 #7
0
 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));
 }
コード例 #8
0
 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));
 }
コード例 #9
0
        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));
        }
コード例 #10
0
 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));
 }
コード例 #11
0
 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));
     }
 }
コード例 #12
0
 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;
 }
コード例 #13
0
        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 }));
            }
        }
コード例 #14
0
        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 }));
        }
コード例 #15
0
 public void SetCurrent()
 {
     try
     {
         SprintsLogic.SetCurrent();
     }
     catch (Exception e)
     {
         LogsLogic.InsertLog(new Log()
         {
             Message    = e.Message,
             StackTrace = e.StackTrace,
             StoryName  = "ManagementProject/Sprints/SetCurrent"
         });
     }
 }
コード例 #16
0
        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());
        }
コード例 #17
0
 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"));
 }
コード例 #18
0
 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"));
 }
コード例 #19
0
 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)));///////////////////
 }
コード例 #20
0
 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 }));
 }
コード例 #21
0
 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"));
 }
コード例 #22
0
 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"));
 }
コード例 #23
0
 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"));
 }
コード例 #24
0
 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 }));
 }
コード例 #25
0
 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 }));
 }
コード例 #26
0
 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"));
 }
コード例 #27
0
 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"));
 }
コード例 #28
0
        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));
        }
コード例 #29
0
        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));
        }
コード例 #30
0
 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 }));
 }