public SalesPersonCollection GetAllSalesPersonsDynamicCollection(string whereExpression, string orderBy) { IDBManager dbm = new DBManager(); SalesPersonCollection cols = new SalesPersonCollection(); try { dbm.CreateParameters(2); dbm.AddParameters(0, "@WhereCondition", whereExpression); dbm.AddParameters(1, "@OrderByExpression", orderBy); IDataReader reader = dbm.ExecuteReader(CommandType.StoredProcedure, "SelectSalesPersonsDynamic"); while (reader.Read()) { SalesPerson SP = new SalesPerson(); SP.SalesPersonID = Int32.Parse(reader["SalesPersonID"].ToString()); SP.TerritoryID = Int32.Parse(reader["TerritoryID"].ToString()); SP.SalesQuota = Decimal.Parse(reader["SalesQuota"].ToString()); SP.Bonus = Decimal.Parse(reader["Bonus"].ToString()); SP.CommissionPct = Decimal.Parse(reader["CommissionPct"].ToString()); SP.ModifiedDate = DateTime.Parse(reader["ModifiedDate"].ToString()); cols.Add(SP); } } catch (Exception ex) { log.Write(ex.Message, "GetAllSalesPersonsDynamicCollection"); throw (ex); } finally { dbm.Dispose(); } return(cols); }
public SalesPersonCollection GetAllSalesPersonsViewCollection() { IDBManager dbm = new DBManager(); SalesPersonCollection col = new SalesPersonCollection(); try { IDataReader reader = dbm.ExecuteReader(CommandType.StoredProcedure, "ViewSalesPersonsAll"); while (reader.Read()) { SalesPerson SP = new SalesPerson(); SP.SalesPersonID = Int32.Parse(reader["SalesPersonID"].ToString()); SP.FullName = reader["FullName"].ToString().Trim(); SP.SalesQuota = Decimal.Parse(reader["SalesQuota"].ToString()); SP.Bonus = Decimal.Parse(reader["Bonus"].ToString()); SP.CommissionPct = Decimal.Parse(reader["CommissionPct"].ToString()); SP.FirstName = reader["FirstName"].ToString().Trim(); SP.MiddleName = reader["MiddleName"].ToString().Trim(); SP.LastName = reader["LastName"].ToString().Trim(); col.Add(SP); } } catch (Exception ex) { log.Write(ex.Message, "GetAllSalesPersonsViewDataCollection()"); throw (ex); } finally { dbm.Dispose(); } return(col); }
public SalesPersonCollection GetAllSalesPersonsCollection() { IDBManager dbm = new DBManager(); SalesPersonCollection cols = new SalesPersonCollection(); try { IDataReader reader = dbm.ExecuteReader(CommandType.StoredProcedure, "SelectSalesPersonAll"); while (reader.Read()) { SalesPerson SP = new SalesPerson(); SP.SalesPersonID = Int32.Parse(reader["SalesPersonID"].ToString()); SP.TerritoryID = Int32.Parse(reader["TerritoryID"].ToString()); SP.SalesQuota = Decimal.Parse(reader["SalesQuota"].ToString()); SP.Bonus = Decimal.Parse(reader["Bonus"].ToString()); SP.CommissionPct = Decimal.Parse(reader["CommissionPct"].ToString()); SP.ModifiedDate = DateTime.Parse(reader["ModifiedDate"].ToString()); cols.Add(SP); } } catch (Exception ex) { log.Write(ex.Message, "GetAllSalesPersonsCollection"); throw (ex); } finally { dbm.Dispose(); } return(cols); }