private PartialViewResult ViewDeleteRelationshipType(OrganizationRelationshipType organizationRelationshipType, ConfirmDialogFormViewModel viewModel)
        {
            var canDelete      = organizationRelationshipType.CanDelete();
            var confirmMessage = canDelete
                ? $"Are you sure you want to delete this {FieldDefinitionEnum.ProjectOrganizationRelationshipType.ToType().GetFieldDefinitionLabel()} '{organizationRelationshipType.OrganizationRelationshipTypeName}'?"
                : ConfirmDialogFormViewData.GetStandardCannotDeleteMessage(FieldDefinitionEnum.ProjectOrganizationRelationshipType.ToType().GetFieldDefinitionLabel(), SitkaRoute <OrganizationTypeAndOrganizationRelationshipTypeController> .BuildLinkFromExpression(x => x.Index(), "here"));

            var viewData = new ConfirmDialogFormViewData(confirmMessage, canDelete);

            return(RazorPartialView <ConfirmDialogForm, ConfirmDialogFormViewData, ConfirmDialogFormViewModel>(viewData, viewModel));
        }
Beispiel #2
0
 public EditOrganizationRelationshipTypeViewModel(OrganizationRelationshipType organizationRelationshipType)
 {
     RelationshipTypeID = organizationRelationshipType.OrganizationRelationshipTypeID;
     OrganizationRelationshipTypeName = organizationRelationshipType.OrganizationRelationshipTypeName;
     OrganizationTypeIDs = organizationRelationshipType.OrganizationTypeOrganizationRelationshipTypes
                           .Select(x => x.OrganizationTypeID)
                           .ToList();
     CanStewardProjects = organizationRelationshipType.CanStewardProjects;
     IsPrimaryContact   = organizationRelationshipType.IsPrimaryContact;
     IsOrganizationRelationshipTypeRequired  = organizationRelationshipType.IsOrganizationRelationshipTypeRequired;
     OrganizationRelationshipTypeDescription = organizationRelationshipType.OrganizationRelationshipTypeDescription;
     ShowOnFactSheet = organizationRelationshipType.ShowOnFactSheet;
 }
Beispiel #3
0
        public void UpdateModel(OrganizationRelationshipType organizationRelationshipType, ICollection <OrganizationTypeOrganizationRelationshipType> allOrganizationTypeOrganizationRelationshipTypes)
        {
            organizationRelationshipType.OrganizationRelationshipTypeName = OrganizationRelationshipTypeName;

            var organizationTypesUpdated = OrganizationTypeIDs.Select(x => new OrganizationTypeOrganizationRelationshipType(x, organizationRelationshipType.OrganizationRelationshipTypeID)).ToList();

            organizationRelationshipType.OrganizationTypeOrganizationRelationshipTypes.Merge(organizationTypesUpdated,
                                                                                             allOrganizationTypeOrganizationRelationshipTypes,
                                                                                             (x, y) => x.OrganizationTypeID == y.OrganizationTypeID && x.OrganizationRelationshipTypeID == y.OrganizationRelationshipTypeID, HttpRequestStorage.DatabaseEntities);

            organizationRelationshipType.CanStewardProjects = CanStewardProjects ?? false;                                                                                                                                               // Should never be null due to required validation attribute
            organizationRelationshipType.IsPrimaryContact   = IsPrimaryContact ?? false;                                                                                                                                                 // Should never be null due to required validation attribute
            organizationRelationshipType.IsOrganizationRelationshipTypeRequired = organizationRelationshipType.CanStewardProjects || organizationRelationshipType.IsPrimaryContact || (IsOrganizationRelationshipTypeRequired ?? false); // can steward projects and isprimarycontact can only related once to a project
            organizationRelationshipType.ShowOnFactSheet = ShowOnFactSheet ?? false;                                                                                                                                                     // sShould never be null due to required validation attribute
            organizationRelationshipType.OrganizationRelationshipTypeDescription = OrganizationRelationshipTypeDescription;
        }
        public ActionResult NewOrganizationRelationshipType(EditOrganizationRelationshipTypeViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                return(ViewNewOrganizationRelationshipType(viewModel));
            }
            var relationshipType = new OrganizationRelationshipType(viewModel.OrganizationRelationshipTypeName, false, false, false, false, false);

            HttpRequestStorage.DatabaseEntities.AllOrganizationRelationshipTypes.Add(relationshipType);
            HttpRequestStorage.DatabaseEntities.SaveChanges();

            HttpRequestStorage.DatabaseEntities.OrganizationTypeOrganizationRelationshipTypes.Load();
            var organizationTypeRelationshipTypes = HttpRequestStorage.DatabaseEntities.AllOrganizationTypeOrganizationRelationshipTypes.Local;

            viewModel.UpdateModel(relationshipType, organizationTypeRelationshipTypes);

            SetMessageForDisplay(
                $"New {FieldDefinitionEnum.ProjectOrganizationRelationshipType.ToType().GetFieldDefinitionLabel()} {relationshipType.OrganizationRelationshipTypeName} successfully created!");
            return(new ModalDialogFormJsonResult());
        }
            public static ProjectOrganization Create(Project project, Organization organization)
            {
                var projectOrganization = ProjectOrganization.CreateNewBlank(project, organization, OrganizationRelationshipType.CreateNewBlank());

                return(projectOrganization);
            }
 public ProjectOrganizationRelationship(Project project, Organization organization, OrganizationRelationshipType organizationRelationshipType, string displayCssClass) : this(project, organization, organizationRelationshipType)
 {
     DisplayCssClass = displayCssClass;
 }
 public ProjectOrganizationRelationship(Project project, Organization organization, OrganizationRelationshipType organizationRelationshipType)
 {
     Project      = project;
     Organization = organization;
     OrganizationRelationshipTypeName = organizationRelationshipType.OrganizationRelationshipTypeName;
 }
