コード例 #1
0
        public static async Task <tbScheduleData> UpSertSchedule(tbScheduleData schedule)
        {
            var            url    = "api/Doctor/UpsertSchedule";
            tbScheduleData result = await ApiRequest <tbScheduleData> .PostRequest(url, schedule);

            return(result);
        }
コード例 #2
0
        public static async Task <tbScheduleData> scheduledetaildelete(int ID)
        {
            var            url    = string.Format("api/Schedule/ScheduleDetailDelete?ID={0}", ID);
            tbScheduleData result = await ApiRequest <tbScheduleData> .GetRequest(url);

            return(result);
        }
コード例 #3
0
        public HttpResponseMessage UpsertSchedule(HttpRequestMessage request, tbScheduleData schedule)
        {
            string date     = schedule.AppointmentDatetime.Value.ToShortDateString();
            string fromtime = schedule.Fromtime.Value.ToShortTimeString();
            string totime   = schedule.Totime.Value.ToShortTimeString();

            fromtime = date + " " + fromtime;
            totime   = date + " " + totime;
            DateTime fromtimedate = DateTime.Parse(fromtime);
            DateTime totimedate   = DateTime.Parse(totime);

            tbScheduleData UpdatedEntity = null;

            if (schedule.ID > 0)
            {
                schedule.Fromtime            = fromtimedate;
                schedule.Totime              = totimedate;
                schedule.AppointmentDatetime = fromtimedate;
                UpdatedEntity = scheduledataRepo.UpdatewithObj(schedule);
            }
            else
            {
                schedule.IsDeleted           = false;
                schedule.Fromtime            = fromtimedate;
                schedule.Totime              = totimedate;
                schedule.AppointmentDatetime = fromtimedate;
                UpdatedEntity = scheduledataRepo.AddWithGetObj(schedule);
            }
            return(request.CreateResponse <tbScheduleData>(HttpStatusCode.OK, UpdatedEntity));
        }
コード例 #4
0
        public HttpResponseMessage limitAppointment(HttpRequestMessage request, int doctorid, int hospitalid, DateTime AppointmentDatetime, int toLimitQty, string Type = "2")
        {
            tbScheduleData scheduleData = scheduleDataRepo.Get().Where(a => a.DoctorID == doctorid && a.HospitalID == hospitalid && a.AppointmentDatetime == AppointmentDatetime && a.IsDeleted != true).FirstOrDefault();

            if (Type == "1")
            {
                scheduleData.MaxPatientCount = scheduleData.ReachedPatientCount + toLimitQty;
                scheduleData.IsLimited       = true;
                scheduleData = scheduleDataRepo.UpdatewithObj(scheduleData);
            }
            else
            {
                scheduleData.MaxPatientCount = toLimitQty;
                scheduleData.IsLimited       = true;
                scheduleData = scheduleDataRepo.UpdatewithObj(scheduleData);
            }
            if (scheduleData != null)
            {
                return(request.CreateResponse <string>(HttpStatusCode.OK, "S001"));
            }
            else
            {
                return(request.CreateResponse <string>(HttpStatusCode.OK, "E001"));
            }
        }
コード例 #5
0
        public async Task <ActionResult> scheduledetaildelete(int ID = 0)
        {
            tbScheduleData result = await DoctorApiRequestHelper.scheduledetaildelete(ID);

            if (result != null)
            {
                return(Json("Success", JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json("Fail", JsonRequestBehavior.AllowGet));
            }
        }
コード例 #6
0
        public async Task <ActionResult> UpSertSchedule(tbScheduleData schedule)
        {
            tbScheduleData result = await DoctorApiRequestHelper.UpSertSchedule(schedule);

            if (result != null)
            {
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json("Fail", JsonRequestBehavior.AllowGet));
            }
        }
コード例 #7
0
        public HttpResponseMessage ScheduleDelete(HttpRequestMessage request, int ID)
        {
            tbScheduleData UpdatedEntity = new tbScheduleData();

            tbScheduleData schedule = scheduleRepo.Get().Where(a => a.ID == ID).FirstOrDefault();

            schedule.IsDeleted = true;

            UpdatedEntity = scheduleRepo.UpdatewithObj(schedule);


            return(request.CreateResponse <tbScheduleData>(HttpStatusCode.OK, UpdatedEntity));
        }
