示例#1
0
 // ClaimInfo: ClaimFiles/ClaimInfo
 public ActionResult ClaimInfo(int FileID, int recordsequence, string FileVersion, ClaimLayoutType ClaimLayout, string DCN)
 {
     try
     {
         ParsedViewModel pvm       = new ParsedViewModel();
         ClaimFile       claimFile = db.ClaimFiles.Find(FileID);
         if (claimFile == null)
         {
             return(HttpNotFound());
         }
         int iFileID = FileID;
         pvm.cf          = claimFile;
         pvm.cf.fh       = new FileHeader(iFileID);
         pvm.cf.fh.lsdch = new List <ClaimHeader>();
         pvm.lsCHTVM     = new List <ClaimHeaderTableViewModel>();
         ClaimHeader ch = new ClaimHeader(FileID, recordsequence, FileVersion, DCN);
         PaperHeader ph = new PaperHeader(FileID, recordsequence + 1, FileVersion, ClaimLayout);
         ch.ph   = ph;
         ch.lscd = new List <ClaimDetail>();
         for (int x = 0; x < ch.NumberofDetails; x++)
         {
             int         iCDRecordSeq = recordsequence + 2 + (x * 2);
             ClaimDetail cd           = new ClaimDetail(FileID, iCDRecordSeq, FileVersion, ClaimLayout);
             ch.lscd.Add(cd);
         }
         pvm.cf.fh.lsdch.Add(ch);
         return(View(pvm));
     }
     catch (Exception ex)
     {
         return(View("Error", new HandleErrorInfo(ex, "ClaimFiles", "Index")));
     }
 }
示例#2
0
        // Details: ClaimFiles/Details/5
        public ActionResult Details(int?id)
        {
            try
            {
                ParsedViewModel pvm = new ParsedViewModel();
                if (id == null)
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                }
                ClaimFile claimFile = db.ClaimFiles.Find(id);
                if (claimFile == null)
                {
                    return(HttpNotFound());
                }
                int iFileID = (int)id;
                pvm.cf          = claimFile;
                pvm.cf.fh       = new FileHeader(iFileID);
                pvm.cf.fh.lsdch = new List <ClaimHeader>();
                pvm.lsCHTVM     = new List <ClaimHeaderTableViewModel>();
                List <FileFieldValue> lsClaims = db.FileFieldValues.Where(x => x.FileID == id && x.recordType == RecordType.ClaimHeader).ToList();
                for (int i = 0; i < pvm.cf.fh.NumberofClaims; i++)
                {
                    int iMinRecordSequence        = lsClaims.Min(x => x.recordSequence);
                    List <FileFieldValue> lsClaim = lsClaims.Where(x => x.recordSequence == iMinRecordSequence).ToList();

                    var ffvct = (from c in db.FileFieldValues
                                 join f in db.Fields on c.FieldID equals f.FieldID
                                 where f.Name == "STD_BATCH_TYPE_CODE" &&
                                 c.FileID == iFileID &&
                                 c.recordType == RecordType.ClaimHeader &&
                                 c.recordSequence == iMinRecordSequence
                                 select new { value = c.value });
                    string          sClaimTypeCode = ffvct.First().value;
                    ClaimLayoutType clt            = Utility.GetCLT(sClaimTypeCode);

                    Field                     fDCN   = db.Fields.Where(x => x.RecordType == RecordType.PaperHeader && x.ClaimType == clt && x.FileVersion == pvm.cf.fh.FileVersion && x.Name.Trim().ToUpper() == "ENDORSEMENT NUMBER").Single();
                    FileFieldValue            ffvDCN = db.FileFieldValues.Where(x => x.FieldID == fDCN.FieldID && x.FileID == id && x.recordSequence == iMinRecordSequence + 1).Single();
                    ClaimHeaderTableViewModel chtvm  = new ClaimHeaderTableViewModel(iFileID, pvm.cf.fh.FileVersion, ffvDCN.value, sClaimTypeCode, iMinRecordSequence);
                    pvm.lsCHTVM.Add(chtvm);
                    foreach (FileFieldValue ffv in lsClaim)
                    {
                        lsClaims.Remove(ffv);
                    }
                }

                return(View(pvm));
            }
            catch (Exception ex)
            {
                return(View("Error", new HandleErrorInfo(ex, "ClaimFiles", "Index")));
            }
        }
