public static void FixStatusFromVersionHistory() { var employees = GetAll().Where(x => x.FilerType == ""); var settings = Settings.GetAll().FirstOrDefault(); var forms = OGEForm450.GetAll(); foreach (Employee emp in employees) { // Determine if has a Form 450 var empForms = forms.Where(x => x.Filer.ToLower() == emp.AccountName.ToLower() && x.FormStatus != Constants.FormStatus.CANCELED).ToList(); // If Exists Set FilerType = 450 Filer if (empForms.Count > 0) { emp.FilerType = Constants.FilerType._450_FILER; // get most recent non-canceled form var f = empForms.Where(x => x.FormStatus == Constants.FormStatus.CERTIFIED).OrderByDescending(x => x.DateOfReviewerSignature).FirstOrDefault(); if (f != null) { // If has a certified form Set ReportingStatus to Annual // Set Last File Date emp.ReportingStatus = Constants.ReportingStatus.ANNUAL; emp.Last450Date = f.DateOfReviewerSignature; } else { // Else Set to New Entrant emp.ReportingStatus = Constants.ReportingStatus.NEW_ENTRANT; } } else { // Else Set FilerType = Not Available if (emp.Inactive == false) { emp.FilerType = Constants.FilerType.NOT_ASSIGNED; } } emp.Save(); } }
public static void UpdateNotStartedFormsAddProfileData() { var list = OGEForm450.GetAll().Where(x => x.FormStatus == Constants.FormStatus.NOT_STARTED).ToList(); foreach (OGEForm450 form in list) { var emp = Get(form.Filer); GetEmployeeUserProfileInfo(emp); form.Agency = emp.Agency; form.BranchUnitAndAddress = emp.Branch; form.EmailAddress = emp.EmailAddress; form.PositionTitle = emp.Position; form.WorkPhone = emp.WorkPhone; form.Save(); } }