Exemple #1
0
        public static string ResolveCheck(int checkNum)
        {
            string status;

            using (var dbCtx = new MSMEntities())
            {
                var longUnmatched = dbCtx.Set <ResearchCheck>();

                var check = (from lu in longUnmatched
                             where lu.Num == checkNum
                             select lu).FirstOrDefault();

                if (check == null)
                {
                    status = string.Format("<p>Could not find check with number {0} in research table.<p>", checkNum);
                }
                else
                {
                    longUnmatched.Remove(check);
                    dbCtx.SaveChanges();
                    status = string.Format("<p>Removed from research table:<br/>&nbsp;&nbsp;&nbsp;Date: {0}<br/>&nbsp;&nbsp;&nbsp;Record ID: {1}<br/>&nbsp;&nbsp;&nbsp;Interview Record ID: {2}<br/>&nbsp;&nbsp;&nbsp;Name: {3}<br/>&nbsp;&nbsp;&nbsp;Check number: {4}<br/>&nbsp;&nbsp;&nbsp;Service: {5}</p>", check.Date.ToString("d"), check.RecordID, check.InterviewRecordID, check.Name, check.Num, check.Service);
                }

                return(status);
            }
        }
Exemple #2
0
        private static void AppendToResearchChecks(List <Check> checks)
        {
            using (var dbCtx = new MSMEntities())
            {
                var longUnmatched = dbCtx.Set <ResearchCheck>();

                foreach (Check check in checks)
                {
                    ResearchCheck existing = (from c in longUnmatched
                                              where c.Num == check.Num
                                              select c).FirstOrDefault();

                    if (existing == null && !IsKnownDisposition(check.Num))
                    {
                        ResearchCheck unm = new ResearchCheck
                        {
                            RecordID          = check.RecordID,
                            InterviewRecordID = check.InterviewRecordID,
                            Num     = check.Num,
                            Name    = check.Name,
                            Date    = check.Date,
                            Service = check.Service,
                            Matched = false
                        };

                        longUnmatched.Add(unm);
                    }
                }

                dbCtx.SaveChanges();
            }
        }
Exemple #3
0
 private static void DeleteMarkedChecks()
 {
     using (var dbCtx = new MSMEntities())
     {
         dbCtx.ResearchChecks.RemoveRange(dbCtx.ResearchChecks.Where(lu => lu.Matched == true));
         dbCtx.SaveChanges();
     }
 }
Exemple #4
0
        public static void MarkResolvedChecks()
        {
            using (var dbCtx = new MSMEntities())
            {
                var longUnmatched = dbCtx.Set <ResearchCheck>();

                foreach (ResearchCheck lu in longUnmatched)
                {
                    if (IsResolved(lu.Num) || IsResolved(-lu.Num))
                    {
                        lu.Matched = true;
                    }
                }

                dbCtx.SaveChanges();
            }
        }