Esempio n. 1
0
        protected virtual void SetDefaultValue(IInputData input, ITableSchemeEx scheme,
                                               DataTable table, DataRow row)
        {
            foreach (DataColumn col in table.Columns)
            {
                string value = input.QueryString[col.ColumnName];
                if (!string.IsNullOrEmpty(value))
                {
                    DataSetUtil.SetSafeValue(row, col, value);
                }
            }

            var defaultFields = from field in scheme.Fields
                                where Tk5TableResolver.HasDefaultValue(field)
                                select field as ITk5FieldInfo;

            foreach (var field in defaultFields)
            {
                try
                {
                    row[field.NickName] = Expression.Execute(field.Edit.DefaultValue, DataSet, this);
                }
                catch
                {
                }
            }
        }
Esempio n. 2
0
        public TableResolver CreateObject(params object[] args)
        {
            IDbDataSource source = ObjectUtil.ConfirmQueryObject <IDbDataSource>(this, args);

            Tk5TableResolver resolver;

            if (string.IsNullOrEmpty(TableName))
            {
                resolver = new Tk5TableResolver(DataXml, source);
            }
            else
            {
                resolver = new Tk5TableResolver(DataXml, TableName, source);
            }
            resolver.AutoUpdateKey  = AutoUpdateKey;
            resolver.AutoTrackField = AutoTrackField;

            return(resolver);
        }