public ActionResult FromAddProjectScreen()
        {
            //equipmentModelToPassBack = equipmentModel;
            var db   = new CodeFirst.CodeFirst();
            var type = new Models.ProjectType();

            ViewBag.Referrer = "AddProject";
            return(View("Index", type));
        }
예제 #2
0
 public EditViewModel(Models.ProjectType projectType)
 {
     ProjectTypeID          = projectType.ProjectTypeID;
     ProjectTypeName        = projectType.ProjectTypeName;
     ProjectTypeDescription = projectType.ProjectTypeDescriptionHtmlString;
     TaxonomyBranchID       = projectType.TaxonomyBranchID;
     ThemeColor             = projectType.ThemeColor;
     LimitVisibilityToAdmin = projectType.LimitVisibilityToAdmin;
 }
예제 #3
0
 public void UpdateModel(Models.ProjectType projectType, Person currentPerson)
 {
     projectType.ProjectTypeName = ProjectTypeName;
     projectType.ProjectTypeDescriptionHtmlString = ProjectTypeDescription;
     projectType.TaxonomyBranchID = !MultiTenantHelpers.IsTaxonomyLevelLeaf()
         ? TaxonomyBranchID
         : HttpRequestStorage.DatabaseEntities.TaxonomyBranches.First().TaxonomyBranchID; // really should only be one
     ;
     projectType.ThemeColor             = ThemeColor;
     projectType.LimitVisibilityToAdmin = LimitVisibilityToAdmin;
 }
 private ProjectTaxonomyViewData(Models.TaxonomyTrunk taxonomyTrunk, Models.TaxonomyBranch taxonomyBranch, Models.ProjectType projectType, Models.Project project, TaxonomyLevel taxonomyLevel)
 {
     ProjectType      = projectType;
     TaxonomyTrunk    = taxonomyTrunk;
     TaxonomyBranch   = taxonomyBranch;
     Project          = project;
     IsProject        = Project != null;
     IsProjectType    = ProjectType != null && !IsProject;
     IsTaxonomyBranch = TaxonomyBranch != null && !IsProjectType && !IsProject;
     IsTaxonomyTrunk  = TaxonomyTrunk != null && !IsTaxonomyBranch && !IsProjectType && !IsProject;
     TaxonomyLevel    = taxonomyLevel;
 }
