예제 #1
0
        public int addTableConverter(ITableConverter pConv)
        {
            int newId = ++idIndx;

            cnverterList.Add(newId, pConv);
            return(newId);
        }
예제 #2
0
        protected DbcCreatorBase(string dbcPath, ITableConverter <T> tableConverter, IDbcFilesProvider dbcFilesProvider)
        {
            DbcPath           = ArgumentUtility.CheckNotNullOrEmpty("dbcPath", dbcPath);
            _tableConverter   = ArgumentUtility.CheckNotNull("tableConverter", tableConverter);
            _dbcFilesProvider = ArgumentUtility.CheckNotNull("dbcFilesProvider", dbcFilesProvider);

            CreateDbc(dbcFilesProvider);
            _connection = new VfpConnection("provider=vfpoledb;exclusive=off;OLE DB Services=0;data source=" + DbcPath);
        }
예제 #3
0
 public DataTableDbcCreator(string dbcPath, ITableConverter <DataTable> tableConverter, IDbcFilesProvider dbcFilesProvider)
     : base(dbcPath, tableConverter, dbcFilesProvider)
 {
 }
예제 #4
0
        public static string Replace(this string template, Dictionary <string, object> nameValueDictionary, ITableConverter tableConverter, Durados.View view)
        {
            if (nameValueDictionary == null)
            {
                return(template);
            }

            AdjustToShortDictionary(nameValueDictionary);

            string content = template;

            foreach (string name in nameValueDictionary.Keys)
            {
                if (!name.IsToken())
                {
                    continue;
                }

                object value = nameValueDictionary[name];
                if (value is string)
                {
                    content = content.ReplaceToken(name, value.ToString());
                }
                else if (value == null)
                {
                    content = content.ReplaceToken(name, string.Empty);
                }
                else if (value is DataView)
                {
                    if (tableConverter == null || view == null)
                    {
                        content = content.ReplaceToken(name, string.Empty);
                    }
                    else
                    {
                        if (content.Contains(name))
                        {
                            Durados.View childrenView = GetChildrenView(view, name);
                            if (childrenView != null)
                            {
                                content = content.ReplaceToken(name, tableConverter.Convert(childrenView, (DataView)value, nameValueDictionary));
                            }
                            else
                            {
                                content = content.ReplaceToken(name, value.ToString());
                            }
                        }
                    }
                }
                else
                {
                    content = content.ReplaceToken(name, value.ToString());
                }
            }

            return(content);
        }