示例#1
0
        public async void save()
        {
            switch (this.accion)
            {
            case ACCION.NUEVO:
                if (!validacionCampos())
                {
                    await Mensajes.ShowMessageAsync("Error", "Ingrese Un tipo de Producto");
                }
                else
                {
                    try
                    {
                        this.Productos.Add(producto.Save(Convert.ToInt16(Mensajes.CodigoCategoria.Text), Convert.ToInt16(Mensajes.CodigoEmpaque.Text), this.Descripcion, Convert.ToDecimal(this.PrecioUnitario),
                                                         Convert.ToDecimal(this.PrecioPorDocena), Convert.ToDecimal(this.PrecioPorMayor), Convert.ToInt16(this.Existencia), this.Imagen, this.NombreImagen));
                        await Mensajes.ShowMessageAsync("Exito", "Producto ingresada exitosamente");

                        moverImagen(this.Imagen, this.NombreImagen);
                    }catch (Exception e)
                    {
                        System.Console.WriteLine(e);
                        await Mensajes.ShowMessageAsync("Error", "Formato Incorrecto");
                    }
                    borrarCampos();
                    isEnableSave();
                }
                break;

            case ACCION.ACTUALIZAR:
                try
                {
                    if (this.SelectProducto != null)
                    {
                        //Mensajes.CodigoCategoria.Focus();
                        int posicion = this.Productos.IndexOf(this.SelectProducto);
                        if (validacionCampos())
                        {
                            //await Mensajes.ShowMessageAsync("Error", Mensajes.CodigoCategoria.Text);
                            var updatProducto = producto.update(this.SelectProducto.CodigoProducto, Convert.ToInt16(Mensajes.CodigoCategoria.Text), Convert.ToInt16(Mensajes.CodigoEmpaque.Text), this.Descripcion, Convert.ToDecimal(this.PrecioUnitario),
                                                                Convert.ToDecimal(this.PrecioPorDocena), Convert.ToDecimal(this.PrecioPorMayor), Convert.ToInt16(this.Existencia), this.Imagen, this.NombreImagen);
                            this.Productos.RemoveAt(posicion);
                            this.Productos.Insert(posicion, updatProducto);
                            await Mensajes.ShowMessageAsync("Exito", "Registro actualizado correctamente");

                            isEnableActualizar();
                            borrarCampos();
                        }
                        else
                        {
                            await Mensajes.ShowMessageAsync("Actualizar", "Debe ingresar todos los campos");
                        }
                    }
                    else
                    {
                        await Mensajes.ShowMessageAsync("Error", "Ingrese una descripción");
                    }
                }
                catch (Exception e)
                {
                    await Mensajes.ShowMessageAsync("", e.Message);

                    await Mensajes.ShowMessageAsync("Error", "Seleccione una fila para actualizar");

                    isEnableErrorActualizar();
                    borrarCampos();
                }
                break;
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            #region prestamos

            if (String.IsNullOrEmpty(textBox1.Text))
            {
                Mensajes.error("Ingrese un número de documento");
                return;
            }

            comando = Datos.crearComando();

            comando.Parameters.Clear();
            comando.CommandText = "SELECT fecha, valor, interes, observacion, finalizado FROM prestamos WHERE clientes_documento = @clientes_documento ORDER BY fecha DESC";
            comando.Parameters.AddWithValue("@clientes_documento", textBox1.Text);

            // Al ejecutar la consulta se devuelve un DataTable.
            // --
            dataGridView1.DataSource = Datos.ejecutarComandoSelect(comando);

            for (int i = 0; i < dataGridView1.RowCount; i++)
            {
                if ((bool)dataGridView1["finalizado", i].Value)
                {
                    dataGridView1.Rows[i].DefaultCellStyle.BackColor = Color.PaleGreen;
                }
                else
                {
                    dataGridView1.Rows[i].DefaultCellStyle.BackColor = Color.White;
                }
            }

            #endregion

            #region pagos

            comando = Datos.crearComando();

            comando.Parameters.Clear();
            comando.CommandText = "SELECT fecha_pago, numero_cuota, valor, finalizada FROM cuotas WHERE clientes_documento = @clientes_documento ORDER BY fecha_pago DESC";
            comando.Parameters.AddWithValue("@clientes_documento", textBox1.Text);

            // Al ejecutar la consulta se devuelve un DataTable.
            // --
            dataGridView2.DataSource = Datos.ejecutarComandoSelect(comando);

            int deuda = 0;

            for (int i = 0; i < dataGridView2.RowCount; i++)
            {
                if ((bool)dataGridView2["finalizada", i].Value)
                {
                    dataGridView2.Rows[i].DefaultCellStyle.BackColor = Color.PaleGreen;
                    continue;
                }
                else if (Convert.ToDateTime(dataGridView2["fecha_pago", i].Value.ToString()) < DateTime.Now)
                {
                    dataGridView2.Rows[i].DefaultCellStyle.BackColor = Color.LightSalmon;
                }
                else
                {
                    dataGridView2.Rows[i].DefaultCellStyle.BackColor = Color.White;
                }
                deuda = deuda + Convert.ToInt32(dataGridView2["valor", i].Value.ToString());
            }

            textBox2.Text = deuda.ToString();

            #endregion

            #region incumplimientos

            comando = Datos.crearComando();

            comando.Parameters.Clear();
            comando.CommandText = "SELECT documento, nombre, fecha, direccion, telefono, ruta FROM incumplimientos i JOIN clientes c ON i.clientes_documentos=c.documento JOIN rutas r ON c.rutas_id = r.id WHERE c.documento = @documento ORDER BY documento, fecha";
            comando.Parameters.AddWithValue("@documento", textBox1.Text);

            // Al ejecutar la consulta se devuelve un DataTable.
            // --
            dataGridView3.DataSource = Datos.ejecutarComandoSelect(comando);

            #endregion
        }
示例#3
0
        private bool Comprobaciones(out ECorreos eCorreo)
        {
            eCorreo = new ECorreos();
            if (!this.ComprobacionEmail(this.txtCorreoEnvio.Text))
            {
                Mensajes.MensajeInformacion("El correo del remitente no tiene un formato correcto", "Entendido");
                return(false);
            }

            if (!this.ComprobacionEmail(this.txtCorreoReceptor.Text))
            {
                Mensajes.MensajeInformacion("El correo del destinatario no tiene un formato correcto", "Entendido");
                return(false);
            }

            if (this.chkCopia.Checked)
            {
                if (!this.ComprobacionEmail(this.txtCopia.Text))
                {
                    Mensajes.MensajeInformacion("El correo para el envío de copia no tiene un formato correcto", "Entendido");
                    return(false);
                }
                else
                {
                    eCorreo.Correo_copia = this.txtCopia.Text;
                }
            }
            else
            {
                eCorreo.Correo_copia = string.Empty;
            }

            if (this.txtPass1.Text.Equals(""))
            {
                Mensajes.MensajeInformacion("La contraseña del correo de envío es obligatoria", "Entendido");
                return(false);
            }
            else
            {
                eCorreo.Clave_correo_remitente = this.txtPass1.Text;
            }

            eCorreo.Correo_remitente    = this.txtCorreoEnvio.Text;
            eCorreo.Correo_destinatario = this.txtCorreoReceptor.Text;
            eCorreo.Estado_correo       = "ACTIVO";

            if (this.rdErrores.Checked)
            {
                eCorreo.Tipo_correo = "ERRORES";
            }
            else
            {
                eCorreo.Tipo_correo = "REPORTES";
            }

            if (this.ECorreo != null)
            {
                eCorreo.Id_correo = this.ECorreo.Id_correo;
            }
            else
            {
                Mensajes.MensajeInformacion("No se encontró el id del correo ligado", "Entendido");
                return(false);
            }

            return(true);
        }
        private bool Comprobaciones(out EVehiculos eVehiculo)
        {
            eVehiculo = new EVehiculos();

            if (this.txtPlaca.Text.Equals(string.Empty))
            {
                Mensajes.MensajeInformacion("Verifique la placa", "Entendido");
                return(false);
            }

            if (this.txtPropietario.Text.Equals(string.Empty))
            {
                Mensajes.MensajeInformacion("Verifique el propietario", "Entendido");
                return(false);
            }

            if (this.txtChofer.Text.Equals(string.Empty))
            {
                Mensajes.MensajeInformacion("Verifique el chofer", "Entendido");
                return(false);
            }

            if (this.txtMarca.Text.Equals(string.Empty))
            {
                Mensajes.MensajeInformacion("Verifique la marca", "Entendido");
                return(false);
            }

            if (this.txtModelo.Text.Equals(string.Empty))
            {
                Mensajes.MensajeInformacion("Verifique el modelo", "Entendido");
                return(false);
            }

            if (txtCodigo.Text.Equals(""))
            {
                Mensajes.MensajeInformacion("Por favor verifique el código", "Entendido");
                this.txtCodigo.BackColor = Color.FromArgb(255, 192, 192);
                this.errorProvider1.SetError(this.gbCodigo, "El código está vacío");
                return(false);
            }

            if (!int.TryParse(txtCodigo.Text, out int codigo))
            {
                this.txtCodigo.BackColor = Color.FromArgb(255, 192, 192);
                this.errorProvider1.SetError(this.gbCodigo, "El código debe ser sólo números");
                return(false);
            }

            if (this.DtVehiculos != null)
            {
                DataRow[] rows =
                    this.DtVehiculos.Select(string.Format("Id_vehiculo = {0}", codigo));
                if (rows.Length > 0)
                {
                    this.txtCodigo.BackColor = Color.FromArgb(255, 192, 192);
                    this.errorProvider1.SetError(this.gbCodigo, "El código ya existe");
                    return(false);
                }
                else
                {
                    this.txtCodigo.BackColor = Color.White;
                    this.errorProvider1.Clear();
                }
            }
            else
            {
                this.txtCodigo.BackColor = Color.White;
                this.errorProvider1.Clear();
            }

            eVehiculo.Id_vehiculo     = codigo;
            eVehiculo.Placa           = this.txtPlaca.Text;
            eVehiculo.Propietario     = this.txtPropietario.Text;
            eVehiculo.Chofer          = this.txtChofer.Text;
            eVehiculo.Marca           = this.txtMarca.Text;
            eVehiculo.Modelo          = this.txtModelo.Text;
            eVehiculo.Color           = this.txtColor.Text;
            eVehiculo.Estado_vehiculo = "ACTIVO";

            return(true);
        }
示例#5
0
        private void Aceptar()
        {
            if (PopupAbierto)
            {
                PopupAbierto = false;
            }
            else if (MensajeErrorAbierto)
            {
                MensajeErrorAbierto = false;
            }
            else if (ConfirmacionAbierta)
            {
                ConfirmacionAbierta = false;
            }
            else
            {
                if (dgvListado.Rows.Count > 0)
                {
                    var     lineas     = new List <VentaProducto>();
                    decimal total      = 0;
                    decimal costoTotal = 0;
                    for (int i = 0; i <= dgvListado.Rows.Count - 1; i++)
                    {
                        var linea = new VentaProducto();

                        linea.Cantidad   = decimal.Parse(dgvListado.Rows[i].Cells["Cantidad"].Value.ToString());
                        linea.Eliminado  = false;
                        linea.Identifier = Guid.NewGuid();
                        linea.Precio     = Convert.ToDecimal(dgvListado.Rows[i].Cells["Unitario"].Value.ToString().Replace("$", ""));
                        linea.ProductoId = (int)dgvListado.Rows[i].Cells["productoId"].Value;
                        linea.Costo      = dgvListado.Rows[i].Cells["Costo"].Value == null
                                                ? 0
                                                : Convert.ToDecimal(dgvListado.Rows[i].Cells["Costo"].Value.ToString().Replace("$", ""));

                        var recargo = dgvListado.Rows[i].Cells["Recargo"].Value;
                        linea.EsPromocion           = bool.Parse(dgvListado.Rows[i].Cells["EsPromocion"].Value.ToString());
                        linea.AdicionalPorExcepcion = recargo == null
                                                                ? (decimal?)null :
                                                      Convert.ToDecimal(recargo.ToString().Replace("$", "")) * linea.Cantidad;
                        linea.Desincronizado = true;


                        total      += Convert.ToDecimal(linea.Cantidad) * linea.Precio.GetValueOrDefault();
                        costoTotal += Convert.ToDecimal(linea.Cantidad) * linea.Costo;
                        lineas.Add(linea);
                    }


                    ConfirmacionAbierta = true;
                    var frmConfirmar = new frmConfirmarVenta(total);
                    if (frmConfirmar.ShowDialog() == DialogResult.OK)
                    {
                        ConfirmacionAbierta = false;
                        var venta = new Venta
                        {
                            ImporteTotal   = total,
                            CostoTotal     = costoTotal,
                            Identifier     = Guid.NewGuid(),
                            Eliminado      = false,
                            CierreCajaId   = UsuarioActual.CierreCajaIdActual,
                            FechaVenta     = DateTime.Now,
                            VentaProductos = lineas
                        };
                        venta.CierreCajaId = UsuarioActual.CierreCajaIdActual;
                        var stockRepository            = new StockRepository();
                        var stockTransaccionRepository = new EFRepository <StockTransaccion>();

                        var seAgregoStock       = false;
                        var seAgregoTransaccion = false;

                        //Agrego primero a la coleccion las lineas secundarias correspondientes a promociones
                        var secundarias = new List <VentaProducto>();
                        foreach (var linea in lineas.Where(l => l.EsPromocion))
                        {
                            var productos = ProductoPromocionRepository.Listado().Where(p => p.PadreId == linea.ProductoId && !p.Eliminado).ToList();
                            secundarias.AddRange(productos.Select(p => new VentaProducto()
                            {
                                Cantidad   = p.Unidades * linea.Cantidad,
                                ProductoId = p.HijoId
                            }));
                        }

                        lineas.AddRange(secundarias);

                        foreach (var line in lineas)
                        {
                            var stockSt = new StockTransaccion
                            {
                                Cantidad = line.Cantidad * (-1),
                                StockTransaccionTipoId = 1,
                                Identifier             = Guid.NewGuid(),
                                Desincronizado         = true
                            };

                            var stock = stockRepository.ObtenerByProducto(line.ProductoId, AppSettings.MaxiKioscoId);
                            if (stock != null)
                            {
                                stockSt.StockId   = stock.StockId;
                                stock.StockActual = stock.StockActual - Convert.ToDecimal(line.Cantidad);
                                stockTransaccionRepository.Agregar(stockSt);
                                stockRepository.Modificar(stock);
                                seAgregoTransaccion = true;
                                seAgregoStock       = true;
                            }
                            else
                            {
                                stock = new Stock()
                                {
                                    Identifier         = Guid.NewGuid(),
                                    MaxiKioscoId       = AppSettings.MaxiKioscoId,
                                    ProductoId         = line.ProductoId,
                                    StockActual        = -line.Cantidad,
                                    OperacionCreacion  = "Venta en DESKTOP",
                                    FechaCreacion      = DateTime.Now,
                                    StockTransacciones = new List <StockTransaccion> {
                                        stockSt
                                    }
                                };
                                stockRepository.Agregar(stock);
                                seAgregoStock = true;
                            }
                        }

                        if (seAgregoStock)
                        {
                            stockRepository.Commit();
                        }
                        if (seAgregoTransaccion)
                        {
                            stockTransaccionRepository.Commit();
                        }

                        Repository.Agregar(venta);
                        if (Repository.Commit())
                        {
                            Limpiar();
                        }
                        else
                        {
                            Mensajes.Guardar(false, "Ha ocurrido un error al registrar la venta. Por favor intente nuevamente");
                        }
                        ReiniciarVenta();
                    }
                }
            }
        }
示例#6
0
        private void GenerarExamen(int cantidadExamenes = 1, int cantidadCopias = 1)
        {
            string resultPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments).ToString(cultureInfo) + "\\Test.docx";

            using (WordprocessingDocument document = WordprocessingDocument.Create(resultPath, WordprocessingDocumentType.Document))
            {
                var diccionarioBloqueCuestionarioCopy = new Dictionary <string, BloqueCuestionario>();
                var listBloqueCuestionarioCopy        = new List <BloqueCuestionario>();
                // listaBloqueCuestionarioCopy = listaBloqueCuestionario;
                diccionarioBloqueCuestionarioCopy = diccionarioBloqueCuestionarioEstructurado;
                listBloqueCuestionarioCopy        = diccionarioBloqueCuestionarioCopy.Values.ToList();
                MainDocumentPart mainPart = document.AddMainDocumentPart();
                mainPart.Document = new Document();
                Body body = mainPart.Document.AppendChild(new Body());
                int  contadorNumberingId = 0;
                for (int i = 0; i < cantidadExamenes; i++)
                {
                    if (true)
                    {
                        Random rnd = new Random((int)DateTime.Now.Ticks);

                        listBloqueCuestionarioCopy.Shuffle(rnd);
                    }

                    for (int j = 0; j < cantidadCopias; j++)
                    {
                        if (i > 0 || j > 0)
                        {
                            InsertarSaltoDePagina(body);
                        }
                        contadorNumberingId++;
                        foreach (var item in diccionarioBloqueCuestionarioCopy.Values)
                        {
                            ParagraphProperties paragraphProperties = new ParagraphProperties();
                            ParagraphStyleId    paragraphStyleId    = new ParagraphStyleId()
                            {
                                Val = "ListParagraph"
                            };
                            NumberingProperties     numberingProperties     = new NumberingProperties();
                            NumberingLevelReference numberingLevelReference = new NumberingLevelReference()
                            {
                                Val = 0
                            };
                            NumberingId numberingId = new NumberingId()
                            {
                                Val = contadorNumberingId
                            };                                                                         //Val is 1, 2, 3 etc based on your numberingid in your numbering element
                            NumberingFormat numberingFormat = new NumberingFormat()
                            {
                                Val = NumberFormatValues.UpperLetter
                            };

                            numberingProperties.Append(numberingLevelReference);
                            numberingProperties.Append(numberingFormat);
                            numberingProperties.Append(numberingId);
                            paragraphProperties.Append(paragraphStyleId);
                            paragraphProperties.Append(numberingProperties);

                            Paragraph para = body.AppendChild(new Paragraph());
                            para.Append(paragraphProperties);
                            Run run = para.AppendChild(new Run());
                            run.AppendChild(new Text(item.Pregunta.InnerText.Substring(1).Trim(' ')));
                        }
                    }
                }
            }
            if (diccionarioBloqueCuestionarioEstructurado.Count > 0)
            {
                if (MessageBox.Show(Mensajes.AbrirArchivoGenerado + "\n" + resultPath, Mensajes.ArchivoGeneradoCorrectamenteTitle, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    ProcessStartInfo startInfo = new ProcessStartInfo();
                    startInfo.FileName  = "WINWORD.EXE";
                    startInfo.Arguments = resultPath;
                    Process.Start(startInfo);
                }
            }
            else
            {
                Mensajes.NoExistenDatosParaEstructurar();
            }
        }
示例#7
0
        private void eLIMINARToolStripMenuItem_Click(object sender, EventArgs e)
        {
            #region validaciones

            if (dataGridView1.RowCount == 0)
            {
                Mensajes.error("No hay datos para elimnar");
                return;
            }

            #endregion

            if (Mensajes.confirmacion("¿Está seguro de que desea eliminar el registro?") == false)
            {
                return;
            }

            #region Transacción Delete
            comando = Datos.crearComando();
            comando.Connection.Open();
            MySqlTransaction transaccion = comando.Connection.BeginTransaction();
            comando.Transaction = transaccion;
            bool operacionCorrecta = false;

            try
            {
                //Se realiza la inserción de los datos en la base de datos
                comando.Parameters.Clear();
                comando.CommandText = "DELETE FROM referencias WHERE clientes_documento = @clientes_documento";
                comando.Parameters.AddWithValue("@clientes_documento", dataGridView1["Documento", dataGridView1.CurrentRow.Index].Value.ToString());

                comando.ExecuteNonQuery();

                string documento = dataGridView1["documento", dataGridView1.CurrentRow.Index].Value.ToString();

                //Se realiza la inserción de los datos en la base de datos
                comando.Parameters.Clear();
                comando.CommandText = "DELETE FROM clientes WHERE documento = @documento";

                comando.Parameters.AddWithValue("@documento", documento);

                comando.ExecuteNonQuery();

                comando.Transaction.Commit();

                operacionCorrecta = true;
            }
            catch
            {
                comando.Transaction.Rollback();
            }
            finally
            {
                comando.Connection.Close();

                if (operacionCorrecta)
                {
                    // TODO: OPERACIÓN A REALIZAR EN CASO DE ÉXITO.
                    string formulario  = this.Name;
                    string descripcion = "ACCIÓN: eliminación; LOS DATOS DE LA ACCIÓN SON: nombre = " + dataGridView1["nombre", dataGridView1.CurrentRow.Index].Value.ToString() + ", documento = " + dataGridView1["documento", dataGridView1.CurrentRow.Index].Value.ToString() + ", direccion = " + dataGridView1["direccion", dataGridView1.CurrentRow.Index].Value.ToString() + ", telefono = " + dataGridView1["telefono", dataGridView1.CurrentRow.Index].Value.ToString() + ", rutas_id = " + dataGridView1["rutas_id", dataGridView1.CurrentRow.Index].Value.ToString() + "";
                    Datos.crearLOG(formulario, descripcion);
                    llenarGridClientes();
                    Mensajes.informacion("Proceso finalizado con éxito");
                    limpiarPantalla();
                }
                else
                {
                    Mensajes.error("Ha ocurrido un error al intentar eliminar el registro.");
                }
            }

            #endregion
        }
示例#8
0
        public async Task Camara()
        {
            try
            {
                var permissionStatus = await CrossPermissions.Current.CheckPermissionStatusAsync(Permission.Camera);

                if (permissionStatus == PermissionStatus.Denied)
                {
                    var results = await CrossPermissions.Current.RequestPermissionsAsync(Permission.Camera);

                    if (results.ContainsKey(Permission.Camera))
                    {
                        if (permissionStatus != PermissionStatus.Granted)
                        {
                            await Mensajes.Alerta("Camara no ascesible");

                            return;
                        }
                    }
                }

                await CrossMedia.Current.Initialize();


                if (!CrossMedia.Current.IsCameraAvailable || !CrossMedia.Current.IsTakePhotoSupported)
                {
                    await Mensajes.Alerta("Camara no ascesible");
                }

                //obtenemos fecha actual
                long n = Int64.Parse(DateTime.Now.ToString("yyyyMMddHHmmss"));

                var file = await CrossMedia.Current.TakePhotoAsync(new StoreCameraMediaOptions
                {
                    SaveToAlbum = true,

                    Directory = "CityCenter",
                    PhotoSize = PhotoSize.Full,

                    Name = Convert.ToString(n)
                });

                VariablesGlobales.RutaImagene = file.Path;


                // var content = new MultipartFormDataContent();
                //// https://www.citycenter-rosario.com.ar/images/usuarios/usuario_20180505195025.jpg
                //content.Add(new StreamContent(file.GetStream()), "\"usuarios\"", $"\"{file.Path}\"");

                //var httpClient = new System.Net.Http.HttpClient();
                //var url = "https://www.citycenter-rosario.com.ar/images";
                //var responseMsg = await httpClient.PostAsync(url, content);

                //var remotePath = await responseMsg.Content.ReadAsStringAsync();



                imagen1.Source = ImageSource.FromStream(() =>
                {
                    var stream = file.GetStream();
                    file.Dispose();

                    return(stream);
                });
            }
            catch (Exception ex)
            {
                //await DisplayAlert("Error", ex.ToString(), "OK");
            }
        }
示例#9
0
        public async void save()
        {
            switch (this.accion)
            {
            case ACCION.NUEVO:
                if (!validacionCampos())
                {
                    await Mensajes.ShowMessageAsync("Error", "Ingrese todos los campos");
                }
                else
                {
                    try
                    {
                        this.Clientes.Add(cliente.Save(this.Nit, this.Dpi, this.Nombre, this.Direccion));
                        await Mensajes.ShowMessageAsync("Exito", "Cliente ingresado exitosamente");
                    }
                    catch (Exception e)
                    {
                        await Mensajes.ShowMessageAsync(e.Message, "Nit ya ingresado");
                    }
                    borrarCampos();
                    isEnableSave();
                }
                break;

            case ACCION.ACTUALIZAR:
                try
                {
                    if (this.SelectCliente != null)
                    {
                        int posicion = this.Clientes.IndexOf(this.SelectCliente);
                        if (validacionCampos())
                        {
                            var updatCliente = cliente.update(this.SelectCliente.Nit, this.Dpi, this.Nombre, this.Direccion);
                            this.Clientes.RemoveAt(posicion);
                            this.Clientes.Insert(posicion, updatCliente);
                            await Mensajes.ShowMessageAsync("Exito", "Registro actualizado correctamente");

                            isEnableActualizar();
                            borrarCampos();
                        }
                        else
                        {
                            await Mensajes.ShowMessageAsync("Actualizar", "Debe ingresar todos los campos");
                        }
                    }
                    else
                    {
                        await Mensajes.ShowMessageAsync("Error", "Ingrese todos los campos");
                    }
                }
                catch (Exception e)
                {
                    await Mensajes.ShowMessageAsync("Error", "Seleccione una fila para actualizar");

                    isEnableErrorActualizar();
                    borrarCampos();
                }
                break;
            }
        }
示例#10
0
 public void ActualizaMensajes(Mensajes mensajes)
 {
     _db = _conexion.Open();
     _db.Update(mensajes);
 }
示例#11
0
 public void InsertarMensajes(Mensajes mensajes)
 {
     _db = _conexion.Open();
     _db.Insert(mensajes);
 }
 public void LlenarClase(Mensajes Mensaje)
 {
     Mensaje.Email   = EmailTextBox.Text;
     Mensaje.Asunto  = AsuntoTextBox.Text;
     Mensaje.Mensaje = MensajeTextBox.Text;
 }
        private void mODIFICARToolStripMenuItem_Click(object sender, EventArgs e)
        {
            #region validaciones

            if (String.IsNullOrEmpty(inputnombre.Text))
            {
                Mensajes.error("Debe Ingresar un Nombre de Campaña");
                return;
            }

            if (gridCampanas.RowCount == 0)
            {
                Mensajes.error("No Hay Datos Para Modificar");
                return;
            }

            #endregion

            #region update

            string id       = gridCampanas["id", gridCampanas.CurrentRow.Index].Value.ToString();
            string nombre   = inputnombre.Text;
            bool   publicar = (bool)inputpublicar.Checked;

            if (Mensajes.confirmacion("¿Está seguro de que desea modificar el registro?") == false)
            {
                return;
            }

            try
            {
                //Se realiza la inserción de los datos en la base de datos
                comando = Datos.crearComando();

                comando.Parameters.Clear();
                comando.CommandText = "UPDATE campana SET nombre=@nombre, publicar=@publicar WHERE id = @id";

                comando.Parameters.AddWithValue("@id", id);
                comando.Parameters.AddWithValue("@nombre", nombre);
                comando.Parameters.AddWithValue("@publicar", publicar);

                // Ejecutar la consulta y decidir
                // True: caso exitoso
                // false: Error.
                if (Datos.ejecutarComando(comando))
                {
                    // TODO: OPERACIÓN A REALIZAR EN CASO DE ÉXITO.
                    Mensajes.informacion("El registro se ha modificado correctamente.");
                    string formulario  = this.Name;
                    string descripcion = "ACCIÓN: modificación; LOS DATOS DE LA ACCIÓN SON: id = " + id + ", nombre = " + nombre + ", publicar = " + publicar + "";
                    Datos.crearLOG(formulario, descripcion);
                    LlenarGridCampana();
                }
                else
                {
                    Mensajes.error("Ha ocurrido un error al intentar modificar el registro.");
                }
            }
            catch
            {
                Mensajes.error("Ha ocurrido un error al intentar modificar el registro.");
            }

            #endregion
        }
        private void aLMACENARToolStripMenuItem_Click(object sender, EventArgs e)
        {
            #region validaciones

            if (String.IsNullOrEmpty(inputnombre.Text))
            {
                Mensajes.error("Debe Ingresar un Nombre de Campaña");
                return;
            }

            if (String.IsNullOrEmpty(inputfranquicia_id.Text))
            {
                Mensajes.error("Debe Seleccionar una Franquicia");
                return;
            }

            if (String.IsNullOrEmpty(inputtipo_dispositivo_id.Text))
            {
                Mensajes.error("Debe Seleccionar el Tipo de Dispositivo");
                return;
            }

            if (String.IsNullOrEmpty(inputmes.Text))
            {
                Mensajes.error("Debe Seleccionar el Mes");
                return;
            }

            if (String.IsNullOrEmpty(inputano.Text))
            {
                Mensajes.error("Debe Seleccionar el Año");
                return;
            }

            comando = Datos.crearComando();

            comando.Parameters.Clear();
            comando.CommandText = "SELECT * FROM campana WHERE tipo_dispositivo_id = @tipo_dispositivo_id AND franquicia_id=@franquicia_id AND mes = @mes AND ano = @ano";
            comando.Parameters.AddWithValue("@tipo_dispositivo_id", inputtipo_dispositivo_id.SelectedValue.ToString());
            comando.Parameters.AddWithValue("@franquicia_id", inputfranquicia_id.SelectedValue.ToString());
            comando.Parameters.AddWithValue("@mes", inputmes.Text);
            comando.Parameters.AddWithValue("@ano", inputano.Value.ToString());

            // Al ejecutar la consulta se devuelve un DataTable.
            // --
            DataTable Validacion = Datos.ejecutarComandoSelect(comando);

            if (Validacion.Rows.Count > 0)
            {
                Mensajes.error("Ya Existe Una Campaña Creada Para este Mes y Este Tipo de Dispositivos y esta Franquicia");
                return;
            }

            #endregion

            #region Insert

            string fecha               = DateTime.Now.ToString("yyyy-MM-dd");
            string nombre              = inputnombre.Text;
            string mes                 = inputmes.Text;
            string ano                 = inputano.Value.ToString();
            string franquicia_id       = inputfranquicia_id.SelectedValue.ToString();
            string tipo_dispositivo_id = inputtipo_dispositivo_id.SelectedValue.ToString();
            bool   publicar            = (bool)inputpublicar.Checked;

            if (Mensajes.confirmacion("¿Está seguro de que desea Insertar el registro?") == false)
            {
                return;
            }

            try
            {
                //Se realiza la inserción de los datos en la base de datos
                comando = Datos.crearComando();

                comando.Parameters.Clear();
                comando.CommandText = "INSERT INTO campana (fecha, nombre, mes, ano, franquicia_id, tipo_dispositivo_id, publicar) VALUES (@fecha, @nombre, @mes, @ano, @franquicia_id, @tipo_dispositivo_id, @publicar)";

                comando.Parameters.AddWithValue("@fecha", fecha);
                comando.Parameters.AddWithValue("@nombre", nombre);
                comando.Parameters.AddWithValue("@mes", mes);
                comando.Parameters.AddWithValue("@ano", ano);
                comando.Parameters.AddWithValue("@franquicia_id", franquicia_id);
                comando.Parameters.AddWithValue("@tipo_dispositivo_id", tipo_dispositivo_id);
                comando.Parameters.AddWithValue("@publicar", publicar);

                // Ejecutar la consulta y decidir
                // True: caso exitoso
                // false: Error.
                if (Datos.ejecutarComando(comando))
                {
                    // TODO: OPERACIÓN A REALIZAR EN CASO DE ÉXITO.
                    Mensajes.informacion("La inserción se ha realizado correctamente.");

                    string formulario  = this.Name;
                    string descripcion = "ACCIÓN: inserción; LOS DATOS DE LA ACCIÓN SON: fecha = " + fecha + ", nombre = " + nombre + ", mes = " + mes + ", ano = " + ano + ", franquicia_id = " + franquicia_id + ", tipo_dispositivo_id = " + tipo_dispositivo_id + ", publicar = " + inputpublicar.Checked + "";
                    Datos.crearLOG(formulario, descripcion);
                    LlenarGridCampana();
                }
                else
                {
                    Mensajes.error("Ha ocurrido un error al intentar realizar la inserción.");
                }
            }
            catch
            {
                Mensajes.error("Ha ocurrido un error al intentar realizar la inserción.");
            }

            #endregion
        }
示例#15
0
        private void BtnIniciarImportacion_Click(object sender, System.EventArgs e)
        {
            if (!int.TryParse(this.listaCobro.SelectedValue.ToString(), out int id_cobro))
            {
                Mensajes.MensajeInformacion("Compruebe el cobro seleccionado", "Entendido");
                return;
            }

            int       id_zona  = 0;
            DataTable dtCobros =
                NCobros.BuscarCobros("ID COBRO", id_cobro.ToString(), "", out string rpta);

            if (dtCobros != null)
            {
                Cobros co = new Cobros(dtCobros.Rows[0]);
                id_zona = co.Id_zona;
            }

            if (id_zona == 0)
            {
                Mensajes.MensajeInformacion("Compruebe la zona del cobro", "Entendido");
                return;
            }

            if (!int.TryParse(this.listaCobradores.SelectedValue.ToString(), out int id_cobrador))
            {
                Mensajes.MensajeInformacion("Compruebe el cobrador seleccionado", "Entendido");
                return;
            }

            if (!int.TryParse(this.listaProductos.SelectedValue.ToString(), out int id_producto))
            {
                Mensajes.MensajeInformacion("Compruebe el producto seleccionado", "Entendido");
                return;
            }

            if (!decimal.TryParse(this.listaInteres.SelectedValue.ToString(), out decimal valor_interes))
            {
                Mensajes.MensajeInformacion("Compruebe el interes seleccionado", "Entendido");
                return;
            }

            if (string.IsNullOrWhiteSpace(this.listaFrecuencia.Text))
            {
                Mensajes.MensajeInformacion("Compruebe la frecuencia", "Entendido");
                return;
            }

            object[] objs = new object[]
            {
                id_cobro,
                id_producto,
                valor_interes,
                this.listaFrecuencia.Text,
                id_zona,
                id_cobrador,
            };

            this.OnBtnContinuarClick.Invoke(objs, e);
            this.Close();
        }
示例#16
0
        public object Editar(Cliente cte)
        {
            object resultado = new object();

            try
            {
                if (Validar(1, cte))
                {
                    using (SqlConnection conexion = new SqlConnection(Properties.Settings.Default.cadenaConexion))
                    {
                        string cadena_sql = "update Clientes set direccion=@dir,codidoPostal= @cp,rfc= @rfc, telefono=@tel," +
                                            " email=@email,tipo= @tipo, estatus=@estatus, idCiudad=@idciudad where idcliente = @idcliente";
                        //idCliente	direccion	codidoPostal	rfc	telefono	email	tipo	estatus     idCiudad
                        SqlCommand comando = new SqlCommand(cadena_sql, conexion);
                        comando.Parameters.AddWithValue("@dir", cte.Direccion);
                        comando.Parameters.AddWithValue("@cp", cte.CP);
                        comando.Parameters.AddWithValue("@rfc", cte.RFC);
                        comando.Parameters.AddWithValue("@tel", cte.Telefono);
                        comando.Parameters.AddWithValue("@email", cte.Email);
                        comando.Parameters.AddWithValue("@tipo", cte.Tipo);
                        comando.Parameters.AddWithValue("@estatus", cte.Estatus);
                        comando.Parameters.AddWithValue("@idciudad", cte.IDCiudad);
                        comando.Parameters.AddWithValue("@idcliente", cte.ID);
                        conexion.Open();

                        int cant_registros = (int)comando.ExecuteNonQuery();
                        conexion.Close();
                        if (cant_registros == 1)
                        {
                            //cte.ID = getID(cte);

                            if (cte.Tipo == 'T')
                            {
                                resultado = new ClienteTiendaDAO().Editar((ClienteTienda)cte.InfoCliente, cte.ID);
                                Type resultado_tipo = resultado.GetType();

                                if (resultado_tipo.Equals(typeof(string)))
                                {
                                    Mensajes.Error(resultado.ToString());
                                }
                                else
                                {
                                    resultado = true;
                                }
                            }
                            else
                            {
                                resultado = new ClienteIndividualDAO().Editar((ClienteIndividual)cte.InfoCliente, cte.ID);
                                Type resultado_tipo = resultado.GetType();

                                if (resultado_tipo.Equals(typeof(string)))
                                {
                                    return(resultado);
                                }
                                else
                                {
                                    resultado = true;
                                }
                            }
                        }
                        else
                        {
                            resultado = "Se ha generado un error no especificado";
                        }
                    }
                }
                else
                {
                    resultado = "Error: Ya existe un cliente de tienda con datos en común";
                }
            }
            catch (SqlException ex)
            {
                throw new Exception("Error relacionado con la BD. [ClienteDAO.R] \n Anota este error y contacta al administrador.\n" + ex.Message);
            }
            return(resultado);
        }
示例#17
0
        private void dgvOrdenOxigeno_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            GeneralC.deshabilitarColumnas(dgvOrdenOxigeno);
            if (edicion)
            {
                dgvOrdenOxigeno.Columns["dgSuspenderOxigenoOrden"].ReadOnly = false;
                if (GeneralC.verificarUbicacionCelda(e, dgvOrdenOxigeno, "quitar") & e.RowIndex > -1)
                {
                    bool filaVacia;
                    int  filaActual;
                    filaActual = dgvOrdenOxigeno.CurrentCell.RowIndex;

                    filaVacia = ((dgvOrdenOxigeno.Rows[filaActual].Cells[2].Value == null) ||
                                 string.IsNullOrEmpty(dgvOrdenOxigeno.Rows[filaActual].Cells[2].Value.ToString())) ? true : false;

                    if (!filaVacia && Mensajes.preguntaAnular())
                    {
                        dgvOrdenOxigeno.Rows[filaActual].Cells["dgIdOxigenoOrden"].Value          = DBNull.Value;
                        dgvOrdenOxigeno.Rows[filaActual].Cells["dgDescripcionOrdenOxigeno"].Value = DBNull.Value;
                        dgvOrdenOxigeno.Rows[filaActual].Cells["dgObservacionOxigeno"].Value      = DBNull.Value;
                        dgvOrdenOxigeno.Rows[filaActual].Cells["dgSuspenderOxigenoOrden"].Value   = false;
                    }
                }
                else if (GeneralC.verificarUbicacionCelda(e, dgvOrdenOxigeno, "agregar") & e.RowIndex > -1)
                {
                    try
                    {
                        List <string> parametros = new List <string>();

                        DataTable tablaParametros    = new DataTable();
                        DataTable tablasSeleccionado = new DataTable();

                        tablaParametros.Columns.Add("Parametro", Type.GetType("System.Object"));
                        tablaParametros.Columns.Add("Valor", Type.GetType("System.Object"));

                        object[] myObjArray  = { "@pIdAtencion", idAtencion };
                        object[] myObjArray1 = { "@pFiltro", "" };

                        DataView view = new DataView(oxigeno.tblOxigeno);

                        tablasSeleccionado = view.ToTable(true, new string[] { "idOxigeno" }).Copy();
                        tablasSeleccionado.Rows.RemoveAt(tablasSeleccionado.Rows.Count - 1);
                        object[] myObjArray2 = { "@pTblSeleccionados", tablasSeleccionado };

                        tablaParametros.Rows.Add(myObjArray);
                        tablaParametros.Rows.Add(myObjArray1);
                        tablaParametros.Rows.Add(myObjArray2);

                        GeneralC.buscarDevuelveFila(Sentencias.ORDEN_CLINICA_BUSCAR_OXIGENO,
                                                    parametros,
                                                    new GeneralC.cargarInfoFila(cargarOxigeno),
                                                    Mensajes.BUSQUEDA_PROCEDIMIENTOS,
                                                    true,
                                                    null,
                                                    tablasSeleccionado,
                                                    tablaParametros);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                }
                abrirObservacion();
            }
        }
        public static void Cuenta(Persona usuario)
        {
            var cuenta = usuario.Nombre.Substring(0, 1) + usuario.Apellido;

            Mensajes.MostrarUsuario(cuenta);
        }
示例#19
0
        private void mODIFICARToolStripMenuItem_Click(object sender, EventArgs e)
        {
            #region validaciones

            if (String.IsNullOrEmpty(inputnombre.Text))
            {
                Mensajes.error("Ingrese el nombre del cliente");
                return;
            }

            if (String.IsNullOrEmpty(inputdocumento.Text))
            {
                Mensajes.error("Ingrese el documento del cliente");
                return;
            }

            if (String.IsNullOrEmpty(inputdireccion.Text))
            {
                Mensajes.error("Ingrese la dirección del cliente");
                return;
            }

            if (String.IsNullOrEmpty(inputtelefono.Text))
            {
                Mensajes.error("Ingrese el teléfono del cliente");
                return;
            }

            if (String.IsNullOrEmpty(inputruta_id.Text))
            {
                Mensajes.error("Seleccione la ruta a la que pertenece el cliente");
                return;
            }

            if (dataGridView1.RowCount == 0)
            {
                Mensajes.error("No hay datos para modificar");
                return;
            }

            #endregion

            if (Mensajes.confirmacion("¿Está seguro de que desea modificar el registro?") == false)
            {
                return;
            }

            #region transaccion

            comando = Datos.crearComando();
            comando.Connection.Open();
            MySqlTransaction transaccion = comando.Connection.BeginTransaction();
            comando.Transaction = transaccion;
            bool operacionCorrecta = false;

            string nombreReferencia    = inputnombre_referencia.Text;
            string documentoReferencia = inputdocumento_referencia.Text;
            string direccionReferencia = inputdireccion_referencia.Text;
            string telefonoReferencia  = inputtelefono_referencia.Text;

            string nombre            = inputnombre.Text;
            string documentoAnterior = dataGridView1["Documento", dataGridView1.CurrentRow.Index].Value.ToString();
            string direccion         = inputdireccion.Text;
            string telefono          = inputtelefono.Text;
            string ruta_id           = inputruta_id.SelectedValue.ToString();
            string documentoNuevo    = inputdocumento.Text;

            try
            {
                comando.Parameters.Clear();
                comando.CommandText = "UPDATE referencias SET nombre=@nombre, documento=@documento, direccion=@direccion, telefono=@telefono WHERE clientes_documento = @clientes_idAnterior";

                comando.Parameters.AddWithValue("@nombre", nombreReferencia);
                comando.Parameters.AddWithValue("@documento", documentoReferencia);
                comando.Parameters.AddWithValue("@direccion", direccionReferencia);
                comando.Parameters.AddWithValue("@telefono", telefonoReferencia);
                comando.Parameters.AddWithValue("@clientes_idAnterior", documentoAnterior);

                comando.ExecuteNonQuery();

                comando.Parameters.Clear();
                comando.CommandText = "UPDATE clientes SET nombre=@nombre, direccion=@direccion, telefono=@telefono, rutas_id=@rutas_id WHERE documento = @documentoAnterior";

                comando.Parameters.AddWithValue("@nombre", nombre);
                comando.Parameters.AddWithValue("@documentoAnterior", documentoAnterior);
                comando.Parameters.AddWithValue("@direccion", direccion);
                comando.Parameters.AddWithValue("@telefono", telefono);
                comando.Parameters.AddWithValue("@rutas_id", ruta_id);

                comando.ExecuteNonQuery();

                comando.Transaction.Commit();

                operacionCorrecta = true;
            }
            catch
            {
                comando.Transaction.Rollback();
            }
            finally
            {
                comando.Connection.Close();

                if (operacionCorrecta)
                {
                    // TODO: OPERACIÓN A REALIZAR EN CASO DE ÉXITO.
                    string formulario  = this.Name;
                    string descripcion = "ACCIÓN: modificación; LOS DATOS DE LA ACCIÓN SON: documento anterior = " + documentoAnterior + ", nombre = " + nombre + ", documento nuevo = " + documentoNuevo + ", direccion = " + direccion + ", telefono = " + telefono + ", rutas_id = " + ruta_id + ", documento = " + documentoReferencia + ", nombre = " + nombreReferencia + ", documento nuevo cliente = " + inputdocumento.Text + ", direccion = " + direccionReferencia + ", telefono = " + telefonoReferencia + ", cliente anterior = " + dataGridView1["Documento", dataGridView1.CurrentRow.Index].Value.ToString() + "";
                    Datos.crearLOG(formulario, descripcion);
                    llenarGridClientes();
                    Mensajes.informacion("Proceso finalizado con éxito");
                    limpiarPantalla();
                }
                else
                {
                    Mensajes.error("Ha ocurrido un error al intentar eliminar el registro.");
                }
            }

            #endregion
        }
示例#20
0
        private async void CambiaContrasena()
        {
            var connection = await this.apiService.CheckConnection();

            if (!connection.IsSuccess)
            {
                await Mensajes.Alerta(connection.Message);

                return;
            }

            if (string.IsNullOrEmpty(this.contrasenatemp))
            {
                await Mensajes.Alerta("Contraseña temporal requerida");

                return;
            }

            if (string.IsNullOrEmpty(this.Contrasena1))
            {
                await Mensajes.Alerta("Nueva contraseña requerida");

                return;
            }

            if (string.IsNullOrEmpty(this.Contrasena2))
            {
                await Mensajes.Alerta("Necesario confirmar contraseña");

                return;
            }


            if (this.Contrasena1 != this.Contrasena2)
            {
                await Mensajes.Alerta("Las contraseñas no coiciden");

                return;
            }


            UserDialogs.Instance.ShowLoading("Iniciando sesion...", MaskType.Black);

            var content = new FormUrlEncodedContent(new[]
            {
                new KeyValuePair <string, string>("use_id", VariablesGlobales.IDUsuario),
                new KeyValuePair <string, string>("usu_contrasena_temp", this.contrasenatemp),
                new KeyValuePair <string, string>("usu_contrasena", this.Contrasena1),
            });


            var response = await this.apiService.Get <CambiaContrasenaReturn>("/usuarios", "/modifica_contrasena", content);

            if (!response.IsSuccess)
            {
                await Mensajes.Alerta("Ha habido un error en tu solicitud, por favor volvé a intentarlo");

                UserDialogs.Instance.HideLoading();

                return;
            }

            CambiaContrasenaReturn list = (CambiaContrasenaReturn)response.Result;

            if (list.mensaje == "Ha habido un error en tu solicitud, por favor volvé a intentarlo")
            {
                await Mensajes.Alerta("Ha habido un error en tu solicitud, por favor volvé a intentarlo");

                UserDialogs.Instance.HideLoading();

                return;
            }

            Application.Current.Properties["IsLoggedIn"]      = true;
            Application.Current.Properties["IdUsuario"]       = list.resultado.usu_id;
            Application.Current.Properties["Email"]           = list.resultado.usu_email;
            Application.Current.Properties["NombreCompleto"]  = list.resultado.usu_nombre + ' ' + list.resultado.usu_apellidos;
            Application.Current.Properties["Ciudad"]          = list.resultado.usu_ciudad;
            Application.Current.Properties["Pass"]            = this.Contrasena1;
            Application.Current.Properties["FechaNacimiento"] = list.resultado.usu_fecha_nacimiento;
            Application.Current.Properties["FotoPerfil"]      = VariablesGlobales.RutaServidor + list.resultado.usu_imagen;
            Application.Current.Properties["TipoCuenta"]      = "CityCenter";

            Application.Current.Properties["TipoDocumento"]   = list.resultado.usu_tipo_documento;
            Application.Current.Properties["NumeroDocumento"] = list.resultado.usu_no_documento;
            Application.Current.Properties["NumeroSocio"]     = list.resultado.usu_id_tarjeta_socio;

            await Application.Current.SavePropertiesAsync();

            MainViewModel.GetInstance().Inicio = new InicioViewModel();
            MainViewModel.GetInstance().Detail = new DetailViewModel();
            MainViewModel.GetInstance().Casino = new CasinoViewModel();

            MasterPage fpm = new MasterPage();

            Application.Current.MainPage = fpm;

            await Mensajes.Alerta("Bienvenido/a nuevamente a nuestra app");            //+ list.resultado.usu_nombre + ' ' + list.resultado.usu_apellidos);

            UserDialogs.Instance.HideLoading();
        }
示例#21
0
        private void aLMACENARToolStripMenuItem_Click(object sender, EventArgs e)
        {
            #region validaciones

            if (String.IsNullOrEmpty(inputnombre.Text))
            {
                Mensajes.error("Ingrese el nombre del cliente");
                return;
            }

            if (String.IsNullOrEmpty(inputdocumento.Text))
            {
                Mensajes.error("Ingrese el documento del cliente");
                return;
            }

            if (String.IsNullOrEmpty(inputdireccion.Text))
            {
                Mensajes.error("Ingrese la dirección del cliente");
                return;
            }

            if (String.IsNullOrEmpty(inputtelefono.Text))
            {
                Mensajes.error("Ingrese el teléfono del cliente");
                return;
            }

            if (String.IsNullOrEmpty(inputruta_id.Text))
            {
                Mensajes.error("Seleccione la ruta a la que pertenece el cliente");
                return;
            }

            if (dataGridView1.RowCount > 0)
            {
                Mensajes.error("Este número de documento ya se encuentra registrado");
                Mensajes.informacion("A continuación se mostrará la información del paciente registrado");

                inputnombre.Text           = dataGridView1["nombre", dataGridView1.CurrentRow.Index].Value.ToString();
                inputdocumento.Text        = dataGridView1["documento", dataGridView1.CurrentRow.Index].Value.ToString();
                inputdireccion.Text        = dataGridView1["direccion", dataGridView1.CurrentRow.Index].Value.ToString();
                inputtelefono.Text         = dataGridView1["telefono", dataGridView1.CurrentRow.Index].Value.ToString();
                inputruta_id.SelectedValue = dataGridView1["rutas_id", dataGridView1.CurrentRow.Index].Value.ToString();

                inputnombre_referencia.Text    = dataGridView1["nombre1", dataGridView1.CurrentRow.Index].Value.ToString();
                inputdocumento_referencia.Text = dataGridView1["documento1", dataGridView1.CurrentRow.Index].Value.ToString();
                inputdireccion_referencia.Text = dataGridView1["direccion1", dataGridView1.CurrentRow.Index].Value.ToString();
                inputtelefono_referencia.Text  = dataGridView1["telefono1", dataGridView1.CurrentRow.Index].Value.ToString();

                calcularIncumplimientos(inputdocumento.Text);

                return;
            }

            #endregion

            #region transaccion

            comando = Datos.crearComando();
            comando.Connection.Open();
            MySqlTransaction transaccion = comando.Connection.BeginTransaction();
            comando.Transaction = transaccion;
            bool operacionCorrecta = false;

            string nombre    = inputnombre.Text;
            string documento = inputdocumento.Text;
            string direccion = inputdireccion.Text;
            string telefono  = inputtelefono.Text;
            string ruta_id   = inputruta_id.SelectedValue.ToString();
            int    idCliente = 0;

            string nombreReferencia    = inputnombre_referencia.Text;
            string documentoReferencia = inputdocumento_referencia.Text;
            string direccionReferencia = inputdireccion_referencia.Text;
            string telefonoReferencia  = inputtelefono_referencia.Text;

            try
            {
                comando.Parameters.Clear();
                comando.CommandText = "INSERT INTO clientes (nombre, documento, direccion, telefono, rutas_id) VALUES (@nombre, @documento, @direccion, @telefono, @rutas_id)";

                comando.Parameters.AddWithValue("@nombre", nombre);
                comando.Parameters.AddWithValue("@documento", documento);
                comando.Parameters.AddWithValue("@direccion", direccion);
                comando.Parameters.AddWithValue("@telefono", telefono);
                comando.Parameters.AddWithValue("@rutas_id", ruta_id);

                comando.ExecuteNonQuery();

                idCliente = unchecked ((int)comando.LastInsertedId);

                comando.Parameters.Clear();

                if (!String.IsNullOrEmpty(documentoReferencia))
                {
                    comando.CommandText = "INSERT INTO referencias (nombre, documento, direccion, telefono, clientes_documento) VALUES (@nombre, @documento, @direccion, @telefono, @clientes_documento)";

                    comando.Parameters.AddWithValue("@nombre", nombreReferencia);
                    comando.Parameters.AddWithValue("@documento", documentoReferencia);
                    comando.Parameters.AddWithValue("@direccion", direccionReferencia);
                    comando.Parameters.AddWithValue("@telefono", telefonoReferencia);
                    comando.Parameters.AddWithValue("@clientes_documento", documento);

                    comando.ExecuteNonQuery();
                }

                comando.Transaction.Commit();

                operacionCorrecta = true;
            }
            catch
            {
                comando.Transaction.Rollback();
            }
            finally
            {
                comando.Connection.Close();

                if (operacionCorrecta)
                {
                    // TODO: OPERACIÓN A REALIZAR EN CASO DE ÉXITO.
                    string formulario  = this.Name;
                    string descripcion = "ACCIÓN: inserción; LOS DATOS DE LA ACCIÓN SON: nombre = " + nombre + ", documento = " + documento + ", direccion = " + direccion + ", telefono = " + telefono + ", rutas_id = " + ruta_id + " , nombreReferencia = " + nombreReferencia + ", documentoReferencia = " + documentoReferencia + ", direccionReferencia = " + direccionReferencia + ", telefonoReferencia = " + telefonoReferencia + "";
                    Datos.crearLOG(formulario, descripcion);
                    llenarGridClientes();
                    Mensajes.informacion("Proceso finalizado con éxito");
                    limpiarPantalla();
                }
                else
                {
                    Mensajes.error("Ha ocurrido un error al intentar eliminar el registro, probablemente el número de documento o referencia ya se encuetren registrados");
                }
            }

            #endregion
        }
示例#22
0
        private void tablaEmpleados_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            var    dgv          = sender as DataGridView;
            string auxMunicipio = "";

            if (dgv.Columns[e.ColumnIndex] is DataGridViewImageColumn)
            {
                var boton = dgv.Columns[e.ColumnIndex] as DataGridViewImageColumn;

                if (boton.Name == "btnEditar" && MessageBox.Show("¿Editar registro?", "Edición de datos.", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    //Aquí el check toma el id del empleado de la columna que se ocultó y que se encuentra en la posición 3... (Se ocultaron en la carga)
                    //El 0 es el botón editar, 1 = btnEliminar, 2 = columna "num" y 3 = columna "id_empleado", los últimos dos se ocultaron, pero siguen ahí

                    tablaEmpleados.Columns[1].Visible = false;//oculta botón eliminar
                    check = dgv.CurrentRow.Cells[3].Value.ToString();

                    Conexion.Consulta(
                        string.Format("select * from listarEmpleados where id_empleado = '{0}'", check));

                    while (Conexion.result.Read())
                    {
                        txtId.Text     = Conexion.result["id_empleado"].ToString();
                        txtNombre.Text = Conexion.result["Nombre"].ToString();
                        txtAP.Text     = Conexion.result["Apellido paterno"].ToString();
                        txtAM.Text     = Conexion.result["Apellido materno"].ToString();
                        if (Conexion.result["Sexo"].ToString() == radioSexo.Tag.ToString())
                        {
                            radioSexo.Checked = true;
                        }
                        else
                        {
                            radioSexo2.Checked = true;
                        }
                        dtNacimiento.Text = Conexion.result["Fecha de nacimiento"].ToString();
                        txtDirección.Text = Conexion.result["Dirección"].ToString();
                        txtCP.Text        = Conexion.result["Código postal"].ToString();
                        txtTelefono.Text  = Conexion.result["Teléfono"].ToString();
                        txtCorreo.Text    = Conexion.result["Correo"].ToString();
                        txtRFID.Text      = Conexion.result["RFID"].ToString();
                        txtNIP.Text       = Conexion.result["NIP"].ToString();
                        dtDiaInicio.Text  = Conexion.result["Día inicio"].ToString();
                        dtDiaFin.Text     = Conexion.result["Día fin"].ToString();

                        auxMunicipio = Conexion.result["Municipio"].ToString();
                        comboTurnos.SelectedIndex     = comboTurnos.FindStringExact(Conexion.result["Turno"].ToString());
                        comboEstatus.SelectedIndex    = comboEstatus.FindStringExact(Conexion.result["Estatus"].ToString());
                        comboCargo.SelectedIndex      = comboCargo.FindStringExact(Conexion.result["Cargo"].ToString());
                        comboPrivilegio.SelectedIndex = comboPrivilegio.FindStringExact(Conexion.result["Privilegio"].ToString());
                        comboArea.SelectedIndex       = comboArea.FindStringExact(Conexion.result["Área"].ToString());
                        comboEstado.SelectedIndex     = comboEstado.FindStringExact(Conexion.result["Estado"].ToString());
                    }

                    comboMunicipio.SelectedIndex = comboMunicipio.FindStringExact(auxMunicipio);

                    btnGuardar.BackgroundImage = null;
                    btnGuardar.BackgroundImage = Properties.Resources.edit1;
                    checkCambioId.Visible      = true;
                    Validar.Requeridos(txts);

                    Conexion.con.Close();
                }
                else if (boton.Name == "btnEliminar" && MessageBox.Show("¿Eliminar registro?", "Eliminar datos.", MessageBoxButtons.YesNo, MessageBoxIcon.Error) == DialogResult.Yes)
                {
                    check = dgv.CurrentRow.Cells[3].Value.ToString();
                    dgv.Rows.Remove(dgv.CurrentRow);

                    Conexion.Ejecutar(
                        String.Format("update empleados set id_estatus = 1, fecha_retiro = '{0}' where id_empleado = '{1}'", DateTime.Now.ToShortDateString(), check));

                    Mensajes.Caja("Information", "Información", "Registro eliminado correctamente.");
                    check = "0";
                }
            }
        }
示例#23
0
        private void TablaMem_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            var    dgv = sender as DataGridView;
            string auxCosto = "", auxPromo = "";

            if (dgv.Columns[e.ColumnIndex] is DataGridViewImageColumn)
            {
                var boton = dgv.Columns[e.ColumnIndex] as DataGridViewImageColumn;

                if (boton.Name == "btnEditar" && MessageBox.Show("¿Editar registro?", "Edición de datos.", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    TablaMem.Columns[1].Visible = false;//oculta botón eliminar
                    check = Convert.ToInt32(dgv.CurrentRow.Cells[2].Value);

                    Conexion.Consulta(
                        string.Format("select * from listarCategorias where id_categoria = '{0}'", check));

                    while (Conexion.result.Read())
                    {
                        txtNombre.Text = Conexion.result["Categoría"].ToString();
                        if (radioEstatus.Text == Conexion.result["Estatus de categoría"].ToString())
                        {
                            radioEstatus.Checked = true;
                        }
                        else
                        {
                            radioEstatus2.Checked = true;
                        }
                        numIVA.Value = Convert.ToInt32(Conexion.result["IVA"].ToString().Replace("%", ""));
                        auxCosto     = Conexion.result["Costo"].ToString();
                        auxPromo     = Conexion.result["Promoción"].ToString();
                    }

                    txtPrecio.Text = auxCosto;

                    if (auxPromo != "Sin promoción")
                    {
                        comboPromocion.SelectedIndex = comboPromocion.FindStringExact(auxPromo);
                    }
                    else
                    {
                        comboPromocion.SelectedIndex = 0;
                    }

                    btnGuardar.BackgroundImage = null;
                    btnGuardar.BackgroundImage = Properties.Resources.edit1;

                    Conexion.con.Close();
                }
                else if (boton.Name == "btnEliminar" && MessageBox.Show("¿Eliminar registro?", "Eliminar datos.", MessageBoxButtons.YesNo, MessageBoxIcon.Error) == DialogResult.Yes)
                {
                    check = Convert.ToInt32(dgv.CurrentRow.Cells[2].Value);
                    dgv.Rows.Remove(dgv.CurrentRow);

                    Conexion.Ejecutar(
                        string.Format("update categorias_membresias set estatus = 1 where id_categoria = '{0}'", check));

                    Mensajes.Caja("Information", "Información", "Registro eliminado correctamente.");
                    check = 0;
                    actualizaComboCategorias();
                }
            }
        }
        private async void btnCrear_Click(object sender, EventArgs e)
        {
            if (btnCrear.Text == "Crear")
            {
                var nombre         = txtNombre.Text;
                var costoPorUnidad = double.Parse(txtCostoPorUnidad.Text);
                var costoPublico   = double.Parse(txtCostoPublico.Text);



                var cantidad = int.Parse(txtCantidad.Text);
                var ganacia  = Math.Round(costoPorUnidad - costoPublico);
                if (string.IsNullOrEmpty(nombre))
                {
                    Mensajes.EmptyFields();
                    txtNombre.Focus();
                }
                else if (string.IsNullOrEmpty(costoPorUnidad.ToString()) || string.IsNullOrWhiteSpace(costoPorUnidad.ToString()))
                {
                    Mensajes.EmptyFields();
                    txtCostoPorUnidad.Focus();
                }
                else if (string.IsNullOrEmpty(costoPublico.ToString()) || string.IsNullOrWhiteSpace(costoPublico.ToString()))
                {
                    Mensajes.EmptyFields();
                    txtCostoPublico.Focus();
                }
                else if (string.IsNullOrEmpty(cantidad.ToString()) || string.IsNullOrWhiteSpace(cantidad.ToString()))
                {
                    Mensajes.EmptyFields();
                    txtCantidad.Focus();
                }
                else
                {
                    _producto.nombre           = nombre;
                    _producto.costo_por_unidad = costoPorUnidad;
                    _producto.costo_publico    = costoPublico;
                    _producto.cantidad         = cantidad;
                    _producto.ganancia         = ganacia;
                    var rs = await _controller.AddMedicamento(_producto);

                    if (rs > 0)
                    {
                        Mensajes.AgregadoConExito();
                        limpiar();
                    }
                    else
                    {
                        Mensajes.OcurrioUnError();
                    }
                }
            }
            else
            {
                var nombre         = txtNombre.Text;
                var costoPorUnidad = double.Parse(txtCostoPorUnidad.Text);
                var costoPublico   = double.Parse(txtCostoPublico.Text);



                var cantidad = int.Parse(txtCantidad.Text);
                var ganacia  = Math.Round(costoPorUnidad - costoPublico);
                if (string.IsNullOrEmpty(nombre))
                {
                    Mensajes.EmptyFields();
                    txtNombre.Focus();
                }
                else if (string.IsNullOrEmpty(costoPorUnidad.ToString()) || string.IsNullOrWhiteSpace(costoPorUnidad.ToString()))
                {
                    Mensajes.EmptyFields();
                    txtCostoPorUnidad.Focus();
                }
                else if (string.IsNullOrEmpty(costoPublico.ToString()) || string.IsNullOrWhiteSpace(costoPublico.ToString()))
                {
                    Mensajes.EmptyFields();
                    txtCostoPublico.Focus();
                }
                else if (string.IsNullOrEmpty(cantidad.ToString()) || string.IsNullOrWhiteSpace(cantidad.ToString()))
                {
                    Mensajes.EmptyFields();
                    txtCantidad.Focus();
                }
                else
                {
                    _producto.nombre           = nombre;
                    _producto.costo_por_unidad = costoPorUnidad;
                    _producto.costo_publico    = costoPublico;
                    _producto.cantidad         = cantidad;
                    _producto.ganancia         = ganacia;
                    var rs = await _controller.UpdateMedicamento(_producto);

                    if (rs > 0)
                    {
                        Mensajes.ActualizadoConExito();
                        limpiar();
                    }
                    else
                    {
                        Mensajes.OcurrioUnError();
                    }
                }
            }
        }
示例#25
0
        protected void BuscarButton_Click(object sender, EventArgs e)
        {
            ValidacionLimpiar();
            bool   retorno     = true;
            string Condiciones = "";

            if (CodigoTextBox.Text.Length > 0)
            {
                if (CompaniaDropDownList.SelectedIndex == 0)
                {
                    if (!Seguridad.ValidarSoloNumero(CodigoTextBox.Text))
                    {
                        Mensajes.ShowToastr(this, "Error", "Consulta Invalida", "Error");
                        CodigoDiv.Attributes.Add("class", " col-lg-4 col-md-4 has-error ");
                        retorno = false;
                    }

                    if (retorno)
                    {
                        if (Seguridad.ValidarEntero(CodigoTextBox.Text) == 0)
                        {
                            Condiciones = " 1=1 ";
                        }
                        else
                        {
                            Condiciones = CompaniaDropDownList.SelectedItem.Value + " = " + CodigoTextBox.Text;
                        }
                    }
                    else
                    {
                        Condiciones = " 1=1 ";
                    }
                }

                if (CompaniaDropDownList.SelectedIndex == 1)
                {
                    if (!Seguridad.ValidarNombre(CodigoTextBox.Text))
                    {
                        Mensajes.ShowToastr(this, "Error", "Consulta Invalida", "Error");
                        CodigoDiv.Attributes.Add("class", " col-lg-4 col-md-4 has-error ");
                        retorno = false;
                    }

                    if (retorno)
                    {
                        Condiciones = CompaniaDropDownList.SelectedItem.Value + " like '%" + CodigoTextBox.Text + "%' ";
                    }
                    else
                    {
                        Condiciones = " 1=1 ";
                    }
                }

                if (CompaniaDropDownList.SelectedIndex == 2)
                {
                    if (!Seguridad.ValidarSoloNumero(CodigoTextBox.Text))
                    {
                        Mensajes.ShowToastr(this, "Error", "Consulta Invalida", "Error");
                        CodigoDiv.Attributes.Add("class", " col-lg-4 col-md-4 has-error ");
                        retorno = false;
                    }

                    if (retorno)
                    {
                        if (Seguridad.ValidarEntero(CodigoTextBox.Text) == 0)
                        {
                            Condiciones = " 1=1 ";
                        }
                        else
                        {
                            Condiciones = CompaniaDropDownList.SelectedItem.Value + " = " + CodigoTextBox.Text;
                        }
                    }
                    else
                    {
                        Condiciones = " 1=1 ";
                    }
                }

                LlenarGrid(Condiciones);

                if (ConsultaGridView.Rows.Count == 0)
                {
                    Mensajes.ShowToastr(this.Page, "No hay Registro", "Error", "Error");
                    LlenarGrid(" 1=1 ");
                }

                Limpiar();
            }
            else
            {
                Mensajes.ShowToastr(this.Page, "Ingrese un Caracter Valido", "Error", "Error");
                Limpiar();
            }
        }
 private void TxtProveedor_Click(object sender, EventArgs e)
 {
     Mensajes.MensajeErrorForm("Opción en mantenimiento");
 }
        private void button1_Click(object sender, EventArgs e)
        {
            #region validaciones

            if (inputvalor.Value.Equals(0))
            {
                Mensajes.error("Ingrese un valor de saldo inicial");
                return;
            }

            comando = Datos.crearComando();

            comando.Parameters.Clear();
            comando.CommandText = "SELECT fecha, valor FROM saldo_inicial";

            // Al ejecutar la consulta se devuelve un DataTable.
            // --
            DataTable SaldoInicial = Datos.ejecutarComandoSelect(comando);

            if (SaldoInicial.Rows.Count > 0)
            {
                Mensajes.error("El saldo inicial ya se encuentra configurado");
                return;
            }

            #endregion

            if (Mensajes.confirmacion("¿Está seguro de que desea Insertar el registro?") == false)
            {
                return;
            }

            comando = Datos.crearComando();
            comando.Connection.Open();
            MySqlTransaction transaccion = comando.Connection.BeginTransaction();
            comando.Transaction = transaccion;
            bool operacionCorrecta = false;

            string fecha = DateTime.Now.ToString("yyyy-MM-dd");
            string valor = inputvalor.Text;

            try
            {
                comando.Parameters.Clear();
                comando.CommandText = "INSERT INTO saldo_inicial (fecha, valor) VALUES (@fecha, @valor)";

                comando.Parameters.AddWithValue("@fecha", fecha);
                comando.Parameters.AddWithValue("@valor", valor);

                comando.ExecuteNonQuery();

                comando.Parameters.Clear();
                comando.CommandText = "INSERT INTO caja (valor) VALUES (@valor)";

                comando.Parameters.AddWithValue("@valor", valor);

                comando.ExecuteNonQuery();

                comando.Transaction.Commit();

                operacionCorrecta = true;
            }

            catch
            {
                comando.Transaction.Rollback();
            }
            finally
            {
                comando.Connection.Close();

                if (operacionCorrecta)
                {
                    string formulario  = this.Name;
                    string descripcion = "ACCIÓN: creación de saldos iniciales; LOS DATOS DE LA ACCIÓN SON: fecha = " + fecha + ", valor = " + valor + "";
                    Datos.crearLOG(formulario, descripcion);

                    descripcion = "ACCIÓN: inserción en la caja; LOS DATOS DE LA ACCIÓN SON: valor = " + valor + "";
                    Datos.crearLOG(formulario, descripcion);

                    Mensajes.informacion("La inserción se ha realizado correctamente.");

                    inputvalor.Enabled = false;
                    label2.Text        = "Fecha del saldo: " + DateTime.Now.ToString("yyyy-MM-dd");
                }
                else
                {
                    Mensajes.error("Ocurrió un error en el proceso, imposible crear los saldos iniciales");
                }
            }
        }
示例#28
0
        public Afiliado Eligibilidad(string credencial, int matricula)
        {
            var afiliado = new Afiliado();

            try
            {
                string resultado;

                var output = new StringBuilder();
                using (var writer = XmlWriter.Create(output))
                {
                    writer.WriteStartElement("Mensaje");

                    writer.WriteStartElement("EncabezadoMensaje");
                    writer.WriteElementString("VersionMsj", "ACT20");
                    writer.WriteElementString("TipoMsj", "OL");
                    writer.WriteElementString("TipoTransaccion", "01A");
                    writer.WriteStartElement("InicioTrx");
                    writer.WriteElementString("FechaTrx", DateTime.Now.ToString("yyyyMMdd"));
                    writer.WriteEndElement();
                    writer.WriteStartElement("Terminal");
                    writer.WriteElementString("TipoTerminal", "PC");
                    writer.WriteElementString("NumeroTerminal", "60000001");
                    writer.WriteEndElement();
                    writer.WriteStartElement("Financiador");
                    writer.WriteElementString("CodigoFinanciador", "PATCAB");
                    writer.WriteEndElement();
                    writer.WriteStartElement("Prestador");
                    writer.WriteElementString("CuitPrestador", "30543364610");
                    writer.WriteElementString("RazonSocial", "Circulo Medico de Salta");
                    writer.WriteEndElement();
                    writer.WriteEndElement();
                    writer.WriteStartElement("EncabezadoAtencion");
                    writer.WriteStartElement("Credencial");
                    writer.WriteElementString("NumeroCredencial", credencial); //"0100002201"
                    writer.WriteElementString("ModoIngreso", "M");
                    writer.WriteEndElement();
                    writer.WriteEndElement();
                    writer.WriteEndElement();
                }

                try
                {
                    resultado = service.ExecuteFileTransactionSLAsync("0000", output.ToString()).Result;
                    logResult(output.ToString(), resultado.ToString(), "E");
                }
                catch (Exception ex)
                {
                    afiliado.SetError(GetType().Name, GetMethod.ErrorLine(ex), ex.Message, ex.InnerException?.ToString() ?? "", credencial + ";" + matricula, string.Empty);
                    afiliado.Error.Mensaje = Mensajes.Get("ServidorNoResponde");
                    afiliado.Name          = Mensajes.Get("ServidorNoResponde");

                    resultado = "";
                }

                if (resultado == "")
                {
                    afiliado.Name = Mensajes.Get("AfiIne");
                }
                else
                {
                    var nombre = "";
                    var plan   = "";
                    using (var reader = XmlReader.Create(new StringReader(resultado)))
                    {
                        reader.MoveToContent();
                        while (reader.Read())
                        {
                            if (reader.NodeType != XmlNodeType.Element)
                            {
                                continue;
                            }
                            switch (reader.Name)
                            {
                            case "NombreBeneficiario":
                                nombre = reader.ReadElementContentAsString();
                                break;

                            case "PlanCredencial":
                                plan = reader.ReadElementContentAsString();
                                break;
                            }
                        }
                    }
                    afiliado.Name = nombre.Trim() != "" ? nombre.Trim() : Mensajes.Get("AfiIne");
                    afiliado.Plan = plan.Trim();
                }
            }
            catch (Exception ex)
            {
                afiliado.SetError(GetType().Name, GetMethod.ErrorLine(ex), ex.Message, ex.InnerException?.ToString() ?? "", credencial + ";" + matricula, string.Empty);
            }
            return(afiliado);
        }
示例#29
0
        private async void LoadDestacados()
        {
            try
            {
                var connection = await this.apiService.CheckConnection();

                if (!connection.IsSuccess)
                {
                    await Mensajes.Alerta("Verificá tu conexión a Internet");
                }


                string IDUsuario;

                try
                {
                    IDUsuario = Application.Current.Properties["IdUsuario"].ToString();
                }
                catch (Exception)
                {
                    IDUsuario = "";
                }


                var content = new FormUrlEncodedContent(new[]
                {
                    new KeyValuePair <string, string>("usu_id", IDUsuario),
                });


                var response = await this.apiService.Get <DestacadosReturn>("/casino/destacados", "/indexApp", content);

                if (!response.IsSuccess)
                {
                    //await Mensajes.Error("Error al cargar Destacados");

                    return;
                }

                MainViewModel.GetInstance().listDestacados = (DestacadosReturn)response.Result;

#if __ANDROID__
                DestacadosDetalle = new ObservableCollection <DestacadosItemViewModel>(this.ToDestacadosItemViewModel2());
#endif

#if __IOS__
                DestacadosDetalle = new ObservableCollection <DestacadosItemViewModel>(this.ToDestacadosItemViewModel());
#endif

                if (DestacadosDetalle.Count > 0)
                {
                    MuestraFlechaDestacado = true;
                    VariablesGlobales.RegistrosCasinoDestacados = DestacadosDetalle.Count - 1;
                }
                else
                {
                    MuestraFlechaDestacado = false;
                }
            }
            catch (Exception)
            {
                MuestraFlechaDestacado = false;
                //await Mensajes.Error("Casino - Destacados" + ex.ToString());
            }
        }
        private async void EnviaCorreo()
        {
            if (string.IsNullOrEmpty(Nombre))
            {
                await Mensajes.Alerta("Nombre y Apellido Requerido");

                return;
            }

            if (string.IsNullOrEmpty(Correo))
            {
                await Mensajes.Alerta("correo electrónico Requerido");

                return;
            }


            if (!ValidaEmailMethod.ValidateEMail(this.Correo))
            {
                await Mensajes.Alerta("Correo electronico mal estructurado");

                return;
            }

            if (string.IsNullOrEmpty(TipoDocumento))
            {
                await Mensajes.Alerta("Tipo de documento Requerido");

                return;
            }

            if (string.IsNullOrEmpty(NumeroDocumento))
            {
                await Mensajes.Alerta("Numero de documento Requerido");

                return;
            }

            if (this.Fecha == "00/00/0000")
            {
                await Mensajes.Alerta("Campo fecha es requerida");

                return;
            }

            if (string.IsNullOrEmpty(Nacionalidad))
            {
                await Mensajes.Alerta("Nacionalidad Requerido");

                return;
            }


            if (string.IsNullOrEmpty(Pais))
            {
                await Mensajes.Alerta("Pais Requerido");

                return;
            }

            if (string.IsNullOrEmpty(Provincia))
            {
                await Mensajes.Alerta("Provincia Requerido");

                return;
            }


            if (string.IsNullOrEmpty(Ciudad))
            {
                await Mensajes.Alerta("Ciudad Requerido");

                return;
            }

            var content = new FormUrlEncodedContent(new[]
            {
                new KeyValuePair <string, string>("email", Correo),
                new KeyValuePair <string, string>("tor_nombre", td.tor_nombre),
                new KeyValuePair <string, string>("nombre", Convert.ToString(Nombre)),
                new KeyValuePair <string, string>("numero_documento", NumeroDocumento),
                new KeyValuePair <string, string>("nacionalidad", Nacionalidad),
                new KeyValuePair <string, string>("provincia", Provincia),
                new KeyValuePair <string, string>("tipo_de_documento", TipoDocumento),
                new KeyValuePair <string, string>("fecha_nac", Fecha),
                new KeyValuePair <string, string>("pais", Pais),
                new KeyValuePair <string, string>("ciudad", Ciudad)
            });


            var response = await this.apiService.Get <GuardadoGenerico>("/casino/torneos", "/registro_torneo", content);

            if (!response.IsSuccess)
            {
                await Mensajes.Alerta("Verificá tu conexión a Internet");

                return;
            }

            await Mensajes.Alerta("La información ha sido enviada correctamente");

            Correo          = string.Empty;
            Nombre          = string.Empty;
            NumeroDocumento = string.Empty;
            Nacionalidad    = string.Empty;
            Provincia       = string.Empty;
            TipoDocumento   = string.Empty;
            Pais            = string.Empty;
            Ciudad          = string.Empty;
            Fecha           = "00/00/0000";
        }