public FormAgent()
 {
     InitializeComponent();
     connection = new DatabaseConnection(@"GATEWAY-NE\SQLEXPRESS", "databasecar");
     dataGridViewAgent.DataSource = connection.Refresh(tableName, "*");
     propertyFormAgent();
 }
        public FormViewAddSupplier()
        {
            InitializeComponent();

            connection = new DatabaseConnection(@"GATEWAY-NE\SQLEXPRESS", "databasecar");
            dataGridViewSuppliers.DataSource = connection.Refresh(tableName, "*");
        }
 public FormSeekClient()
 {
     InitializeComponent();
     connection            = new DatabaseConnection(@"GATEWAY-NE\SQLEXPRESS", "databasecar");
     dgvClients.DataSource = connection.Refresh("Cliente", "Nombre,Domicilio,Telefono");
     id = name = address = phone = "";
 }
Exemple #4
0
        // Este método actualiza el DataGridView de los proveedores con la información de todos los mismos.

        public void updateDataGrid()
        {
            //OleDbConnection con = new OleDbConnection(@"Provider=SQLNCLI11;Server=CASA-PC;Database=databasecar;Trusted_Connection=yes;");

            //con.Open();
            //if (con.State != ConnectionState.Open) { return; }

            //OleDbCommand command = new OleDbCommand("SELECT * FROM dbo.Proveedor", con);
            //OleDbDataAdapter adapter = new OleDbDataAdapter(command);

            //DataTable table = new DataTable();
            //adapter.Fill(table);

            dgvSuppliers.DataSource = connection.Refresh("dbo.Proveedor", "*");;

            //con.Close();
        }
Exemple #5
0
 public Form1()
 {
     InitializeComponent();
     databaseconnection = new DatabaseConnection(@"DESKTOP-Q77ELOA\SQLEXPRESS", "databasecar");
     //databaseconnection.InsertInto("Auto", "NoSerie, Nombre, Marca, Modelo, PrecioFabrica, PrecioVenta", "'hoolamundo','tsuru','niisan','hibrido',10.5,50.5");
     databaseconnection.InsertInto("Cliente", "Nombre,Domicilio,Telefono,Ocupacion", "'Juan Perez','Himno Nacional', '4444954621','Estudiante'");
     this.dataGridView1.DataSource = databaseconnection.Refresh("Cliente", "*");
 }
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            string order = "Nombre, Telefono, Domicilio, RazonSocial, Email";

            try
            {
                if (verify_Fields())
                {
                    string value = String.Format("'{0}','{1}','{2}','{3}','{4}'",
                                                 textBoxName.Text, textBoxPhone.Text, textBoxResidency.Text, textBoxBusinessName.Text,
                                                 textBoxEmail.Text);
                    connection.InsertInto(tableName, order, value);
                    dataGridViewSuppliers.DataSource = connection.Refresh(tableName, "*");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("El E-mail,Telefono y Razon Social deben ser unicos \ny no se pueden repetir");
            }
        }
 private void buttonInsert_Click(object sender, EventArgs e)
 {
     try
     {
         if (existEmptyFields() != true)
         {
             connection.InsertInto(tableName, "Nombre,RFC,Salario,Domicilio,Celular,Email", generateStringValue("INSERT"));
             dataGridViewAgent.DataSource = connection.Refresh(tableName, "*");
             cleanForm();
         }
         else
         {
             MessageBox.Show("Es obligatorio llenar todos los campos");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("El RFC, E-mail y Telefono deben ser unicos \ny no se pueden repetir");
     }
 }
 private void buttonInsert_Click(object sender, EventArgs e)
 {
     try
     {
         if (existEmptyFields() != true)
         {
             connection.InsertInto(tableName, "Nombre,Domicilio,Telefono,Ocupacion", generateStringValue("INSERT"));
             dataGridViewClient.DataSource = connection.Refresh(tableName, "*");
             cleanForm();
         }
         else
         {
             MessageBox.Show("Es Obligatorio llenar todos los campos");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("El Celular tiene que ser unico\ny no se puede repetir.");
     }
 }
        // Método para evitar que el botón de búsqueda sea presionado con el campo de nombre vacío.

        private void tbName_TextChanged(object sender, EventArgs e)
        {
            dgvClients.DataSource = connection.Refresh("Cliente", "Nombre,Domicilio,Telefono", string.Format("Nombre='{0}*'", tbName.Text));
        }