public S_FileInfo(string ID, S_DOC_Space space) { this._initEntity(); if (space == null) { throw new Formula.Exceptions.BusinessException("档案配置对象未空,无法实例化编目节点对象"); } this.Space = space; this.InstanceDB = SQLHelper.CreateSqlHelper(this.Space.SpaceKey, this.Space.ConnectString); string sql = String.Format("select * from {0} where ID='{1}' ", TableName, ID); var dt = this.InstanceDB.ExecuteDataTable(sql); if (dt != null && dt.Rows.Count > 0) { var row = dt.Rows[0]; _validateColumns(row); DataAdapter.DataRowToHashTable(row, this.DataEntity); this.ConfigInfo = this.Space.S_DOC_File.FirstOrDefault(d => d.ID == this.DataEntity["ConfigID"].ToString()); if (this.ConfigInfo == null) { throw new Formula.Exceptions.BusinessException("未找到ID为【" + this.DataEntity["ConfigID"].ToString() + "】编目定义对象,无法实例化编目节点对象"); } } else { throw new Formula.Exceptions.BusinessException("未能找到ID为【" + ID + "】的编目节点"); } }
public S_Attachment(DataRow row, string spaceID) { this._initEntity(); _validateColumns(row); DataAdapter.DataRowToHashTable(row, this.DataEntity); this.Space = DocConfigHelper.CreateConfigSpaceByID(spaceID); if (this.Space == null) { throw new Formula.Exceptions.BusinessException("未找到ID为【" + this.DataEntity["SpaceID"].ToString() + "】档案配置对象,无法实例化附件对象"); } this.InstanceDB = SQLHelper.CreateSqlHelper(this.Space.SpaceKey, this.Space.ConnectString); if (Tool.IsNullOrEmpty(this.ID)) { this.IsNewModel = true; } }
public S_FileInfo(DataRow row) { this._initEntity(); _validateColumns(row); DataAdapter.DataRowToHashTable(row, this.DataEntity); this.Space = DocConfigHelper.CreateConfigSpaceByID(this.DataEntity["SpaceID"].ToString()); if (this.Space == null) { throw new Formula.Exceptions.BusinessException("未找到ID为【" + this.DataEntity["SpaceID"].ToString() + "】档案配置对象,无法实例化编目节点对象"); } this.ConfigInfo = this.Space.S_DOC_File.FirstOrDefault(d => d.ID == this.DataEntity["ConfigID"].ToString()); if (this.ConfigInfo == null) { throw new Formula.Exceptions.BusinessException("未找到ID为【" + this.DataEntity["ConfigID"].ToString() + "】编目定义对象,无法实例化编目节点对象"); } this.InstanceDB = SQLHelper.CreateSqlHelper(this.Space.SpaceKey, this.Space.ConnectString); if (Tool.IsNullOrEmpty(this.ID)) { this.IsNewModel = true; } }
public S_Attachment(string ID, S_DOC_Space space) { this._initEntity(); if (space == null) { throw new Formula.Exceptions.BusinessException("档案配置对象未空,无法实例化附件对象"); } this.Space = space; this.InstanceDB = SQLHelper.CreateSqlHelper(this.Space.SpaceKey, this.Space.ConnectString); string sql = String.Format("select * from {0} where ID='{1}' ", TableName, ID); var dt = this.InstanceDB.ExecuteDataTable(sql); if (dt != null && dt.Rows.Count > 0) { var row = dt.Rows[0]; DataAdapter.DataRowToHashTable(row, this.DataEntity); } else { throw new Formula.Exceptions.BusinessException("未能找到ID为【" + ID + "】的编目节点"); } }