public static void Process(string inputFile, string outputFile) { ClaimBatch batch = null; string ConfigurationFile = System.Windows.Forms.Application.StartupPath + "\\ClaimCodeChanger.config"; if (!File.Exists(ConfigurationFile)) { LoggingHelper.Log("Error in ClaimCodeChanger.Process", LogSeverity.Critical, new Exception("Configuration file (" + ConfigurationFile + ") not found."), true); } // Set things up. changerSettings = (ClaimCodeChangerSettings)Utilities.DeserializeFromFile(typeof(ClaimCodeChangerSettings), ConfigurationFile); if (outputFile == "") { outputFile = inputFile; } if (!File.Exists(inputFile)) { LoggingHelper.Log("Error in ClaimCodeChanger.Process", LogSeverity.Critical, new Exception("Specified input file (" + inputFile + ") not found."), true); } // Read in the claims. try { batch = (ClaimBatch)Utilities.DeserializeFromFile(typeof(ClaimBatch), inputFile); } catch (Exception ex) { LoggingHelper.Log("Error in ClaimCodeChanger.Process", LogSeverity.Critical, new Exception("An unexpected error occurred processing the input file: \n\n" + ex.Message, ex), true); } // Change procedure codes. int totalChanges = 0; foreach (Claim c in batch.Claims) { totalChanges += Change(c); } // Write out the modified claims. try { Utilities.SerializeToFile(batch, typeof(ClaimBatch), outputFile); } catch (Exception ex) { LoggingHelper.Log("Error in ClaimCodeChanger.Process", LogSeverity.Critical, new Exception("Could not serialize the file.\n\n" + ex.Message, ex), true); } // All done. }
public ActionResult DeleteConfirmed(int id) { ClaimBatch claimBatch = db.ClaimBatches.Find(id); db.ClaimBatches.Remove(claimBatch); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,ProviderId,month,year,Batch,status,submitedVetbyUser,submitedReviewbyUser,SubmitedForReviewDate,reviewDate,reviewedBy,VetDate,SubmitedForPaymentDate,submitedPaymentbyUser,AuthorizationStatus,AuthorizationNote,DisapprovalNote,AuthorizedBy,DisapprovedBy,AuthorizedDate,DisapprovalDate,DeletionNote,Guid,CreatedOn,UpdatedOn,IsDeleted,SiteId,paymentbatchId,AmountPaid,paymentmethod,paymentref,chequeno,sourceBankName,sourceBankAccountNo,DestBankName,DestBankAccountNo,remark,paymentdate,paidby,markpaidby,ProviderName,claimscountfromclient,paymentmethodstring,paymentadvicesent,datepaymentadvicesent,isremote")] ClaimBatch claimBatch) { if (ModelState.IsValid) { db.Entry(claimBatch).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.paymentbatchId = new SelectList(db.PaymentBatches, "Id", "Title", claimBatch.paymentbatchId); return(View(claimBatch)); }
// GET: ClaimBatches/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ClaimBatch claimBatch = db.ClaimBatches.Find(id); if (claimBatch == null) { return(HttpNotFound()); } return(View(claimBatch)); }
// GET: ClaimBatches/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ClaimBatch claimBatch = db.ClaimBatches.Find(id); if (claimBatch == null) { return(HttpNotFound()); } ViewBag.paymentbatchId = new SelectList(db.PaymentBatches, "Id", "Title", claimBatch.paymentbatchId); return(View(claimBatch)); }
public void Combine(string inputFile, string outputFile) { ClaimBatch batch = null; if (!File.Exists(inputFile)) { throw new Exception("Input file does not exist."); } // Read in the claims. try { batch = (ClaimBatch)Utilities.DeserializeFromFile(typeof(ClaimBatch), inputFile); } catch (Exception ex) { throw new Exception("Could not read batch file.", ex); } // Apply splitting rules. foreach (Claim c in batch.Claims) { try { CombineClaim(c); } catch (Exception ex) { throw new Exception("There was an error when processing claim " + c.Identity.ClaimID.ToString() + "/" + c.Identity.ClaimDB.ToString(), ex); } } // Write out the modified claims. try { Utilities.SerializeToFile(batch, typeof(ClaimBatch), outputFile); } catch (Exception ex) { throw new Exception("Could not write batch file.", ex); } }
/// <summary>Create a batch in the database.</summary> /// <param name="trans">The transaction to create the batch in.</param> /// <remarks>During the save the BatchID is retrieved and saved in the field.</remarks> virtual public void CreateBatch(SqlTransaction trans) { Batch = new ClaimBatch(); Batch.BatchInformation.DateCreated = DateTime.Now; // Create the batch entry. SqlCommand cmd = new SqlCommand("INSERT INTO NHDG_CLAIM_BATCHES " + "(BATCH_DATE, HANDLING) " + "VALUES " + "('" + Batch.BatchInformation.DateCreated.ToString("d") + "', " + "'" + Name + "'); " + "SELECT SCOPE_IDENTITY() AS ID;", trans.Connection, trans); // Get the database batch ID. SqlDataReader reader = cmd.ExecuteReader(); reader.Read(); Batch.BatchInformation.BatchID = (int)reader.GetDecimal(0); reader.Close(); }
public void PerformSplit(string inputFile, string outputFile) { ClaimBatch batch = null; if (!File.Exists(inputFile)) { throw new Exception("Input file does not exist."); } // Read in the claims. try { batch = (ClaimBatch)Utilities.DeserializeFromFile(typeof(ClaimBatch), inputFile); } catch (Exception ex) { throw new Exception("Could not read batch file.", ex); } // Connect to the database. // Load splitting rules. try { LoadSplitters(); } catch (Exception ex) { throw new Exception("Could not load splitting rules.", ex); } if (Splitters.Count < 1) { // No splitting rules to apply } else { // Apply splitting rules. Splitter splitter = null; int numSplits = 0; foreach (Claim c in batch.Claims) { foreach (string s in Splitters.Keys) { splitter = GetApplicableSplitter(c, s); if (splitter != null) { try { System.Diagnostics.Debug.Print("Applying splitter rule (" + splitter.ProcedureCode + "/" + splitter.Carrier + ") to claim " + c.Identity.ClaimID.ToString() + "/" + c.Identity.ClaimDB.ToString() + "..."); splitter.Split(c); numSplits++; } catch (Exception ex) { throw new Exception("There was an error when processing claim " + c.Identity.ClaimID.ToString() + "/" + c.Identity.ClaimDB.ToString() + " with rule " + splitter.ProcedureCode + "/" + splitter.Carrier, ex); } } } } System.Diagnostics.Debug.Print("Total of " + numSplits.ToString() + " splits performed."); } // Write out the modified claims. try { Utilities.SerializeToFile(batch, typeof(ClaimBatch), outputFile); } catch (Exception ex) { throw new Exception("Could not write batch file.", ex); } }
static int Main(string[] args) { string inputFile; string outputFile; ClaimBatch batch = null; // Set things up. log4net.Config.DOMConfigurator.ConfigureAndWatch(new System.IO.FileInfo(SettingsManager.Instance.Settings["ApexEDI"].LogConfigurationFile)); Globals.Logger = LogManager.GetLogger("ApexEDI"); // Read in the file layout information. try { Globals.Logger.Debug("Loading file format information (" + SettingsManager.Instance.Settings["ApexEDI"].ConfigurationFile + ")..."); Globals.Format = (FileFormat)Utilities.DeserializeFromFile(typeof(FileFormat), SettingsManager.Instance.Settings["ApexEDI"].ConfigurationFile); Globals.Logger.Debug("File format information loaded."); } catch (Exception ex) { Globals.Logger.Fatal("Could not load file format information.", ex); return(-3); } // Say hello. Version v = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version; Globals.Logger.Info("Application starting: v" + v.ToString() + ", Windows v" + System.Environment.OSVersion.Version.ToString() + ", .NET v" + System.Environment.Version.ToString()); // Figure out what file(s) to deal with. if (args.Length < 1) { Globals.Logger.Fatal("No input file was specified."); return(-1); } else { inputFile = args[0]; } if (args.Length > 1) { outputFile = args[1]; } else { outputFile = Path.ChangeExtension(inputFile, ".apexedi"); } if (!File.Exists(inputFile)) { Globals.Logger.Fatal("Specified input file does not exist (" + inputFile + ")."); return(-2); } // Read in the claims. try { Globals.Logger.Debug("Loading batch file..."); batch = (ClaimBatch)Utilities.DeserializeFromFile(typeof(ClaimBatch), inputFile); Globals.Logger.Info("Batch file loaded (" + batch.Claims.Count.ToString() + " claims - " + inputFile + ")."); } catch (Exception ex) { Globals.Logger.Fatal("Could not read batch file.", ex); return(-4); } // Write the claims in the ApexEDI format. int i = 0; StreamWriter sw = null; try { sw = new StreamWriter(outputFile, true, System.Text.Encoding.ASCII); } catch (Exception ex) { Globals.Logger.Fatal("Could not open " + outputFile + " for output.", ex); return(-5); } bool first = true; foreach (Claim c in batch.Claims) { try { // Separate the claims. if (first) { first = false; } else { if (Globals.Format.General.ClaimSeparator != string.Empty) { sw.WriteLine(Globals.Format.General.ClaimSeparator); } } WriteClaim(sw, c); i++; } catch (Exception ex) { Globals.Logger.Error("There was an error transforming claim " + c.Identity.ClaimID.ToString() + "/" + c.Identity.ClaimDB.ToString() + ".", ex); first = true; } } sw.Close(); Globals.Logger.Info(i.ToString() + " of " + batch.Claims.Count.ToString() + " claims written to " + outputFile); // All done. Globals.Logger.Info("Application exiting."); return(0); }
static int Main(string[] args) { string inputFile; string outputFile; ClaimBatch batch = null; // Set things up. Globals.Settings = (ClaimCodeChangerSettings)Utilities.DeserializeFromFile(typeof(ClaimCodeChangerSettings), SettingsManager.Instance.Settings["ClaimCodeChanger"].ConfigurationFile); log4net.Config.DOMConfigurator.ConfigureAndWatch(new System.IO.FileInfo(SettingsManager.Instance.Settings["ClaimCodeChanger"].LogConfigurationFile)); Globals.Logger = LogManager.GetLogger("ClaimCodeChanger"); // Say hello. Version v = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version; Globals.Logger.Info("Application starting: v" + v.ToString() + ", Windows v" + System.Environment.OSVersion.Version.ToString() + ", .NET v" + System.Environment.Version.ToString()); // Figure out what file(s) to deal with. if (args.Length < 1) { Globals.Logger.Fatal("No input file was specified."); return(-1); } else { inputFile = outputFile = args[0]; } if (args.Length > 1) { outputFile = args[1]; } if (!File.Exists(inputFile)) { Globals.Logger.Fatal("Specified input file does not exist (" + inputFile + ")."); return(-2); } // Read in the claims. try { Globals.Logger.Debug("Loading batch file..."); batch = (ClaimBatch)Utilities.DeserializeFromFile(typeof(ClaimBatch), inputFile); Globals.Logger.Info("Batch file loaded (" + batch.Claims.Count.ToString() + " claims - " + inputFile + ")."); } catch (Exception ex) { Globals.Logger.Fatal("Could not read batch file.", ex); return(-4); } // Change procedure codes. int totalChanges = 0; foreach (Claim c in batch.Claims) { totalChanges += Change(c); } Globals.Logger.Info("Total of " + totalChanges.ToString() + " changes made."); // Write out the modified claims. try { Globals.Logger.Debug("Writing new batch file..."); Utilities.SerializeToFile(batch, typeof(ClaimBatch), outputFile); Globals.Logger.Info("Wrote new batch file (" + batch.Claims.Count.ToString() + " claims - " + outputFile + ")."); } catch (Exception ex) { Globals.Logger.Error("Could not write batch file.", ex); return(-5); } // All done. Globals.Logger.Info("Application exiting."); return(0); }
/// <summary> /// Process the file to format it for ApexEDI. Recommended extension for output file is .apexedi. /// </summary> /// <param name="inputFile"></param> /// <param name="outputFile"></param> /// <returns></returns> public static void Process(string inputFile, string outputFile) { string _inputFile; string _outputFile; _inputFile = inputFile; if (outputFile == string.Empty) { _outputFile = Path.ChangeExtension(inputFile, ".apexedi"); } else { _outputFile = outputFile; } ClaimBatch batch = null; // Read in the file layout information. try { Globals.Format = (FileFormat)Utilities.DeserializeFromFile(typeof(FileFormat), SettingsManager.Instance.Settings["ApexEDI"].ConfigurationFile); } catch (Exception ex) { LoggingHelper.Log("Error Occurred in ApexEDI.Process loading settings.", LogSeverity.Error, ex, false); throw new Exception("An error occurred loading the settings for ApexEDI processing: \n\n" + ex.Message, ex); } if (!File.Exists(_inputFile)) { throw new Exception("Input file (" + _inputFile + ") does not exist."); } // Read in the claims. try { batch = (ClaimBatch)Utilities.DeserializeFromFile(typeof(ClaimBatch), _inputFile); } catch (Exception ex) { LoggingHelper.Log("Error occurred in ApexEDI.Process reading input file.", LogSeverity.Error, ex, false); throw new Exception("An error occurred reading the input file: \n\n" + ex.Message, ex); } // Write the claims in the ApexEDI format. int i = 0; StreamWriter sw = null; try { sw = new StreamWriter(_outputFile, true, System.Text.Encoding.ASCII); } catch (Exception ex) { LoggingHelper.Log("Error occurred in ApexEDI.Process writing to output.", LogSeverity.Error, ex, false); throw new Exception("An error occurred writing to the output file: \n\n" + ex.Message, ex); } bool first = true; foreach (Claim c in batch.Claims) { try { // Separate the claims. if (first) { first = false; } else { if (Globals.Format.General.ClaimSeparator != string.Empty) { sw.WriteLine(Globals.Format.General.ClaimSeparator); } } WriteClaim(sw, c); i++; } catch { first = true; } } sw.Close(); // All done. }