public ConverterTimeSlot(int id, ConverterDentist dentist, int hour, int min, int day)
 {
     this.id      = id;
     this.dentist = dentist;
     this.hour    = hour;
     this.minute  = min;
     this.day     = day;
 }
Пример #2
0
        public override string GetJson(object o)
        {
            var t = o as TimeSlot;

            CheckNull(t);
            var d  = t.GetDentist();
            var dc = new ConverterDentist(d.GetID(), d.GetName(), d.GetEmail(), d.GetPhone());

            return(JsonConvert.SerializeObject(new ConverterTimeSlot(t.GetID(), dc, t.GetHour(), t.GetMin(), t.GetDay())));
        }
        public override string GetJson(object o)
        {
            var lts = o as List <TimeSlot>;
            var cdl = new List <ConverterTimeSlot>();

            CheckNull(lts);
            foreach (var t in lts)
            {
                var d  = t.GetDentist();
                var dc = new ConverterDentist(d.GetID(), d.GetName(), d.GetEmail(), d.GetPhone());
                cdl.Add(new ConverterTimeSlot(t.GetID(), dc, t.GetHour(), t.GetMin(), t.GetDay()));
            }
            return(JsonConvert.SerializeObject(cdl));
        }
        public override string GetJson(object o)
        {
            var a = o as Appointment;

            CheckNull(a);
            var at   = a.GetAppointmentType();
            var cat  = new ConverterAppointmentType(at.GetID(), at.GetDescription(), at.GetCost());
            var ts   = a.GetTimeSlot();
            var den  = ts.GetDentist();
            var cDen = new ConverterDentist(den.GetID(), den.GetName(), den.GetEmail(), den.GetPhone());
            var cts  = new ConverterTimeSlot(ts.GetID(), cDen, ts.GetHour(), ts.GetMin(), ts.GetDay());

            return(JsonConvert.SerializeObject(new ConverterAppointment(a.GetID(), cat, cts, a.GetExpectedDate())));
        }