Example #1
0
        public async Task <ActionResult> Save(ScheduleDetailViewModel model)
        {
            using (ScheduleDetailServiceClient client = new ScheduleDetailServiceClient())
            {
                ScheduleDetail obj = new ScheduleDetail()
                {
                    Key = new ScheduleDetailKey()
                    {
                        ScheduleName = model.ScheduleName,
                        ShiftName    = model.ShiftName
                    },
                    Editor     = User.Identity.Name,
                    EditTime   = DateTime.Now,
                    CreateTime = DateTime.Now,
                    Creator    = User.Identity.Name
                };
                MethodReturnResult rst = await client.AddAsync(obj);

                if (rst.Code == 0)
                {
                    rst.Message = string.Format(FMMResources.StringResource.ScheduleDetail_Save_Success
                                                , obj.Key);
                }
                return(Json(rst));
            }
        }
Example #2
0
 void populateShedule()
 {
     scheduleDetailObj = (ScheduleDetailViewModel)NavigationService.GetNavigationData();
     this.DataContext  = scheduleDetailObj;
     populateConnectedTrain(scheduleDetailObj.connectedTrain);
     populateTicketPrice(scheduleDetailObj.startStationId.ToString(), scheduleDetailObj.endStationId.ToString());
 }
        public async Task <int> Transaction(ScheduleDetailViewModel data, char action)
        {
            var param  = Mapper.Map <Schedule>(data);
            var result = await _scheduleRepo.Transaction(param, action);

            return(result);
        }
Example #4
0
        ScheduleDetailViewModel getScheduleDetailObj(TRAINQUERY trainQuery, TrainsList trainList)
        {
            ScheduleDetailViewModel scheduleDetailObj = new ScheduleDetailViewModel();

            DateTime searchDate              = DateTime.ParseExact(trainQuery.searchDate, "yyyy-MM-dd", CultureInfo.InvariantCulture);
            DateTime dtArrivalTime           = DateTime.ParseExact(trainList.arrivalTime, "HH:mm:ss", CultureInfo.InvariantCulture);
            DateTime dtDepartureTime         = DateTime.ParseExact(trainList.depatureTime, "HH:mm:ss", CultureInfo.InvariantCulture);
            DateTime dtArrivalTimeEndStation = DateTime.ParseExact(trainList.arrivalTimeEndStation, "HH:mm:ss", CultureInfo.InvariantCulture);

            if (dtDepartureTime > dtArrivalTimeEndStation)
            {
                dtArrivalTimeEndStation = dtArrivalTimeEndStation.AddDays(1.0);
            }
            TimeSpan ts = dtArrivalTimeEndStation.Subtract(dtDepartureTime).Duration();

            string        arrivalTime               = dtArrivalTime.ToString("h:mm", CultureInfo.CurrentCulture);
            string        arrivalTimeEndStation     = dtArrivalTimeEndStation.ToString("h:mm", CultureInfo.CurrentCulture);
            string        departureTime             = dtDepartureTime.ToString("h:mm", CultureInfo.CurrentCulture);
            string        departureTimeZone         = dtDepartureTime.ToString("tt", CultureInfo.CurrentCulture);
            string        arrivalTimeZone           = dtArrivalTime.ToString("tt", CultureInfo.CurrentCulture);
            string        arrivalTimeEndStationZone = dtArrivalTimeEndStation.ToString("tt", CultureInfo.CurrentCulture);
            StringBuilder availableClasses          = new StringBuilder();

            foreach (ClassList value in trainList.classList)
            {
                if (availableClasses.ToString() == "")
                {
                    availableClasses.Append(value.className);
                }
                else
                {
                    availableClasses.Append(", " + value.className);
                }
            }

            scheduleDetailObj.startStationId        = trainQuery.startStaion;
            scheduleDetailObj.endStationId          = trainQuery.endStaion;
            scheduleDetailObj.detailHeader          = string.Format(APPCONTEXT.sheduleListHeader, trainList.startStationName, trainList.endStationName).ToLower();;
            scheduleDetailObj.departureTime         = string.Format(APPCONTEXT.sceduleDetailTimeHeader, searchDate.DayOfWeek.ToString(), departureTime, departureTimeZone);
            scheduleDetailObj.arrivalTime           = string.Format(APPCONTEXT.sceduleDetailTime, arrivalTime, arrivalTimeZone);
            scheduleDetailObj.arrivalTimeEndStation = string.Format(APPCONTEXT.sceduleDetailTime, arrivalTimeEndStation, arrivalTimeZone);
            scheduleDetailObj.travelTime            = String.Format(APPCONTEXT.sheduleListDuration, ts.ToString(@"hh\:mm"));
            scheduleDetailObj.trainFrequncy         = AppUtility.ToCamelCase(trainList.trainFrequncy);
            scheduleDetailObj.startStationName      = AppUtility.ToCamelCase(trainList.startStationName);
            scheduleDetailObj.endStationName        = AppUtility.ToCamelCase(trainList.endStationName);
            scheduleDetailObj.finalStationName      = AppUtility.ToCamelCase(trainList.finalStationName);
            scheduleDetailObj.trainType             = AppUtility.ToCamelCase(trainList.trainType);
            scheduleDetailObj.trainName             = AppUtility.ToCamelCase(trainList.trainName.Equals("") ? "Not Available" : trainList.trainName);
            scheduleDetailObj.classList             = availableClasses.ToString();

            return(scheduleDetailObj);
        }
