public bool TransferData()
        {
            TableVersion tv = new TableVersion();

            using (EntityTransaction Tr = 
                new EntityTransaction(DpDestination)) 
            {
                foreach (TableTransfer tbl in ListTable) 
                {
                    tv.TableName= tbl.TableName;
                    DpSource.LoadEntity(tv, false);

                    TransferTable(new TableDef(tbl.TableName, tv.CreateStr),
                        tbl.Condition);
                }
                foreach (TypeTransfer typ in ListObjectType)
                {
                    TableDef td = MetaData.GetTableDef(typ.ObjectType);
                    TransferTable(td, typ.Condition);
                    foreach (EntityCollDef ecd in td.ChildEntities)
                        TransferTable(MetaData.GetTableDef(ecd.ChildType), 
                            typ.Condition);
                }
                Tr.CommitTransaction();
            }
            return true;
        }
Esempio n. 2
0
        internal static TVar GetVariable <TVar>(DataPersistance dp,
                                                string ModuleName, string VarName, TVar DefaultValue)
        {
            AppVariable Var = new AppVariable();

            Var.ModuleName = ModuleName;
            Var.VarName    = VarName;

            if (!dp.LoadEntity(Var, false))
            {
                return(DefaultValue);
            }

            Type tp = typeof(TVar);

            if (tp == typeof(string) ||
                tp == typeof(decimal) ||
                tp == typeof(DateTime) ||
                tp == typeof(int) ||
                tp == typeof(Single) ||
                tp == typeof(bool))
            {
                return(BaseUtility.ConvertFromString <TVar>(
                           (string)Var.VarValue));
            }
            else if (tp == typeof(Image))
            {
                if (Var.BinValue == null)
                {
                    return((TVar)(object)null);
                }
                else
                {
                    return((TVar)(object)Helper.ConvertByteArrayToImage(
                               Var.BinValue));
                }
            }
            else
            {
                return((TVar)(object)Var.BinValue);
            }
        }