コード例 #8
0
        public HttpResponseMessage UpSertGenerateSchedule(HttpRequestMessage request, DateTime?fromdatepicker = null, DateTime?todatepicker = null, int doctorid = 0, int hospitalid = 0, string hospitalname = null)
        {
            List <DateTime> days_list  = new List <DateTime>();
            DateTime        temp_start = fromdatepicker.Value.Date;
            DateTime        temp_end   = todatepicker.Value.Date;

            //temp_start = new DateTime(fromdatepicker.Value.Year, fromdatepicker.Value.Month, fromdatepicker.Value.Day);
            //temp_end = new DateTime(todatepicker.Value.Year, todatepicker.Value.Month, todatepicker.Value.Day);
            for (DateTime date = temp_start; date <= temp_end; date = date.AddDays(1))
            {
                days_list.Add(date);
            }

            List <tbScheduleData> schdatalist = new List <tbScheduleData>();

            foreach (var item in days_list)
            {
                var day = item.DayOfWeek.ToString();
                List <tbSchedule> schedules = dbContext.tbSchedules.Where(a => a.IsDeleted != true && a.DoctorID == doctorid).Where(iQueryService.daysQuery(day)).ToList();
                foreach (var sch in schedules)
                {
                    //added skip existed scheduledata
                    var            appointmentDatetime = HelperExtension.getCombinedDateTime(item, sch.Fromtime);
                    tbScheduleData existedData         = dbContext.tbScheduleDatas.Where(a => a.DoctorID == doctorid && a.HospitalID == hospitalid &&
                                                                                         a.AppointmentDatetime == appointmentDatetime).FirstOrDefault();
                    if (existedData == null)
                    {
                        tbScheduleData sd = new tbScheduleData();
                        sd.AppointmentDatetime = appointmentDatetime;  // HelperExtension.getCombinedDateTime(item, sch.Fromtime);
                        sd.Day                 = day;
                        sd.HospitalID          = hospitalid;
                        sd.HospitalName        = hospitalname;
                        sd.DoctorID            = doctorid;
                        sd.DoctorName          = dbContext.tbDoctors.Where(a => a.ID == doctorid).Select(a => a.Name).FirstOrDefault();
                        sd.ScheduleID          = sch.ID;
                        sd.Fromtime            = sch.Fromtime;
                        sd.Totime              = sch.Totime;
                        sd.MaxPatientCount     = sch.PatientLimit;
                        sd.DefaultPatientCount = sch.PatientLimit;
                        sd.AppointmentTime     = sch.Fromtime.Value.ToShortDateString();
                        sd = scheduledataRepo.AddWithGetObj(sd);
                    }
                }
            }
            return(request.CreateResponse <tbScheduleData>(HttpStatusCode.OK, null));
        }
コード例 #9
0
        public async Task <ActionResult> UpSertGenerateSchedule(DateTime?fromdatepicker = null, DateTime?todatepicker = null, int doctorid = 0)
        {
            int    hospitalid   = CookieHelper.getstaffHospitalID();
            string hospitalname = CookieHelper.getstaffHospitalName();

            ViewBag.hospitalid   = hospitalid;   // CareMeClient.Helper.CookieHelper.getstaffHospitalID();
            ViewBag.hospitalname = hospitalname; // CareMeClient.Helper.CookieHelper.getstaffHospitalName();

            tbScheduleData result = await DoctorApiRequestHelper.UpSertGenerateSchedule(fromdatepicker, todatepicker, doctorid, hospitalid, hospitalname);

            if (result == null)
            {
                return(Json("Success", JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json("Fail", JsonRequestBehavior.AllowGet));
            }
        }
コード例 #10
0
        public async Task <ActionResult> _ScheduleForm(string FormType, int ID, string docname = null, string hosname = null, int docid = 0, int hosid = 0)
        {
            tbScheduleData schedule = new tbScheduleData();

            schedule.DoctorName   = docname;
            schedule.HospitalName = hosname;
            schedule.DoctorID     = docid;
            schedule.HospitalID   = hosid;
            if (FormType == "Add")
            {
                return(PartialView("_ScheduleForm", schedule));
            }
            else
            {
                tbSchedule result = await DoctorApiRequestHelper.GetScheduleByID(ID);

                return(PartialView("_ScheduleForm", result));
            }
        }
コード例 #11
0
        public HttpResponseMessage getScheduleDetail(HttpRequestMessage request, int ID)
        {
            tbScheduleData schedule = scheduleRepo.Get().Where(a => a.ID == ID && a.IsDeleted != true).FirstOrDefault();

            return(request.CreateResponse <tbScheduleData>(HttpStatusCode.OK, schedule));
        }