protected void ibtnExporteMotivoNoCompra_Click(object sender, ImageClickEventArgs e) { try { DataTable dt = new DataTable(); dt = dal.getExporteCotizacionesRechazadas().Tables[0]; Utilidad.ExportDataTableToExcel(dt, "ExporteCotizacionesRechazadas.xls", "", "", "", ""); } catch (Exception ex) { Response.Write("ERROR: " + ex.Message); } }
protected void ibtnExportar_Click(object sender, EventArgs e) { try { DataTable dt = Session["grillaGestionesVentas"] as DataTable; Utilidad.ExportDataTableToExcel(dt, "Exporte_Gestiones.xls", "", "", "", ""); } catch (Exception ex) { lblInformacion.Text = ex.Message; mdlInformacion.Show(); } }
protected void lnkAddGridPropietarios_Click(object sender, EventArgs e) { GridViewRow row = GridPropietarios.FooterRow; TextBox tb = (TextBox)row.FindControl("textBoxNuevoNombrePropietario"); string nombrePropietario = Utilidad.verificarString_nombres(tb.Text); tb = (TextBox)row.FindControl("textBoxNuevoIdTipoId"); int idTipoId; bool success = int.TryParse(tb.Text, out idTipoId); if (!success) { idTipoId = -1; } tb = (TextBox)row.FindControl("textBoxNuevoIdentificacion"); string identificacion = (tb.Text).Trim(); if (String.IsNullOrEmpty(identificacion)) { identificacion = "-1"; } try { using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["connDB"].ConnectionString)) { string procedure = propietarioInsert; SqlCommand cmd = new SqlCommand(procedure, conn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@inNombre", SqlDbType.VarChar).Value = nombrePropietario; cmd.Parameters.Add("@inValorDocId", SqlDbType.Int).Value = idTipoId; cmd.Parameters.Add("@inIdentificacion", SqlDbType.VarChar).Value = identificacion; cmd.Parameters.Add("@inUsuarioACargo", SqlDbType.VarChar).Value = Session["userName"]; cmd.Parameters.Add("@inIPusuario", SqlDbType.VarChar).Value = Session["userIp"]; cmd.Connection = conn; conn.Open(); cmd.ExecuteNonQuery(); } fillGridPropietarios(); } catch (SqlException ex) { string alertMessage = Utilidad.mensajeAlerta(ex); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('" + alertMessage + "')", true); } }
protected void botonUpdate_propietario_Click(object sender, EventArgs e) { string identificacionActual = (identificacion_txtForUpdate.Text).Trim(); string newIdentificacion = (newIdentificacion_txtForUpdate.Text).Trim(); if (String.IsNullOrEmpty(identificacionActual)) { identificacionActual = "-1"; } if (String.IsNullOrEmpty(newIdentificacion)) { newIdentificacion = "-1"; } int tipoDocId; bool success = int.TryParse(newTipoDocIdP_txtForUpdate.Text, out tipoDocId); if (!success) { tipoDocId = -1; } string newName = Utilidad.verificarString_nombres(newName_txtForUpdate.Text); try { using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["connDB"].ConnectionString)) { string procedure = propietarioUpdate; SqlCommand cmd = new SqlCommand(procedure, conn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@inNombre", SqlDbType.VarChar).Value = newName; cmd.Parameters.Add("@inValorDocId", SqlDbType.Int).Value = tipoDocId; cmd.Parameters.Add("@inIdentificacion", SqlDbType.VarChar).Value = newIdentificacion; cmd.Parameters.Add("@inIdentificacionOriginal", SqlDbType.VarChar).Value = identificacionActual; cmd.Parameters.Add("@inUsuarioACargo", SqlDbType.VarChar).Value = Session["userName"]; cmd.Parameters.Add("@inIPusuario", SqlDbType.VarChar).Value = Session["userIp"]; cmd.Connection = conn; conn.Open(); cmd.ExecuteNonQuery(); } fillGridPropietarios(); } catch (SqlException ex) { string alertMessage = Utilidad.mensajeAlerta(ex); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('" + alertMessage + "')", true); } }
protected void ibtnExportarExcel_Click(object sender, ImageClickEventArgs e) { try { DataTable dt = new DataTable(); dt = Session["DatosListadoProducto"] as DataTable; Utilidad.ExportDataTableToExcel(dt, "Exporte_Productos.xls", "", "", "", ""); } catch (Exception ex) { lblInformacion.Text = "Error: " + ex.Message; mdlInformacion.Show(); } }
//--------------------------------------------FUNCIONES ASOCIADAS A EVENTOS------------------------------------------------- /// <summary> /// Asociado al evento click del botón "btImportarCSV" permite importar usuarios desde un archivo .csv y añadirlos a la base de datos /// para ello hace uso de una clase auxiliar <see cref="Utilidad.ImportarCSv(string)"/> /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BtImportarCSV_Click(object sender, RoutedEventArgs e) { try { Utilidad.ImportarCSv("usuario"); listaUsuarios = Negocio.ObtenerUsuarios(); vistaUsuarios.Source = listaUsuarios; } catch (Exception error) { statusBar.Background = Brushes.IndianRed; tbStatusInformation.Text = error.Message; } }
/// <summary> /// Asociado al evento click de la botón btImportarCsv, permite importar sedes desde un archivo CSV, se hace valer de una clase Auxiliar /// <see cref=Utilidad.ImportarCSv(string)">"/> que permite reutilizar código para las distintas entidades. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BtImportarCSV_Click(object sender, RoutedEventArgs e) { limpiarBarra(); try { Utilidad.ImportarCSv("sede"); vistaSedes.Source = Negocio.ObtenerSedes(); } catch (Exception error) { statusBar.Background = Brushes.IndianRed; tbStatusInformation.Text = error.Message; } }
protected void ibtnExportarExcel_Click(object sender, EventArgs e) { try { DataTable dt = new DataTable(); dt = dal.getBuscarCarteraAsignadaExporte(ddlEjecutivo.SelectedValue, ddlCampana.SelectedValue).Tables[0]; Utilidad.ExportDataTableToExcel(dt, "Exporte_CarteraAsignada.xls", "", "", "", ""); } catch (Exception ex) { lblInformacion.Text = ex.Message; mdlInformacion.Show(); } }
protected void botonUpdate_usuario_Click(object sender, EventArgs e) { string usuario = (usuario_txtForUpdate.Text).Trim(); string newUsuario = (newUsuario_txtForUpdate.Text).Trim(); string newPassword = (newPassword_TxtForUpdate.Text).Trim(); string tipoUsuario = newTipoUsuario_DllForUpdate.SelectedValue; if (String.IsNullOrEmpty(usuario)) { usuario = "-1"; } if (String.IsNullOrEmpty(newUsuario)) { newUsuario = "-1"; } if (String.IsNullOrEmpty(newPassword)) { newPassword = "******"; } try { using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["connDB"].ConnectionString)) { string procedure = updateUsuarioSpName; SqlCommand cmd = new SqlCommand(procedure, conn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@inNombre ", SqlDbType.VarChar).Value = newUsuario; cmd.Parameters.Add("@inPassword ", SqlDbType.VarChar).Value = newPassword; cmd.Parameters.Add("@inNombreOriginal ", SqlDbType.VarChar).Value = usuario; cmd.Parameters.Add("@inTipoDeUsuario ", SqlDbType.VarChar).Value = tipoUsuario; cmd.Parameters.Add("@inUsuarioACargo", SqlDbType.VarChar).Value = Session["userName"]; cmd.Parameters.Add("@inIPusuario", SqlDbType.VarChar).Value = Session["userIp"]; cmd.Connection = conn; conn.Open(); cmd.ExecuteNonQuery(); } fillGridUsuarios(); } catch (SqlException ex) { string alertMessage = Utilidad.mensajeAlerta(ex); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('" + alertMessage + "')", true); } }
private void BtnEdad_Click(object sender, EventArgs e) { if (DtpFechaFacimiento.Value > DateTime.Now) { ErpMensaje.SetError(DtpFechaFacimiento, "La fecha de nacimiento debe ser menor a la fecha del sistema"); return; } else { ErpMensaje.SetError(DtpFechaFacimiento, null); } MessageBox.Show("La edad es: " + Utilidad.ObtenerEdad(DtpFechaFacimiento.Value)); }
private void buscarButton_Click(object sender, EventArgs e) { if (!(tipoIdTextBox.Text == "")) { Entidades.TiposEmails tipoEmail = BLL.TipoEmailBLL.Buscar(Utilidad.ToInt(tipoIdTextBox.Text)); if (tipoEmail != null) { descripcionTextBox.Text = tipoEmail.Descripcion; } else { MessageBox.Show("No encotrado..."); } } }
void Awake() { directorioArchivo = Application.persistentDataPath + "/datosJuego.dat"; //Impide que se destruya EstadoObjto al cambiar de escena if (estadoJuego == null) { estadoJuego = this; DontDestroyOnLoad(gameObject); objetos_guardados = Utilidad.crearDiccionarioPuntuacion(); } else if (estadoJuego != this) { Destroy(gameObject); } }
protected void ibtnExportarExcel_Click(object sender, EventArgs e) { try { DataTable dt = new DataTable(); dt = dal.getBuscarClienteExporte(txtBuscar.Text, txtBuscar.Text).Tables[0]; Utilidad.ExportDataTableToExcel(dt, "Exporte_Clientes.xls", "", "", "", ""); } catch (Exception ex) { lblInformacion.Text = ex.Message; mdlInformacion.Show(); } }
public int RegistrarPersona(Persona persona) { persona.Nombres = persona.Nombres.ToUpperInvariant(); persona.ApellidoMaterno = persona.ApellidoMaterno.ToUpperInvariant(); persona.ApellidoPaterno = persona.ApellidoPaterno.ToUpperInvariant(); persona.IdPersona = _db.Persona .Select(p => p.IdPersona) .DefaultIfEmpty(0) .Max() + 1; persona.FechaUsuario = DateTime.Now; persona.Estacion = Environment.MachineName; persona.IpEstacion = Utilidad.ObtenerIpv4(); _db.Persona.Add(persona); return(_db.SaveChanges()); }
protected void Buscar_Click(object sender, EventArgs e) { int id = Utilidad.TOINT(IdTextBox.Text); presupuesto = Bll.PresupuestoBll.Buscar(p => p.PresupuestoId == id); if (presupuesto != null) { DescripcionTextbox.Text = presupuesto.Descripcion; MontoTextbox.Text = Convert.ToString(presupuesto.Monto); FechaTextbox.Text = Convert.ToString(presupuesto.Fecha); relacion = Bll.PresupuestoDetalleBll.GetList(p => p.PresupuestoId == id); AgregarAGrid(relacion); } }
private void button4_Click(object sender, EventArgs e) { if (!string.IsNullOrWhiteSpace(retencionIdTextBox.Text)) { Retenciones retencion = RetencionBLL.Buscar(Utilidad.ToInt(retencionIdTextBox.Text)); if (retencion != null) { descripcionTextBox.Text = retencion.Descripcion; valorTextBox.Text = retencion.Valor.ToString(); } else { MessageBox.Show("No encontrado..."); } } }
public ActionResult <UtilidadViewModel> Post(UtilidadInputModel UtilidadInput) { Utilidad utilidad = MapearUtilidad(UtilidadInput); var response = _utilidadService.Guardar(utilidad); if (response.Error) { ModelState.AddModelError("Guardar Utilidad", response.Mensaje); var problemDetails = new ValidationProblemDetails(ModelState) { Status = StatusCodes.Status400BadRequest, }; return(BadRequest(problemDetails)); } return(Ok(response.Utilidad)); }
public GuardarUtilidadesResponse Guardar(Utilidad utilidad) { try { var UtulidadBuscada = _Context.Utilidades.Find(utilidad.IdPago); if (UtulidadBuscada != null) { return(new GuardarUtilidadesResponse("El Hotel ya se encuentra registrado")); } utilidad.CalcularUtilidades(); _Context.Utilidades.Add(utilidad); _Context.SaveChanges(); return(new GuardarUtilidadesResponse(utilidad)); } catch (Exception e) { return(new GuardarUtilidadesResponse($"Error de la Aplicacion: {e.Message}")); } }
protected void ibtnExportar_Click(object sender, EventArgs e) { try { string vendedor = Session["variableIdUsuario"].ToString(); string perfil = Session["variablePerfil"].ToString(); DataTable dt = new DataTable(); dt = dal.getBuscarSeguimientoExporte(ddlVendedorIndicador.SelectedValue, null, null, txtFechaDesde.Text, txtFechaHasta.Text).Tables[0]; Utilidad.ExportDataTableToExcel(dt, "Exporte_Seguimiento.xls", "", "", "", ""); //if (perfil == "3") //{ // lblInfoVendedor.Visible = false; // ddlVendedor.Visible = false; // string montoCotizacionDesde = txtMontoCotizacionDesde.Text; // string montoCotizacionHasta = txtMontoCotizacionHasta.Text; // string fechaDesde = txtFechaDesde.Text.Replace("-", "/"); // string fechaHasta = txtFechaHasta.Text.Replace("-", "/"); // ds = dal.getBuscarSeguimiento(vendedor, montoCotizacionDesde, montoCotizacionHasta, fechaDesde, fechaHasta); // Utilidad.ExportDataTableToExcel(ds.Tables[0], "Exporte_Seguimiento.xls", "", "", "", ""); //} //else //{ // vendedor = ddlVendedor.SelectedValue; // if (vendedor == "0") // { // vendedor = null; // } // string montoCotizacionDesde = txtMontoCotizacionDesde.Text; // string montoCotizacionHasta = txtMontoCotizacionHasta.Text; // string fechaDesde = txtFechaDesde.Text.Replace("-", "/"); // string fechaHasta = txtFechaHasta.Text.Replace("-", "/"); // ds = dal.getBuscarSeguimiento(vendedor, montoCotizacionDesde, montoCotizacionHasta, fechaDesde, fechaHasta); // Utilidad.ExportDataTableToExcel(ds.Tables[0], "Exporte_Seguimiento.xls", "", "", "", ""); //} } catch (Exception ex) { lblInformacion.Text = ex.Message; mdlInformacion.Show(); } }
private void emailIdTextBox_KeyPress(object sender, KeyPressEventArgs e) { int id = Utilidad.ToInt(emailIdTextBox.Text); if (e.KeyChar == (char)Keys.Enter) { detalle.TiposEmails = BLL.TipoEmailBLL.Buscar(id); if (detalle.TiposEmails != null) { emailTipoTextBox.Text = detalle.TiposEmails.Descripcion; } else { MessageBox.Show("TipoEmail no encontrado..."); } } }
protected void BuscarButton_Click(object sender, EventArgs e) { if (!string.IsNullOrWhiteSpace(PresupuestoIdTextBox.Text)) { int id = Utilidad.ToInt(PresupuestoIdTextBox.Text); presupuesto = PresupuestoBLL.Buscar(P => P.PresupuestoId == id); if (presupuesto != null) { CargarDatos(); NuevoOModificando(); } else { MensajeAlertaError.Text = "No encontrado"; AlertaError.Visible = true; } } }
protected void btnExcel_Click(object sender, EventArgs e) { try { //grvResultado.DataSource = dal.getBuscarCarteraAsignada() Deuda deuda = new Deuda(); Deudor deudor = new Deudor(); //deuda.IdMandante = Convert.ToInt32(ddlMandante.SelectedValue); deuda.IdMandante = Convert.ToInt32(Session["IdMandante"]); deuda.IdAsignacion = Convert.ToInt32(ddlAsignacion.SelectedValue); deuda.IdCampana = Convert.ToInt32(ddlCampana.SelectedValue); deuda.IdUsuarioAsig = Convert.ToInt32(ddlEjecutivo.SelectedValue); deuda.IdTipoDeuda = Convert.ToInt32(ddlTipoDeuda.SelectedValue); deudor.NombreDeudor = txtNombreRazonSocial.Text; deudor.RutDeudor = txtRut.Text; deuda.IdEstadoDeuda = Convert.ToInt32(ddlEstadoDeuda.SelectedValue); int?montoDesde = null; int?montoHasta = null; if (IsNumeric(txtMontoDesde.Text)) { montoDesde = Convert.ToInt32(txtMontoDesde.Text); } if (IsNumeric(txtMontoHasta.Text)) { montoHasta = Convert.ToInt32(txtMontoHasta.Text); } DataTable dt = new DataTable(); dt = dal.getBuscarCarteraAsignadaExporte(deuda, deudor, montoDesde, montoHasta).Tables[0]; Response.ContentType = "Application/x-msexcel"; Response.AddHeader("content-disposition", "attachment;filename=" + "exporte" + ".csv"); Response.ContentEncoding = Encoding.Unicode; Response.Write(Utilidad.ExportToCSVFile(dt)); Response.End(); } catch (Exception ex) { divAlerta.Visible = true; lblInfo.Text = ex.Message; } }
public static List <CCiudad> ObtenerCiudades() { try { var registros = from datos in DB.Singleton().M20_ObtenerCiudades() select new CCiudad { Codigo = datos.lug_id, Nombre = datos.lug_nombre }; return(registros.ToList()); } catch (Exception ex) { Utilidad.RegistrarLog(new ReservaHabitacionException("Ocurrio un problema al obtener las ciudades.", ex)); } return(null); }
protected void ibtnExportar_Click(object sender, ImageClickEventArgs e) { try { DataTable dt = new DataTable(); dt = dal.getBuscarLeadSeguimientoExporte(null, null, Convert.ToInt32(ddlEjecutivoAsignado.SelectedValue)).Tables[0]; Response.ContentType = "Application/x-msexcel"; Response.AddHeader("content-disposition", "attachment;filename=" + "export_seguimientoLead" + ".csv"); Response.ContentEncoding = Encoding.Unicode; Response.Write(Utilidad.ExportToCSVFile(dt)); Response.End(); } catch (Exception ex) { lblInformacion.Text = ex.Message; mdlInformacion.Show(); } }
/// <summary> /// Asociado al evento click del botón "btImportarCSV" permite importar un archivo .csv de equipos a través de /// <see cref="Utilidad.ImportarCSv(string)"/> /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BtImportarCSV_Click(object sender, RoutedEventArgs e) { try { Utilidad.ImportarCSv("equipo"); List <Equipo> listaEquiposBD = Negocio.ObtenerEquipos(); foreach (Equipo team in listaEquiposBD) { listaEquipos.Add(team); } vistaEquipos.Source = listaEquipos; } catch (Exception error) { statusBar.Background = Brushes.IndianRed; tbStatusInformation.Text = error.Message; } }
protected void ibtnExportarExcel_Click(object sender, ImageClickEventArgs e) { try { string idVendedor = ddlVendedor.SelectedValue; string fechaDesde = txtFechaDesde.Text.Trim(); string fechaHasta = txtFechaHasta.Text.Trim(); string idEmpresa = ddlEmpresa.SelectedValue; int conFact = Convert.ToInt32(ddlFacturado.SelectedValue); ds = dal.getBuscarNotaVentaParametros(idVendedor, fechaDesde, fechaHasta, idEmpresa, conFact); Utilidad.ExportDataTableToExcel(ds.Tables[0], "Exporte_NV.xls", "", "", "", ""); } catch (Exception ex) { lblInformacion.Text = ex.Message; mdlInformacion.Show(); } }
/// <summary> /// Asociado al evento click del botón "btImportarCSV" permite importar localidades existentes en un archivo .csv /// para ello hace uso de <see cref="Utilidad.ImportarCSv(string)"/> /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BtImportarCSV_Click(object sender, RoutedEventArgs e) { try { Utilidad.ImportarCSv("localidad"); List <Localidad> listaLocalidades = Negocio.ObtenerLocalidades(); this.listaLocalidades = new ObservableCollection <Localidad>(); foreach (Localidad local in listaLocalidades) { this.listaLocalidades.Add(local); } vistaLocalidad.Source = this.listaLocalidades; } catch (Exception error) { statusBar.Background = Brushes.IndianRed; tbStatusInformation.Text = error.Message; } }
private void buscarButton_Click(object sender, EventArgs e) { if (empleadoIdTextBox.Text != "") { empleado = BLL.EmpleadoBLL.Buscar(Utilidad.ToInt(empleadoIdTextBox.Text)); if (empleado != null) { nombresTextBox.Text = empleado.Nombres; fechaNacimientoDateTimePicker.Value = empleado.FechaNacimiento; sueldoTextBox.Text = empleado.Sueldo.ToString(); LlenarGridRetenciones(); LlenarGridEmails(); } else { MessageBox.Show("No encontrado..."); } } }
private void retencionIdTextBox_KeyPress(object sender, KeyPressEventArgs e) { int id = Utilidad.ToInt(retencionIdTextBox.Text); if (e.KeyChar == (char)Keys.Enter) { Entidades.Retenciones retencion = BLL.RetencionBLL.Buscar(id); if (retencion != null) { retencionDescripcionTextBox.Text = retencion.Descripcion; retencionValorTextBox.Text = retencion.Valor.ToString(); retencionSeleccionada = retencion; } else { MessageBox.Show("Retencion no encontrada..."); } } }
/// <summary> /// Asociada al evento click del botón "btImportarCSV" permite importar desde un archivo .csv un listado de categorías /// mediante <see cref="Utilidad.ImportarCSv(string)"/> en caso de existir algún problema en la transacción muestra un error /// a través de <see cref="VentanaInformacion"/> /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BtImportarCSV_Click(object sender, RoutedEventArgs e) { try { Utilidad.ImportarCSv("categoria"); List <Tipo> listaCategoriasBD = Negocio.ObtenerTipos(); listaCategorias = new ObservableCollection <Tipo>(); foreach (Tipo tip in listaCategoriasBD) { listaCategorias.Add(tip); } vistaCategoria.Source = listaCategorias; } catch (Exception error) { statusBar.Background = Brushes.IndianRed; tbStatusInformation.Text = error.Message; } }