public UpdateUniqueRowValidator(WizardContext context, SheetHelper sheet) { //在 Insert 模式不進行此類型驗證。 _skip_validate = (context.CurrentMode != ImportMode.Update); if (_skip_validate) { return; } _sheet = sheet; _primary_condition = context.IdentifyField; _check_conditions = new List <ImportCondition>(); List <ImportCondition> conditions = new List <ImportCondition>(); foreach (ImportCondition each in context.UpdateConditions) { if (each.ContainsAllField(context.SelectedFields.ToArray())) { conditions.Add(each); } } _check_conditions = conditions; if (!conditions.Contains(context.IdentifyField)) { conditions.Add(context.IdentifyField); //連同 Primary Condition 一起加入。 } XmlElement recordData = context.DataSource.GetUniqueFieldData(); _key_sets = new ConditionKeySetCollection(conditions, recordData, "Record"); }
public ShiftCheckRowValidator(WizardContext context) { //未指定 CheckField 時不進行驗證。 _skip_validate = (context.ShiftCheckField == null); if (_skip_validate) { return; } _check_field = context.ShiftCheckField; List <string> requireFields = new List <string>(); requireFields.AddRange(context.IdentifyField.Fields.ToInternalNames()); requireFields.Add(context.ShiftCheckField.InternalName); XmlElement recordData = context.DataSource.GetShiftCheckList(requireFields.ToArray()); List <ImportCondition> cond = new List <ImportCondition>(); cond.Add(context.IdentifyField); _key_sets = new ConditionKeySetCollection(cond, recordData, "Record"); }
public UpdateIdentifyRowValidator(WizardContext context) { //當不是 Update 模式時不驗證。 _skip_validate = (context.CurrentMode != ImportMode.Update); if (_skip_validate) { return; } _cond = context.IdentifyField; List <ImportCondition> conditions = new List <ImportCondition>(); conditions.Add(context.IdentifyField); XmlElement recordData = context.DataSource.GetUniqueFieldData(); _key_sets = new ConditionKeySetCollection(conditions, recordData, "Record"); }
public InsertDBUniqueRowValidator(WizardContext context) { //在 Update 模式不進行此類型驗證。 _skip_validate = (context.CurrentMode != ImportMode.Insert); if (_skip_validate) { return; } List <ImportCondition> conditions = new List <ImportCondition>(); foreach (ImportCondition each in context.UpdateConditions) { if (each.ContainsAllField(context.SelectedFields.ToArray())) { conditions.Add(each); } } XmlElement recordData = context.DataSource.GetUniqueFieldData(); _key_sets = new ConditionKeySetCollection(conditions, recordData, "Record"); }
public InsertSheetUniqueRowValidator(WizardContext context) { //在 Update 模式不進行此類型驗證。 _skip_validate = (context.CurrentMode != ImportMode.Insert); if (_skip_validate) { return; } _selected_fields = context.SelectedFields; List <ImportCondition> conditions = new List <ImportCondition>(); foreach (ImportCondition each in context.UpdateConditions) { if (each.ContainsAllField(context.SelectedFields.ToArray())) { conditions.Add(each); } } _key_sets = new ConditionKeySetCollection(conditions); }