/// <summary> /// 更改分类启用状态 /// </summary> /// <param name="TypeId"></param> /// <param name="status"></param> /// <returns></returns> public ReturnInfo ChangeEnable(String TypeId, IsEnable status) { ReturnInfo RInfo = new ReturnInfo(); if (String.IsNullOrEmpty(TypeId)) { throw new Exception("分类编号不能为空"); } AssetsType assetsType = _AssetsTypeRepository.GetByID(TypeId).FirstOrDefault(); if (assetsType == null) { throw new Exception("分类编号不存在,请检查!"); } try { assetsType.ISENABLE = (int)status; _unitOfWork.RegisterDirty(assetsType); _unitOfWork.Commit(); RInfo.IsSuccess = true; return(RInfo); } catch (Exception ex) { _unitOfWork.Rollback(); RInfo.IsSuccess = false; RInfo.ErrorInfo = ex.Message; return(RInfo); } }
/// <summary> /// 更改区域启用状态 /// </summary> /// <param name="LocationID"></param> /// <param name="status"></param> /// <returns></returns> public ReturnInfo ChangeEnable(String LocationID, IsEnable status) { ReturnInfo RInfo = new ReturnInfo(); try { if (String.IsNullOrEmpty(LocationID)) { throw new Exception("区域编号不能为空"); } AssLocation al = _AssLocationRepository.GetByID(LocationID).FirstOrDefault(); if (al == null) { throw new Exception("区域编号不存在,请检查!"); } al.ISENABLE = (int)status; _unitOfWork.RegisterDirty(al); bool result = _unitOfWork.Commit(); RInfo.IsSuccess = true; return(RInfo); } catch (Exception ex) { _unitOfWork.Rollback(); RInfo.IsSuccess = false; RInfo.ErrorInfo = ex.Message; return(RInfo); } }
public override string ToString() { return(String.Format("Устройство: {0}.\nПоложение: {1}.\nМощность: {2}.\nТаймер: {3}.\nЯркость: {4}.\nСтатус: {5}." , Name , Location , Power.ToString() , _timerProperty != null ? "TimerIsSet: " + RemainingTime() : "TimerIsAbsent" , _brightnessProperty != null ? "BrightnessIsSet: " + Brightness.ToString(): "BrightnessIsAbsent" , IsEnable.ToString())); }
/// <summary> /// 启用/禁用:仓库/存储类型/库位 /// </summary> /// <param name="wareId"></param> /// <param name="stId"></param> /// <returns></returns> public ReturnInfo ChangeEnable(string wareId, string stId, string SlId, IsEnable isEnable) { ReturnInfo RInfo = new ReturnInfo(); // 启用/禁用库位 if (!String.IsNullOrEmpty(wareId) && !String.IsNullOrEmpty(stId) && !String.IsNullOrEmpty(SlId)) { WHStorageLocation wHStorageLocation = _wHStorageLocationRepository.GetById(wareId, stId, SlId).FirstOrDefault(); if (wHStorageLocation != null) { if (wHStorageLocation.ISENABLE == (int)isEnable && isEnable == IsEnable.启用) { throw new Exception("该库位已启用,不可重复启用"); } else if (wHStorageLocation.ISENABLE == (int)isEnable && isEnable == IsEnable.禁用) { throw new Exception("该库位已禁用,不可重复禁用"); } wHStorageLocation.ISENABLE = (int)isEnable; } else { throw new Exception("当前库位不存在"); } } // 启用/禁用存储类型 else if (!String.IsNullOrEmpty(wareId) && !String.IsNullOrEmpty(stId)) { WHStorageType wHStorageType = _wHStorageTypeReposity.GetById(wareId, stId).FirstOrDefault(); if (wHStorageType != null) { if (wHStorageType.ISENABLE == (int)isEnable && isEnable == IsEnable.启用) { throw new Exception("该存储类型已启用,不可重复启用"); } else if (wHStorageType.ISENABLE == (int)isEnable && isEnable == IsEnable.禁用) { throw new Exception("该存储类型已禁用,不可重复禁用"); } wHStorageType.ISENABLE = (int)isEnable; } else { throw new Exception("当前存储类型不存在"); } } else // 启用/禁用仓库 { WareHouse wareHouse = _warehouseRepository.GetById(wareId).FirstOrDefault(); if (wareHouse != null) { if (wareHouse.ISENABLE == (int)isEnable && isEnable == IsEnable.启用) { throw new Exception("该仓库已启用,不可重复启用"); } else if (wareHouse.ISENABLE == (int)isEnable && isEnable == IsEnable.禁用) { throw new Exception("该仓库已禁用,不可重复禁用"); } wareHouse.ISENABLE = (int)isEnable; } else { throw new Exception("当前仓库不穿在"); } } try { _unitOfWork.Commit(); RInfo.IsSuccess = true; return(RInfo); } catch (Exception ex) { _unitOfWork.Rollback(); RInfo.IsSuccess = false; RInfo.ErrorInfo = ex.Message; return(RInfo); } }
public CodeGenerableResult GenerateCode(string varName = null, int space = 0) { var codeResult = new CodeGenerableResult(); var stringBuilder = new StringBuilder(); varName = varName != null ? varName : "ActionCommandOptions"; _ = stringBuilder.AppendLine($"{varName} = new LetPortal.Portal.Entities.Shared.ActionCommandOptions", space); _ = stringBuilder.AppendLine($"{{", space); var actionType = "LetPortal.Portal.Entities.Shared.ActionType." + Enum.GetName(typeof(ActionType), ActionType); _ = stringBuilder.AppendLine($" ActionType = {actionType},", space); _ = stringBuilder.AppendLine($" IsEnable = {IsEnable.ToString().ToLower()},", space); if (IsEnable) { //if(MapDataOptions != null) //{ // _ = stringBuilder.AppendLine(MapDataOptions.GenerateCode("MapDataOptions", space + 4).InsertingCode, space); //} if (ConfirmationOptions != null) { _ = stringBuilder.AppendLine($" ConfirmationOptions = new LetPortal.Portal.Entities.Shared.ConfirmationOptions", space); _ = stringBuilder.AppendLine($" {{", space); _ = stringBuilder.AppendLine($" IsEnable = {ConfirmationOptions.IsEnable.ToString().ToLower()},", space); _ = stringBuilder.AppendLine($" ConfirmationText = \"{ConfirmationOptions.ConfirmationText}\",", space); _ = stringBuilder.AppendLine($" }},", space); } if (NotificationOptions != null) { _ = stringBuilder.AppendLine($" NotificationOptions = new LetPortal.Portal.Entities.Shared.NotificationOptions", space); _ = stringBuilder.AppendLine($" {{", space); _ = stringBuilder.AppendLine($" CompleteMessage = \"{NotificationOptions.CompleteMessage}\",", space); _ = stringBuilder.AppendLine($" FailedMessage = \"{NotificationOptions.FailedMessage}\",", space); _ = stringBuilder.AppendLine($" }},", space); } switch (ActionType) { case ActionType.Redirect: _ = stringBuilder.AppendLine($" RedirectOptions = new LetPortal.Portal.Entities.Shared.RedirectOptions", space); _ = stringBuilder.AppendLine($" {{", space); _ = stringBuilder.AppendLine($" IsSameDomain = {RedirectOptions.IsSameDomain.ToString().ToLower()},", space); _ = stringBuilder.AppendLine($" RedirectUrl = \"{RedirectOptions.RedirectUrl}\"", space); _ = stringBuilder.AppendLine($" }},", space); break; case ActionType.ExecuteDatabase: _ = stringBuilder.AppendLine($" DbExecutionChains = new LetPortal.Portal.Entities.Shared.DatabaseExecutionChains", space); _ = stringBuilder.AppendLine($" {{", space); _ = stringBuilder.AppendLine($" Steps = new List<LetPortal.Portal.Entities.Shared.DatabaseExecutionStep>", space); _ = stringBuilder.AppendLine($" {{", space); foreach (var step in DbExecutionChains.Steps) { _ = stringBuilder.AppendLine($" new LetPortal.Portal.Entities.Shared.DatabaseExecutionStep", space); _ = stringBuilder.AppendLine($" {{", space); _ = stringBuilder.AppendLine($" DatabaseConnectionId = \"{step.DatabaseConnectionId}\",", space); _ = stringBuilder.AppendLine($" ExecuteCommand = {StringUtil.ToLiteral(step.ExecuteCommand)},", space); _ = stringBuilder.AppendLine($" DataLoopKey = \"{step.DataLoopKey}\",", space); if (step != DbExecutionChains.Steps.Last()) { _ = stringBuilder.AppendLine($" }},", space); } else { _ = stringBuilder.AppendLine($" }}", space); } } _ = stringBuilder.AppendLine($" }}", space); _ = stringBuilder.AppendLine($" }},", space); break; case ActionType.CallHttpService: _ = stringBuilder.AppendLine(HttpServiceOptions.GenerateCode(space: space + 1).InsertingCode); break; case ActionType.CallWorkflow: // TODO: We will implement this later break; } } _ = stringBuilder.AppendLine($"}},", space); codeResult.InsertingCode = stringBuilder.ToString(); return(codeResult); }
public override string ToString() { return(String.Format("Устройство: {0}.\nПоложение: {1}.\nСкорость: {2}.\nСтатус: {3}.", Name, Location, Speed.ToString(), IsEnable.ToString())); }
public override string ToString() { return(String.Format("Устройство: {0}.\nПоложение: {1}.\nТемпература: {2}.\nСкорость: {3}.\nПрограмма: {4}.\nСтатус: {5}.", Name, Location, Temperature.ToString(), Speed.ToString(), Program, IsEnable.ToString())); }
public override string ToString() { return(String.Format("Устройство: {0}.\nПоложение: {1}.\nТемпература: {2}.\nСтатус: {3}.", Name, Location, Temperature.ToString(), IsEnable.ToString())); }