コード例 #1
0
 private void CheckForHoursOfOperationNOtherMerchantInfo(MerchantBusinessInfoModel orgModel)
 {
     if (orgModel.HoursOfOperation == null || !orgModel.HoursOfOperation.Any())
     {
         orgModel.HoursOfOperation = AddEmptySchedule();
     }
     if (orgModel.HolidayHours == null || !orgModel.HolidayHours.Any())
     {
         orgModel.HolidayHours = AddEmptyHolidayHrsSchedule();
     }
     else
     {
         orgModel.HolidayHours.ToList().ForEach(x => x.HolidayDate = !string.IsNullOrEmpty(x.HolidayDate) ? (Convert.ToDateTime(x.HolidayDate)).ToShortDateString() : "");
     }
 }
コード例 #2
0
 private void CheckForMerchantTerminalNBusinessType(MerchantBusinessInfoModel orgModel)
 {
     if (orgModel.MerchantTerminal == null || !orgModel.MerchantTerminal.Any())
     {
         orgModel.MerchantTerminal = AddEmptyTerminal();
     }
     if (orgModel.MealPeriod == null || !orgModel.MealPeriod.Any())
     {
         orgModel.MealPeriod = AddEmptyMealPeriod();
     }
     else
     {
         var obj = new MealPeriodDto();
         obj.isSelected = true;
         obj.title      = "";
         obj.openTime   = TimeSpan.Parse("12:00");
         obj.closeTime  = TimeSpan.Parse("12:00");
         orgModel.MealPeriod.Insert(0, obj);
     }
 }
コード例 #3
0
        public async Task <MerchantBusinessInfoModel> GetMerchantBusinessInfo(string id)
        {
            MerchantBusinessInfoModel orgModel = new MerchantBusinessInfoModel();

            if (!string.IsNullOrEmpty(id))
            {
                using (var client = new HttpClient())
                {
                    HttpResponseMessage result = GetMerchantBusinessInfoData(id, client);
                    if (result.IsSuccessStatusCode)
                    {
                        var response = await result.Content.ReadAsAsync <ApiResponse>();

                        orgModel = MapResponseToModal(id, response);
                        CheckForHoursOfOperationNOtherMerchantInfo(orgModel);
                        CheckForMerchantTerminalNBusinessType(orgModel);
                        BindingDataForDrpDwnInViewBag(orgModel);
                    }
                }
            }
            return(orgModel);
        }
コード例 #4
0
        private void BindingDataForDrpDwnInViewBag(MerchantBusinessInfoModel orgModel)
        {
            List <WeekDayDto>     weekDaysList       = orgModel.WeekDays;
            List <SelectListItem> ddlWeekDayItemlist = weekDaysList.AsEnumerable().Select(c => new SelectListItem {
                Text = c.DayName, Value = c.DayName
            }).ToList();

            ViewBag.WeekDay = ddlWeekDayItemlist;
            List <DwellTimeDto>   dwelltime        = orgModel.DwellTime;
            List <SelectListItem> ddlDwellItemlist = dwelltime.AsEnumerable().Select(c => new SelectListItem {
                Text = c.Time, Value = c.Id.ToString()
            }).ToList();

            ViewBag.DwellTime = ddlDwellItemlist;

            List <TerminalTypeDto> terminalType            = orgModel.TerminalType;
            List <SelectListItem>  ddlTerminalTypeItemlist = terminalType.AsEnumerable().Select(c => new SelectListItem {
                Text = c.TerminalType, Value = c.Id.ToString()
            }).ToList();

            ViewBag.TerminalType = ddlTerminalTypeItemlist;
        }