示例#3
0
 // Parse: ClaimFiles/Parse/5
 public ActionResult Parse(int?id)
 {
     try
     {
         ParsedViewModel pvm = new ParsedViewModel();
         if (id == null)
         {
             return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
         }
         ClaimFile claimFile = db.ClaimFiles.Find(id);
         if (claimFile == null)
         {
             return(HttpNotFound());
         }
         string _FileName = claimFile.Filename;
         string _path     = Path.Combine(Server.MapPath("~/UploadedFiles"), _FileName);
         string sSource   = System.IO.File.ReadAllText(_path);
         pvm.cf    = claimFile;
         pvm.cf.fh = claimFile.Parse(sSource);
         Thread.Sleep(1000);
         SavePVMToDB(pvm);
         db                = new FESContext();
         claimFile         = db.ClaimFiles.Find(id);
         claimFile.Parsed  = true;
         claimFile.DocType = pvm.cf.fh.lsdch[0].ClaimType;
         if (claimFile != null)
         {
             try
             {
                 db.ClaimFiles.Attach(claimFile);
                 db.Entry(claimFile).State = EntityState.Modified;
                 db.SaveChanges();
             }
             catch (Exception ex)
             {
                 throw;
             }
         }
         return(Request.IsAjaxRequest()
             ? (ActionResult)PartialView("FileList", db.ClaimFiles.ToList())
             : RedirectToAction("index"));
         //return View(pvm);
     }
     catch (Exception ex)
     {
         return(View("Error", new HandleErrorInfo(ex, "ClaimFiles", "Index")));
     }
 }