Beispiel #8
0
 public ProjectOrganizationForDiff(ProjectFirmaModels.Models.Organization organization, OrganizationRelationshipType organizationRelationshipType, string displayCssClassDeletedElement)
 {
     Organization = organization;
     OrganizationRelationshipType = organizationRelationshipType;
     DisplayCssClass = displayCssClassDeletedElement;
 }
Beispiel #9
0
 ///<summary>Sets the value of the <c>&lt;StudentLEARelationship&gt;</c> element.</summary>
 /// <param name="RefId">The unique identifier for a particular affiliation between a student and a LEA.</param>
 /// <param name="StudentPersonalRefId">The SIF RefId of the StudentPersonal object to which this instance of StudentLEARelationship refers.</param>
 /// <param name="LeaInfoRefId">The SIF RefId of the LEAInfo object to which this instance of StudentLEARelationship refers.</param>
 /// <param name="SchoolYear">Contains the SIF school year to which this instance of StudentLEARelationship applies. StudentLEARelationship must not span multiple school years.</param>
 /// <param name="MembershipType">The type of this affiliation as it relates to the LEA identified in LEAInfoRefId.</param>
 /// <param name="LeaRelationshipType">An instance of the OrganizationRelationshipType common element that describes the details of the student's affiliation with the LEA.</param>
 /// <param name="EntryDate">The date from when this affiliation is valid.</param>
 ///<remarks>
 /// <para>This form of <c>setStudentLEARelationship</c> is provided as a convenience method
 /// that is functionally equivalent to the <c>StudentLEARelationship</c></para>
 /// <para>Version: 2.6</para>
 /// <para>Since: 2.4</para>
 /// </remarks>
 public void SetStudentLEARelationship(string RefId, string StudentPersonalRefId, string LeaInfoRefId, int?SchoolYear, MembershipType MembershipType, OrganizationRelationshipType LeaRelationshipType, DateTime?EntryDate)
 {
     RemoveChild(EtranscriptsDTD.STUDENTSCHOOLENROLLMENTHISTORY_STUDENTLEARELATIONSHIP);
     AddChild(EtranscriptsDTD.STUDENTSCHOOLENROLLMENTHISTORY_STUDENTLEARELATIONSHIP, new StudentLEARelationship(RefId, StudentPersonalRefId, LeaInfoRefId, SchoolYear, MembershipType, LeaRelationshipType, EntryDate));
 }
Beispiel #10
0
 public ProjectOrganization(Organization organization, OrganizationRelationshipType organizationRelationshipType, string displayCssClass)
 {
     Organization = organization;
     OrganizationRelationshipType = organizationRelationshipType;
     SetDisplayCssClass(displayCssClass);
 }