public static OGEForm450 Create(Employee emp, OGEForm450 copy, Settings settings) { var form = new OGEForm450(); // Filer Information form.Filer = emp.AccountName; form.Agency = emp.Agency; form.BranchUnitAndAddress = emp.Branch; form.DateOfAppointment = copy.DateOfAppointment; form.DueDate = GetNextBusinessDay(settings.AnnualDueDate, 0); form.EmailAddress = emp.EmailAddress; form.EmployeesName = emp.DisplayName; form.FormStatus = Constants.FormStatus.NOT_STARTED; form.ReportingStatus = emp.ReportingStatus; form.Title = emp.DisplayName + " (" + settings.CurrentFilingYear.ToString() + ")"; form.WorkPhone = emp.WorkPhone; form.AppUser = emp.DisplayName; form.Grade = copy.Grade; form.PositionTitle = copy.PositionTitle; form.Year = settings.CurrentFilingYear; form.CorrelationId = Guid.NewGuid().ToString(); form.SubmittedPaperCopy = false; // Form Info form.HasAgreementsOrArrangements = copy.HasAgreementsOrArrangements; form.HasAssetsOrIncome = copy.HasAssetsOrIncome; form.HasGiftsOrTravelReimbursements = copy.HasGiftsOrTravelReimbursements; form.HasLiabilities = copy.HasLiabilities; form.HasOutsidePositions = copy.HasOutsidePositions; form.IsSpecialGovernmentEmployee = copy.IsSpecialGovernmentEmployee; form.MailingAddress = copy.MailingAddress; var newForm = form.Save(); newForm.ReportableInformationList = new List <ReportableInformation>(); if (copy.ReportableInformationList != null) { foreach (ReportableInformation ri in copy.ReportableInformationList) { var newInfo = new ReportableInformation(ri); newForm.ReportableInformationList.Add(newInfo); } } newForm.SaveReportableInformation(); var user = UserInfo.GetUser(emp.AccountName); var emailData = newForm.GetEmailData(user); newForm.AddEmail(EmailHelper.GetEmail(NotificationTemplates.NotificationTypes.OGE_FORM_450_NEW_ANNUAL, user, emailData, emp.AnnualEmailText)); return(newForm); }
public override void MapFromList(ListItem item, bool includeChildren = false) { base.MapFromList(item); this.Agency = SharePointHelper.ToStringNullSafe(item["Agency"]); this.BranchUnitAndAddress = SharePointHelper.ToStringNullSafe(item["BranchUnitAndAddress"]); this.CommentsOfReviewingOfficial = SharePointHelper.ToStringNullSafe(item["CommentsOfReviewingOfficial"]); this.DateOfAppointment = SharePointHelper.ToDateTimeNullIfMin(Convert.ToDateTime(item["DateOfAppointment"])); this.DateOfEmployeeSignature = SharePointHelper.ToDateTimeNullIfMin(Convert.ToDateTime(item["DateOfEmployeeSignature"])); this.DateOfReviewerSignature = SharePointHelper.ToDateTimeNullIfMin(Convert.ToDateTime(item["DateOfReviewerSignature"])); this.DateOfSubstantiveReview = SharePointHelper.ToDateTimeNullIfMin(Convert.ToDateTime(item["DateOfSubstantiveReview"])); this.DateReceivedByAgency = SharePointHelper.ToDateTimeNullIfMin(Convert.ToDateTime(item["DateReceivedByAgency"])); this.EmployeeSignature = SharePointHelper.ToStringNullSafe(item["EmployeeSignature"]); this.EmailAddress = SharePointHelper.ToStringNullSafe(item["EmailAddress"]); this.EmployeesName = SharePointHelper.ToStringNullSafe(item["EmployeesName"]); this.Grade = SharePointHelper.ToStringNullSafe(item["Grade"]); this.HasAgreementsOrArrangements = SharePointHelper.ToStringNullSafe(item["HasAgreementsOrArrangements"]) == "True"; this.HasAssetsOrIncome = SharePointHelper.ToStringNullSafe(item["HasAssetsOrIncome"]) == "True"; this.HasGiftsOrTravelReimbursements = SharePointHelper.ToStringNullSafe(item["HasGiftsOrTravelReimbursements"]) == "True"; this.HasLiabilities = SharePointHelper.ToStringNullSafe(item["HasLiabilities"]) == "True"; this.HasOutsidePositions = SharePointHelper.ToStringNullSafe(item["HasOutsidePositions"]) == "True"; this.IsSpecialGovernmentEmployee = SharePointHelper.ToStringNullSafe(item["IsSpecialGovernmentEmployee"]) == "True"; this.MailingAddress = SharePointHelper.ToStringNullSafe(item["MailingAddress"]); this.PositionTitle = SharePointHelper.ToStringNullSafe(item["PositionTitle"]); this.ReportingStatus = SharePointHelper.ToStringNullSafe(item["ReportingStatus"]); this.ReviewingOfficialSignature = SharePointHelper.ToStringNullSafe(item["ReviewingOfficialSignature"]); this.SubstantiveReviewer = SharePointHelper.ToStringNullSafe(item["SubstantiveReviewer"]); this.FormStatus = SharePointHelper.ToStringNullSafe(item["FormStatus"]); this.WorkPhone = SharePointHelper.ToStringNullSafe(item["WorkPhone"]); this.Year = Convert.ToInt32(item["Year"]); this.Filer = ((FieldUserValue)item["Filer"]).LookupValue; this.DueDate = Convert.ToDateTime(item["DueDate"]); this.DaysExtended = Convert.ToInt32(item["DaysExtended"]); this.ExtendedText = this.DaysExtended > 0 ? "Yes (" + this.DaysExtended.ToString() + ")" : "No"; this.SubmittedPaperCopy = Convert.ToBoolean(item["SubmittedPaperCopy"]); this.IsUnchanged = SharePointHelper.ToStringNullSafe(item["IsUnchanged"]) == "True"; this.ReSubmittedDate = Convert.ToDateTime(item["ResubmittedDate"]); this.FormFlags = GetFormFlags(); if (includeChildren) { this.ReportableInformationList = ReportableInformation.GetAllBy(ListName + "Id", Id, this.Year); } }
public static OGEForm450 GetPreviousFormByUser(string accountName, Settings settings = null) { if (settings == null) { settings = Settings.GetAll().FirstOrDefault(); } var forms = OGEForm450.GetAllBy("Filer", accountName); OGEForm450 prevForm = null; if (forms != null) { prevForm = forms.Where(x => x.Year == settings.CurrentFilingYear - 1 && x.FormStatus != Constants.FormStatus.CANCELED).OrderByDescending(x => x.DueDate).FirstOrDefault(); if (prevForm != null) { prevForm.ReportableInformationList = ReportableInformation.GetAllBy(prevForm.ListName + "Id", prevForm.Id, prevForm.Year); } } return(prevForm); }