public static StoreCustomAttachment GetStoreCustomAttachmentByStoreCustomAttachmentId(int storeCustomAttachmentId) { Database db = DatabaseFactory.CreateDatabase("Spar-StoreRep"); string sqlCommand = "GetStoreCustomAttachmentByStoreCustomAttachmentId"; DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand); db.AddInParameter(dbCommand, "@StoreCustomAttachmentId", DbType.Int32, storeCustomAttachmentId); db.AddOutParameter(dbCommand, "@Description", DbType.String, 200); db.AddOutParameter(dbCommand, "@Attachment", DbType.String, 1000); db.AddOutParameter(dbCommand, "@StoreCustomId", DbType.Int32, 4); db.ExecuteNonQuery(dbCommand); StoreCustomAttachment storeCustomAttachment = new StoreCustomAttachment(); storeCustomAttachment.StoreCustomAttachmentId = storeCustomAttachmentId; storeCustomAttachment.Description = db.GetParameterValue(dbCommand, "Description").ToString(); storeCustomAttachment.Attachment = db.GetParameterValue(dbCommand, "Attachment").ToString(); storeCustomAttachment.StoreCustomId = Convert.ToInt32(db.GetParameterValue(dbCommand, "StoreCustomId")); return(storeCustomAttachment); }
public static List <StoreCustomAttachment> GetStoreCustomAttachmentListByStoreCustomId(int storeCustomId, int companyId) { List <StoreCustomAttachment> list = new List <StoreCustomAttachment>(); Database db = DatabaseFactory.CreateDatabase("Spar-StoreRep"); string sqlCommand = "GetStoreCustomAttachmentListByStoreCustomId"; DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand); db.AddInParameter(dbCommand, "@StoreCustomId", DbType.Int32, storeCustomId); db.AddInParameter(dbCommand, "@CompanyId", DbType.Int32, companyId); using (IDataReader dataReader = db.ExecuteReader(dbCommand)) { while (dataReader.Read()) { StoreCustomAttachment storeCustomAttachment = new StoreCustomAttachment(); storeCustomAttachment.StoreCustomAttachmentId = Convert.ToInt32(dataReader["StoreCustomAttachmentId"]); storeCustomAttachment.Description = dataReader["Description"].ToString(); list.Add(storeCustomAttachment); } } return(list); }