public AddProfileWindow(Target invoker, IEnumerable <LookupViewModel> profiles) { InitializeComponent(); _invoker = invoker; _eventPublisher = DependencyResolver.Current.Resolve <IEventPublisher>(); _eventPublisher.PublishAsync(new ChangeViewEnabledEvent(_invoker, false)); _viewModel = new AddProfileViewModel(profiles); _viewModel.OnCancelled += Cancel; _viewModel.OnSubmitted += Submit; DataContext = _viewModel; }
public IActionResult AddProfile(AddProfileViewModel model) { if (ModelState.IsValid) { PERSONNEL_DATA marine = new PERSONNEL_DATA(); if (_PersonnelService.Get(model.DOD_ID_NUMBER) == null) { marine.DOD_NUMBER = model.DOD_ID_NUMBER; marine.RANK = model.RANK; marine.FIRST_NAME = model.FIRST_NAME; marine.LAST_NAME = model.LAST_NAME; marine.MIDDLE_NAME = model.MIDDLE_NAME; marine.HEIGHT_IN_INCHES = model.HEIGHT_IN_INCHES; marine.DOB = model.DOB; marine.SEX = model.SEX; marine.AGE = model.AGE; marine.WEIGHT = model.WEIGHT; marine.HOME_OF_RECORD = model.HOME_OF_RECORD; marine.PLACE_OF_BIRTH = model.PLACE_OF_BIRTH; marine.CIVILIAN_LIC_STATE = model.CIVILIAN_LIC_STATE; marine.CIVILIAN_LIC_NUMBER = model.CIVILIAN_LIC_NUMBER; marine.CIVILIAN_ISSUE_DATE = model.CIV_ISSUE_DATE; marine.CIVILIAN_EXP_DATE = model.CIV_EXP_DATE; marine.CLASS_OF_VEHICLE = model.CLASS_OF_VEHICLE; marine.HAIR_COLOR = model.HAIR_COLOR; marine.EYE_COLOR = model.EYE_COLOR; marine.MED_CERT_REQ = model.MED_CERT_REQUIRED; marine.WEARS_GLASSES = model.WEARS_GLASSES; //HEALTH EVAL. This will be used for the OF_... .pdf mandatory file. marine.POOR_HEARING_IN_ONE_OR_BOTH = model.POOR_HEARING_IN_ONE_OR_BOTH; marine.EYE_DISEASE = model.EYE_DISEASE; marine.POOR_VIS_IN_ONE_OR_BOTH = model.POOR_VIS_IN_ONE_OR_BOTH; marine.DIABETES = model.DIABETES; marine.PALPITATION_CHEST_PAIN_SHORT_BREATH = model.PALPITATION_CHEST_PAIN_SHORT_BREATH; marine.DIZZINESS_OR_FAINT_SPELLS = model.DIZZINESS_OR_FAINT_SPELLS; marine.FREQUENT_OR_SEVERE_HEADACHES = model.FREQUENT_OR_SEVERE_HEADACHES; marine.HIGH_OR_LOW_BLOOD_PRESSURE = model.HIGH_OR_LOW_BLOOD_PRESSURE; marine.DRUG_OR_NARCODIC_HABIT = model.DRUG_OR_NARCODIC_HABIT; marine.ARTHRITIS_RHEUMATISM_SWOLLEN_OR_PAINFUL_JOINTS = model.ARTHRITIS_RHEUMATISM_SWOLLEN_OR_PAINFUL_JOINTS; marine.LOSS_OF_HAND_ARM_FOOT_OR_LEG = model.LOSS_OF_HAND_ARM_FOOT_OR_LEG; marine.DEFOMITY_OF_HAND_ARM_FOOT_OR_LEG = model.DEFOMITY_OF_HAND_ARM_FOOT_OR_LEG; marine.NERVOUS_OR_MENTAL_TROUBLE = model.NERVOUS_OR_MENTAL_TROUBLE; marine.BLACKOUTS_EPILIEPSY = model.BLACKOUTS_EPILIEPSY; marine.SUGAR_OR_ALBUMIN_IN_URINE = model.SUGAR_OR_ALBUMIN_IN_URINE; marine.EXCESSIVE_DRINKING_HABIT = model.EXCESSIVE_DRINKING_HABIT; marine.OTHER_SERIOUS_DEFECTS_OR_DISEASE = model.OTHER_SERIOUS_DEFECTS_OR_DISEASE; marine.DOES_WEAR_HEARING_AID = model.DOES_WEAR_HEARING_AID; marine.DOES_WEAR_GLASSES_OR_CONTACTS_WHILE_DRIVING = model.DOES_WEAR_GLASSES_OR_CONTACTS_WHILE_DRIVING; marine._3270 = model._3270; marine.PERSONNEL_ID = new Guid(); _PersonnelService.Add(marine, HttpContext.User.Identity.Name); var newMarine = _DocumentService.GetByName("NAVMC_10694.pdf"); //Creates a record in the DB that this user has filled out this information. FILLED_DOCUMENT newDoc = new FILLED_DOCUMENT(); newDoc.created_by = HttpContext.User.Identity.Name; newDoc.date_created = DateTime.Now; newDoc.date_last_modified = DateTime.Now; //newDoc.DATE_SIGNED = null; This needs to reflect in the website as something other than jan 1st 1900 newDoc.DOCUMENT_GUID = newMarine.DOCUEMNT_GUID; newDoc.DOCUMENT_NAME = marine.DOD_NUMBER + newMarine.DOCUMENT_NAME; newDoc.DOD_ID_OF_APPROVING_SUPERVISOR = null; newDoc.FILLED_DOCUMENT_GUID = new Guid(); newDoc.PDF_FILENAME = newMarine.DOCUMENT_NAME; newDoc.IS_SIGNED = false; newDoc.last_modified_by = HttpContext.User.Identity.Name; //newDoc.PERMIT_GUID = null; a blank guid will be ok newDoc.PERSONNEL_OWNER = marine.PERSONNEL_ID; _FileDocumentService.File(newDoc, HttpContext.User.Identity.Name); return(RedirectToAction("Index")); } else { } } else { } ///Something went wrong, reapply states to view bag var states = new List <SelectListItem> { new SelectListItem { Value = "AL", Text = "Alabama" }, new SelectListItem { Value = "AK", Text = "Alaska" }, new SelectListItem { Value = "AZ", Text = "Arizona" }, new SelectListItem { Value = "AR", Text = "Arkansas" }, new SelectListItem { Value = "CA", Text = "California" }, new SelectListItem { Value = "CO", Text = "Colorado" }, new SelectListItem { Value = "CT", Text = "Connecticut" }, new SelectListItem { Value = "DE", Text = "Delaware" }, new SelectListItem { Value = "FL", Text = "Florida" }, new SelectListItem { Value = "GA", Text = "Georgia" }, new SelectListItem { Value = "HI", Text = "Hawaii" }, new SelectListItem { Value = "ID", Text = "Idaho" }, new SelectListItem { Value = "IL", Text = "Illinois" }, new SelectListItem { Value = "IN", Text = "Indiana" }, new SelectListItem { Value = "IA", Text = "Iowa" }, new SelectListItem { Value = "KS", Text = "Kansas" }, new SelectListItem { Value = "KY", Text = "Kentucky" }, new SelectListItem { Value = "LA", Text = "Louisiana" }, new SelectListItem { Value = "ME", Text = "Maine" }, new SelectListItem { Value = "MD", Text = "Maryland" }, new SelectListItem { Value = "MA", Text = "Massachusetts" }, new SelectListItem { Value = "MI", Text = "Michigan" }, new SelectListItem { Value = "MN", Text = "Minnesota" }, new SelectListItem { Value = "MS", Text = "Mississippi" }, new SelectListItem { Value = "MO", Text = "Missouri" }, new SelectListItem { Value = "MT", Text = "Montana" }, new SelectListItem { Value = "NC", Text = "North Carolina" }, new SelectListItem { Value = "ND", Text = "North Dakota" }, new SelectListItem { Value = "NE", Text = "Nebraska" }, new SelectListItem { Value = "NV", Text = "Nevada" }, new SelectListItem { Value = "NH", Text = "New Hampshire" }, new SelectListItem { Value = "NJ", Text = "New Jersey" }, new SelectListItem { Value = "NM", Text = "New Mexico" }, new SelectListItem { Value = "NY", Text = "New York" }, new SelectListItem { Value = "OH", Text = "Ohio" }, new SelectListItem { Value = "OK", Text = "Oklahoma" }, new SelectListItem { Value = "OR", Text = "Oregon" }, new SelectListItem { Value = "PA", Text = "Pennsylvania" }, new SelectListItem { Value = "RI", Text = "Rhode Island" }, new SelectListItem { Value = "SC", Text = "South Carolina" }, new SelectListItem { Value = "SD", Text = "South Dakota" }, new SelectListItem { Value = "TN", Text = "Tennessee" }, new SelectListItem { Value = "TX", Text = "Texas" }, new SelectListItem { Value = "UT", Text = "Utah" }, new SelectListItem { Value = "VT", Text = "Vermont" }, new SelectListItem { Value = "VA", Text = "Virginia" }, new SelectListItem { Value = "WA", Text = "Washington" }, new SelectListItem { Value = "WV", Text = "West Virginia" }, new SelectListItem { Value = "WI", Text = "Wisconsin" }, new SelectListItem { Value = "WY", Text = "Wyoming" } }; var list = new SelectList(states, "Value", "Text"); ViewBag.STATES = list; return(View()); }