private void BtnAgregar_Click(object sender, EventArgs e)
        {
            NLotes.CambiarEstado(Convert.ToInt32(txtCodigoLote.Text));
            try

            {
                if (this.txtCantidad.Text == string.Empty
                    )
                {
                    MensajeError("Falta ingresar algunos datos, serán remarcados");
                    //errorIcono.SetError(txtDetalle, "Ingrese un Valor");
                    //errorIcono.SetError(txtCantidad, "Ingrese un Valor");
                }
                else
                {
                    bool registrar = true;
                    foreach (DataRow row in dtDetalle.Rows)
                    {
                        if (Convert.ToInt32(row["Lote"]) == Convert.ToInt32(this.txtCodigoLote.Text))
                        {
                            registrar = false;
                            this.MensajeError("YA se encuentra este Lote en el detalle");
                        }
                    }
                    if (registrar)
                    {
                        DataRow row = this.dtDetalle.NewRow();
                        row["CodigoL"]         = Convert.ToInt32(this.txtCodigoLote.Text);
                        row["Lote"]            = Convert.ToInt32(this.txtLote.Text);
                        row["Cantidad"]        = Convert.ToInt32(this.txtCantidad.Text);
                        row["Precio_Unitario"] = this.txtPrecioUnitario.Text;



                        this.dtDetalle.Rows.Add(row);
                    }
                    //else
                    //{

                    //    DataRow row = this.dtDetalle.NewRow();
                    //    row["idarticulo"] = Convert.ToInt32(this.txtIdArticulo.Text);
                    //    row["nombre_articulo"] = this.txtNombreArticulo.Text;

                    //    row["descripcion"] = this.txtDescripcion.Text;
                    //    row["cantidad"] = Convert.ToInt32(this.txtCantidad.Text);
                    //    row["precio_unitario"] = Convert.ToDecimal(this.txtPrecioUnaitario.Text);
                    //    row["precio_sub_total"] = Convert.ToDecimal(this.txtPrecioTotal.Text);
                    //    //row["subtotal"] = subTotal;
                    //    this.dtDetalle.Rows.Add(row);
                    //    this.limpiarDetalle();
                    //    this.sumar();
                    //}
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + ex.StackTrace);
            }
        }
        private void BtnQuitar_Click(object sender, EventArgs e)
        {
            NLotes.CambiarEstado2(Convert.ToInt32(txtCodigoLote.Text));
            try
            {
                int     indiceFila = this.dataListadoDetalle.CurrentCell.RowIndex;
                DataRow row        = this.dtDetalle.Rows[indiceFila];

                this.dtDetalle.Rows.Remove(row);
            }
            catch (Exception ex)
            {
                MensajeError("No hay fila para remover");
            }
        }
Beispiel #3
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            try
            {
                string Rpta = "";
                if (this.txtUrbanizacion.Text == string.Empty || this.txtPrecio.Text == string.Empty || this.txtSuperficie.Text == string.Empty || this.txtNro.Text == string.Empty || this.txtSector.Text == string.Empty)
                {
                    MensajeError("Falta ingresar algunos datos, serán remarcados");
                    errorIcono.SetError(txtDescripcion, "Ingrese el nombre");
                    errorIcono.SetError(txtPrecio, "Ingrese el password");
                    errorIcono.SetError(txtSuperficie, "Ingrese el usuaurio");
                    errorIcono.SetError(txtNro, "Ingrese el telefono");
                    errorIcono.SetError(txtSector, "Ingrese el usuaurio");
                    errorIcono.SetError(txtUrbanizacion, "Ingrese el telefono");
                }
                else
                {
                    System.IO.MemoryStream ms = new System.IO.MemoryStream();
                    this.pxImagen.Image.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
                    byte[] imagen = ms.GetBuffer();
                    if (this.IsNuevo)
                    {
                        Rpta = NLotes.Insertar(
                            Convert.ToInt32(this.txtCodigoUrbani.Text),
                            this.txtSuperficie.Text,
                            Convert.ToInt32(this.txtNro.Text),
                            "HABILITADO",
                            this.txtDescripcion.Text,
                            this.txtPrecio.Text,
                            this.txtSector.Text,
                            imagen
                            );
                    }
                    else
                    {
                        Rpta = NLotes.Editar(Convert.ToInt32(this.txtCodigo.Text),
                                             Convert.ToInt32(this.txtCodigoUrbani.Text),
                                             this.txtSuperficie.Text,
                                             Convert.ToInt32(this.txtNro.Text),
                                             this.cbEstado.Text,
                                             this.txtDescripcion.Text,
                                             this.txtPrecio.Text,
                                             this.txtSector.Text,
                                             imagen
                                             );
                    }

                    if (Rpta.Equals("OK"))
                    {
                        if (this.IsNuevo)
                        {
                            this.MensajeOk("Se insertó de forma correcta el registro");
                            errorIcono.Clear();
                            txtCodigo.Visible = true;
                            label10.Visible   = true;
                        }
                        else
                        {
                            this.MensajeOk("Se actualizó de forma correcta el registro");
                            errorIcono.Clear();
                        }
                    }
                    else
                    {
                        this.MensajeError(Rpta);
                    }
                    this.IsNuevo  = false;
                    this.IsEditar = false;
                    this.Botones();
                    this.Limpiar();
                    this.Mostrar();
                    dgvRegistros.Enabled = true;
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + ex.StackTrace);
            }
        }
Beispiel #4
0
 private void Buscar()
 {
     this.dgvRegistros.DataSource = NLotes.Buscar(this.cbBuscarEstado.Text, this.txtBuscarNro.Text);
     this.OcultarColumnas();
     lblTotal.Text = "Total de registros: " + Convert.ToString(dgvRegistros.Rows.Count);
 }
Beispiel #5
0
 private void Mostrar()
 {
     this.dgvRegistros.DataSource = NLotes.Mostrar();
     this.OcultarColumnas();
     lblTotal.Text = "Total de Registros: " + Convert.ToString(dgvRegistros.Rows.Count);
 }