public bool Validate(IRowSource Value) { //格過驗證。 if (_skip_validate) { return(true); } List <DuplicateInfo> dups = _key_sets.GetDuplicate(Value); if (dups.Count <= 0) { return(true); } else { DuplicateInfo dup = dups[0]; _previous_result = dup; string serverValue = dup.Record[_check_field.InternalName].Trim(); string sourceValue = Value.GetFieldData(_check_field.FieldName).Trim(); return(serverValue == sourceValue); } }
public bool Validate(IRowSource Value) { //格過驗證。 if (_skip_validate) { return(true); } int rowIndex = -1; SheetRowSource sheetRow = Value as SheetRowSource; if (sheetRow != null) { rowIndex = sheetRow.CurrentRowIndex; } DuplicateInfo dup = _key_sets.GetDuplicateBy(_primary_condition, Value); if (dup != null) { Record record = dup.Record; record.SourceRowIndex = rowIndex; foreach (ImportCondition each in _check_conditions) { foreach (ImportField eachField in each.Fields) { record[eachField.InternalName] = Value.GetFieldData(eachField.FieldName); } } } return(true); }
public Record(IRowSource rowSource, IEnumerable <string> fields) { foreach (string field in fields) { Add(field, rowSource.GetFieldData(field)); } }
private static bool IsValid(List <string> fields, Record record, IRowSource rowSource) { Dictionary <string, string> teachers = new Dictionary <string, string>(); teachers.Add("授課教師一", string.Empty); teachers.Add("授課教師二", string.Empty); teachers.Add("授課教師三", string.Empty); foreach (string each in new string[] { "授課教師一", "授課教師二", "授課教師三" }) { teachers[each] = record[_field_map[each]]; } foreach (string each in fields) { teachers[each] = rowSource.GetFieldData(each); } Dictionary <string, string> dup = new Dictionary <string, string>(); foreach (string each in teachers.Values) { if (dup.ContainsKey(each)) { return(false); } if (!string.IsNullOrEmpty(each)) { dup.Add(each, each); } } return(true); }
private static bool IsValid(List <string> fields, IRowSource rowSource) { Dictionary <string, string> dup = new Dictionary <string, string>(); foreach (string each in fields) { if (dup.ContainsKey(rowSource.GetFieldData(each))) { return(false); } dup.Add(rowSource.GetFieldData(each), each); } return(true); }
internal bool IsEmptyKey(IRowSource rowSource) { StringBuilder builder = new StringBuilder(); foreach (ImportField each in Fields) { builder.Append(rowSource.GetFieldData(each.FieldName)); } return(string.IsNullOrEmpty(builder.ToString().Trim())); }
internal string GetKeyByFieldName(IRowSource rowSource) { StringBuilder builder = new StringBuilder(); foreach (ImportField each in Fields) { builder.Append(rowSource.GetFieldData(each.FieldName) + ":"); } return(builder.ToString()); }