コード例 #1
0
        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");
        }
コード例 #2
0
        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");
        }
コード例 #3
0
        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");
        }
コード例 #4
0
        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");
        }
コード例 #5
0
        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);
        }