Ejemplo n.º 1
0
        public string UpdateMission(TruckInfoDto input)
        {
            try
            {
                Logger.Info("Updating a task for input: " + input);

                var updateTask = Mapper.Map <TruckInfo>(input);
                _TruckInfoRepository.InsertOrUpdate(updateTask);
            }
            catch
            { return("修改失败"); }
            return("修改成功");
        }
Ejemplo n.º 2
0
        public long CreateMissionQ(TruckInfoDto input)
        {
            try
            {
                Logger.Info("Creating a task for input: " + input);
                // input.TruckID = Snowflake.Instance().GetId();
                input.Id = input.TruckID;
                var  task   = Mapper.Map <TruckInfo>(input);
                long result = _TruckInfoRepository.InsertAndGetId(task);
                return(result);
            }
            catch
            { return(404); }


            //throw new NotImplementedException();
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 添加车辆
        /// </summary>
        /// <param name="truck">车辆信息</param>
        /// <returns></returns>
        public async Task CreateTruck(TruckInfoDto truck)
        {
            var mytruck = new Model.TruckInfo()
            {
                Price           = truck.Price,
                TruckModel      = truck.TruckModel,
                TruckType       = truck.TruckType,
                TruckClass      = truck.TruckClass,
                TruckSize       = truck.TruckSize,
                Wheelbase       = truck.Wheelbase,
                AxlesNum        = truck.AxlesNum,
                TruckLength     = truck.TruckLength,
                TruckWidth      = truck.TruckWidth,
                TruckHeight     = truck.TruckHeight,
                TruckWeight     = truck.TruckWeight,
                Load            = truck.Load,
                TotalWeight     = truck.TotalWeight,
                CarrierNum      = truck.CarrierNum,
                Exhaust         = truck.Exhaust,
                LicencePlate    = truck.LicencePlate,
                PlateProvince   = truck.PlateProvince,
                ContainerType   = truck.ContainerType,
                ContainerLength = truck.ContainerLength,
                ContainerWidth  = truck.ContainerWidth,
                ContainerHeight = truck.ContainerHeight,
                WebsiteId       = truck.AffiliationId
            };

            using (var truckInfoService = new TruckInfoService())
            {
                await truckInfoService.CreateAsync(mytruck);
            }

            using (var truckStateService = new TruckStateService())
            {
                await truckStateService.CreateAsync(new Model.TruckState()
                {
                    TruckId  = mytruck.Id,
                    Location = truck.InitLocation
                });
            }
        }
Ejemplo n.º 4
0
        public string CreateMission(TruckInfoDto input)
        {
            try
            {
                input.TruckID = Snowflake.Instance().GetId();
                input.Id      = input.TruckID;
                var task = Mapper.Map <TruckInfo>(input);

                var result = _TruckInfoRepository.Insert(task);
            }
            catch
            { return("新增失败"); }

            return("新增成功");
            //记录日志,Logger定义在ApplicationService中
            //Logger.Info("Creating a new task with description: " + input.TruckInsuranceNum);
            //获取本地化文本(L是LocalizationHelper.GetString(...)的简便版本, 定义在 ApplicationService类型)
            // var text = L("SampleLocalizableTextKey");
            //TODO: Add new task to database...
        }