public EbayStore GetEbayStore(string storeType) { EbayStore s = new EbayStore(); DataSet ds = new DataSet(); DataTable dt = new DataTable(); ArrayList storeDetails = new ArrayList(); string cmdStr = "SELECT * FROM ebay_details WHERE type='" + storeType + "'"; MySqlCommand command = new MySqlCommand(cmdStr, connection); ds = GetMultipleQuery(command); try { dt = ds.Tables[0]; } catch { } DataRow dr = dt.Rows[0]; for (int i = 0; i < dt.Columns.Count; i++) { storeDetails.Add(dr[i]); } s.Type = storeDetails[0].ToString(); s.Listings = Convert.ToInt32(storeDetails[1]); s.MonthlyPrice = Convert.ToDouble(storeDetails[2]); s.InsertionFee = Convert.ToInt32(storeDetails[3]); s.FinalValueFee = Convert.ToDouble(storeDetails[4]); s.InsertionFee = Convert.ToDouble(storeDetails[5]); return(s); }
//retrive eBay store type and fees public EbayStore GetStoreDetails(string storeType) { EbayStore store = new EbayStore(); string cmdStr = "SELECT * FROM ebay WHERE type=@storeType"; using (OleDbCommand command = new OleDbCommand(cmdStr)) { command.Parameters.AddWithValue("@storeType", storeType); base.ExecuteStoreQuery(command); } return(store); }
//submiting a qery with an argument and returning an EbayStore protected EbayStore ExecuteStoreQuery(OleDbCommand command) { EbayStore store = new EbayStore(); lock (_conn) { Connect(); command.Connection = _conn; try { // calling a query that returns the store details store = (EbayStore)command.ExecuteScalar(); } finally { Disconnect(); } return(store); } }