Example #5
0
        private void lsSearchResult_Tap(object sender, System.Windows.Input.GestureEventArgs e)
        {
            TrainListViewModel trainList = (TrainListViewModel)(lsSearchResult.SelectedItem);

            if (trainList != null)
            {
                ScheduleDetailViewModel scheduleDetailObj = trainList.scheduleDetail;
                lsSearchResult.SelectedItem = null;
                if (trainList.trainTypeFlag == 1)
                {
                    NavigationService.Navigate(new Uri("/ScheduleDetailPage.xaml", UriKind.Relative), scheduleDetailObj);
                }
                else
                {
                    NavigationService.Navigate(new Uri("/ConnectedScheduleDetailPage.xaml", UriKind.Relative), scheduleDetailObj);
                }
            }
        }
Example #6
0
        ScheduleDetailViewModel getScheduleDetailObj(TRAINQUERY trainQuery, TrainsList2 trainList)
        {
            ScheduleDetailViewModel scheduleDetailObj = new ScheduleDetailViewModel();

            RecordHeader          recordHeader    = trainList.recordHeader[0];
            List <ConnectedTrain> connectedTrains = trainList.connectedTrains;

            DateTime dtArrivalTime           = DateTime.ParseExact(recordHeader.startArrivalTime, "HH:mm:ss", CultureInfo.InvariantCulture);
            DateTime dtDepartureTime         = DateTime.ParseExact(recordHeader.startDepartureTime, "HH:mm:ss", CultureInfo.InvariantCulture);
            DateTime dtArrivalTimeEndStation = DateTime.ParseExact(recordHeader.endArrivalTime, "HH:mm:ss", CultureInfo.InvariantCulture);
            TimeSpan ts = dtArrivalTimeEndStation.Subtract(dtDepartureTime).Duration();

            if (dtDepartureTime > dtArrivalTimeEndStation)
            {
                dtArrivalTimeEndStation = dtArrivalTimeEndStation.AddDays(1.0);
            }
            ConnetedTrainViewModel connectedTrain = new ConnetedTrainViewModel();


            string arrivalTime               = dtArrivalTime.ToString("h:mm", CultureInfo.CurrentCulture);
            string arrivalTimeEndStation     = dtArrivalTimeEndStation.ToString("h:mm", CultureInfo.CurrentCulture);
            string departureTime             = dtArrivalTime.ToString("h:mm", CultureInfo.CurrentCulture);
            string departureTimeZone         = dtDepartureTime.ToString("tt", CultureInfo.CurrentCulture);
            string arrivalTimeZone           = dtDepartureTime.ToString("tt", CultureInfo.CurrentCulture);
            string arrivalTimeEndStationZone = dtArrivalTimeEndStation.ToString("tt", CultureInfo.CurrentCulture);

            connectedTrain.connectedTrains = connectedTrains;

            scheduleDetailObj.startStationId        = trainQuery.startStaion;
            scheduleDetailObj.endStationId          = trainQuery.endStaion;
            scheduleDetailObj.detailHeader          = string.Format(APPCONTEXT.sheduleListHeader, recordHeader.startName, recordHeader.endName).ToLower();
            scheduleDetailObj.departureTime         = string.Format(APPCONTEXT.sceduleDetailTimeHeader, dtDepartureTime.DayOfWeek.ToString(), departureTime, departureTimeZone);
            scheduleDetailObj.arrivalTime           = string.Format(APPCONTEXT.sceduleDetailTime, arrivalTime, arrivalTimeZone);
            scheduleDetailObj.arrivalTimeEndStation = string.Format(APPCONTEXT.sceduleDetailTime, arrivalTimeEndStation, arrivalTimeZone);
            scheduleDetailObj.travelTime            = String.Format(APPCONTEXT.sheduleListDuration, ts.ToString(@"hh\:mm"));
            scheduleDetailObj.startStationName      = AppUtility.ToCamelCase(recordHeader.startName);
            scheduleDetailObj.endStationName        = AppUtility.ToCamelCase(recordHeader.endName);
            scheduleDetailObj.trainType             = APPCONTEXT.globalConnectedTrain;
            scheduleDetailObj.connectedTrain        = connectedTrain;

            return(scheduleDetailObj);
        }