/* ##################################################################### # Q6 # existsIn._STORECODE # existsIn._ITEMCODE # existsIn._QUANTITY ##################################################################### */ public static List <Exists_In> FindRunnuingOutItems() { List <Exists_In> existIns = new List <Exists_In>(); Exists_In existsIn; if (Connect()) { using (SqlCommand sqlCommand = new SqlCommand("Q6", _Connection)) { sqlCommand.CommandType = CommandType.StoredProcedure; sqlCommand.CommandText = "sp_FindRunnuingOutItems"; SqlDataReader reader; try { reader = sqlCommand.ExecuteReader(); } catch (Exception ex) { return(null); } while (reader.Read()) { existsIn = new Exists_In(); existsIn._STORECODE = Convert.ToInt32(reader[0]); existsIn._ITEMCODE = Convert.ToInt32(reader[1]); existsIn._QUANTITY = Convert.ToInt32(reader[2]); existIns.Add(existsIn); } reader.Close(); } } return(existIns); }
/* ##################################################################### # Q6 # existsIn._STORECODE # existsIn._ITEMCODE # existsIn._QUANTITY ##################################################################### */ public static List <Exists_In> FindRunnuingOutItems() { string Q6Query = " select STORECODE, ITEMCODE, QUANTITY from EXISTS_IN " + " where QUANTITY < 5 " + " order by STORECODE asc, quantity asc, ITEMCODE asc "; List <Exists_In> existIns = new List <Exists_In>(); Exists_In existsIn; if (Connect()) { //we are going to call query called Q6 using (SqlCommand sqlCommand = new SqlCommand()) { sqlCommand.CommandType = CommandType.Text; sqlCommand.CommandText = Q6Query; sqlCommand.Connection = _Connection; SqlDataReader reader; try { reader = sqlCommand.ExecuteReader(); } catch (Exception ex) { return(null); } //Converting query results to PersonPhoneAddress objects while (reader.Read()) { existsIn = new Exists_In(); existsIn._STORECODE = Convert.ToInt32(reader[0]); existsIn._ITEMCODE = Convert.ToInt32(reader[1]); existsIn._QUANTITY = Convert.ToInt32(reader[2]); existIns.Add(existsIn); } reader.Close(); } } return(existIns); }