예제 #1
0
        private void button4_Click(object sender, EventArgs e)
        {
            try
            {
                string sql = $"select idaddress from address where address = '{comboBox4.SelectedItem.ToString()}'";



                var dt        = Conexion.realizarConsulta(sql);
                var dr        = dt.Rows[0];
                var idaddress = Convert.ToInt32(dr[0].ToString());

                string sql2 =
                    $"select idproduct from PRODUCT where name = '{comboBox3.SelectedItem.ToString()}'";
                var dt2       = Conexion.realizarConsulta(sql2);
                var dt3       = dt2.Rows[0];
                var productid = Convert.ToInt32(dt3[0].ToString());

                DateTimePicker date2 = new DateTimePicker();


                //string sql3 = String.Format();
                Conexion.realizarAccion($"INSERT INTO APPORDER( createdate, idproduct, idaddress) VALUES (" +
                                        $"'{dateTimePicker1.Value}' ," +
                                        $"'{productid}' ," +
                                        $"{idaddress})");

                MessageBox.Show("pedido exitoso");
            }
            catch (Exception ex)
            {
                MessageBox.Show("pedido exitoso");
            }
        }
예제 #2
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            string sql = "SELECT * FROM appuser WHERE username ='******'and password ='******'";

            dt = Conexion.realizarConsulta(sql);


            if (dt.Rows.Count > 0)
            {
                string type = dt.Rows[0][4].ToString().Trim();

                if (type == "true")
                {
                    this.Hide();
                    AdminPanel adminPanel = new AdminPanel();
                    adminPanel.Show();
                }
                else
                {
                    OrdenesCliente ordenesCliente = new OrdenesCliente();
                    this.Hide();
                    ordenesCliente.Show();
                }
            }
            else
            {
                MessageBox.Show("revise sus datos e ingrese de nuevo");
            }
        }
예제 #3
0
        private void addAddressButton_Click(object sender, EventArgs e)
        {
            comboBox1.Items.Clear();
            var iduser = Conexion.realizarConsulta("select iduser from appuser where username= '******';");

            var dt     = iduser.Rows[0];
            var userid = Convert.ToInt32(dt[0].ToString());


            if (textBox1.Text.Equals("") || textBox2.Text.Equals(""))
            {
                MessageBox.Show("No puede dejar casillas en blanco.");
            }
            else
            {
                try
                {
                    Conexion.realizarAccion("INSERT INTO public.ADDRESS(iduser, address) VALUES('" + userid + "', '" + textBox2.Text + "')");

                    MessageBox.Show("Ha sido registrado");
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Ha ocurrido un error", ex.ToString());
                }
            }
        }
예제 #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            DataTable dt = new DataTable();

            dt = Conexion.realizarConsulta("select address from ADDRESS;");

            foreach (DataRow dr in dt.Rows)
            {
                comboBox1.Items.Add(dr["address"].ToString());
            }
        }
예제 #5
0
        private void button1_Click(object sender, EventArgs e)
        {
            string sql    = "select iduser from APPUSER where username = '******';";
            var    dt     = Conexion.realizarConsulta(sql);
            var    dr     = dt.Rows[0];
            var    iduser = Convert.ToInt32(dr[0].ToString());

            string sql2      = "select address from ADDRESS where iduser = '******';";
            var    direccion = Conexion.realizarConsulta(sql2);

            var combo4direccion = new List <string>();

            foreach (DataRow dr2 in direccion.Rows)
            {
                combo4direccion.Add(dr2[0].ToString());
            }

            comboBox4.DataSource = combo4direccion;
        }
예제 #6
0
        private void button3_Click(object sender, EventArgs e)
        {
            string sql = "select idbusiness from BUSINESS where name = '" + comboBox1.Text + "'";

            var dt         = Conexion.realizarConsulta(sql);
            var dr         = dt.Rows[0];
            var idbusiness = Convert.ToInt32(dr[0].ToString());


            string sql2    = "select name from PRODUCT where idbusiness = '" + idbusiness + "' ;";
            var    product = Conexion.realizarConsulta(sql2);

            var combo3product = new List <string>();

            foreach (DataRow dr2 in product.Rows)
            {
                combo3product.Add(dr2[0].ToString());
            }

            comboBox3.DataSource = combo3product;
        }