示例#4
0
 private Boolean Parse(int?id, string sPath)
 {
     try
     {
         ParsedViewModel pvm = new ParsedViewModel();
         if (id == null)
         {
             return(false);
         }
         ClaimFile claimFile = db.ClaimFiles.Find(id);
         if (claimFile == null)
         {
             return(false);
         }
         string sSource = System.IO.File.ReadAllText(sPath);
         pvm.cf    = claimFile;
         pvm.cf.fh = claimFile.Parse(sSource);
         SavePVMToDB(pvm);
         db                = new FESContext();
         claimFile         = db.ClaimFiles.Find(id);
         claimFile.Parsed  = true;
         claimFile.DocType = pvm.cf.fh.lsdch[0].ClaimType;
         if (claimFile != null)
         {
             try
             {
                 db.ClaimFiles.Attach(claimFile);
                 db.Entry(claimFile).State = EntityState.Modified;
                 db.SaveChanges();
             }
             catch (Exception ex)
             {
                 throw ex;
             }
         }
         return(true);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
示例#5
0
        private void SavePVMToDB(ParsedViewModel pvm)
        {
            try
            {
                List <FileFieldValue> ls = new List <FileFieldValue>();
                int iRecordSeq           = 0;
                int FileID = pvm.cf.FileID;
                foreach (Field f in pvm.cf.fh.lsFields)
                {
                    FileFieldValue ffv = new FileFieldValue();
                    ffv.FileID         = FileID;
                    ffv.FieldID        = f.FieldID;
                    ffv.value          = f.Value;
                    ffv.ts             = DateTime.Now;
                    ffv.recordType     = f.RecordType;
                    ffv.recordSequence = iRecordSeq;
                    ls.Add(ffv);
                }
                iRecordSeq++;
                foreach (ClaimHeader ch in pvm.cf.fh.lsdch)
                {
                    foreach (Field f in ch.lsFields)
                    {
                        FileFieldValue ffv = new FileFieldValue();
                        ffv.FileID         = FileID;
                        ffv.FieldID        = f.FieldID;
                        ffv.value          = f.Value;
                        ffv.ts             = DateTime.Now;
                        ffv.recordType     = f.RecordType;
                        ffv.recordSequence = iRecordSeq;
                        ls.Add(ffv);
                    }
                    iRecordSeq++;
                    foreach (Field f in ch.ph.lsFields)
                    {
                        FileFieldValue ffv = new FileFieldValue();
                        ffv.FileID         = FileID;
                        ffv.FieldID        = f.FieldID;
                        ffv.value          = f.Value;
                        ffv.ts             = DateTime.Now;
                        ffv.recordType     = f.RecordType;
                        ffv.recordSequence = iRecordSeq;
                        ls.Add(ffv);
                    }
                    iRecordSeq++;
                    foreach (ClaimDetail cd in ch.lscd)
                    {
                        foreach (Field f in cd.lsFields)
                        {
                            FileFieldValue ffv = new FileFieldValue();
                            ffv.FileID         = FileID;
                            ffv.FieldID        = f.FieldID;
                            ffv.value          = f.Value;
                            ffv.ts             = DateTime.Now;
                            ffv.recordType     = f.RecordType;
                            ffv.recordSequence = iRecordSeq;
                            ls.Add(ffv);
                        }
                        iRecordSeq++;
                        foreach (Field f in cd.pd.lsFields)
                        {
                            FileFieldValue ffv = new FileFieldValue();
                            ffv.FileID         = FileID;
                            ffv.FieldID        = f.FieldID;
                            ffv.value          = f.Value;
                            ffv.ts             = DateTime.Now;
                            ffv.recordType     = f.RecordType;
                            ffv.recordSequence = iRecordSeq;
                            ls.Add(ffv);
                        }
                        iRecordSeq++;
                    }
                }

                for (int i = 0; i < iRecordSeq; i++)
                {
                    Utility.SendProgress("Saving Claims to DB...", i, iRecordSeq);
                    using (SqlConnection sc = new SqlConnection(ConfigurationManager.ConnectionStrings["FESSiteContext"].ConnectionString))
                    {
                        sc.Open();
                        InsertFileFieldValues(sc, ls.Where(x => x.recordSequence == i));
                        sc.Close();
                    }
                }
                Utility.SendProgress("Saving Claims to DB...", iRecordSeq, iRecordSeq);
            }
            catch (Exception e)
            {
                Utility.SendProgress("Saving Claims to DB...", 1, 1);
                throw e;
            }
        }
示例#6
0
 private void SavePVMToDB(ParsedViewModel pvm)
 {
     try
     {
         List <FileFieldValue> ls = new List <FileFieldValue>();
         int iRecordSeq           = 0;
         int FileID = pvm.cf.FileID;
         foreach (Field f in pvm.cf.fh.lsFields)
         {
             FileFieldValue ffv = new FileFieldValue();
             ffv.FileID         = FileID;
             ffv.FieldID        = f.FieldID;
             ffv.value          = f.Value;
             ffv.ts             = DateTime.Now;
             ffv.recordType     = f.RecordType;
             ffv.recordSequence = iRecordSeq;
             ls.Add(ffv);
         }
         iRecordSeq++;
         foreach (ClaimHeader ch in pvm.cf.fh.lsdch)
         {
             foreach (Field f in ch.lsFields)
             {
                 FileFieldValue ffv = new FileFieldValue();
                 ffv.FileID         = FileID;
                 ffv.FieldID        = f.FieldID;
                 ffv.value          = f.Value;
                 ffv.ts             = DateTime.Now;
                 ffv.recordType     = f.RecordType;
                 ffv.recordSequence = iRecordSeq;
                 ls.Add(ffv);
             }
             iRecordSeq++;
             foreach (Field f in ch.ph.lsFields)
             {
                 FileFieldValue ffv = new FileFieldValue();
                 ffv.FileID         = FileID;
                 ffv.FieldID        = f.FieldID;
                 ffv.value          = f.Value;
                 ffv.ts             = DateTime.Now;
                 ffv.recordType     = f.RecordType;
                 ffv.recordSequence = iRecordSeq;
                 ls.Add(ffv);
             }
             iRecordSeq++;
             foreach (ClaimDetail cd in ch.lscd)
             {
                 foreach (Field f in cd.lsFields)
                 {
                     FileFieldValue ffv = new FileFieldValue();
                     ffv.FileID         = FileID;
                     ffv.FieldID        = f.FieldID;
                     ffv.value          = f.Value;
                     ffv.ts             = DateTime.Now;
                     ffv.recordType     = f.RecordType;
                     ffv.recordSequence = iRecordSeq;
                     ls.Add(ffv);
                 }
                 iRecordSeq++;
                 foreach (Field f in cd.pd.lsFields)
                 {
                     FileFieldValue ffv = new FileFieldValue();
                     ffv.FileID         = FileID;
                     ffv.FieldID        = f.FieldID;
                     ffv.value          = f.Value;
                     ffv.ts             = DateTime.Now;
                     ffv.recordType     = f.RecordType;
                     ffv.recordSequence = iRecordSeq;
                     ls.Add(ffv);
                 }
                 iRecordSeq++;
             }
         }
         if (ls.Count > 0)
         {
             using (SqlConnection sc = new SqlConnection(ConfigurationManager.ConnectionStrings["FESSiteContext"].ConnectionString))
             {
                 sc.Open();
                 InsertFileFieldValues(sc, ls);
                 sc.Close();
             }
         }
     }
     catch (Exception e)
     {
         throw e;
     }
 }