private void consultarBDporFechayHora(DateTime myDate) { //llamar a algun metodo en la BD. _conexionSQL conectarBD = _conexionSQL.Instance; DataTable resultadoConsulta = new DataTable(); //string fechaSQL = Properties.Settings.Default.FECHA_HORA_APP.Date.ToString("dd-MM-yyyy hh:mm:ss"); resultadoConsulta = conectarBD.ejecutarUnaQuery(@"exec DALE_SA.ActualizarFechaHoraBD '" + myDate.ToString("yyyy/MM/dd hh:mm:ss") + @"'"); System.Console.WriteLine("NUEVA FECHA Y HORA: " + Properties.Settings.Default.FECHA_HORA_APP.ToString("yyyy/MM/dd hh:mm:ss")); if (resultadoConsulta != null) { System.Console.WriteLine("NUEVA FECHA Y HORA: " + resultadoConsulta.Rows[0][0].ToString()); //if (String.Compare(Properties.Settings.Default.FECHA_HORA_APP.ToString(), (DateTime.Parse(resultadoConsulta.Rows[0][0].ToString())).ToString()) == 0) if ((DateTime.Compare(myDate, (DateTime)resultadoConsulta.Rows[0][0])) == 0) { //MessageBox.Show("Se cambio OK la Fecha y Hora en la BD"); } else { MessageBox.Show("Hubo problemas al cambiar la fecha y hora en la BD. Por favor revise la conexion"); } //Usa un dataTable porque esta usando un metodo generico... para este caso es idem que sea void. } else { MessageBox.Show("Hubo problemas al cambiar la fecha y hora en la BD(Al cerrar publicaciones). Por favor revise la conexion"); } }
private void btAceptarElegirRol_Click(object sender, EventArgs e) { //MessageBox.Show(this.comboElegirRol.Text); DataTable resultado2 = new DataTable(); _conexionSQL conectarBD = _conexionSQL.Instance; string sql; // comienzo.... sql = @"select t1.nombre as nombre from DALE_SA.rol t1 where t1.nombre = RTRIM(LTRIM('" + this.comboElegirRol.Text + @"'))"; resultado2 = conectarBD.ejecutarUnaQuery(sql); fcAuxiliarLogin(ref resultado2); this.gboxElegirRol.Visible = false; this.gboxElegirRol.Enabled = false; this.gboxHoraFechaSistema.Visible = true; //que se vea la hora this.gboxHoraFechaSistema.Enabled = true; }
private void fcFuncionalidadDelRol(string nombreRol) { DataTable resultado2 = new DataTable(); _conexionSQL conectarBD = _conexionSQL.Instance; string sql; // comienzo.... sql = @" select t3.descripcion as NombreFuncionalidad from DALE_SA.rol t1, DALE_SA.rol_funcionalidad t2, DALE_SA.funcionalidad t3 where t1.nombre = RTRIM(LTRIM('" + nombreRol + @"')) and t1.idrol = t2.idrol and t2.idfuncionalidad = t3.idfuncionalidad "; resultado2 = conectarBD.ejecutarUnaQuery(sql); //habilito o deshabilito los menues segun funcionalidades foreach (DataRow dtRow in resultado2.Rows) { switch (dtRow["NombreFuncionalidad"].ToString()) { case "ABM de ROL": this.AMB_ROL.Visible = true; this.AMB_ROL.Enabled = true; break; case "ABM de USUARIOS": this.AMB_USUARIO.Visible = true; this.AMB_USUARIO.Enabled = true; break; case "ABM de VISIBILIDAD": this.ABM_VIS.Visible = true; this.ABM_VIS.Enabled = true; break; case "ABM de RUBRO": break; case "Facturas por Vendedor": this.cONSULTAFACTURASAVENDEDORToolStripMenuItem.Enabled = true; this.cONSULTAFACTURASAVENDEDORToolStripMenuItem.Visible = true; break; case "Listado Estadistico": this.cONSULTARESTADISTICASToolStripMenuItem.Enabled = true; this.cONSULTARESTADISTICASToolStripMenuItem.Visible = true; break; case "Comprar y Ofertar": this.COMPRA.Enabled = true; this.COMPRA.Visible = true; this.COMPRA_BUSCAR.Enabled = true; this.COMPRA_BUSCAR.Visible = true; break; case "Historial del Cliente y Calificacion": this.miHistorialDeComprasToolStripMenuItem.Visible = true; this.miHistorialDeComprasToolStripMenuItem.Enabled = true; this.calificarToolStripMenuItem.Visible = true; this.calificarToolStripMenuItem.Enabled = true; break; case "Generar Publicacion": this.PUBLICACION.Enabled = true; this.PUBLICACION.Visible = true; this.COMPRA_BUSCAR.Enabled = true; break; } } }