private void eliminarCliente() { float dni = 0; foreach (DataGridViewRow row in dataGridView1.SelectedRows) { dni = float.Parse(row.Cells[0].Value.ToString(), CultureInfo.InvariantCulture.NumberFormat); } DialogResult dialogResult = MessageBox.Show("Esta seguro que desea eliminar el usuario?", "Eliminar usuario", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { coneccion.Open(); username = new SqlCommand("PERSISTIENDO.usernameCliente", coneccion); username.CommandType = CommandType.StoredProcedure; username.Parameters.Add("@dni", SqlDbType.Float).Value = dni; SqlDataAdapter adapter = new SqlDataAdapter(username); DataTable table = new DataTable(); adapter.Fill(table); String user = table.Rows[0][0].ToString(); eliminar1 = new SqlCommand("PERSISTIENDO.bloquearUsuario", coneccion); eliminar1.CommandType = CommandType.StoredProcedure; eliminar1.Parameters.Add("@Username", SqlDbType.VarChar).Value = user; eliminar1.ExecuteNonQuery(); //eliminar1 = new SqlCommand("PERSISTIENDO.eliminarRPU", coneccion); //eliminar1.CommandType = CommandType.StoredProcedure; //eliminar1.Parameters.Add("@Username", SqlDbType.VarChar).Value = user; //eliminar1.ExecuteNonQuery(); //eliminar2 = new SqlCommand("PERSISTIENDO.eliminarCliente", coneccion); //eliminar2.CommandType = CommandType.StoredProcedure; //eliminar2.Parameters.Add("@Username", SqlDbType.VarChar).Value = user; //eliminar2.ExecuteNonQuery(); //eliminar3 = new SqlCommand("PERSISTIENDO.eliminarUsuario", coneccion); //eliminar3.CommandType = CommandType.StoredProcedure; //eliminar3.Parameters.Add("@Username", SqlDbType.VarChar).Value = user; //eliminar3.ExecuteNonQuery(); //coneccion.Close(); String mensaje = "El usuario se ha eliminado correctamente"; String caption = "Usuario borrado"; MessageBox.Show(mensaje, caption, MessageBoxButtons.OK); ABM_Usuario.Form2 frm2 = new ABM_Usuario.Form2(); this.Close(); frm2.Show(); } }
private void modificarEmpresa() { con.Open(); cod = new SqlCommand("PERSISTIENDO.codigoRubro", con); cod.CommandType = CommandType.StoredProcedure; cod.Parameters.Add("@Rubro", SqlDbType.VarChar).Value = comboBox3.Text.ToString(); var result = cod.Parameters.Add("@Valor", SqlDbType.Int); result.Direction = ParameterDirection.ReturnValue; data = cod.ExecuteReader(); data.Close(); var codigoRubro = result.Value; modificar = new SqlCommand("PERSISTIENDO.updateEmpresa", con); modificar.CommandType = CommandType.StoredProcedure; modificar.Parameters.Add("@Username", SqlDbType.VarChar).Value = textBox1.Text; modificar.Parameters.Add("@razon", SqlDbType.VarChar).Value = textBox12.Text; modificar.Parameters.Add("@cuil", SqlDbType.VarChar).Value = textBox4.Text; modificar.Parameters.Add("@mail", SqlDbType.VarChar).Value = textBox2.Text; modificar.Parameters.Add("@calle", SqlDbType.VarChar).Value = textBox7.Text; modificar.Parameters.Add("@cp", SqlDbType.VarChar).Value = textBox11.Text; modificar.Parameters.Add("@depto", SqlDbType.VarChar).Value = textBox10.Text; if (String.IsNullOrEmpty(textBox9.Text)) { modificar.Parameters.Add("@piso", SqlDbType.Float).Value = DBNull.Value; } else { modificar.Parameters.Add("@piso", SqlDbType.Float).Value = float.Parse(textBox9.Text, CultureInfo.InvariantCulture.NumberFormat); } modificar.Parameters.Add("@rubro", SqlDbType.Int).Value = (int)codigoRubro; modificar.Parameters.Add("@nro", SqlDbType.Float).Value = float.Parse(textBox8.Text, CultureInfo.InvariantCulture.NumberFormat); modificar.Parameters.Add("@localidad", SqlDbType.VarChar).Value = textBox6.Text; modificar.Parameters.Add("@ciudad", SqlDbType.VarChar).Value = textBox5.Text; modificar.Parameters.Add("@tel", SqlDbType.Float).Value = float.Parse(textBox3.Text, CultureInfo.InvariantCulture.NumberFormat); modificar.Parameters.Add("@contacto", SqlDbType.VarChar).Value = textBox13.Text; con.Close(); String mensaje = "La empresa se ha modificado correctamente"; String caption = "Empresa modificada"; MessageBox.Show(mensaje, caption, MessageBoxButtons.OK); ABM_Usuario.Form2 frm2 = new ABM_Usuario.Form2(); frm2.Show(); this.Close(); }
private void button3_Click(object sender, EventArgs e) { ABM_Usuario.Form2 frm2 = new ABM_Usuario.Form2(); this.Close(); frm2.Show(); }