public List <Porder> Get(string corte, int i = 1)
        {
            var conectionString = CreadorConection.Creador(CreadorConection.Auditoria).conectionstring();

            var list = new List <Porder>();

            using (SqlConnection cn = new SqlConnection(conectionString))
            {
                cn.Open();

                var sqlcommand = new SqlCommand("spdGetTallasUniXCorteCliente", cn);
                sqlcommand.CommandType = CommandType.StoredProcedure;

                sqlcommand.Parameters.Add("@corte", SqlDbType.NChar, 25).Value = corte;

                var dr = sqlcommand.ExecuteReader();


                while (dr.Read())
                {
                    var obj = new Porder
                    {
                        idCorte = Convert.ToInt32(dr["unidades"].ToString()),
                        corte   = dr["Size"].ToString(),
                    };

                    list.Add(obj);
                }

                return(list);
            }
        }
Beispiel #2
0
        public ActionResult get(string corte, string test)
        {
            string connectionString = Configuration["ConnectionStrings:ConeccionPrueba"];
            var    lista            = new List <Porder>();

            using (SqlConnection con = new SqlConnection(connectionString))
            {
                con.Open();
                SqlCommand command = new SqlCommand("spdConstainPorder", con);
                command.CommandType = CommandType.StoredProcedure;
                command.Parameters.AddWithValue("@corte", corte);

                SqlDataReader dtr = command.ExecuteReader();

                while (dtr.Read())
                {
                    var obj = new Porder()
                    {
                        //ObjectId = Convert.ToInt32(dtr["Id_Order"].ToString()),
                        Corte    = dtr["porder"].ToString(),
                        Estilo   = dtr["style"].ToString(),
                        Unidades = Convert.ToInt32(dtr["quantity"].ToString()),
                        descr    = dtr["descr"].ToString()
                    };

                    lista.Add(obj);
                }


                return(Ok(lista));
            }
        }
Beispiel #3
0
        public IEnumerable <Porder> get()
        {
            try
            {
                string connectionString = Configuration["ConnectionStrings:ConeccionPrueba"];
                var    lista            = new List <Porder>();
                using (SqlConnection con = new SqlConnection(connectionString))
                {
                    con.Open();
                    SqlCommand command = new SqlCommand("getporderAll", con);

                    command.CommandType = CommandType.StoredProcedure;

                    SqlDataReader dtr = command.ExecuteReader();

                    ///var r = dtr.Read();
                    //var h = 10 / Convert;

                    while (dtr.Read())
                    {
                        var obj = new Porder()
                        {
                            ObjectId = Convert.ToInt32(dtr["Id_Order"].ToString()),
                            Corte    = dtr["Porder"].ToString(),
                            IdEstilo = Convert.ToInt32(dtr["Id_Style"].ToString()),
                            Unidades = Convert.ToInt32(dtr["Quantity"].ToString())
                        };

                        lista.Add(obj);
                    }
                    //;

                    return(lista.AsEnumerable());
                }
            }
            catch (Exception ex)
            {
                var obj = new Porder()
                {
                    ObjectId = 1,          // Convert.ToInt32(dtr["Id_Order"].ToString()),
                    Corte    = ex.Message, // dtr["Porder"].ToString(),
                    IdEstilo = 1,          // Convert.ToInt32(dtr["Id_Style"].ToString()),
                    Unidades = 1152        //Convert.ToInt32(dtr["Quantity"].ToString())
                };

                var lista = new List <Porder>();

                lista.Add(obj);

                return(lista.AsEnumerable());

                //return //Ok(ex.Message);
                //throw;
            }
        }
Beispiel #4
0
        public int Post([FromBody] Porder data)
        {
            var coneccion = Configuration["ConnectionStrings:ConeccionPrueba"];

            using (SqlConnection cn = new SqlConnection(coneccion))
            {
                cn.Open();
                var cmm = new SqlCommand("spdCrearPorder", cn);
                cmm.CommandType = CommandType.StoredProcedure;
                cmm.Parameters.Add("@po", SqlDbType.NChar, 15).Value = data.Corte;
                cmm.Parameters.Add("@unidades", SqlDbType.Int).Value = data.Unidades;
                cmm.Parameters.Add("@idestilo", SqlDbType.Int).Value = data.IdEstilo;

                var resp = cmm.ExecuteNonQuery();

                return(resp);
            }
        }
Beispiel #5
0
        public IEnumerable <Porder> get(int id)
        {
            //string connectionString = Configuration["ConnectionStrings:ConeccionPrueba"];
            var lista = new List <Porder>();
            //using (SqlConnection con = new SqlConnection(connectionString))
            //{
            //    con.Open();
            //    SqlCommand command = new SqlCommand("getporderXid", con);

            //    command.CommandType = CommandType.StoredProcedure;

            //    command.Parameters.AddWithValue("@id", id);

            //    SqlDataReader dtr = command.ExecuteReader();

            //SqlDataAdapter dataAdapter = new SqlDataAdapter(command);
            //DataTable dt = new DataTable();
            //dataAdapter.Fill(dt);

            // var r = dtr.Read();

            //  while (dtr.Read()) // (dtr.Read())
            // {
            var obj = new Porder()
            {
                ObjectId = 1,       // Convert.ToInt32(dtr["Id_Order"].ToString()),
                Corte    = "corte", //dtr["Porder"].ToString(),
                IdEstilo = 10,      //Convert.ToInt32(dtr["Id_Style"].ToString()),
                Unidades = 1152     //Convert.ToInt32(dtr["Quantity"].ToString())
            };

            lista.Add(obj);

            //  }
            //;

            return(lista.AsEnumerable());

            // }
        }
        public List <Porder> Get(string pre)
        {
            // var conectionString = Coneccion.Cadena.conexion;
            var conectionString = CreadorConection.Creador(CreadorConection.Auditoria).conectionstring();

            var list = new List <Porder>();

            using (SqlConnection cn = new SqlConnection(conectionString))
            {
                cn.Open();

                var sqlcommand = new SqlCommand("spdBuscarPoCliente", cn);
                sqlcommand.CommandType = CommandType.StoredProcedure;

                sqlcommand.Parameters.Add("@porder", SqlDbType.NChar, 15).Value = pre;

                var dr = sqlcommand.ExecuteReader();


                while (dr.Read())
                {
                    var obj = new Porder
                    {
                        //idCorte = Convert.ToInt32(dr["Id_Order"].ToString()),
                        corte    = dr["Porder"].ToString(),
                        estilo   = dr["Style"].ToString(),
                        cantidad = Convert.ToInt32(dr["Quantity"].ToString()),
                        washed   = Convert.ToBoolean(dr["Washed"]),
                        descrip  = dr["Describir"].ToString()
                    };

                    list.Add(obj);
                }

                return(list);
            }
        }
Beispiel #7
0
 public static UInt32 Insert(Porder pom)
 {
     return(HelperDal <Porder> .Insert(pom, "SELECT * FROM porder WHERE pom_id=0"));
 }
Beispiel #8
0
 public static bool Update(Porder pom)
 {
     return(HelperDal <Porder> .Update(pom, "SELECT * FROM porder WHERE pom_id=" + pom.pom_id));
 }