Example #1
0
        public ActionResult Edit(Projects_ParentProject projects_parentproject)
        {
            if (Authorized(RoleType.SystemManager))
            {
                Projects_ParentProject projectFromDB;
                using (ParentProjectsRepository projectsRep = new ParentProjectsRepository())
                {
                    projectFromDB = projectsRep.GetEntity(projects_parentproject.Id);

                    if (projectFromDB != null)
                    {
                        if (projectFromDB.CompanyId == CurrentUser.CompanyId)
                        {
                            projectFromDB.Name = projects_parentproject.Name;

                            projectsRep.Update(projectFromDB);

                            return(RedirectToAction("Index"));
                        }
                        else
                        {
                            return(Error(Loc.Dic.error_no_permission));
                        }
                    }
                    else
                    {
                        return(Error(Loc.Dic.error_projects_get_error));
                    }
                }
            }
            else
            {
                return(Error(Loc.Dic.error_no_permission));
            }
        }
Example #2
0
        public ActionResult DeleteConfirmed(int id)
        {
            if (Authorized(RoleType.SystemManager))
            {
                Projects_ParentProject project;

                using (OrdersRepository orderssRep = new OrdersRepository(CurrentUser.CompanyId))
                    using (ParentProjectsRepository projectsRep = new ParentProjectsRepository())
                    {
                        project = projectsRep.GetEntity(id);

                        if (project != null)
                        {
                            if (project.CompanyId == CurrentUser.CompanyId)
                            {
                                project.IsActive = false;
                                Projects_ParentProject update = projectsRep.Update(project);

                                if (update != null)
                                {
                                    return(RedirectToAction("Index"));
                                }
                                else
                                {
                                    return(Error(Loc.Dic.error_projects_get_error));
                                }
                            }
                            else
                            {
                                return(Error(Loc.Dic.error_no_permission));
                            }
                        }
                        else
                        {
                            return(Error(Loc.Dic.error_projects_get_error));
                        }
                    }
            }
            else
            {
                return(Error(Loc.Dic.error_no_permission));
            }
        }
Example #3
0
        public ActionResult Edit(Projects_ParentProject projects_parentproject)
        {
            if (Authorized(RoleType.SystemManager))
            {
                Projects_ParentProject projectFromDB;
                using (ParentProjectsRepository projectsRep = new ParentProjectsRepository())
                {
                    projectFromDB = projectsRep.GetEntity(projects_parentproject.Id);

                    if (projectFromDB != null)
                    {
                        if (projectFromDB.CompanyId == CurrentUser.CompanyId)
                        {
                            projectFromDB.Name = projects_parentproject.Name;

                            projectsRep.Update(projectFromDB);

                            return RedirectToAction("Index");
                        }
                        else
                        {
                            return Error(Loc.Dic.error_no_permission);
                        }
                    }
                    else
                    {
                        return Error(Loc.Dic.error_projects_get_error);
                    }
                }
            }
            else
            {
                return Error(Loc.Dic.error_no_permission);
            }
        }
Example #4
0
        public ActionResult DeleteConfirmed(int id)
        {
            if (Authorized(RoleType.SystemManager))
            {
                Projects_ParentProject project;

                using (OrdersRepository orderssRep = new OrdersRepository(CurrentUser.CompanyId))
                using (ParentProjectsRepository projectsRep = new ParentProjectsRepository())
                {
                    project = projectsRep.GetEntity(id);

                    if (project != null)
                    {
                        if (project.CompanyId == CurrentUser.CompanyId)
                        {
                            project.IsActive = false;
                            Projects_ParentProject update = projectsRep.Update(project);

                            if (update != null)
                                return RedirectToAction("Index");
                            else
                                return Error(Loc.Dic.error_projects_get_error);
                        }
                        else
                        {
                            return Error(Loc.Dic.error_no_permission);
                        }
                    }
                    else
                    {
                        return Error(Loc.Dic.error_projects_get_error);
                    }
                }
            }
            else
            {
                return Error(Loc.Dic.error_no_permission);
            }
        }