public void btnAdd_Click(object sender, EventArgs e) { if (notebook4.Page == 0) { SPC.Add_User ventana_add = new SPC.Add_User("", this); ventana_add.Show(); } else if (notebook4.Page == 1) { SPC.Add_Materiales ventana_add = new SPC.Add_Materiales(); ventana_add.Show(); } else if (notebook4.Page == 2) { SPC.Add_Maquina ventana_add = new SPC.Add_Maquina("Maquina"); ventana_add.Show(); } else if (notebook4.Page == 3) { SPC.Add_Maquina ventana_add = new SPC.Add_Maquina("Medicion"); ventana_add.Show(); } else if (notebook4.Page == 4) { SPC.Error_Ventana Ventana_Error = new SPC.Error_Ventana("NoDisponible"); } else if (notebook4.Page == 5) { SPC.Error_Ventana Ventana_Error = new SPC.Error_Ventana("NoDisponible"); } }
public void btnOk_Click(object sender, EventArgs e) { //Declaracion de las variables var Material = E_Mat.Text; var Maquina = E_Mach.Text; var Equipo = E_Tool.Text; //Buscar info en la base de datos /* * //Asignar a una variable que sea un commando * OracleCommand user = new OracleCommand("USER_PASSW"); * * //user.BindByName = true; * * //Al comando agregarle la conexion con la base de datos * user.Connection = connection; * //Declarar que es un Procedure guardado * user.CommandType = System.Data.CommandType.StoredProcedure; * * //Declarar cuales son los parametros y si son entradas o salidas * OracleParameter rv = new OracleParameter("v_Return", OracleDbType.Varchar2, System.Data.ParameterDirection.ReturnValue); * // * OracleParameter r = new OracleParameter("r", OracleDbType.Varchar2, 200, "KATI0", System.Data.ParameterDirection.Input); * // * OracleParameter id = new OracleParameter("ID_U", OracleDbType.Varchar2, 200, id_t, System.Data.ParameterDirection.Input); * // * OracleParameter pas = new OracleParameter("PASSWORD_U", OracleDbType.Varchar2, 200, pass_t, System.Data.ParameterDirection.Input); * * OracleParameter[] ora_par = { r, id, pas, rv }; * user.Parameters.AddRange(ora_par); * * //Abrir coneccion * connection.Open(); * * //Ejecutar * user.ExecuteNonQuery(); * * //Poner el valor de regreso de la funcion en una variable * var text = (string)((OracleString)(user.Parameters[0].Value)).Value; * */ //Checar todos los campos llenos, si no mandar mensaje if (Material != "" && Maquina != "" && Equipo != "") { SPC.Operador_Datos Ventana = new SPC.Operador_Datos(Principal, this, Material, Maquina, Equipo, Us_); Ventana.Show(); //Esconder la pantalla; this.Hide(); } else { SPC.Error_Ventana Ventana_Error = new SPC.Error_Ventana("NoCaptura"); } }
public void Mod_Table(string sql_c) { tree_mod.RemoveColumn(tree_mod.GetColumn(0)); tree_mod.RemoveColumn(tree_mod.GetColumn(0)); tree_mod.RemoveColumn(tree_mod.GetColumn(0)); tree_mod.RemoveColumn(tree_mod.GetColumn(0)); tree_mod.RemoveColumn(tree_mod.GetColumn(0)); // ID, Nombre, Apellido, Puesto, Turno Gtk.TreeViewColumn ID = new Gtk.TreeViewColumn(); ID.Title = "ID"; Gtk.TreeViewColumn Nombre = new Gtk.TreeViewColumn(); Nombre.Title = "Problema"; Gtk.TreeViewColumn Apellido = new Gtk.TreeViewColumn(); Apellido.Title = "Actividad"; Gtk.TreeViewColumn Apellido2 = new Gtk.TreeViewColumn(); Apellido2.Title = "Usuario"; Gtk.TreeViewColumn Apellido3 = new Gtk.TreeViewColumn(); Apellido3.Title = "Estado"; tree_mod.AppendColumn(ID); tree_mod.AppendColumn(Nombre); tree_mod.AppendColumn(Apellido); tree_mod.AppendColumn(Apellido2); tree_mod.AppendColumn(Apellido3); Gtk.ListStore ListaUsuario = new Gtk.ListStore(typeof(string), typeof(string), typeof(string), typeof(string), typeof(string)); tree_mod.Model = ListaUsuario; try { const string connectionString = "Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=spcprojectdb.cxmd6kjxslqw.us-west-1.rds.amazonaws.com)(PORT=1521)) (CONNECT_DATA=(SERVICE_NAME=ORCL))); User Id=kyann;Password=Gakd0132;"; OracleConnection connection = new OracleConnection(connectionString); OracleCommand cmd; connection.Open(); //Console.Write(notebook4.SelectPage); string sql = "select TO_CHAR(MODIFICACION_ID), DESCRIPCION_PROBLEMA, DESCRIPCION_ACTIVIDAD, TO_CHAR(USUARIO_ID), STATE from MODIFICACION"; cmd = new OracleCommand(sql, connection); cmd.CommandType = System.Data.CommandType.Text; da = new OracleDataAdapter(cmd); cb = new OracleCommandBuilder(da); ds = new System.Data.DataSet(); da.Fill(ds); DataTable de = ds.Tables[0]; foreach (DataRow row in de.Rows) { ListaUsuario.AppendValues(row[0], row[1], row[2], row[3], row[4]); } } catch (OracleException) { SPC.Error_Ventana Ventana_Error = new SPC.Error_Ventana("ErrorCon"); } Gtk.CellRendererText IDCell = new Gtk.CellRendererText(); ID.PackStart(IDCell, true); Gtk.CellRendererText NombreCell = new Gtk.CellRendererText(); Nombre.PackStart(NombreCell, true); Gtk.CellRendererText ApellidoCell = new Gtk.CellRendererText(); Apellido.PackStart(ApellidoCell, true); Gtk.CellRendererText ApellidoCell2 = new Gtk.CellRendererText(); Apellido2.PackStart(ApellidoCell2, true); Gtk.CellRendererText ApellidoCell3 = new Gtk.CellRendererText(); Apellido3.PackStart(ApellidoCell3, true); ID.AddAttribute(IDCell, "text", 0); Nombre.AddAttribute(NombreCell, "text", 1); Apellido.AddAttribute(ApellidoCell, "text", 2); Apellido2.AddAttribute(ApellidoCell2, "text", 3); Apellido3.AddAttribute(ApellidoCell3, "text", 4); this.ShowAll(); }
public void Entradas_Table(string sql_c) { tree_ent.RemoveColumn(tree_ent.GetColumn(0)); tree_ent.RemoveColumn(tree_ent.GetColumn(0)); tree_ent.RemoveColumn(tree_ent.GetColumn(0)); tree_ent.RemoveColumn(tree_ent.GetColumn(0)); tree_ent.RemoveColumn(tree_ent.GetColumn(0)); tree_ent.RemoveColumn(tree_ent.GetColumn(0)); tree_ent.RemoveColumn(tree_ent.GetColumn(0)); // ID, Nombre, Apellido, Puesto, Turno Gtk.TreeViewColumn ID = new Gtk.TreeViewColumn(); ID.Title = "ID"; Gtk.TreeViewColumn Nombre = new Gtk.TreeViewColumn(); Nombre.Title = "Material"; Gtk.TreeViewColumn Apellido = new Gtk.TreeViewColumn(); Apellido.Title = "Maquina"; Gtk.TreeViewColumn Apellido1 = new Gtk.TreeViewColumn(); Apellido1.Title = "Instrumento de medicion"; Gtk.TreeViewColumn Apellido2 = new Gtk.TreeViewColumn(); Apellido2.Title = "Usuario"; Gtk.TreeViewColumn Apellido3 = new Gtk.TreeViewColumn(); Apellido3.Title = "Cpk"; Gtk.TreeViewColumn Apellido4 = new Gtk.TreeViewColumn(); Apellido4.Title = "Fecha"; tree_ent.AppendColumn(ID); tree_ent.AppendColumn(Nombre); tree_ent.AppendColumn(Apellido); tree_ent.AppendColumn(Apellido1); tree_ent.AppendColumn(Apellido2); tree_ent.AppendColumn(Apellido3); tree_ent.AppendColumn(Apellido4); Gtk.ListStore ListaUsuario = new Gtk.ListStore(typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string)); tree_ent.Model = ListaUsuario; try { const string connectionString = "Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=spcprojectdb.cxmd6kjxslqw.us-west-1.rds.amazonaws.com)(PORT=1521)) (CONNECT_DATA=(SERVICE_NAME=ORCL))); User Id=kyann;Password=Gakd0132;"; OracleConnection connection = new OracleConnection(connectionString); OracleCommand cmd; connection.Open(); string sql = "select TO_CHAR(ENTRADA_ID), TO_CHAR(MATERIAL_ID), TO_CHAR(MAQUINA_ID), TO_CHAR(MEDICION_ID), TO_CHAR(USUARIO_ID), DATOS, TO_CHAR(FECHA) from ENTRADAS"; cmd = new OracleCommand(sql, connection); cmd.CommandType = System.Data.CommandType.Text; da = new OracleDataAdapter(cmd); cb = new OracleCommandBuilder(da); ds = new System.Data.DataSet(); da.Fill(ds); DataTable de = ds.Tables[0]; foreach (DataRow row in de.Rows) { ListaUsuario.AppendValues(row[0], row[1], row[2], row[3], row[4], row[5], row[6]); } } catch (OracleException) { SPC.Error_Ventana Ventana_Error = new SPC.Error_Ventana("ErrorCon"); } Gtk.CellRendererText IDCell = new Gtk.CellRendererText(); ID.PackStart(IDCell, true); Gtk.CellRendererText NombreCell = new Gtk.CellRendererText(); Nombre.PackStart(NombreCell, true); Gtk.CellRendererText ApellidoCell = new Gtk.CellRendererText(); Apellido.PackStart(ApellidoCell, true); Gtk.CellRendererText ApellidoCell1 = new Gtk.CellRendererText(); Apellido1.PackStart(ApellidoCell1, true); Gtk.CellRendererText ApellidoCell2 = new Gtk.CellRendererText(); Apellido2.PackStart(ApellidoCell2, true); Gtk.CellRendererText ApellidoCell3 = new Gtk.CellRendererText(); Apellido3.PackStart(ApellidoCell3, true); Gtk.CellRendererText ApellidoCell4 = new Gtk.CellRendererText(); Apellido4.PackStart(ApellidoCell4, true); ID.AddAttribute(IDCell, "text", 0); Nombre.AddAttribute(NombreCell, "text", 1); Apellido.AddAttribute(ApellidoCell, "text", 2); Apellido1.AddAttribute(ApellidoCell1, "text", 3); Apellido2.AddAttribute(ApellidoCell2, "text", 4); Apellido3.AddAttribute(ApellidoCell3, "text", 5); Apellido4.AddAttribute(ApellidoCell4, "text", 6); this.ShowAll(); }
public void user_Table(string sql_c) { tree_U.RemoveColumn(tree_U.GetColumn(0)); tree_U.RemoveColumn(tree_U.GetColumn(0)); tree_U.RemoveColumn(tree_U.GetColumn(0)); tree_U.RemoveColumn(tree_U.GetColumn(0)); tree_U.RemoveColumn(tree_U.GetColumn(0)); // ID, Nombre, Apellido, Puesto, Turno Gtk.TreeViewColumn ID = new Gtk.TreeViewColumn(); ID.Title = "ID"; Gtk.TreeViewColumn Nombre = new Gtk.TreeViewColumn(); Nombre.Title = "Nombre"; Gtk.TreeViewColumn Apellido = new Gtk.TreeViewColumn(); Apellido.Title = "Apellido"; Gtk.TreeViewColumn Puesto = new Gtk.TreeViewColumn(); Puesto.Title = "Puesto"; Gtk.TreeViewColumn Turno = new Gtk.TreeViewColumn(); Turno.Title = "Turno"; tree_U.AppendColumn(ID); tree_U.AppendColumn(Nombre); tree_U.AppendColumn(Apellido); tree_U.AppendColumn(Puesto); tree_U.AppendColumn(Turno); Gtk.ListStore ListaUsuario = new Gtk.ListStore(typeof(string), typeof(string), typeof(string), typeof(string), typeof(string)); tree_U.Model = ListaUsuario; try { const string connectionString = "Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=spcprojectdb.cxmd6kjxslqw.us-west-1.rds.amazonaws.com)(PORT=1521)) (CONNECT_DATA=(SERVICE_NAME=ORCL))); User Id=kyann;Password=Gakd0132;"; OracleConnection connection = new OracleConnection(connectionString); OracleCommand cmd; connection.Open(); btn_Regresar.Clicked += new EventHandler(this.btnCancelar_Click); //Console.Write(notebook4.SelectPage); string sql = ""; if (sql_c == "") { sql = "select ID_SYS, NOMBRE, APELLIDO, PUESTO, TURNO from usuario"; } else { sql = sql_c; } cmd = new OracleCommand(sql, connection); cmd.CommandType = System.Data.CommandType.Text; da = new OracleDataAdapter(cmd); cb = new OracleCommandBuilder(da); ds = new System.Data.DataSet(); da.Fill(ds); DataTable de = ds.Tables[0]; foreach (DataRow row in de.Rows) { ListaUsuario.AppendValues(row[0], row[1], row[2], row[3], row[4]); } } catch (OracleException) { SPC.Error_Ventana Ventana_Error = new SPC.Error_Ventana("ErrorCon"); } Gtk.CellRendererText IDCell = new Gtk.CellRendererText(); ID.PackStart(IDCell, true); Gtk.CellRendererText NombreCell = new Gtk.CellRendererText(); Nombre.PackStart(NombreCell, true); Gtk.CellRendererText ApellidoCell = new Gtk.CellRendererText(); Apellido.PackStart(ApellidoCell, true); Gtk.CellRendererText PuestoCell = new Gtk.CellRendererText(); Puesto.PackStart(PuestoCell, true); Gtk.CellRendererText TurnoCell = new Gtk.CellRendererText(); Turno.PackStart(TurnoCell, true); ID.AddAttribute(IDCell, "text", 0); Nombre.AddAttribute(NombreCell, "text", 1); Apellido.AddAttribute(ApellidoCell, "text", 2); Puesto.AddAttribute(PuestoCell, "text", 3); Turno.AddAttribute(TurnoCell, "text", 4); this.ShowAll(); }
public void btnDelete_Click(object sender, EventArgs e) { try { Gtk.TreeIter selected; var Data = ""; const string connectionString = "Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=spcprojectdb.cxmd6kjxslqw.us-west-1.rds.amazonaws.com)(PORT=1521)) (CONNECT_DATA=(SERVICE_NAME=ORCL))); User Id=kyann;Password=Gakd0132;"; var connection = new OracleConnection(connectionString); //Asignar a una variable que sea un commando var commando = ""; if (notebook4.Page == 0) { commando = "ELIMINAR_USUARIO"; tree_U.Selection.GetSelected(out selected); Data = tree_U.Model.GetValue(selected, 0).ToString(); } else if (notebook4.Page == 1) { commando = "ELIMINAR_MATERIAL"; Mat_Tree.Selection.GetSelected(out selected); Data = Mat_Tree.Model.GetValue(selected, 0).ToString(); } else if (notebook4.Page == 2) { commando = "ELIMINAR_MAQUINA"; tree_Maq.Selection.GetSelected(out selected); Data = tree_Maq.Model.GetValue(selected, 0).ToString(); } else if (notebook4.Page == 3) { commando = "ELIMINAR_MEDICION"; tree_Med.Selection.GetSelected(out selected); Data = tree_Med.Model.GetValue(selected, 0).ToString(); } else if (notebook4.Page == 4) { commando = "ELIMINAR_ENTRADA"; tree_ent.Selection.GetSelected(out selected); Data = tree_ent.Model.GetValue(selected, 0).ToString(); } else if (notebook4.Page == 5) { SPC.Error_Ventana Ventana_Error = new SPC.Error_Ventana("NoDisponible"); } OracleCommand user = new OracleCommand(commando); //Al comando agregarle la conexion con la base de datos user.Connection = connection; //Declarar que es un Procedure guardado user.CommandType = System.Data.CommandType.StoredProcedure; //Declarar cuales son los parametros y si son entradas o salidas user.Parameters.Add("ID_U", OracleDbType.Varchar2).Direction = System.Data.ParameterDirection.Input; //Declarar los valores user.Parameters["ID_U"].Value = Data; var r = notebook4.Page; Console.Write(r); connection.Open(); //Ejecutar user.ExecuteScalar(); }catch (OracleException) { SPC.Error_Ventana Ventana_Error = new SPC.Error_Ventana("ErrorCon"); } Refresh(); }
public Add_User(String Id, Admin_First Ventana) : base(Gtk.WindowType.Toplevel) { this.Build(); P = Ventana; combobox3.AppendText("Spr"); combobox3.AppendText("Ing"); combobox3.AppendText("Opr"); combobox3.AppendText("Admin"); combobox4.AppendText("Matutino"); combobox4.AppendText("Vespertino"); v = Id; btn_Ok.Clicked += new EventHandler(this.btnOk_Click); btn_Con.Clicked += new EventHandler(this.btnCon_Click); btn_Cnl.Clicked += new EventHandler(this.btnCnl_Click); if (v != "") { try { const string connectionString = "Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=spcprojectdb.cxmd6kjxslqw.us-west-1.rds.amazonaws.com)(PORT=1521)) (CONNECT_DATA=(SERVICE_NAME=ORCL))); User Id=kyann;Password=Gakd0132;"; OracleConnection connection = new OracleConnection(connectionString); OracleCommand cmd; connection.Open(); string sql = "select ID_SYS, NOMBRE, APELLIDO, PUESTO, TURNO, PASSWORD_ from USUARIO WHERE ID_SYS='" + v.ToString() + "'"; Console.WriteLine(sql); cmd = new OracleCommand(sql, connection); cmd.CommandType = System.Data.CommandType.Text; da = new OracleDataAdapter(cmd); cb = new OracleCommandBuilder(da); ds = new System.Data.DataSet(); da.Fill(ds); DataTable de = ds.Tables[0]; String id_u1 = ""; String id_u2 = ""; String id_u3 = ""; String id_u4 = ""; String id_u5 = ""; String id_u6 = ""; foreach (DataRow row in de.Rows) { id_u1 = (string)row[0]; id_u2 = (string)row[1]; id_u3 = (string)row[2]; id_u4 = (string)row[3]; id_u5 = (string)row[4]; id_u6 = (string)row[5]; //ListaUsuario.AppendValues(row[0], row[1], row[2]); } e_id.Text = id_u1; e_nombre.Text = id_u2; e_apellido.Text = id_u3; //combobox3.; if (id_u4 == "Spr") { combobox3.Active = 2; } else if (id_u4 == "Ing") { combobox3.Active = 1; } else if (id_u4 == "Opr") { combobox3.Active = 0; } else if (id_u4 == "Admin") { combobox3.Active = 3; } if (id_u5 == "Matutino") { combobox3.Active = 1; } else if (id_u5 == "Vespertino") { combobox3.Active = 2; } e_contrasena.Text = id_u6; } catch (OracleException Error) { SPC.Error_Ventana Ventana_Error = new SPC.Error_Ventana("ErrorCon"); Console.Write(Error); } } }
public void btnOk_Click(object sender, EventArgs e) { if (v != "") { } else { try { const string connectionString = "Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=spcprojectdb.cxmd6kjxslqw.us-west-1.rds.amazonaws.com)(PORT=1521)) (CONNECT_DATA=(SERVICE_NAME=ORCL))); User Id=kyann;Password=Gakd0132;"; OracleConnection connection = new OracleConnection(connectionString); // OracleCommand cmd; var found = ""; connection.Close(); //Asignar a una variable que sea un commando OracleCommand user = new OracleCommand("CHECK_USER"); //user.BindByName = true; //Al comando agregarle la conexion con la base de datos user.Connection = connection; //Declarar que es un Procedure guardado user.CommandType = System.Data.CommandType.StoredProcedure; //Declarar cuales son los parametros y si son entradas o salidas OracleParameter rv = new OracleParameter("v_Return", OracleDbType.Varchar2, System.Data.ParameterDirection.ReturnValue); // OracleParameter r = new OracleParameter("r", OracleDbType.Varchar2, 200, "KATI0000", System.Data.ParameterDirection.Input); // OracleParameter id = new OracleParameter("ID_U", OracleDbType.Varchar2, 100, e_id.Text.ToString().ToUpper(), System.Data.ParameterDirection.Input); // OracleParameter[] ora_par = { r, id, rv }; user.Parameters.AddRange(ora_par); //Abrir coneccion connection.Open(); //Ejecutar user.ExecuteNonQuery(); //Poner el valor de regreso de la funcion en una variable found = (string)((Oracle.ManagedDataAccess.Types.OracleString)(user.Parameters[0].Value)).Value; //Cerrar conexion connection.Close(); Console.Write(found); if (found != "11111") { SPC.Error_Ventana Ventana_Error = new SPC.Error_Ventana("UserAlready"); } else { //const string connectionString = "Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=spcprojectdb.cxmd6kjxslqw.us-west-1.rds.amazonaws.com)(PORT=1521)) (CONNECT_DATA=(SERVICE_NAME=ORCL))); User Id=kyann;Password=Gakd0132;"; //var connection = new OracleConnection(connectionString); //Asignar a una variable que sea un commando OracleCommand user1 = new OracleCommand("AGREGAR_USUARIO"); //Al comando agregarle la conexion con la base de datos user1.Connection = connection; //Declarar que es un Procedure guardado user1.CommandType = System.Data.CommandType.StoredProcedure; //Declarar cuales son los parametros y si son entradas o salidas user1.Parameters.Add("ID_U", OracleDbType.Varchar2).Direction = System.Data.ParameterDirection.Input; user1.Parameters.Add("NOMBRE_U", OracleDbType.Varchar2).Direction = System.Data.ParameterDirection.Input; user1.Parameters.Add("APELLIDO_U", OracleDbType.Varchar2).Direction = System.Data.ParameterDirection.Input; user1.Parameters.Add("PUESTO_U", OracleDbType.Varchar2).Direction = System.Data.ParameterDirection.Input; user1.Parameters.Add("TURNO_U", OracleDbType.Varchar2).Direction = System.Data.ParameterDirection.Input; user1.Parameters.Add("PASSWORD_U", OracleDbType.Varchar2).Direction = System.Data.ParameterDirection.Input; //Declarar los valores user1.Parameters["ID_U"].Value = e_id.Text.ToString(); user1.Parameters["NOMBRE_U"].Value = e_nombre.Text.ToString(); user1.Parameters["APELLIDO_U"].Value = e_apellido.Text.ToString(); user1.Parameters["PUESTO_U"].Value = combobox3.ActiveText.ToString(); //e_puesto.Text.ToString(); user1.Parameters["TURNO_U"].Value = combobox4.ActiveText.ToString(); //e_turno.Text.ToString(); user1.Parameters["PASSWORD_U"].Value = e_contrasena.Text.ToString(); connection.Open(); //Ejecutar user1.ExecuteScalar(); P.Refresh(); this.Hide(); } } catch (OracleException) { SPC.Error_Ventana Ventana_Error = new SPC.Error_Ventana("ErrorCon"); //Console.Write(error); } } }