Ejemplo n.º 1
0
        public void SP_TEST_WITH_T(int IdModelo, string Descripcion)
        {
            PH.Entidades.SP_CALL_PRECIO        cm    = null;
            List <PH.Entidades.SP_CALL_PRECIO> lista = new List <Entidades.SP_CALL_PRECIO>();

            using (FirebirdSql.Data.FirebirdClient.FbConnection cn = new FbConnection(ConfigurationManager.ConnectionStrings["PHConnection"].ConnectionString))
            {
                try
                {
                    cn.Open();
                    string spName = "INSERT INTO MODELO(IDMODELO,DESCRIPCION) VALUES(?,?)";
                    // declare command
                    FbTransaction t           = cn.BeginTransaction();
                    FbCommand     readCommand =
                        new FbCommand(spName, cn, t);
                    // new FbCommand("Select * From " + spName + "(@IDSucursal,@Header,@Details,@Cliente,@IdPedido)", cn);
                    readCommand.Parameters.Add(new FbParameter("@IDMODELO", IdModelo));
                    readCommand.Parameters.Add(new FbParameter("@DESCRIPCION", Descripcion));


                    FbDataReader myreader = readCommand.ExecuteReader();
                    while (myreader.Read())
                    {
                        //// load the combobox with the names of the people inside.
                        //// myreader[0] reads from the 1st Column
                        ////DeleteComboBox.Items.Add(myreader[0]);
                        //cm = new PH.Entidades.SP_CALL_PRECIO();
                        //cm.IDARTICULO = myreader.GetString(0);
                        //cm.PRECIO = myreader.GetDecimal(1);
                        //cm.IDLISTA = myreader.GetInt32(2);
                        //cm.LISTA = myreader.GetString(3);

                        //lista.Add(cm);
                    }
                    t.Commit();
                    myreader.Close();                     // we are done with the reader
                }
                catch (Exception x)
                {
                    //MessageBox.Show(x.Message);
                    throw x;
                }
                finally
                {
                    cn.Close();
                }
            }
        }
Ejemplo n.º 2
0
        public List <PH.Entidades.SP_CALL_PRECIO> SP_CALL_PRECIO(string IdProducto)
        {
            PH.Entidades.SP_CALL_PRECIO        cm    = null;
            List <PH.Entidades.SP_CALL_PRECIO> lista = new List <Entidades.SP_CALL_PRECIO>();

            using (FirebirdSql.Data.FirebirdClient.FbConnection cn = new FbConnection(ConfigurationManager.ConnectionStrings["PHConnection"].ConnectionString))
            {
                try
                {
                    cn.Open();
                    string spName = "Select * FROM SP_CALL_PRECIO p where p.IDARTICULO = ?";
                    // declare command
                    FbCommand readCommand =
                        new FbCommand(spName, cn);
                    // new FbCommand("Select * From " + spName + "(@IDSucursal,@Header,@Details,@Cliente,@IdPedido)", cn);
                    readCommand.Parameters.Add(new FbParameter("@IDARTICULO", IdProducto));

                    FbDataReader myreader = readCommand.ExecuteReader();
                    while (myreader.Read())
                    {
                        // load the combobox with the names of the people inside.
                        // myreader[0] reads from the 1st Column
                        //DeleteComboBox.Items.Add(myreader[0]);
                        cm            = new PH.Entidades.SP_CALL_PRECIO();
                        cm.IDARTICULO = myreader.GetString(0);
                        cm.PRECIO     = myreader.GetDecimal(1);
                        cm.IDLISTA    = myreader.GetInt32(2);
                        cm.LISTA      = myreader.GetString(3);

                        lista.Add(cm);
                    }
                    myreader.Close();                     // we are done with the reader
                }
                catch (Exception x)
                {
                    //MessageBox.Show(x.Message);
                    throw x;
                }
                finally
                {
                    cn.Close();
                }
            }

            return(lista);
        }