예제 #5
0
        public ActionResult Index(Models.ProjectType model)
        {
            CodeFirst.CodeFirst db = new CodeFirst.CodeFirst();
            if (ModelState.IsValid)
            {
                var myType = db.Project_Type.Where(i => i.TypeID == model.TypeID).FirstOrDefault();

                model.TypeID          = myType.TypeID;
                model.TypeName        = myType.TypeName;
                model.TypeDescription = myType.TypeDescription;
            }

            return(View(model));
        }
        // GET: ProjectTypeDetails
        public ActionResult Index(string typeID)
        {
            Models.ProjectType  myModel = new Models.ProjectType();
            CodeFirst.CodeFirst db      = new CodeFirst.CodeFirst();
            if (typeID != null)
            {
                var intTypeID = Int32.Parse(typeID);
                var myType    = db.Project_Type.Where(i => i.TypeID == intTypeID).FirstOrDefault();

                myModel.TypeID          = myType.TypeID;
                myModel.TypeName        = myType.TypeName;
                myModel.TypeDescription = myType.TypeDescription;
            }

            return(View(myModel));
        }
        public ActionResult Create([Bind(Prefix = "")] Models.ProjectType model)
        {
            if (ModelState.IsValid)
            {
                var db = new CodeFirst.CodeFirst();
                if (db.Project_Type.Count() > 0)
                {
                    var item = db.Project_Type.OrderByDescending(a => a.TypeID).FirstOrDefault();

                    db.Project_Type.Add(new CodeFirst.Project_Type
                    {
                        TypeID          = item.TypeID + 1,
                        TypeName        = model.TypeName,
                        TypeDescription = model.TypeDescription
                    });
                }
                else
                {
                    db.Project_Type.Add(new CodeFirst.Project_Type
                    {
                        TypeID          = 1,
                        TypeName        = model.TypeName,
                        TypeDescription = model.TypeDescription
                    });
                }
                db.SaveChanges();

                if (Request.Form["Referrer"] == "AddProject")
                {
                    //TempData["EquipmentModel"] = equipmentModelToPassBack;
                    return(RedirectToAction("Index", "AddProject"));
                }
                else
                {
                    model.JavaScriptToRun = "mySuccess()";
                    TempData["model"]     = model;
                    return(RedirectToAction("Index", "ProjectType"));
                }
            }

            return(View("Index", model));
        }
        public DetailViewData(Person currentPerson,
                              Models.ProjectType projectType,
                              ProjectLocationsMapInitJson projectLocationsMapInitJson,
                              ProjectLocationsMapViewData projectLocationsMapViewData, bool canHaveAssociatedPerformanceMeasures,
                              RelatedPerformanceMeasuresViewData relatedPerformanceMeasuresViewData,
                              List <PerformanceMeasureChartViewData> performanceMeasureChartViewDatas, TaxonomyLevel taxonomyLevel) : base(currentPerson)
        {
            ProjectType = projectType;
            PageTitle   = projectType.DisplayName;
            var fieldDefinitionProjectType = Models.FieldDefinition.ProjectType;
            var projectTypeDisplayName     = fieldDefinitionProjectType.GetFieldDefinitionLabel();

            EntityName = projectTypeDisplayName;

            ProjectLocationsMapInitJson = projectLocationsMapInitJson;
            ProjectLocationsMapViewData = projectLocationsMapViewData;
            ProjectMapFilteredUrl       = ProjectLocationsMapInitJson.ProjectMapCustomization.GetCustomizedUrl();

            UserHasProjectTypeManagePermissions = new ProjectTypeManageFeature().HasPermissionByPerson(CurrentPerson);
            EditProjectTypeUrl = SitkaRoute <ProjectTypeController> .BuildUrlFromExpression(c => c.Edit(projectType));

            IndexUrl = SitkaRoute <ProgramInfoController> .BuildUrlFromExpression(x => x.Taxonomy());

            BasicProjectInfoGridName = "projectTypeProjectListGrid";
            BasicProjectInfoGridSpec = new BasicProjectInfoGridSpec(CurrentPerson, true)
            {
                ObjectNameSingular  = $"{Models.FieldDefinition.Project.GetFieldDefinitionLabel()} with this {projectTypeDisplayName}",
                ObjectNamePlural    = $"{Models.FieldDefinition.Project.GetFieldDefinitionLabelPluralized()} with this {projectTypeDisplayName}",
                SaveFiltersInCookie = true
            };

            BasicProjectInfoGridDataUrl = SitkaRoute <ProjectTypeController> .BuildUrlFromExpression(tc => tc.ProjectsGridJsonData(projectType));

            ProjectTaxonomyViewData = new ProjectTaxonomyViewData(projectType, taxonomyLevel);

            ProjectTypeDisplayName           = projectTypeDisplayName;
            ProjectTypeDisplayNamePluralized = fieldDefinitionProjectType.GetFieldDefinitionLabelPluralized();

            CanHaveAssociatedPerformanceMeasures = canHaveAssociatedPerformanceMeasures;
            PerformanceMeasureChartViewDatas     = performanceMeasureChartViewDatas;
            RelatedPerformanceMeasuresViewData   = relatedPerformanceMeasuresViewData;
        }
예제 #9
0
        public ActionResult Update([Bind(Prefix = "")] Models.ProjectType model)
        {
            if (ModelState.IsValid)
            {
                var db   = new CodeFirst.CodeFirst();
                var type = db.Project_Type.Where(v => v.TypeID == model.TypeID).SingleOrDefault();

                if (type != null)
                {
                    type.TypeID          = model.TypeID;
                    type.TypeName        = model.TypeName;
                    type.TypeDescription = model.TypeDescription;
                    db.SaveChanges();
                }

                TempData["js"] = "myUpdateSuccess()";
                return(RedirectToAction("Index", "ProjectType"));
            }

            return(View("Index", model));
        }
 public ProjectTaxonomyViewData(Models.ProjectType projectType, TaxonomyLevel taxonomyLevel) : this(projectType.TaxonomyBranch.TaxonomyTrunk, projectType.TaxonomyBranch, projectType, null, taxonomyLevel)
 {
 }