コード例 #1
0
ファイル: Visits.cs プロジェクト: tmhsplb/OPIDDaily
        private static VisitViewModel RCheckToVisitViewModel(RCheck rcheck, string[] msgs)
        {
            DateTime?rdate = rcheck.Date;
            DateTime date;

            if (rdate == null)
            {
                date = new DateTime(1900, 1, 1);
            }
            else
            {
                date = (DateTime)rdate;
            }

            return(new VisitViewModel
            {
                Id = rcheck.Id,
                Date = date.AddHours(12),
                //  Conversation = (HavingConversation(rcheck.Id) ? "Y" : string.Empty),
                Item = NormalizedService(rcheck.Service),
                Check = (rcheck.Num == 0 ? string.Empty: rcheck.Num.ToString()),
                Status = rcheck.Disposition,
                Notes = rcheck.Notes,
                Sender = MostRecentSender(rcheck.Id)
            });
        }
コード例 #2
0
ファイル: Visits.cs プロジェクト: tmhsplb/OPIDDaily
        public static void EditVisit(int nowServing, VisitViewModel vvm)
        {
            using (OpidDailyDB opiddailycontext = new OpidDailyDB())
            {
                Client client = opiddailycontext.Clients.Find(nowServing);

                if (client != null)
                {
                    AncientCheck ancientCheck = opiddailycontext.AncientChecks.Find(vvm.Id);

                    if (ancientCheck != null)
                    {
                        ancientCheck.Date        = vvm.Date;
                        ancientCheck.Num         = Convert.ToInt32(vvm.Check);
                        ancientCheck.Service     = vvm.Item;
                        ancientCheck.Disposition = vvm.Status;
                        ancientCheck.Notes       = vvm.Notes;
                        opiddailycontext.SaveChanges();
                        return;
                    }

                    RCheck rcheck = opiddailycontext.RChecks.Find(vvm.Id);

                    if (rcheck != null)
                    {
                        rcheck.Date        = vvm.Date;
                        rcheck.Num         = Convert.ToInt32(vvm.Check);
                        rcheck.Service     = vvm.Item;
                        rcheck.Disposition = vvm.Status;
                        rcheck.Notes       = vvm.Notes;
                        opiddailycontext.SaveChanges();
                        return;
                    }

                    PocketCheck pcheck = opiddailycontext.PocketChecks.Find(vvm.Id);

                    if (pcheck != null)
                    {
                        pcheck.Date        = vvm.Date;
                        pcheck.Item        = vvm.Item;
                        pcheck.Num         = Convert.ToInt32(vvm.Check);
                        pcheck.Disposition = vvm.Status;
                        pcheck.Notes       = vvm.Notes;
                        opiddailycontext.SaveChanges();
                        return;
                    }
                }
            }
        }
コード例 #3
0
ファイル: DataManager.cs プロジェクト: tmhsplb/OPIDChecks
        private static void AppendToResearchChecks(List <Check> checks)
        {
            try
            {
                using (OpidDB opidcontext = new OpidDB())
                {
                    foreach (Check check in checks)
                    {
                        RCheck existing = opidcontext.RChecks.Where(u => u.Num == check.Num).FirstOrDefault();

                        if (existing == null) // && string.IsNullOrEmpty(check.Clr))
                        {
                            RCheck rcheck = new RCheck
                            {
                                RecordID           = check.RecordID,
                                sRecordID          = check.RecordID.ToString(),
                                InterviewRecordID  = check.InterviewRecordID,
                                sInterviewRecordID = check.InterviewRecordID.ToString(),
                                Num         = check.Num,
                                sNum        = check.Num.ToString(),
                                Name        = check.Name,
                                Date        = check.Date,
                                sDate       = check.Date.ToString("MM/dd/yyyy"),
                                Service     = check.Service,
                                Disposition = check.Disposition,
                            };

                            opidcontext.RChecks.Add(rcheck);
                        }
                        else if (!string.IsNullOrEmpty(check.Disposition))
                        {
                            // The existing check may have its disposition
                            // changed to, for example, Voided/Replaced.
                            // If a file of voided checks contains a check with number existing.Num
                            // then this change of disposition will protect this check from having its status
                            // in Apricot changed from Voided/Replaced to Voided
                            existing.Disposition = check.Disposition;
                        }
                    }

                    opidcontext.SaveChanges();
                }
            }
            catch (Exception e)
            {
            }
        }