/********* RANGE QUERY **********/ /* * will direct the query requested to the correct function in the this.itsDAL interface * and return a list containing the query results: * all the transactions in which -> fromValue <= field <= toValue */ public List <Transaction> queryByRange(rangeFields field, string fromValue, string toValue) { if (field == rangeFields.dateTime) { return(itsDAL.transactionRangeQuery(field, fromValue, toValue)); } Console.WriteLine("WRONG SEARCH PARAMETERS"); return(null); }
/********* RANGE QUERY *********/ /* * will direct the query requested to the correct function in the this.itsDAL interface * and return a list containing the query results: * all the club members in which -> fromValue <= field <= toValue */ public List <Employee> queryByRange(rangeFields field, string fromValue, string toValue, List <Employee> list = null) { if (field == rangeFields.salary) { return(itsDAL.employeeRangeQuery(field, fromValue, toValue, list)); } Console.WriteLine("WRONG SEARCH PARAMETERS"); return(null); }
/************ RANGE QUERY ****************/ /* * will direct the query requested to the correct function in the this.itsDAL interface * and return a list containing the query results: * all club members in which -> fromValue <= filed <= toValue */ public List <ClubMember> queryByRange(rangeFields field, string fromValue, string toValue) { if (field == rangeFields.date_of_birth) { return(itsDAL.clubMemberRangeQuery(field, fromValue, toValue)); } Console.WriteLine("WRONG SEARCH PARAMETERS"); return(null); }
/********** RANGE QUERY ***********/ /* * will direct the query requested to the correct function in the this.itsDAL interface * and return a list containing the query results: * all the products in which -> fromValue <= field <= toValue */ public List <Product> queryByRange(rangeFields field, string fromValue, string toValue, List <Product> listP = null) { if (field == rangeFields.price || field == rangeFields.stockCount || field == rangeFields.whenToOrder) { List <Product> tempPList = itsDAL.productRangeQuery(field, fromValue, toValue, listP); EmphsizeTopSeller(tempPList); return(tempPList); } Console.WriteLine("WRONG SEARCH PARAMETERS"); return(null); }
//look up public List <ClubMember> clubMemberRangeQuery(rangeFields field, string fromValue, string toValue) { if (field == rangeFields.date_of_birth) { return(clubMember_Linq_DAL.clubMemberDateOfBirthQuery(Convert.ToDateTime(fromValue), Convert.ToDateTime(toValue))); } else { Console.WriteLine("WORNG SEARCH PARAMETERS"); return(null); } }
//look up public List <Transaction> transactionRangeQuery(rangeFields field, string fromValue, string toValue) { if (field == rangeFields.dateTime) { return(transaction_Linq_DAL.transactionDateTimeQuery(Convert.ToDateTime(fromValue), Convert.ToDateTime(toValue))); } else { Console.WriteLine("WORNG SEARCH PARAMETERS"); return(null); } }
//look up public List <Employee> employeeRangeQuery(rangeFields field, string fromValue, string toValue, List <Employee> listE = null) { if (field == rangeFields.salary) { return(employee_Linq_DAL.employeeSalaryQuery(Convert.ToDouble(fromValue), Convert.ToDouble(toValue), listE)); } else { Console.WriteLine("WORNG SEARCH PARAMETERS"); return(null); } }
//look up public List <Product> productRangeQuery(rangeFields field, string fromValue, string toValue, List <Product> listP = null) { if (field == rangeFields.price) { return(product_Linq_DAL.productPriceQuery(Convert.ToDouble(fromValue), Convert.ToDouble(toValue), listP)); } else if (field == rangeFields.stockCount) { return(product_Linq_DAL.productStockCountQuery(Convert.ToInt32(fromValue), Convert.ToInt32(toValue), listP)); } else if (field == rangeFields.whenToOrder) { return(product_Linq_DAL.productWhenToOrderQuery(Convert.ToInt32(fromValue), Convert.ToInt32(toValue), listP)); } else { Console.WriteLine("WORNG SEARCH PARAMETERS"); return(null); } }
/********************************** <END> ADD/EDIT/REMOVE <END> *************************************/ /******************************************** QUERYS ******************************************************/ /********* RANGE QUERY **********/ /* * will direct the query requested to the correct function according to the instance of clas (recieved in function) * and return a list containing the query results: * a list of objects where all where: fromValue<=field<=ToValue */ public List <object> queryByRange(Classes clas, rangeFields field, string fromValue, string ToValue, List <object> listO = null) { if (clas == Classes.ClubMember) { return(clubMember_bl.queryByRange(field, fromValue, ToValue).Cast <object>().ToList()); } else if (clas == Classes.Employee) { if (listO != null) { return(employee_bl.queryByRange(field, fromValue, ToValue, listO.Cast <Employee>().ToList()).Cast <object>().ToList()); } else { return(employee_bl.queryByRange(field, fromValue, ToValue).Cast <object>().ToList()); } } else if (clas == Classes.Product) { if (listO != null) { return(prod_bl.queryByRange(field, fromValue, ToValue, listO.Cast <Product>().ToList()).Cast <object>().ToList()); } else { return(prod_bl.queryByRange(field, fromValue, ToValue).Cast <object>().ToList()); } } else if (clas == Classes.Transaction) { return(transaction_bl.queryByRange(field, fromValue, ToValue).Cast <object>().ToList()); } else { Console.WriteLine("WRONG SEARCH PARAMETERS"); return(null); } }