示例#1
0
        public WorkerStatusDTO ChangeStatus(UserDTO Driver, DriverWorkingStatusEnum newStatus, DateTime? blockTime = null, string message = null)
        {
            var driver = Mapper.Map<User>(Driver);
            var driverStatus = uOW.WorkerStatusRepo.All.Where(o => o.WorkerId == Driver.Id).FirstOrDefault();

            if (driverStatus != null)
            {
                driverStatus.WorkingStatus = newStatus;
                if (blockTime != null)
                    driverStatus.BlockTime = blockTime;
                if (message != null)
                    driverStatus.BlockMessage = message;
                uOW.WorkerStatusRepo.Update(driverStatus);
            }
            else
            {
                driverStatus = new WorkerStatus();
                driverStatus.WorkerId = Driver.Id;
                driverStatus.WorkingStatus = newStatus;
                if (blockTime != null)
                    driverStatus.BlockTime = blockTime;
                if (message != null)
                    driverStatus.BlockMessage = message;
                uOW.WorkerStatusRepo.Insert(driverStatus);
            }

            uOW.Save();
            return Mapper.Map<WorkerStatusDTO>(driverStatus);
        }
示例#2
0
 public static string GetStringifyStatus(DriverWorkingStatusEnum status)
 {
     switch (status)
     {
         case DriverWorkingStatusEnum.DoingOrder:
             return Resources.Resource.DoingOrder;
         case DriverWorkingStatusEnum.AwaitingOrder:
             return Resources.Resource.AwaitingOrder;
         case DriverWorkingStatusEnum.Blocked:
             return Resources.Resource.Blocked;
         default:
             return "";
     }
 }