Exemple #1
0
        public List <Address> getCityStore(Connection connection)
        {
            try
            {
                if (connection._connection.State == System.Data.ConnectionState.Closed)
                {
                    connection.Open();
                }

                var command = new OracleCommand("getCities", connection._connection);
                command.CommandType = System.Data.CommandType.StoredProcedure;
                List <Address>  addressList = new List <Address>();
                OracleParameter output      = command.Parameters.Add("l_cursor", OracleDbType.RefCursor);
                output.Direction = System.Data.ParameterDirection.ReturnValue;
                command.ExecuteNonQuery();

                Oracle.ManagedDataAccess.Client.OracleDataReader reader = command.ExecuteReader();

                while (reader.Read())
                {
                    Address address = new Address(
                        reader.GetInt32(0),
                        reader.GetString(1));
                    addressList.Add(address);
                }
                connection.Close();
                return(addressList);
                //  return null;
            }
            catch (Exception e)
            {
                connection.Close();
                throw;
            }
        }
Exemple #2
0
        public List <Products_Info> GetDbProductsList(Connection connection, int id)
        {
            try
            {
                if (connection._connection.State == System.Data.ConnectionState.Closed)
                {
                    connection.Open();
                }
                var command = new Oracle.ManagedDataAccess.Client.OracleCommand("returnCartPro", connection._connection);
                command.CommandType = System.Data.CommandType.StoredProcedure;
                List <Products_Info> products_Info_list = new List <Products_Info>();

                command.Parameters.Add("ID_INPUT", OracleDbType.Int32, System.Data.ParameterDirection.Input).Value = id;
                Oracle.ManagedDataAccess.Client.OracleParameter p_rc = command.Parameters.Add("rc", OracleDbType.RefCursor,
                                                                                              DBNull.Value,
                                                                                              System.Data.ParameterDirection.Output);
                // Oracle.ManagedDataAccess.Client.OracleParameter output = command.Parameters.Add("rc", OracleDbType.RefCursor);
                // output.Direction = System.Data.ParameterDirection.ReturnValue;
                command.ExecuteNonQuery();

                Oracle.ManagedDataAccess.Client.OracleDataReader reader = command.ExecuteReader();

                while (reader.Read())
                {
                    Products_Info products_Info = new Products_Info(
                        reader.GetInt32(0),
                        reader.GetString(1),
                        reader.GetInt32(2),
                        reader.GetInt32(3),
                        reader.GetString(4),
                        reader.GetString(5));
                    products_Info_list.Add(products_Info);
                }
                connection.Close();
                return(products_Info_list);
                //  return null;
            }
            catch (Exception e)
            {
                connection.Close();
                throw;
            }
        }
Exemple #3
0
 public void Chercher_Reprise(string id, out string erreur, out Bon_reprise br, out Boolean exist)
 {
     erreur = null;
     br     = new Bon_reprise();
     exist  = false;
     rsql   = "select * from  BON_REPRISE where  BON_REPRISE.NUM_BONREPRISE='" + id + "' ";
     cnx.select(rsql, out erreur, out dr);
     if (erreur == null)
     {
         if (dr.HasRows == true)
         {
             exist = true;
             dr.Read();
             br.NUM_BONREPRISES    = dr.GetString(0);
             br.DATE_REPRISE_REELS = dr.GetDateTime(1);
             br.NUM_TITRECONGES    = dr.GetString(2);
         }
         dr.Close();
     }
 }
        public ActionResult Lister()
        {
            User user = (User)Session["User"];

            Oracle.ManagedDataAccess.Client.OracleCommand    ObjSelct = new Oracle.ManagedDataAccess.Client.OracleCommand("select * from QUESTIONS", user.connexion);
            Oracle.ManagedDataAccess.Client.OracleDataReader ObjeRead = ObjSelct.ExecuteReader();
            List <Question> q = new List <Question>();

            while (ObjeRead.Read())
            {
                Question QQ = new Question();
                QQ.Id         = ObjeRead.GetString(0);
                QQ.Enoncer    = ObjeRead.GetString(1);
                QQ.flag       = ObjeRead.GetString(2);
                QQ.Dificulter = ObjeRead.GetString(3);

                q.Add(QQ);
            }
            ObjeRead.Close();



            return(View(q));
        }