public void MaisDetalhe(object sender, EventArgs args) { Label lblDetalhe = (Label)sender; TapGestureRecognizer TapGes = (TapGestureRecognizer)lblDetalhe.GestureRecognizers[0]; Consultas consulta = TapGes.CommandParameter as Consultas; Navigation.PushAsync(new Detalhes(consulta)); }
private void cargarDatos(string condicion) { consultas = new Consultas(); string consulta = "Select Identificacion,NOMBRES AS 'Nombre Proveedor', CELULAR AS Celular, RESPONSABLE AS Responsable, Naturaleza, DIRECCION, IDProveedor AS ID from TbProveedor WHERE ESTADO =" + condicion; consultas.boolLlenarDataGridView(dgvDatosProveedor, consulta); dgvDatosProveedor.Columns["ID"].Visible = false; }
//O código serve para que a gente altere a descrição digitando apenas os campos id e situação. //Não é preciso digitar os demais. public void Cadastrar(Consultas consulta) { using (SpmedgroupContext ctx = new SpmedgroupContext()) { ctx.Consultas.Add(consulta); ctx.SaveChanges(); } }
public ActionResult DeleteConfirmed(int id) { Consultas consultas = db.Consultas.Find(id); db.Consultas.Remove(consultas); db.SaveChanges(); return(RedirectToAction("Index")); }
public void AgendarConsulta(Consultas consulta) { using (SpMedGroupContext ctx = new SpMedGroupContext()) { ctx.Consultas.Add(consulta); ctx.SaveChanges(); } }
public FileStreamResult FastReport(Parametros parametros) { FileStreamResult file = null; var res = Singleton.Instance; for (var i = 0; i < parametros.Iteraciones; i++) { var stopWatch = Stopwatch.StartNew(); var informacion = new Consultas().GetPdfInformacion(); var result = new Resultado { Parametro = parametros, Libreria = Leyendas.Fast }; if (informacion == null) { continue; } var watchCreation = Stopwatch.StartNew(); var pdf = parametros.Template ? new FastReportServicio(Resources.PdfDummy, informacion, parametros.Hojas).GetExcelExample() : new FastReportServicio(informacion, parametros.Hojas).GetExcelExample(); watchCreation.Stop(); result.Tiempos.Add(new Tiempo { Descripcion = Leyendas.Creacion, Value = watchCreation.Elapsed.ToString() }); Stopwatch watchFiletoDonwload = Stopwatch.StartNew(); file = FastReportDownload(pdf); watchFiletoDonwload.Stop(); result.Tiempos.Add(new Tiempo { Descripcion = Leyendas.Download, Value = watchFiletoDonwload.Elapsed.ToString() }); stopWatch.Stop(); result.Tiempos.Add(new Tiempo { Descripcion = Leyendas.Total, Value = stopWatch.Elapsed.ToString() }); result.Intento = i; res.Resultados.Add(result); if (i != (parametros.Iteraciones - 1)) { file = null; } } return(file); }
private void cbProvinciaProveedor_SelectedIndexChanged(object sender, EventArgs e) { if (cbProvinciaProveedor.SelectedValue.ToString() != null) { String ID = cbProvinciaProveedor.SelectedValue.ToString(); consultas = new Consultas(); consultas.BoolLlenarComboBox(cbCantonProveedor, "Select IDCANTON as ID, NOMBRE AS Texto from TbCanton where IDPROVINCIA = " + ID + ";"); } }
protected void btnRegistrarSucursal_Click(object sender, EventArgs e) { int id = Convert.ToInt16(txtID.Text); string nombre = txtNombre.Text; string direccion = txtDireccion.Text; string telefono = txtTelefono.Text; Consultas.setSucursal(id, nombre, direccion, telefono, lblRES); }
/// <summary> /// obtiene el interventor del proyecto. /// </summary> /// <param name="IdProyecto">id del proyecto.</param> /// <returns></returns> public Datos.Contacto getInterventorProyecto(int IdProyecto) { //var tareaUsuario = new Consultas().Db.TareaUsuarios.Where(c => c.Contacto.GrupoContactos.Select(g => g.CodGrupo == Constantes.CONST_GerenteInterventor).FirstOrDefault() != null && c.CodProyecto == IdProyecto); var tareaUsuario = new Consultas().Db.TareaUsuarios.Where(c => c.Contacto.GrupoContacto.Select(g => g.CodGrupo == Constantes.CONST_GerenteInterventor).FirstOrDefault() != false && c.CodProyecto == IdProyecto); var grupoContacto = tareaUsuario.Where(f => f.Contacto.GrupoContacto.Select(c => c.CodGrupo).FirstOrDefault() == Constantes.CONST_Interventor).Select(u => u.Contacto).FirstOrDefault(); var pryIntrv = grupoContacto; return(pryIntrv ?? new Datos.Contacto()); }
//Apagar consulta public void apagarConsulta(int Id) { using (MedGroupContext ctx = new MedGroupContext()) { Consultas consultaProcurada = ctx.Consultas.Find(Id); ctx.Consultas.Remove(consultaProcurada); ctx.SaveChanges(); } }
public static void ComboAutoCompletable(ComboBox cb) { Consultas consultas = new Consultas(); DataTable dt = (DataTable)cb.DataSource; cb.AutoCompleteCustomSource = consultas.LoadAutoComplete(dt); cb.AutoCompleteMode = AutoCompleteMode.SuggestAppend; cb.AutoCompleteSource = AutoCompleteSource.CustomSource; }
public void actualizarJugadas(String usuario, Dictionary <String, Juego> idJuego, String directorioCacheUsuarios) { foreach (var idBgg in idJuego) { asegurarExistenciaDirectorioUsuarioPlays(usuario, directorioCacheUsuarios, idBgg.Key); documentoJugadasJuego = Consultas.consultarApiJugadasJuego(usuario, idBgg.Key); documentoJugadasJuego.Save(directorioCacheUsuarioPlays + idBgg.Key); } }
void combousuario() { Consultas fd = new Consultas(); List <FormularioConsultasModelo> list = fd.getayuda(); boxInformacionSolicitada.ValueMember = "AyudaSolicitada"; boxInformacionSolicitada.DataSource = list; // boxInformacionSolicitada.DisplayMember = "AyudaSolicitad"; }
protected void ActualizarSucursalClick_Click(object sender, EventArgs e) { Consultas.modificarSucursal(txtID.Text, txtNombre.Text, txtDireccion.Text, txtTelefono.Text); txtID.Text = ""; txtNombre.Text = ""; txtDireccion.Text = ""; txtTelefono.Text = ""; Consultas.getGridSucursal(GridView1); }
void estado() { Consultas fd = new Consultas(); List <FormularioConsultasModelo> listestado = fd.getEstados(); boxEstado.ValueMember = "EstadoRespuestaAyuda"; boxEstado.DataSource = listestado; // boxInformacionSolicitada.DisplayMember = "AyudaSolicitad"; }
void seguimiento() { Consultas fd = new Consultas(); List <FormularioConsultasModelo> listestado = fd.getSeguimiento(); boxStatus.ValueMember = "Seguimiento"; boxStatus.DataSource = listestado; // boxInformacionSolicitada.DisplayMember = "AyudaSolicitad"; }
void inversion() { Consultas fd = new Consultas(); List <FormularioConsultasModelo> listinversion = fd.getMontoInversion(); boxMontoInversion.ValueMember = "MontoInvercion"; boxMontoInversion.DataSource = listinversion; // boxInformacionSolicitada.DisplayMember = "AyudaSolicitad"; }
void contacto() { Consultas fd = new Consultas(); List <FormularioConsultasModelo> listcontacto = fd.getMedioContacto(); boxDondellegoMensaje.ValueMember = "ComoLlegoMensaje"; boxDondellegoMensaje.DataSource = listcontacto; // boxInformacionSolicitada.DisplayMember = "AyudaSolicitad"; }
private void FrmConsultarProducto_Load(object sender, EventArgs e) { txtconsultar.Focus(); ObjConsul = new Consultas(); //ObjConsul.boolLlenarDataGridView(dgvProductos, "Select TbProducto.CODIGOBARRA AS CODIGO, TbProducto.DETALLE,TbProducto.CANTIDAD, TbProducto.PRECIOVENTAPUBLICO AS PRECIOPUBLICO, TbProducto.PRECIOVENTAMAYORISTA AS PRECIOMAY, TbProducto.PRECIOVENTACAJA AS PRECIOCAJA from TbProducto;"); ObjConsul.BoolCrearDateTable(dgvProductos, "Select P.IVA as IVA, TbProducto.CODIGOBARRA, TbProducto.ACTIVO, TbProducto.NOMBREPRODUCTO AS DETALLE,TbProducto.CANTIDAD, TbProducto.PRECIOPUBLICO_SIN_IVA AS PRECIOVENTAPUBLICO, TbProducto.PRECIOALMAYOR_SIN_IVA AS PRECIOVENTAMAYORISTA, TbProducto.PRECIOPORCAJA_SIN_IVA AS PRECIOVENTACAJA, TbProducto.IVAESTADO, TbProducto.CAJA from TbProducto , TbParametrosFactura P; "); }
public Inicio() { InitializeComponent(); // Creamos conexion conexionBD miConexion = new conexionBD(direccion, bd, security); //Creamos Consultas this.controllSQL = new Consultas(miConexion); }
protected void btnBuscar_Click(object sender, EventArgs e) { Consultas.buscarSucursal(txtBusqueda.Text, GridView1); if (string.IsNullOrEmpty(txtBusqueda.Text)) { Consultas.getGridSucursal(GridView1); } txtBusqueda.Text = ""; }
public void BSALVAR(object sender, EventArgs args) { AcessoBanco acessoBanco = new AcessoBanco(); List <Consultas> consultas = acessoBanco.Pesquisar(cpf1); Consultas consulta = new Consultas(); consulta.especialidade = Pick.ToString(); Navigation.PushAsync(new Perfil(cpf1)); }
private void cbCantonCliente_SelectedIndexChanged(object sender, EventArgs e) { if (cbCantonCliente.SelectedValue.ToString() != null) { String ID = cbCantonCliente.SelectedValue.ToString(); consultas = new Consultas(); consultas.BoolLlenarComboBox(cbParroquiaCliente, "Select IDPARROQUIA as ID, NOMBRE AS Texto from TbParroquia where IDCANTON = " + ID + ";"); } }
private void cbPaisCliente_SelectedIndexChanged(object sender, EventArgs e) { if (cbPaisCliente.SelectedValue.ToString() != null) { String ID = cbPaisCliente.SelectedValue.ToString(); consultas = new Consultas(); consultas.BoolLlenarComboBox(cbProvinciaCliente, "Select IDPROVINCIA as ID, NOMBRE AS Texto from TbProvincia where IDPAIS = " + ID + ";"); } }
void personal() { Consultas fd = new Consultas(); List <FormularioConsultasModelo> listpersona = fd.getpersonaldeapoyo(); boxPersonalAtendio.ValueMember = "Respuesta"; boxPersonalAtendio.DataSource = listpersona; // boxInformacionSolicitada.DisplayMember = "AyudaSolicitad"; }
private void CmbProvincia_SelectedIndexChanged(object sender, EventArgs e) { if (CmbProvincia.SelectedValue.ToString() != null) { String ID = CmbProvincia.SelectedValue.ToString(); consultas = new Consultas(); consultas.BoolLlenarComboBox(CmbCanton, "Select IDCANTON as ID, NOMBRE AS Texto from TbCanton where IDPROVINCIA = " + ID + ";"); } CmbProvincia.DropDownHeight = CmbProvincia.ItemHeight = 150; }
public MainWindow() { InitializeComponent(); //List<int> exp = ExpedientesSingleton.Compartidos; con = new Consultas(); CentralPanel.Children.Add(con); TabConsultas.Visibility = Visibility.Visible; BarraPrincipal.SelectedItem = TabConsultas; }
public void SumarPartidaPerdida() { Consultas consultas = new Consultas(); int idUsuario = 2; int esperado = 1; int resultado = consultas.SumarPartidaPerdida(idUsuario); Assert.AreEqual(esperado, resultado); }
private void btnCargar_Click(object sender, EventArgs e) { Consultas aux = new Consultas(); var lista = aux.ObtenerTablas(); foreach (var item in lista) { dgvLista.Rows.Add(item); } }
public CrearTipoVehiculo(string id) { if (!String.IsNullOrEmpty(id) && !String.IsNullOrWhiteSpace(id)) { ID = id; var mod = Consultas.GetTipoVehiculoByID(id); txtDescripcion.Text = mod.Descripcion; btnCrear.Text = "Actualizar"; } }
public void ValidaContraUsuario() { Consultas consultas = new Consultas(); string contrasena = "ddc96936f7d0959e7d7549828deef552384521da0a088893ec4655e0d1967b17"; bool esperado = true; bool resultado = consultas.ValidaContraUsuario(contrasena); Assert.AreEqual(esperado, resultado); }
public void Generar_DAL_BD() { Consultas aux = new Consultas(); var lista = aux.ObtenerTablas(); Tipo = "AD"; foreach (var item in lista) { CrearCuerpo(item); } }
//Creacion de cuerpo DAL implementando metodos de entityframework public void CuerpoDALImplementado(StringBuilder Clase, string tablaBD) { Consultas aux = new Consultas(); Clase.AppendLine(" {"); Clase.AppendLine($" public static bool Agregar({tablaBD} ent)"); Clase.AppendLine(" {"); Clase.AppendLine(" var r = 0;"); Clase.AppendLine(" using (var cn = Conexion.ConexionDBSqlServer())"); Clase.AppendLine(" {"); Clase.AppendLine($" SqlCommand cmd = new SqlCommand({Comillas}SPU_INSERTAR_{tablaBD}{Comillas},cn);"); Clase.AppendLine(" cmd.CommandType = CommandType.StoredProcedure;"); var lista = Consultas.getParametros(tablaBD, "INSERTAR"); foreach (var item in lista) { Clase.AppendLine($" cmd.Parameters.AddWithValue({Comillas}{item.nombre}{Comillas},ent.{Regex.Replace(item.nombre, "@", "")});"); } Clase.AppendLine(" cn.Open();"); Clase.AppendLine(" r = cmd.ExecuteNonQuery();"); Clase.AppendLine(" cn.Close();"); Clase.AppendLine(" }"); Clase.AppendLine(" return r > 0;"); Clase.AppendLine(" }"); Clase.AppendLine(""); Clase.AppendLine($" public static bool Modificar({tablaBD} ent)"); Clase.AppendLine(" {"); Clase.AppendLine(" var r = 0;"); Clase.AppendLine(" using (var cn = Conexion.ConexionDBSqlServer())"); Clase.AppendLine(" {"); Clase.AppendLine($" SqlCommand cmd = new SqlCommand({Comillas}SPU_Modificar_{tablaBD}{Comillas},cn);"); Clase.AppendLine(" cmd.CommandType = CommandType.StoredProcedure;"); var listaUpdate = Consultas.getParametros(tablaBD, "MODIFICAR"); foreach (var item in listaUpdate) { Clase.AppendLine($" cmd.Parameters.AddWithValue({Comillas}{item.nombre}{Comillas},ent.{Regex.Replace(item.nombre, "@", "")});"); } Clase.AppendLine(" cn.Open();"); Clase.AppendLine(" r = cmd.ExecuteNonQuery();"); Clase.AppendLine(" cn.Close();"); Clase.AppendLine(" }"); Clase.AppendLine(" return r > 0;"); Clase.AppendLine(" }"); Clase.AppendLine(""); Clase.AppendLine($" public static bool Existe(string id)"); Clase.AppendLine(" {"); Clase.AppendLine(" var r = 0;"); Clase.AppendLine(" using (var cn = Conexion.ConexionDBSqlServer())"); Clase.AppendLine(" {"); Clase.AppendLine($" var sql = {Comillas}select count(Id) from {tablaBD} where Id = @Id{Comillas}; "); Clase.AppendLine(" var cmd = new SqlCommand(sql, cn);"); Clase.AppendLine($" cmd.Parameters.AddWithValue({Comillas}@Id{Comillas}, id);"); Clase.AppendLine(" cn.Open();"); Clase.AppendLine(" r = (int)cmd.ExecuteScalar();"); Clase.AppendLine(" cn.Close();"); Clase.AppendLine(" }"); Clase.AppendLine(" return r > 0;"); Clase.AppendLine(" }"); Clase.AppendLine(""); Clase.AppendLine($" public static bool Eliminar(string id)"); Clase.AppendLine(" {"); Clase.AppendLine(" var r = 0;"); Clase.AppendLine(" using (var cn = Conexion.ConexionDBSqlServer()){"); Clase.AppendLine($" var sql = {Comillas}UPDATE {tablaBD} SET Estado='0' WHERE Id =@Id{Comillas};"); Clase.AppendLine(" var cmd = new SqlCommand(sql, cn);"); Clase.AppendLine($" cmd.Parameters.AddWithValue({Comillas}@Id{Comillas}, id);"); Clase.AppendLine(" cn.Open();"); Clase.AppendLine(" r = cmd.ExecuteNonQuery();"); Clase.AppendLine(" cn.Close();"); Clase.AppendLine(" }"); Clase.AppendLine(" return r > 0;"); Clase.AppendLine(" }"); Clase.AppendLine(""); Clase.AppendLine(""); Clase.AppendLine($" public static {tablaBD} CrearEntidad(IDataReader lector)"); Clase.AppendLine(" {"); Clase.AppendLine($" var aux = new {tablaBD}();"); var Campos = aux.ObtenerCampos(tablaBD); for (int i = 0; i < Campos.Count; i++) { if (Campos[i].tipoDato.Contains("char") || Campos[i].tipoDato.Contains("nvarchar") || Campos[i].tipoDato.Contains("varchar")) { Clase.AppendLine($" aux.{Campos[i].Nombre} = lector.GetString({i});"); } //Agregar Mas tipos de datos } Clase.AppendLine($" return aux;"); Clase.AppendLine(" }"); Clase.AppendLine(""); Clase.AppendLine($" public static List<{tablaBD}> Buscar({tablaBD} ent)"); Clase.AppendLine(" {"); Clase.AppendLine($" var lista = new List<{tablaBD}>();"); Clase.AppendLine($" using (var cn = Conexion.ConexionDBSqlServer())"); Clase.AppendLine(" {"); Clase.AppendLine($" SqlCommand cmd = new SqlCommand({Comillas}SPU_BUSCAR_{tablaBD}{Comillas}, cn); "); Clase.AppendLine(" cmd.CommandType = CommandType.StoredProcedure;"); Clase.AppendLine(" cn.Open();"); var listaSelect = Consultas.getParametros(tablaBD, "BUSCAR"); foreach (var item in listaSelect) { Clase.AppendLine($" cmd.Parameters.AddWithValue({Comillas}{item.nombre}{Comillas},ent.{Regex.Replace(Regex.Replace(item.nombre, $"@{tablaBD}", ""), "@", "")});"); } Clase.AppendLine(" var r = cmd.ExecuteReader();"); Clase.AppendLine(" while (r.Read())"); Clase.AppendLine(" {"); Clase.AppendLine(" lista.Add(CrearEntidad(r));"); Clase.AppendLine(" }"); Clase.AppendLine(" cn.Close();"); Clase.AppendLine(" }"); Clase.AppendLine(" return lista;"); Clase.AppendLine(" }"); Clase.AppendLine(""); Clase.AppendLine($" public static List<{tablaBD}> ObtenerUltimos()"); Clase.AppendLine(" {"); Clase.AppendLine($" var lista = new List<{tablaBD}>();"); Clase.AppendLine($" using (var cn = Conexion.ConexionDBSqlServer())"); Clase.AppendLine(" {"); Clase.AppendLine($" SqlCommand cmd = new SqlCommand({Comillas}SPU_TOP10_{tablaBD}{Comillas}, cn); "); Clase.AppendLine(" cn.Open();"); Clase.AppendLine(" var r = cmd.ExecuteReader();"); Clase.AppendLine(" while (r.Read())"); Clase.AppendLine(" {"); Clase.AppendLine(" lista.Add(CrearEntidad(r));"); Clase.AppendLine(" }"); Clase.AppendLine(" cn.Close();"); Clase.AppendLine(" }"); Clase.AppendLine(" return lista;"); Clase.AppendLine(" }"); Clase.AppendLine(" }"); Clase.AppendLine("}"); }
public void ProcedureSelect(string servidor, string baseDatos, string tabla) { string text = ""; foreach (DataGridViewRow elemento in dgvListaWhere.Rows) { if ((bool)(elemento.Cells[4].Value) == true) { listaBuscar.Add(new Atributos(elemento.Cells[0].Value.ToString(), "nvarchar", elemento.Cells[2].Value.ToString(), elemento.Cells[3].Value.ToString())); } } int maxBuscar = listaBuscar.Count; txtS.AppendText("USE " + cboBD.SelectedItem.ToString() + " \r\n"); txtS.AppendText("GO " + " \r\n"); txtS.AppendText("CREATE PROCEDURE SPU_BUSCAR_" + tabla + "\r\n"); foreach (var item in listaBuscar) { maxBuscar--; if (maxBuscar == 0) { text = $"@{Regex.Replace(item.Nombre, @"[.]", "")} {item.tipoDato} ({item.length}) "; } else { text = $"@{Regex.Replace(item.Nombre, @"[.]", "")} {item.tipoDato}({item.length}), "; } txtS.AppendText(text + "\r\n"); } txtS.AppendText("AS" + "\r\n"); txtS.AppendText("Select "); string query = string.Format("Select i.COLUMN_NAME,CONVERT(text,i.DATA_TYPE),CONVERT(text,i.IS_NULLABLE),CONVERT(nvarchar,i.CHARACTER_MAXIMUM_LENGTH) from information_schema.columns i WHERE TABLE_NAME='{0}'", tabla); string cadenaConexion = string.Format(@"Data Source={0};Initial Catalog={1};Integrated Security=True", servidor, baseDatos); SqlConnection cn = new SqlConnection(cadenaConexion); SqlCommand cmd = new SqlCommand(query, cn); cn.Open(); var lista = cmd.ExecuteReader(); text = ""; foreach (DataGridViewRow elemento in dgvAtributos.Rows) { if ((bool)(elemento.Cells[4].Value) == true) { listaAtrib.Add(new Atributos(elemento.Cells[0].Value.ToString(), elemento.Cells[1].Value.ToString(), elemento.Cells[2].Value.ToString(), elemento.Cells[3].Value.ToString())); } } int max = listaAtrib.Count; maxBuscar = listaBuscar.Count; foreach (var item in listaAtrib) { max--; if (max == 0) { text = item.Nombre; } else { text = item.Nombre + ", "; } txtS.AppendText(text); } txtS.AppendText(" From " + tabla); //Crear InnerJoin Consultas aux = new Consultas(); var listaInner = aux.getGenerarRelacion(tabla); foreach (var item in listaInner) { txtS.AppendText($@" INNER JOIN {item.PK_Tabla} ON {item.PK_Tabla}.{item.PK_Columna} = {tabla}.{item.FK_Columna} "); } txtS.AppendText(" WHERE "); foreach (var item in listaBuscar) { maxBuscar--; if (maxBuscar == 0) { text = item.Nombre + $" like @{Regex.Replace(item.Nombre, @"[.]", "")} + '%' "; } else { text = item.Nombre + $" like @{Regex.Replace(item.Nombre, @"[.]", "")}+ '%' AND "; } txtS.AppendText(text); } txtS.AppendText($" AND {tabla}.Estado='1' "); }