public async Task <HolidayDate> GetHolidayDate(string tglRegis)
        {
            List <HolidayDate> holidayDateList = new List <HolidayDate>();
            HolidayDate        holidayDate     = new HolidayDate();
            var uri = new Uri($"{urlWebServices}/getliburnasional/?dTanggal=" + tglRegis);

            try
            {
                var response = await client.GetAsync(uri);

                if (response.IsSuccessStatusCode)
                {
                    var content = await response.Content.ReadAsStringAsync();

                    holidayDateList = JsonConvert.DeserializeObject <List <HolidayDate> >(content);
                }
                else
                {
                    throw new Exception("Gagal Mengambil Libur Nasional");
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            for (int i = 0; i < holidayDateList.Count; i++)
            {
                holidayDate.deskripsiresponse = holidayDateList[i].deskripsiresponse;
                holidayDate.libur             = holidayDateList[i].libur;
                holidayDate.response          = holidayDateList[i].response;
            }
            return(holidayDate);
        }
Exemple #2
0
        public ActionResult RemoveHolidayDate(int id)
        {
            using (MTCDbContext db = new MTCDbContext())
            {
                var response = new TransactionResult();
                try
                {
                    HolidayDate holidayDate = db.HolidayDates.Find(id);
                    if (holidayDate != null)
                    {
                        var holidayScheduleIds = db.HolidaySchedules.Where(p => p.HolidayDateId == id).Select(p => p.Id).ToList();
                        db.BeatHolidaySchedules.RemoveRange(db.BeatHolidaySchedules.Where(p => holidayScheduleIds.Contains(p.HolidayScheduleId)));
                        db.HolidaySchedules.RemoveRange(db.HolidaySchedules.Where(p => p.HolidayDateId == id));
                        db.HolidayDates.Remove(holidayDate);

                        db.SaveChanges();
                    }

                    response.HasError = false;
                    response.Message  = String.Empty;
                }
                catch (Exception ex)
                {
                    response.HasError = true;
                    response.Message  = ex.InnerException.Message;
                }

                return(Json(response, JsonRequestBehavior.AllowGet));
            }
        }
        private async void btnDaftar_Clicked(object sender, EventArgs e)
        {
            holidayDate = await GetHolidayDateTask(dtTglPeriksa.Date.ToString());

            if (holidayDate.deskripsiresponse.ToLower() != ("ok"))
            {
                await PopupNavigation.Instance.PushAsync(new DialogAlertCustom("Informasi", holidayDate.response));

                return;
            }

            if ((txtKlinik.Text == "") || (App.KodeKlinikRegis == ""))
            {
                await PopupNavigation.Instance.PushAsync(new DialogAlertCustom("Warning", "Klinik Belum Dipilih!!"));

                return;
            }
            if ((txtDokter.Text == "") || (App.KodeDokterRegis == ""))
            {
                await PopupNavigation.Instance.PushAsync(new DialogAlertCustom("Warning", "Dokter Belum dipilih!!"));

                return;
            }
            string textKonfirmasi = "Apakah Anda Yakin Mendaftar Pada Tgl: " + dtTglPeriksa.Date.ToShortDateString().Trim() + " , Klinik : " + txtKlinik.Text.Trim() + ", Dokter : " + txtDokter.Text.Trim();
            bool   answer         = await DisplayAlert("Konfirmasi", textKonfirmasi, "Yes", "Cancel");

            if (answer)
            {
                doRegistration();
            }
        }
        private async Task <HolidayDate> GetHolidayDateTask(string tglRegis)
        {
            RegistrationServices registrationServices = new RegistrationServices();
            HolidayDate          holidayList          = await registrationServices.GetHolidayDate(tglRegis);

            return(holidayList);
        }
        public JsonResult Insert([FromBody] HolidayModel obj)
        {
            var msg = new JMessage()
            {
                Error = false, Title = ""
            };

            try
            {
                var holiday = new HolidayDate
                {
                    CalendarDay = DateTime.ParseExact(obj.CalendarDay, "dd/MM/yyyy", CultureInfo.InvariantCulture),
                    LunarDay    = DateTime.ParseExact(obj.LunarDay, "dd/MM/yyyy", CultureInfo.InvariantCulture),
                    DayOfWeek   = obj.DayOfWeek,
                    Note        = obj.Note,
                    CreatedTime = DateTime.Now
                };
                _context.HolidayDates.Add(holiday);
                _context.SaveChanges();
                msg.Title = String.Format(CommonUtil.ResourceValue("COM_MSG_ADD_SUCCESS"), CommonUtil.ResourceValue("ADM_DAYOFF_TITLE_INFORMATION_DAYOFF"));
            }
            catch (Exception ex)
            {
                msg.Error = true;
                msg.Title = String.Format(CommonUtil.ResourceValue("COM_MSG_ADD_FAILED"), CommonUtil.ResourceValue("ADM_DAYOFF_TITLE_INFORMATION_DAYOFF"));
            }
            return(Json(msg));
        }
        public RegistrationForm()
        {
            InitializeComponent();
            dateUtil    = new DateUtil();
            holidayDate = new HolidayDate();

            setDatePickerValue();
            setDataPasien();
        }
Exemple #7
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sdate"> 日期的格式,20180901</param>
        /// <returns></returns>
        private DateType  GetDateType(string sdate)
        {
            DateType    dt          = new DateType();
            string      response    = HttpGet(url + sdate);
            HolidayDate holidaydate = JsonConvert.DeserializeObject <HolidayDate>(response);

            dt = (DateType)holidaydate.Date;
            return(dt);
        }
Exemple #8
0
        public string getDaysUntil()
        {
            DateTime currentDate = DateTime.Today;

            if (HolidayDate.DayOfYear < currentDate.DayOfYear)
            {
                HolidayDate = HolidayDate.AddYears(1);
            }

            int numDays = (HolidayDate - currentDate).Days;

            return(Convert.ToString(numDays));
        }
Exemple #9
0
        public ActionResult SaveHolidayDate(ScheduleDateViewModel model)
        {
            using (MTCDbContext db = new MTCDbContext())
            {
                HolidayDate holidayDate = null;
                bool        isNew       = false;
                if (model.Id > 0)
                {
                    holidayDate = db.HolidayDates.Find(model.Id);
                }
                else
                {
                    holidayDate           = new HolidayDate();
                    holidayDate.CreatedOn = DateTime.Now;
                    holidayDate.CreatedBy = HttpContext.User.Identity.Name;
                    isNew = true;
                }

                if (model.Times != null)
                {
                    foreach (var time in model.Times)
                    {
                        if (db.HolidaySchedules.Any(p => p.HolidayDateId == holidayDate.Id && p.ScheduleName == time.ScheduleName))
                        {
                            var holidaySchedule = db.HolidaySchedules.FirstOrDefault(p => p.HolidayDateId == holidayDate.Id && p.ScheduleName == time.ScheduleName);
                            holidaySchedule.StartTime  = TimeSpan.Parse(time.StartTime);
                            holidaySchedule.EndTime    = TimeSpan.Parse(time.EndTime);
                            holidaySchedule.ModifiedBy = HttpContext.User.Identity.Name;
                            holidaySchedule.ModifiedOn = DateTime.Now;
                        }
                        else
                        {
                            db.HolidaySchedules.Add(new HolidaySchedule
                            {
                                HolidayDateId = holidayDate.Id,
                                ScheduleId    = Guid.NewGuid(),
                                ScheduleName  = time.ScheduleName,
                                StartTime     = TimeSpan.Parse(time.StartTime),
                                EndTime       = TimeSpan.Parse(time.EndTime),
                                CreatedBy     = HttpContext.User.Identity.Name,
                                ModifiedBy    = HttpContext.User.Identity.Name,
                                CreatedOn     = DateTime.Now,
                                ModifiedOn    = DateTime.Now
                            });
                        }
                    }
                }


                holidayDate.Name         = model.Name;
                holidayDate.Abbreviation = model.Abbreviation;
                holidayDate.Date         = model.Date;

                holidayDate.ModifiedOn = DateTime.Now;
                holidayDate.ModifiedBy = HttpContext.User.Identity.Name;

                if (isNew)
                {
                    db.HolidayDates.Add(holidayDate);
                }

                db.SaveChanges();

                return(Json(true, JsonRequestBehavior.AllowGet));
            }
        }
Exemple #10
0
 public override int GetHashCode()
 {
     return(HolidayDate.GetHashCode());
 }