Exemplo n.º 1
0
 private void SetCarInModel(CarInRecord carInRecord)
 {
     CarOutModel             = new CarOutModel();
     CarOutModel.CarInRecord = carInRecord;
     CarOutModel.OutTime     = DateTime.Now;
     Init(true);
     SetUIModel(CarOutModel, CarOutModel.Receivable);
 }
Exemplo n.º 2
0
        public CarInRecord CarIn(CarInModel carIn, PermissionResult permissionResult)
        {
            var carInRecord = new CarInRecord()
            {
                CarNumber = carIn.CarNumber, InType = carIn.InOutType, InTime = carIn.InTime, CarUser = permissionResult.CarUser, CarPort = permissionResult.CarUser?.CarPorts.FirstOrDefault(), ParkId = carIn.Entrance.ParkLevel.Park.Id, IsMonthTempIn = permissionResult.IsMonthTempIn, CarInCount = permissionResult.CarInCount, CarInNumbers = permissionResult.CarInNumbers, CarInPermission = permissionResult.CarNumberPermission
            };
            var id = _carInRecordRepository.InsertAndGetId(carInRecord);

            _unitOfWorkManager.Current.SaveChanges();
            return(_carInRecordRepository.GetAllIncluding(x => x.CarPort, x => x.CarUser, x => x.Park).Where(x => x.Id == id).FirstOrDefault());
        }
Exemplo n.º 3
0
        public CarOutRecord CarOut(CarInRecord carIn, CarOutModel carOutModel)
        {
            var carOut = new CarOutRecord()
            {
                CarInCount           = carIn.CarInCount,
                ParkId               = carIn.ParkId,
                CarId                = carIn.CarId,
                CarNumber            = carIn.CarNumber,
                InTime               = carIn.InTime,
                Pay                  = carOutModel.Pay,
                Receivable           = carOutModel.Receivable,
                Remark               = carOutModel.Remark,
                CarPortId            = carIn.CarPortId,
                IsMonthTempIn        = carIn.IsMonthTempIn,
                TempConvertMonthTime = carIn.TempConvertMonthTime,
                PayType              = carOutModel.PayType,
                OfferTime            = carOutModel.OfferTime,
                OfferMoney           = carOutModel.OfferMoney,
                CarInPhotoId         = carIn.CarInPhotoId,
                CarOutPhotoId        = carOutModel.ImageId,
                InCloudId            = carIn.CloudId,
                IsMonthTimeOutInt    = carIn.IsMonthTimeOutInt,
                InType               = carIn.InType,
                IsErrorOut           = carOutModel.IsErrorOut,
                OutTime              = carOutModel.OutTime,
                OutPhotoTime         = carOutModel.OutPhotoTime
            };

            _carInRecordRepository.Delete(carIn.Id);

            var id = _carOutRecordRepository.InsertAndGetId(carOut);

            _unitOfWorkManager.Current.SaveChanges();


            var outRecord = _carOutRecordRepository.GetAllIncluding(x => x.CarPort, x => x.CarUser, x => x.Park).Where(x => x.Id == id).FirstOrDefault();


            _eventBus.Trigger(new CarOutRecordCreateedEventData()
            {
                CarOutRecord = outRecord
            });

            return(outRecord);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 入场信息
        /// </summary>
        /// <param name="carInRecord"></param>
        /// <returns></returns>
        public Task SetInfo(CarInRecord carInRecord)
        {
            var tempCarport = carInRecord.CarUser?.CarPorts?.Where(z => z.StartTime <= DateTime.Now && z.EndTime >= DateTime.Now);

            synchronizationContext.Post(x =>
            {
                txt_CarNumber.Text     = carInRecord.CarNumber;
                txt_CarInCount.Text    = carInRecord.CarInCount.ToString();
                txt_CarportsCount.Text = tempCarport == null ? "0" : tempCarport.Count().ToString();
                txt_InTime.Text        = carInRecord.InTime.ToString("yyyy-MM-dd hh:mm:ss");
                txt_RematingDays.Text  = tempCarport == null ? "0" : (tempCarport.Max(c => c.EndTime) - DateTime.Now).TotalDays.ToString();
                txt_CarType.Text       = tempCarport == null ? "临时车" : tempCarport.First().CarPortType.CustomName;
                txt_UserName.Text      = carInRecord.CarUser?.Name;
                txt_OutTime.Text       = "";
                txt_RematingDays.Text  = tempCarport == null ? "0" : ((int)(tempCarport.Max(c => c.EndTime) - DateTime.Now).TotalDays).ToString();
            }, null);


            return(Task.CompletedTask);
        }
Exemplo n.º 5
0
 public Task SetInfo(long entranceId, CarInRecord carInRecord)
 {
     return(SetInfo(carInRecord));
 }