示例#1
0
        private static VisitViewModel AncientCheckToVisitViewModel(AncientCheck ancientCheck, string[] msgs)
        {
            DateTime?adate = ancientCheck.Date;
            DateTime date;

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

            return(new VisitViewModel
            {
                Id = ancientCheck.Id,
                Date = date.AddHours(12),
                //  Conversation = (HavingConversation(ancientCheck.Id) ? "Y" : string.Empty),
                Item = NormalizedService(ancientCheck.Service),
                Check = (ancientCheck.Num == 0 ? string.Empty : ancientCheck.Num.ToString()),
                Status = ancientCheck.Disposition,
                Notes = ancientCheck.Notes,
                Sender = MostRecentSender(ancientCheck.Id)
            });
        }
示例#2
0
        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;
                    }
                }
            }
        }