public ActionResult Edit(int id, FormCollection collection) { //Retrieve existing claim Claim claim = claimService.GetClaim(id); //Retrieve existing claim Claim originalClaim = claim.Copy(); try { //Update model UpdateModel(claim); UpdateModel(claim.Accidents); //Always update the date if the at least one field has been updated if (!claim.IsIdentical(originalClaim)) { claim.DateCreated = DateTime.Now; //Attach the Rental Car endpoint to the claim claim.RentalCar = MvcApplication.CarRentalEndpoint; ////Book a rental car //claim.RentalCar = RentCar(claim.ClaimId); ////Process the claim and update the status //claim.Status = Process(claim.ClaimId); //if (String.IsNullOrEmpty(claim.Status)) return View("NotFound"); try { //Process claim by invoking the WF workflow service if (!ProcessClaim(claim)) { ModelState.AddModelError("Exception", "Failed to process claim in the ProcessClaimService WF"); return(View(new ClaimFormViewModel(claim))); } } catch (Exception ex) { ModelState.AddModelError("Workflow Exception", ex); return(View(new ClaimFormViewModel(claim))); } ////Persist changes back to database //claimService.Save(webClaim); } //Perform HTTP redirect to details page for the saved Claim return(RedirectToAction("Details", new { id = id })); } catch (Exception ex) { ModelState.AddModelError(ex.Message, ex); return(View(new ClaimFormViewModel(claim))); } }
private static Claim SubmitAndFill(string command, bool single) { DataTable table = General.GetTable(command); Claim tempClaim; if (!single) { List = new Claim[table.Rows.Count]; HList = new Hashtable(); } Claim retVal = new Claim(); for (int i = 0; i < table.Rows.Count; i++) { tempClaim = new Claim(); tempClaim.ClaimNum = PIn.PInt(table.Rows[i][0].ToString()); tempClaim.PatNum = PIn.PInt(table.Rows[i][1].ToString()); tempClaim.DateService = PIn.PDate(table.Rows[i][2].ToString()); tempClaim.DateSent = PIn.PDate(table.Rows[i][3].ToString()); tempClaim.ClaimStatus = PIn.PString(table.Rows[i][4].ToString()); tempClaim.DateReceived = PIn.PDate(table.Rows[i][5].ToString()); tempClaim.PlanNum = PIn.PInt(table.Rows[i][6].ToString()); tempClaim.ProvTreat = PIn.PInt(table.Rows[i][7].ToString()); tempClaim.ClaimFee = PIn.PDouble(table.Rows[i][8].ToString()); tempClaim.InsPayEst = PIn.PDouble(table.Rows[i][9].ToString()); tempClaim.InsPayAmt = PIn.PDouble(table.Rows[i][10].ToString()); tempClaim.DedApplied = PIn.PDouble(table.Rows[i][11].ToString()); tempClaim.PreAuthString = PIn.PString(table.Rows[i][12].ToString()); tempClaim.IsProsthesis = PIn.PString(table.Rows[i][13].ToString()); tempClaim.PriorDate = PIn.PDate(table.Rows[i][14].ToString()); tempClaim.ReasonUnderPaid = PIn.PString(table.Rows[i][15].ToString()); tempClaim.ClaimNote = PIn.PString(table.Rows[i][16].ToString()); tempClaim.ClaimType = PIn.PString(table.Rows[i][17].ToString()); tempClaim.ProvBill = PIn.PInt(table.Rows[i][18].ToString()); tempClaim.ReferringProv = PIn.PInt(table.Rows[i][19].ToString()); tempClaim.RefNumString = PIn.PString(table.Rows[i][20].ToString()); tempClaim.PlaceService = (PlaceOfService)PIn.PInt(table.Rows[i][21].ToString()); tempClaim.AccidentRelated = PIn.PString(table.Rows[i][22].ToString()); tempClaim.AccidentDate = PIn.PDate(table.Rows[i][23].ToString()); tempClaim.AccidentST = PIn.PString(table.Rows[i][24].ToString()); tempClaim.EmployRelated = (YN)PIn.PInt(table.Rows[i][25].ToString()); tempClaim.IsOrtho = PIn.PBool(table.Rows[i][26].ToString()); tempClaim.OrthoRemainM = PIn.PInt(table.Rows[i][27].ToString()); tempClaim.OrthoDate = PIn.PDate(table.Rows[i][28].ToString()); tempClaim.PatRelat = (Relat)PIn.PInt(table.Rows[i][29].ToString()); tempClaim.PlanNum2 = PIn.PInt(table.Rows[i][30].ToString()); tempClaim.PatRelat2 = (Relat)PIn.PInt(table.Rows[i][31].ToString()); tempClaim.WriteOff = PIn.PDouble(table.Rows[i][32].ToString()); tempClaim.Radiographs = PIn.PInt(table.Rows[i][33].ToString()); tempClaim.ClinicNum = PIn.PInt(table.Rows[i][34].ToString()); tempClaim.ClaimForm = PIn.PInt(table.Rows[i][35].ToString()); tempClaim.EFormat = (EtransType)PIn.PInt(table.Rows[i][36].ToString()); if (single) { retVal = tempClaim; } else { List[i] = tempClaim.Copy(); HList.Add(tempClaim.ClaimNum, tempClaim.Copy()); } } //end for return(retVal); //only really used if single }