Exemplo n.º 1
0
        private int GetFileVersion(LogicFileInfoData logicFileInfo, DbTransaction trans)
        {
            int result = 1;
            int count  = logicFileInfo.PhysicalFileInfos.Count;

            if (count > 0)
            {
                PhysicalFileInfoData fileData = logicFileInfo.PhysicalFileInfos[count - 1];
                if (fileData.Version != count)
                {
                    LogicFileInfoItemData itemData = new LogicFileInfoItemData();
                    itemData.ID = logicFileInfo.ID;
                    LogicFileInfoData newLogicFileInfo = this.DataProvider.FetchFileInfo(itemData, trans);
                    if (newLogicFileInfo != null)
                    {
                        count    = newLogicFileInfo.PhysicalFileInfos.Count;
                        fileData = newLogicFileInfo.PhysicalFileInfos[count - 1];
                    }
                }
                if (fileData != null)
                {
                    result = fileData.Version + 1;
                }
            }
            return(result);
        }
Exemplo n.º 2
0
        private LogicFileInfoItemData CreateFetchItemParam(OpenFileItemData itemParam)
        {
            LogicFileInfoItemData result = new LogicFileInfoItemData();

            result.ID      = itemParam.FileID;
            result.Version = itemParam.Version;
            result.WithPhysicalFileInfo = true;
            return(result);
        }
        public override LogicFileInfoData FetchFileInfo(LogicFileInfoItemData fetchParam, DbTransaction trans)
        {
            LogicFileInfoData result = null;
            DbCommand         dbCmd  = this.FetchFileInfoCommand;

            this.Database.SetParameterValue(dbCmd, "p_logic_file_id", fetchParam.ID.ToString().ToUpper());
            this.Database.SetParameterValue(dbCmd, "p_physical_file_id", fetchParam.PhysicalFileID.ToString().ToUpper());
            if (fetchParam.Version > 0)
            {
                this.Database.SetParameterValue(dbCmd, "p_VERSION", fetchParam.Version);
            }
            this.Database.SetParameterValue(dbCmd, "p_with_physical_file", fetchParam.WithPhysicalFileInfo);
            IDataReader reader = null;

            if (trans != null)
            {
                reader = this.Database.ExecuteReader(dbCmd, trans);
            }
            else
            {
                reader = this.Database.ExecuteReader(dbCmd);
            }
            if (reader != null)
            {
                try
                {
                    if (reader.Read())
                    {
                        result = new LogicFileInfoData();
                        FieldLookup looup = this.EntityFactory.CreateFieldLookup(reader);
                        this.Adapter.SetEntityValue(result, reader, looup);
                        if (fetchParam.WithPhysicalFileInfo && reader.NextResult())
                        {
                            this.EntityFactory.BuildEntityCollection(result.PhysicalFileInfos, reader);
                        }
                    }
                }
                finally
                {
                    reader.Close();
                }
            }
            return(result);
        }
Exemplo n.º 4
0
 LogicFileInfoData IFileStorageProviderDataProvider.FetchFileInfo(LogicFileInfoItemData fetchParam, IDbTransaction trans)
 {
     return(this.FetchFileInfo(fetchParam, trans as DbTransaction));
 }
Exemplo n.º 5
0
 public abstract LogicFileInfoData FetchFileInfo(LogicFileInfoItemData fetchParam, DbTransaction trans);