public string this[string columnName] { get { ControllerConfig8001 config = new ControllerConfig8001(); Dictionary <string, SCA.Model.RuleAndErrorMessage> dictMessage = config.GetManualControlBoardRegularExpression(8); SCA.Model.RuleAndErrorMessage rule; System.Text.RegularExpressions.Regex exminator; string errorMessage = String.Empty; switch (columnName) { case "Code": rule = dictMessage["Code"]; exminator = new System.Text.RegularExpressions.Regex(rule.Rule); if (!exminator.IsMatch(this.Code.ToString())) { errorMessage = rule.ErrorMessage; } break; case "BoardNo": rule = dictMessage["BoardNo"]; exminator = new System.Text.RegularExpressions.Regex(rule.Rule); if (!exminator.IsMatch(this.BoardNo.ToString())) { errorMessage = rule.ErrorMessage; } break; case "SubBoardNo": rule = dictMessage["SubBoardNo"]; exminator = new System.Text.RegularExpressions.Regex(rule.Rule); if (!exminator.IsMatch(this.SubBoardNo.ToString())) { errorMessage = rule.ErrorMessage; } break; case "KeyNo": rule = dictMessage["KeyNo"]; exminator = new System.Text.RegularExpressions.Regex(rule.Rule); if (!exminator.IsMatch(this.KeyNo.ToString())) { errorMessage = rule.ErrorMessage; } break; case "DeviceCode": rule = dictMessage["DeviceCode"]; exminator = new System.Text.RegularExpressions.Regex(rule.Rule); if (!exminator.IsMatch(this.DeviceCode.ToString())) { errorMessage = rule.ErrorMessage; } break; } return(errorMessage); } }
public string this[string columnName] { get { ControllerConfig8001 config = new ControllerConfig8001(); //器件编码长度需要动态指定 Dictionary <string, SCA.Model.RuleAndErrorMessage> dictMessage = config.GetDeviceInfoRegularExpression(this.Loop.Controller.DeviceAddressLength); SCA.Model.RuleAndErrorMessage rule; System.Text.RegularExpressions.Regex exminator; string errorMessage = String.Empty; switch (columnName) { case "Feature": if (this.Feature != null) { rule = dictMessage["Feature"]; exminator = new System.Text.RegularExpressions.Regex(rule.Rule); if (!exminator.IsMatch(this.Feature.ToString())) { errorMessage = rule.ErrorMessage; } } break; //case "Disable": // rule = dictMessage["Disable"]; // exminator = new System.Text.RegularExpressions.Regex(rule.Rule); // if (!exminator.IsMatch(this.Disable.ToString())) // { // errorMessage = rule.ErrorMessage; // } // break; case "SensitiveLevel": if (this.SensitiveLevel != null) { rule = dictMessage["SensitiveLevel"]; exminator = new System.Text.RegularExpressions.Regex(rule.Rule); if (!exminator.IsMatch(this.SensitiveLevel.ToString())) { errorMessage = rule.ErrorMessage; } } break; case "LinkageGroup1": if (!string.IsNullOrEmpty(this.LinkageGroup1)) { rule = dictMessage["StandardLinkageGroup"]; exminator = new System.Text.RegularExpressions.Regex(rule.Rule); if (!exminator.IsMatch(this.LinkageGroup1.ToString())) { errorMessage = rule.ErrorMessage; } } break; case "LinkageGroup2": if (!string.IsNullOrEmpty(this.LinkageGroup2)) { rule = dictMessage["StandardLinkageGroup"]; exminator = new System.Text.RegularExpressions.Regex(rule.Rule); if (!exminator.IsMatch(this.LinkageGroup2.ToString())) { errorMessage = rule.ErrorMessage; } } break; case "LinkageGroup3": if (this.LinkageGroup3 != null) { if (this.LinkageGroup3.ToString() != "") { rule = dictMessage["StandardLinkageGroup"]; exminator = new System.Text.RegularExpressions.Regex(rule.Rule); if (!exminator.IsMatch(this.LinkageGroup3.ToString())) { errorMessage = rule.ErrorMessage; } } } break; case "DelayValue": if (this.DelayValue != null) { rule = dictMessage["DelayValue"]; exminator = new System.Text.RegularExpressions.Regex(rule.Rule); if (!exminator.IsMatch(this.DelayValue.ToString())) { errorMessage = rule.ErrorMessage; } } break; case "BroadcastZone": if (!string.IsNullOrEmpty(this.BroadcastZone)) { rule = dictMessage["DelayValue"]; exminator = new System.Text.RegularExpressions.Regex(rule.Rule); if (!exminator.IsMatch(this.BroadcastZone.ToString())) { errorMessage = rule.ErrorMessage; } } break; case "BuildingNo": if (this.BuildingNo != null) { if (this.BuildingNo.ToString() != "") { rule = dictMessage["BuildingNo"]; exminator = new System.Text.RegularExpressions.Regex(rule.Rule); if (!exminator.IsMatch(this.BuildingNo.ToString())) { errorMessage = rule.ErrorMessage; } } } break; case "ZoneNo": if (this.ZoneNo != null) { if (this.ZoneNo.ToString() != "") { rule = dictMessage["ZoneNo"]; exminator = new System.Text.RegularExpressions.Regex(rule.Rule); if (!exminator.IsMatch(this.ZoneNo.ToString())) { errorMessage = rule.ErrorMessage; } } } break; case "FloorNo": if (this.FloorNo != null) { if (this.FloorNo.ToString() != "") { rule = dictMessage["FloorNo"]; exminator = new System.Text.RegularExpressions.Regex(rule.Rule); if (!exminator.IsMatch(this.FloorNo.ToString())) { errorMessage = rule.ErrorMessage; } } } break; case "RoomNo": if (this.RoomNo != null) { if (this.RoomNo.ToString() != "") { rule = dictMessage["RoomNo"]; exminator = new System.Text.RegularExpressions.Regex(rule.Rule); if (!exminator.IsMatch(this.RoomNo.ToString())) { errorMessage = rule.ErrorMessage; } } } break; case "Location": if (!string.IsNullOrEmpty(this.Location)) { rule = dictMessage["Location"]; exminator = new System.Text.RegularExpressions.Regex(rule.Rule); if (!exminator.IsMatch(this.Location.ToString())) { errorMessage = rule.ErrorMessage; } } break; } return(errorMessage); } }
public string this[string columnName] { get { ControllerConfig8001 config = new ControllerConfig8001(); Dictionary <string, SCA.Model.RuleAndErrorMessage> dictMessage = config.GetGeneralLinkageConfigRegularExpression(8); SCA.Model.RuleAndErrorMessage rule; System.Text.RegularExpressions.Regex exminator; string errorMessage = String.Empty; switch (columnName) { case "Code": rule = dictMessage["Code"]; exminator = new System.Text.RegularExpressions.Regex(rule.Rule); if (!exminator.IsMatch(this.Code.ToString())) { errorMessage = rule.ErrorMessage; } break; //case "ActionCoefficient": // rule = dictMessage["ActionCoefficient"]; // exminator = new System.Text.RegularExpressions.Regex(rule.Rule); // if (!exminator.IsMatch(this.ActionCoefficient.ToString())) // { // errorMessage = rule.ErrorMessage; // } // break; case "LoopNoA": rule = dictMessage["Loop"]; exminator = new System.Text.RegularExpressions.Regex(rule.Rule); if (!exminator.IsMatch(this.LoopNoA.ToString())) { errorMessage = rule.ErrorMessage; } break; case "DeviceCodeA": rule = dictMessage["Device"]; exminator = new System.Text.RegularExpressions.Regex(rule.Rule); if (!exminator.IsMatch(this.DeviceCodeA.ToString())) { errorMessage = rule.ErrorMessage; } break; case "BuildingNoA": rule = dictMessage["Building"]; exminator = new System.Text.RegularExpressions.Regex(rule.Rule); if (!exminator.IsMatch(this.BuildingNoA.ToString())) { errorMessage = rule.ErrorMessage; } break; case "ZoneNoA": rule = dictMessage["Zone"]; exminator = new System.Text.RegularExpressions.Regex(rule.Rule); if (!exminator.IsMatch(this.ZoneNoA.ToString())) { errorMessage = rule.ErrorMessage; } break; case "LayerNoA": rule = dictMessage["FloorNo"]; exminator = new System.Text.RegularExpressions.Regex(rule.Rule); if (!exminator.IsMatch(this.LayerNoA.ToString())) { errorMessage = rule.ErrorMessage; } break; case "LoopNoB": rule = dictMessage["Loop"]; exminator = new System.Text.RegularExpressions.Regex(rule.Rule); if (!exminator.IsMatch(this.LoopNoB.ToString())) { errorMessage = rule.ErrorMessage; } break; case "DeviceCodeB": rule = dictMessage["Device"]; exminator = new System.Text.RegularExpressions.Regex(rule.Rule); if (!exminator.IsMatch(this.DeviceCodeB.ToString())) { errorMessage = rule.ErrorMessage; } break; case "BuildingNoB": rule = dictMessage["Building"]; exminator = new System.Text.RegularExpressions.Regex(rule.Rule); if (!exminator.IsMatch(this.BuildingNoB.ToString())) { errorMessage = rule.ErrorMessage; } break; case "ZoneNoB": rule = dictMessage["Zone"]; exminator = new System.Text.RegularExpressions.Regex(rule.Rule); if (!exminator.IsMatch(this.ZoneNoB.ToString())) { errorMessage = rule.ErrorMessage; } break; case "LayerNoB": rule = dictMessage["FloorNo"]; exminator = new System.Text.RegularExpressions.Regex(rule.Rule); if (!exminator.IsMatch(this.LayerNoB.ToString())) { errorMessage = rule.ErrorMessage; } break; case "MachineNoC": rule = dictMessage["MachineNo"]; exminator = new System.Text.RegularExpressions.Regex(rule.Rule); if (!exminator.IsMatch(this.MachineNoC.ToString())) { errorMessage = rule.ErrorMessage; } break; case "LoopNoC": rule = dictMessage["Loop"]; exminator = new System.Text.RegularExpressions.Regex(rule.Rule); if (!exminator.IsMatch(this.LoopNoC.ToString())) { errorMessage = rule.ErrorMessage; } break; case "DeviceCodeC": rule = dictMessage["Device"]; exminator = new System.Text.RegularExpressions.Regex(rule.Rule); if (!exminator.IsMatch(this.DeviceCodeC.ToString())) { errorMessage = rule.ErrorMessage; } break; case "BuildingNoC": rule = dictMessage["Building"]; exminator = new System.Text.RegularExpressions.Regex(rule.Rule); if (!exminator.IsMatch(this.BuildingNoC.ToString())) { errorMessage = rule.ErrorMessage; } break; case "ZoneNoC": rule = dictMessage["Zone"]; exminator = new System.Text.RegularExpressions.Regex(rule.Rule); if (!exminator.IsMatch(this.ZoneNoC.ToString())) { errorMessage = rule.ErrorMessage; } break; case "LayerNoC": rule = dictMessage["FloorNo"]; exminator = new System.Text.RegularExpressions.Regex(rule.Rule); if (!exminator.IsMatch(this.LayerNoC.ToString())) { errorMessage = rule.ErrorMessage; } break; } return(errorMessage); } }