示例#1
0
        public static List <Custumers> Listado()
        {
            List <Custumers> cl = null;
            Custumers        ob;

            SQL = "SELECT * from customers";
            MySqlDataReader rg = Mysqlcon.Query(SQL);

            cl = new List <Custumers>();
            while (rg.Read())
            {
                ob                   = new Custumers();
                ob.Number            = rg.GetInt32("customerNumber");//campo en DB
                ob.Name              = rg.GetString("customerName");
                ob.ConstactFirstName = rg.GetString("contactFirstName");
                ob.ContactLastName   = rg.GetString("contactLastName");
                ob.Phone             = rg.GetString("phone");
                ob.AddressLine1      = rg.GetString("addressLine1");
                ob.City              = rg.GetString("city");
                ob.Country           = rg.GetString("country");
                ob.CreditLimit       = rg.GetDouble("creditLimit");
                cl.Add(ob);
            }
            rg.Close();
            return(cl);
        }//end Listado
示例#2
0
        }//end Buscar

        public static Employees BuscarEmployees(int number)
        {
            Employees ob = null;

            SQL = $"Select * from employees where employeeNumber={number}";
            MySqlDataReader rg = Mysqlcon.Query(SQL);

            Console.WriteLine(SQL);
            if (rg.Read())
            {
                ob = new Employees();
                ob.EmployeeNumber = rg.GetInt32("employeeNumber");
                ob.LastName       = rg.GetString("lastName") + " " + rg.GetString("firstName");
            }
            rg.Close();
            return(ob);
        }//end buscar empleado-Cliente
        }//end Listado

        public static Ordes Buscar(int Number)
        {
            Ordes ob = null;

            SQL = $"SELECT * FROM `orders` WHERE orderNumber={Number}";
            MySqlDataReader rg = Mysqlcon.Query(SQL);

            if (rg.Read())
            {
                ob                = new Ordes();
                ob.OrderNumber    = rg.GetInt32("orderNumber");//campo en DB
                ob.OrderDate      = rg.GetDateTime("orderDate");
                ob.RequiredDate   = rg.GetDateTime("requiredDate");
                ob.Status         = rg.GetString("status");
                ob.CustomerNumber = rg.GetInt32("customerNumber");
            }
            rg.Close();
            return(ob);
        }//end Buscar
示例#4
0
        }//end Listado

        public static Custumers Buscar(int Number)
        {
            Custumers ob = null;

            SQL = $"SELECT * FROM customers WHERE customerNumber = { Number}";
            MySqlDataReader rg = Mysqlcon.Query(SQL);

            if (rg.Read())
            {
                ob        = new Custumers();
                ob.Number = rg.GetInt32("customerNumber");//campo en DB
                ob.Name   = rg.GetString("customerName");
                String date   = rg.GetString("addressLine2");
                String adress = (date != "") ? " " + rg.GetString("addressLine2") : "";
                ob.AddressLine1           = rg.GetString("addressLine1") + " - " + adress;
                ob.Phone                  = rg.GetString("phone");
                ob.SalesRepEmployeeNumber = rg.GetInt32("salesRepEmployeeNumber");
            }
            rg.Close();
            return(ob);
        }//end Buscar
        public static List <Ordes> Listado()
        {
            List <Ordes> cl = null;
            Ordes        ob;

            SQL = "SELECT * FROM orders";
            MySqlDataReader rg = Mysqlcon.Query(SQL);

            cl = new List <Ordes>();
            while (rg.Read())
            {
                ob                = new Ordes();
                ob.OrderNumber    = rg.GetInt32("orderNumber");//campo en DB
                ob.OrderDate      = rg.GetDateTime("orderDate");
                ob.RequiredDate   = rg.GetDateTime("requiredDate");
                ob.Status         = rg.GetString("status");
                ob.CustomerNumber = rg.GetInt32("customerNumber");
                cl.Add(ob);
            }
            rg.Close();
            return(cl);
        }//end Listado
        public static List <OrderDetails> Buscar(int Number)
        {
            List <OrderDetails> cl = null;
            OrderDetails        ob;

            SQL = $"SELECT * FROM `orderdetails` WHERE orderNumber={Number}";
            MySqlDataReader rg = Mysqlcon.Query(SQL);

            cl = new List <OrderDetails>();
            while (rg.Read())
            {
                ob                 = new OrderDetails();
                ob.OrderNumber     = rg.GetInt32("orderNumber");//campo en DB
                ob.ProductCode     = rg.GetString("productCode");
                ob.QuantityOrdered = rg.GetInt32("quantityOrdered");
                ob.PriceEach       = rg.GetDouble("PriceEach");
                ob.OrderLineNumber = rg.GetString("orderLineNumber");
                cl.Add(ob);
            }
            rg.Close();
            return(cl);
        }//end Buscar
        }//end Buscar

        public static List <Products> BuscarProducto(int number)
        {
            List <Products> pr = null;
            Products        ob;

            SQL = "SELECT products.productName,products.productCode,products.quantityInStock,products.buyPrice FROM products " +
                  "INNER join orderdetails ON products.productCode=orderdetails.productCode " +
                  "INNER JOIN orders ON orderdetails.orderNumber=orders.orderNumber WHERE orders.orderNumber=" + number;
            MySqlDataReader rg = Mysqlcon.Query(SQL);

            pr = new List <Products>();
            while (rg.Read())
            {
                ob             = new Products();
                ob.ProductName = rg.GetString("productName");
                ob.ProductCode = rg.GetString("productCode");
                ob.Quantity    = rg.GetInt32("quantityInStock");
                ob.Price       = rg.GetDouble("buyPrice");
                pr.Add(ob);
            }
            rg.Close();
            return(pr);
        }