public string this[string propertyName] { get { try { string validationResult = String.Empty; if (ValidationEnabled) { switch (propertyName) { case "TUID": if (TUID == 0 || _dbservicewms.FindPlaceByTUID(TUID) != null) { validationResult = ResourceReader.GetString("ERR_MATERIALEXISTS"); } break; case "PlaceID": var pid = _dbservicewms.FindPlaceID(PlaceID); if (!PlaceID.StartsWith("W")) { validationResult = ResourceReader.GetString("ERR_NOTWH"); } else if (pid == null || pid.DimensionClass < 0) { validationResult = ResourceReader.GetString("ERR_PLACE"); } else if (pid.DimensionClass < 999 && _dbservicewms.FindPlaceByPlace(PlaceID) != null) { validationResult = ResourceReader.GetString("ERR_OCCUPIED"); } break; case "DimensionClass": var p = _dbservicewms.FindPlaceID(PlaceID); if (p != null && DimensionClass > p.DimensionClass) { validationResult = ResourceReader.GetString("ERR_CLASS"); } break; } } Validator.AddOrUpdate(propertyName, validationResult == String.Empty); AllPropertiesValid = Validator.IsValid() && SubTableValidation; return(validationResult); } catch (Exception e) { _warehouse.AddEvent(Database.Event.EnumSeverity.Error, Database.Event.EnumType.Exception, string.Format("{0}.{1}: {2}", this.GetType().Name, (new StackTrace()).GetFrame(0).GetMethod().Name, e.Message)); Validator.AddOrUpdate(propertyName, false); AllPropertiesValid = Validator.IsValid(); return(ResourceReader.GetString("ERR_EXCEPTION")); } } }
public string this[string propertyName] { get { try { string validationResult = String.Empty; if (ValidationEnabled) { switch (propertyName) { case "Destination": if (_dbservicewms.FindPlaceID(Destination) == null) { validationResult = ResourceReader.GetString("ERR_DESTINATION"); } break; case "ReleaseTime": if (ReleaseTime < SqlDateTime.MinValue.Value || ReleaseTime >= SqlDateTime.MaxValue.Value) { validationResult = ResourceReader.GetString("ERR_RANGE"); } break; } } Validator.AddOrUpdate(propertyName, validationResult == String.Empty); AllPropertiesValid = Validator.IsValid(); return(validationResult); } catch (Exception e) { _warehouse.AddEvent(Database.Event.EnumSeverity.Error, Database.Event.EnumType.Exception, string.Format("{0}.{1}: {2}", this.GetType().Name, (new StackTrace()).GetFrame(0).GetMethod().Name, e.Message)); Validator.AddOrUpdate(propertyName, false); AllPropertiesValid = Validator.IsValid(); return(ResourceReader.GetString("ERR_EXCEPTION")); } } }
public string this[string propertyName] { get { try { string validationResult = String.Empty; if (ValidationEnabled) { switch (propertyName) { case "ERPID": break; case "OrderID": if (OrderID <= 0 || (_dbservicewms.ExistsOrderID(ERPID, OrderID) && OrderID != ReferenceOrderID)) { validationResult = ResourceReader.GetString("ERR_ORDERID"); } break; case "Destination": if (_dbservicewms.FindPlaceID(Destination) == null) { validationResult = ResourceReader.GetString("ERR_DESTINATION"); } break; case "ReleaseTime": if (ReleaseTime < SqlDateTime.MinValue.Value || ReleaseTime > SqlDateTime.MaxValue.Value) { validationResult = ResourceReader.GetString("ERR_RANGE"); } break; case "SubOrderID": if (SubOrderID <= 0 || (_dbservicewms.ExistsSubOrderID(OrderID, SubOrderID) && SubOrderID != ReferenceSubOrderID)) { validationResult = ResourceReader.GetString("ERR_SUBORDERID"); } break; case "SubOrderERPID": if (SubOrderERPID < 0) { validationResult = ResourceReader.GetString("ERR_SUBORDERID"); } break; case "SubOrderName": if (SubOrderName == null || SubOrderName.Length == 0) { validationResult = ResourceReader.GetString("ERR_SUBORDERNAME"); } break; case "SKUID": if (_dbservicewms.FindSKUID(SKUID) == null) { validationResult = ResourceReader.GetString("ERR_SKU"); } break; case "SKUBatch": break; case "SKUQty": if (SKUQty <= 0) { validationResult = ResourceReader.GetString("ERR_RANGE"); } break; } } Validator.AddOrUpdate(propertyName, validationResult == String.Empty); AllPropertiesValid = Validator.IsValid(); return(validationResult); } catch (Exception e) { _warehouse.AddEvent(Database.Event.EnumSeverity.Error, Database.Event.EnumType.Exception, string.Format("{0}.{1}: {2}", this.GetType().Name, (new StackTrace()).GetFrame(0).GetMethod().Name, e.Message)); Validator.AddOrUpdate(propertyName, false); AllPropertiesValid = Validator.IsValid(); return(ResourceReader.GetString("ERR_EXCEPTION")); } } }