public ProveedoresGUI() { InitializeComponent(); funciones = new MetodosComunes(); consultas = new MetodosConsultasSQL(); actualizarTabla(); }
public static List <DTOConsumo> ObtenerConsumo(ref HttpStatusCode estado, ref string mensaje, DateTime FechaInicio, DateTime FechaFin, int?id) { List <DTOConsumo> Consumo = new List <DTOConsumo>(); try { var parametros = new Dictionary <string, object>(); parametros.Add("FechaInicio", FechaInicio); parametros.Add("FechaFin", FechaFin); parametros.Add("IdUsuario", id); Consumo = Base.baseFactory.Obtener().ObtenerLista <DTOConsumo>("PA_ObtenerConsumoFechas", parametros); estado = HttpStatusCode.Found; } catch (SqlException sqlex) { MetodosComunes.SQLCatch(sqlex.Number); //throw; } catch (Exception e) { //estado = HttpStatusCode.InternalServerError; throw; } return(Consumo); }
public static DTOCerveza ObtenerCerveza(ref HttpStatusCode estado, ref string mensaje, int id) { DTOCerveza Cerveza = new DTOCerveza(); try { var parametros = new Dictionary <string, object>(); parametros.Add("Id", id); var Cervezas = Base.baseFactory.Obtener().ObtenerLista <DTOCerveza>("PA_ObtenerCervezas", parametros); if (Cervezas.Count() == 0) { estado = HttpStatusCode.NotFound; mensaje = "no se encontro la cerveza"; return(null); } Cerveza = Cervezas[0]; estado = HttpStatusCode.Found; } catch (SqlException sqlex) { MetodosComunes.SQLCatch(sqlex.Number); //throw; } catch (Exception e) { //estado = HttpStatusCode.InternalServerError; throw; } return(Cerveza); }
public static void CrearUsuario(ref HttpStatusCode estado, DTOUsuario usuario) { try { var parametros = new Dictionary <string, object>(); parametros.Add("Nombre", usuario.Nombre); parametros.Add("Apellido1", usuario.Apellido1); parametros.Add("Apellido2", usuario.Apellido2); parametros.Add("Alias", usuario.Alias); parametros.Add("Contrasena", Miscelanios.Ecriptacion.Encriptar(usuario.Contrasena, true)); parametros.Add("TipoUsuarioId", usuario.Admin ? 1 : 2); Base.baseFactory.Insertar().Insert("PA_InsertarUsuario", parametros); estado = HttpStatusCode.Created; } catch (SqlException sqlex) { estado = MetodosComunes.SQLCatch(sqlex.Number); throw; } catch (Exception e) { estado = HttpStatusCode.InternalServerError; throw; } }
public IUPresupuesto() { InitializeComponent(); DoubleBuffered = true; conexion = new ConexionSQLServer(); funciones = new MetodosComunes(); actualizarDGV(); conexion.rellenacombobox(cmbLocalidad, "select idlocalidad, descripcion from localidades order by descripcion", "--Seleccionar Localidad--"); }
public void getMontoConIvaTest() { MetodosComunes target = new MetodosComunes(); // TODO: Inicializar en un valor adecuado Decimal montoNeto = new Decimal(); // TODO: Inicializar en un valor adecuado int expected = 0; // TODO: Inicializar en un valor adecuado int actual; actual = target.getMontoConIva(montoNeto); Assert.AreEqual(expected, actual); Assert.Inconclusive("Compruebe la exactitud de este método de prueba."); }
private void button1_Click(object sender, EventArgs e) { if (nombre.Text.Length == 0 || apellido.Text.Length == 0 || ced.Text.Trim().Length < 16 || dir.Text.Length == 0) { MessageBox.Show("Complete la información del tutor antes de regitrar", "Información"); } else { MetodosComunes m = new MetodosComunes(); m.GuardarTutorEx(idCand, nombre.Text, apellido.Text, ced.Text, dir.Text, tel.Text); this.Hide(); } }
public AnadirPresupuesto(Boolean modificar, int idcliente, int presupuesto) { InitializeComponent(); DoubleBuffered = true; consultas = new ConexionSQLServer(); funciones = new MetodosComunes(); listaEliminar = new List <String>(); idCliente = idcliente; Modificar = modificar; Refpresupuesto = presupuesto; rellenarDatosCliente(); txtCalidades.Text = consultas.selectstring("select descripcion from Presu_Calidades where idcalidad=" + 1); if (Modificar == true) { rellenarDatosPresupuesto(); } }
public static void AgregarHistorico(ref HttpStatusCode estado, DTOHistoricoCerveza cerveza) { try { var parametros = new Dictionary <string, object>(); parametros.Add("UsuarioId", cerveza.UsuarioId); parametros.Add("CervezaId", cerveza.CervezaId); parametros.Add("Consumo", cerveza.Consumo); Base.baseFactory.Insertar().Insert("PA_AgregarHistoricoCerveza", parametros); estado = HttpStatusCode.Created; } catch (SqlException sqlex) { estado = MetodosComunes.SQLCatch(sqlex.Number); throw; } catch (Exception e) { estado = HttpStatusCode.InternalServerError; throw; } }
public static DTOLoginRespuesta Login(ref HttpStatusCode estado, ref string mensaje, DTOUsuario usuario) { DTOLoginRespuesta loginRespuesta = new DTOLoginRespuesta(); try { if (string.IsNullOrEmpty(usuario.Alias) || string.IsNullOrEmpty(usuario.Contrasena)) { estado = HttpStatusCode.BadRequest; mensaje = "Alias o contrasena no ingresados"; return(null); } var parametros = new Dictionary <string, object>(); parametros.Add("Alias", usuario.Alias); parametros.Add("Contrasena", Miscelanios.Ecriptacion.Encriptar(usuario.Contrasena, true)); loginRespuesta = Base.baseFactory.Obtener().ObtenerLista <DTOLoginRespuesta>("PA_Login", parametros)[0]; if (string.IsNullOrEmpty(loginRespuesta.TOKEN)) { estado = HttpStatusCode.Unauthorized; mensaje = "Alias o Contraseña incorrectos"; } else { estado = HttpStatusCode.Created; mensaje = "OK"; } } catch (SqlException sqlex) { MetodosComunes.SQLCatch(sqlex.Number); //throw; } catch (Exception e) { //estado = HttpStatusCode.InternalServerError; throw; } return(loginRespuesta); }
public static List <DTOCerveza> ObtenerTodo(ref HttpStatusCode estado, ref string mensaje) { List <DTOCerveza> lstCervezas = new List <DTOCerveza>(); try { var parametros = new Dictionary <string, object>(); lstCervezas = Base.baseFactory.Obtener().ObtenerLista <DTOCerveza>("PA_ObtenerTodasCervezas", parametros); mensaje = $"La cantidad de cervezas en el sistema es de {lstCervezas.Count()} cerveza{(lstCervezas.Count() == 1 ? "" : "s")}"; estado = HttpStatusCode.OK; } catch (SqlException sqlex) { MetodosComunes.SQLCatch(sqlex.Number); //throw; } catch (Exception e) { //estado = HttpStatusCode.InternalServerError; throw; } return(lstCervezas); }
public static void CrearCerveza(ref HttpStatusCode estado, DTOCerveza cerveza) { try { var parametros = new Dictionary <string, object>(); parametros.Add("Marca", cerveza.Marca); parametros.Add("Alcohol", cerveza.Alcohol); parametros.Add("TipoId", cerveza.TipoId); parametros.Add("PaisId", cerveza.PaisId); Base.baseFactory.Insertar().Insert("PA_NuevaCerveza", parametros); estado = HttpStatusCode.Created; } catch (SqlException sqlex) { estado = MetodosComunes.SQLCatch(sqlex.Number); throw; } catch (Exception e) { estado = HttpStatusCode.InternalServerError; throw; } }