Example #1
0
        public static List <EventRequest> Migrate()
        {
            var oldData = EthicsClearance.GetAll();

            foreach (EthicsClearance ec in oldData)
            {
                try
                {
                    var request = MigrateEthicsClearance(ec);

                    MigrateAttendees(request.Id, ec);

                    MigrateAttachments(request.Id, ec);
                }
                catch (Exception ex)
                {
                    SharePointHelper.HandleException(ex, "admin", "EthicsClearance.Migrate");
                }
            }

            return(EventRequest.GetAll());
        }
        public override void MapFromList(ListItem item, bool includeChildren = false)
        {
            base.MapFromList(item);

            this.SharePointList  = SharePointHelper.ToStringNullSafe(item["SharePointList"]);
            this.ViewName        = SharePointHelper.ToStringNullSafe(item["ViewName"]);
            this.RecipientType   = SharePointHelper.ToStringNullSafe(item["RecipientType"]);
            this.RecipientColumn = SharePointHelper.ToStringNullSafe(item["RecipientColumn"]);
            this.Subject         = SharePointHelper.ToStringNullSafe(item["Subject"]);
            this.Frequency       = SharePointHelper.ToStringNullSafe(item["Frequency"]);
            this.Body            = SharePointHelper.ToStringNullSafe(item["Body"]);
            this.NextRunDate     = Convert.ToDateTime(item["NextRunDateTime"]);
            this.LastRunDate     = Convert.ToDateTime(item["LastRunDateTime"]);
            this.LastRunStatus   = SharePointHelper.ToStringNullSafe(item["LastRunStatus"]);
            this.IncludeCc       = Convert.ToBoolean(item["IncludeCC"]);
            this.Enabled         = Convert.ToBoolean(item["Enabled"]);
            this.Application     = SharePointHelper.ToStringNullSafe(item["Application"]);

            var dict = new Dictionary <string, string>();

            dict = Settings.GetAppEmailFieldsDef(dict);

            if (Title == NotificationTypes.EXTENSION_DECISION || Title == NotificationTypes.EXTENSION_RECEIVED || Title == NotificationTypes.EXTENSION_REQUEST)
            {
                dict = ExtensionRequest.GetEmailFieldsDef(dict);
            }
            else if (this.Application == Constants.ApplicationName.OGE_FORM_450)
            {
                dict = OGEForm450.GetEmailFieldsDef(dict);
            }
            else if (this.Application == Constants.ApplicationName.EVENT_CLEARANCE)
            {
                dict = EventRequest.GetEmailFieldsDef(dict);
            }

            this.TemplateFields = dict;
        }
Example #3
0
        private static EventRequest MigrateEthicsClearance(EthicsClearance ec)
        {
            var request = new EventRequest();

            request.Title            = ec.EventName + " (" + ec.EventStartDate.Value.Year + ")";
            request.SubmittedBy      = UserInfo.GetUserByName(ec.Submitter);
            request.EventName        = ec.EventName;
            request.GuestsInvited    = ec.GuestInvited == "Yes";
            request.EventStartDate   = ec.EventStartDate;
            request.EventEndDate     = ec.EventEndDate;
            request.EventContactName = ec.EventContactName;

            var individualData = ec.IndividualExtendingInvite.Split('|');

            request.IndividualExtendingInvite = individualData.Length > 0 ? individualData[0] : "";
            request.IsIndividualLobbyist      = individualData.Length > 1 ? (individualData[1] == "Yes") : false;

            var orgData = ec.OrganizationExtendingInvite.Split('|');
            var other   = "";

            request.OrgExtendingInvite = orgData.Length > 0 ? orgData[0] : "";
            request.IsOrgLobbyist      = orgData.Length > 1 ? (orgData[1] == "Yes") : false;
            request.TypeOfOrg          = orgData.Length > 2 ? GetOrgType(orgData[2], ref other) : 0;
            request.OrgOther           = other;

            var hostData = ec.OrganizerHostingEvent.Split('|');

            request.OrgHostingEvent = hostData.Length > 0 ? hostData[0] : "";
            request.IsHostLobbyist  = hostData.Length > 1 ? (hostData[1] == "Yes") : false;
            other = "";
            request.TypeOfHost = hostData.Length > 2 ? GetOrgType(hostData[2], ref other) : 0;
            request.HostOther  = other;

            request.IsFundraiser    = ec.Fundraiser == "Yes";
            request.WhoIsPaying     = ec.WhoIsPaying;
            request.FairMarketValue = ec.FairMarketValue;

            request.RequiresTravel        = ec.RequiresTravel == "Yes";
            request.InternationalTravel   = ec.InternationalTravel == "Yes";
            request.AdditionalInformation = ec.AdditionalInformation;

            request.EventLocation        = ec.EventLocation;
            request.CrowdDescription     = ec.EventCrowd;
            request.ApproximateAttendees = ec.EmployeesTotal;
            request.IsOpenToMedia        = ec.OpenToMedia == "Yes";

            request.GuidanceGiven = ec.GuidanceGiven;
            request.AssignedToUpn = UserInfo.GetUserByName(ec.AssignedTo);

            if (ec.Closed == "Yes")
            {
                if (!string.IsNullOrEmpty(ec.GuidanceGiven))
                {
                    // if it's closed and guidance was given, mark as closed approved
                    request.Status = Constants.EventRequestStatus.APPROVED;
                }
                else if (ec.ClosedReason.ToLower().Contains("canceled") || ec.ClosedReason.ToLower().Contains("cancelled"))
                {
                    // if it's closed and a reason was given, mark as closed - other
                    request.Status = Constants.EventRequestStatus.CANCELED;
                }
                else if (ec.ClosedReason.ToLower().Contains("withdrew"))
                {
                    // if it's closed and a reason was given, mark as closed - other
                    request.Status = Constants.EventRequestStatus.WITHDRAWN;
                }
                else
                {
                    request.Status = Constants.EventRequestStatus.CLOSED;
                }
            }
            else if (!string.IsNullOrEmpty(request.AssignedToUpn))
            {
                request.Status = Constants.EventRequestStatus.OPEN;
            }
            else
            {
                request.Status = Constants.EventRequestStatus.UNASSIGNED;
            }


            request.ClosedReason = ec.ClosedReason;
            request.ClosedDate   = ec.ClosedDate;

            request.ContactNumber     = ec.ContactNumber;
            request.ContactEmail      = ec.ContactEmail;
            request.ContactComponent  = ec.ContactComponent;
            request.EventContactPhone = ec.EventContactPhone;

            request.AttachmentGuid = ec.OMBEthicsFormId;

            request.Submitter = ec.Submitter;

            return(request.Save());
        }