Esempio n. 1
0
        private void BtnEliminar_Click(object sender, EventArgs e)
        {
            try
            {
                Opcion = MessageBox.Show("Realmente desea Eliminar el Registro ?", "...::: Step One Ver 5.1:::...",
                                         MessageBoxButtons.OKCancel, MessageBoxIcon.Question);

                string Rpta = "";

                if (Opcion == DialogResult.OK)
                {
                    Rpta = EPrecio.Eliminar(TxtCod_precio.Text);

                    if (Rpta.Equals("Y"))
                    {
                        Botones();
                        MensajeOk("Registro Eliminado Correctamente!");
                        Listar();
                    }
                    else
                    {
                        MensajeError(Rpta);
                    }
                }
                else
                {
                    MensajeError("Cancelando la Eliminacon de Registros!");
                }
            }
            catch (Exception ex)
            {
                MensajeError(ex.Message);
            }
        }
Esempio n. 2
0
        public void Listar()
        {
            try
            {
                Ds = EPrecio.Listar();

                TxtCod_precio.Text  = Ds.Tables[0].Rows[0]["cod_precio"].ToString();
                TxtCod_preciov.Text = Ds.Tables[0].Rows[0]["cod_precio"].ToString();
                TxtDesc_precio.Text = Ds.Tables[0].Rows[0]["desc_precio"].ToString();
                TxtCampo1.Text      = Ds.Tables[0].Rows[0]["campo1"].ToString();
                TxtCampo2.Text      = Ds.Tables[0].Rows[0]["campo2"].ToString();
                TxtCampo3.Text      = Ds.Tables[0].Rows[0]["campo3"].ToString();
                TxtCampo4.Text      = Ds.Tables[0].Rows[0]["campo4"].ToString();
                TxtCampo5.Text      = Ds.Tables[0].Rows[0]["campo5"].ToString();
                TxtCampo6.Text      = Ds.Tables[0].Rows[0]["campo6"].ToString();
                TxtEditar.Text      = "Listar";
                Registros();
            }
            catch (Exception Ex)
            {
                TxtEditar.Text = "Nuevo";
                Limpiar();
                TxtCod_precio.Focus();
                string rpta = Ex.Message;
                MensajeOk("Tabla Vacia, esta en modo Ingreso");
                Show();
            }
        }
Esempio n. 3
0
        static public EPrecio precioAEPrecio(Precio p)
        {
            EPrecio ep = new EPrecio();

            ep.IdPrecio             = p.IdPrecio;
            ep.Precio1              = p.Precio1;
            ep.FechaEntradaVigencia = p.FechaEntradaVigencia;
            ep.IdLinea              = p.IdLinea;
            ep.IdParada             = p.IdParada;
            return(ep);
        }
Esempio n. 4
0
        static public Precio eprecioAPrecio(EPrecio ep)
        {
            Precio p = new Precio();

            p.IdPrecio             = ep.IdPrecio;
            p.Precio1              = ep.Precio1;
            p.FechaEntradaVigencia = ep.FechaEntradaVigencia;
            p.IdLinea              = ep.IdLinea;
            p.IdParada             = ep.IdParada;
            return(p);
        }
Esempio n. 5
0
 private void Buscar()
 {
     if (TxtBtipo.Text == "Codigo")
     {
         DataListado.DataSource = EPrecio.Buscar(TxtBuscar.Text, "cod");
     }
     else if (TxtBtipo.Text == "Descripcion")
     {
         DataListado.DataSource = EPrecio.Buscar(TxtBuscar.Text, "Desc");
     }
 }
Esempio n. 6
0
 private void Mostrar()
 {
     try
     {
         DataListado.DataSource = EPrecio.Mostrar();
         OcultarColumnas();
     }
     catch (Exception Exc)
     {
         MensajeError(Exc.Message);
     }
 }
Esempio n. 7
0
 private void GenerarCod()
 {
     try
     {
         int rpta = Convert.ToInt32(EPrecio.GenerarCod(TxtCod_precio.Text));
         TxtCod_precio.Text = Pref + rpta.ToString(TxtCadena.Text);
     }
     catch (Exception Ex)
     {
         MensajeError(" Solo se puede Generar Codigos Numericos " + Ex.StackTrace);
         TxtCod_precio.Focus();
     }
 }
Esempio n. 8
0
        private void TxtCod_precio_DoubleClick(object sender, EventArgs e)
        {
            FPrecioLista Listado = new FPrecioLista();

            Dt = EPrecio.Mostrar();
            if (Dt.Rows.Count == 0)
            {
                MensajeError("No Existen Registros!");
            }
            else
            {
                Listado.TxtFlag = "TipoCliente";
                Listado.ShowDialog();
            }
        }
Esempio n. 9
0
        private void Guardar()
        {
            try
            {
                string Rpta = "";

                if (TxtCod_precio.Text == string.Empty || TxtDesc_precio.Text == string.Empty)
                {
                    MensajeError("Falta ingresar algunos datos");
                    ErrorTexto.SetError(TxtCod_precio, "Campo Obligatorio");
                    ErrorTexto.SetError(TxtDesc_precio, "Campo Obligatorio");
                }
                else
                {
                    if (TxtEditar.Text == "Nuevo")
                    {
                        Rpta = EPrecio.Insertar(TxtCod_precio.Text.Trim().ToUpper(), TxtDesc_precio.Text.Trim(), TxtCampo1.Text, TxtCampo2.Text, TxtCampo3.Text, TxtCampo4.Text, TxtCampo5.Text, TxtCampo6.Text);
                    }
                    else if (TxtEditar.Text == "Editar")
                    {
                        Rpta = EPrecio.Editar(TxtCod_precio.Text.Trim().ToUpper(), TxtCod_preciov.Text, TxtDesc_precio.Text.Trim(), TxtCampo1.Text, TxtCampo2.Text, TxtCampo3.Text, TxtCampo4.Text, TxtCampo5.Text, TxtCampo6.Text);
                    }

                    if (Rpta.Equals("Y"))
                    {
                        if (TxtEditar.Text == "Nuevo")
                        {
                            MensajeOk("El Registro se Insertó Correctamente");
                            TxtEditar.Text      = "Listar";
                            TxtCod_preciov.Text = TxtCod_precio.Text;
                        }
                        else if (TxtEditar.Text == "Editar")
                        {
                            MensajeOk("El Registro se Editó Correctamente");
                            TxtEditar.Text = "Listar";
                        }
                    }
                    else
                    {
                        MensajeError(Rpta);
                    }
                }
            }
            catch (Exception Ex)
            {
                MensajeError(Ex.Message);
            }
        }
Esempio n. 10
0
        private void TxtCod_precio_DoubleClick(object sender, EventArgs e)
        {
            FPrecioLista Listado = new FPrecioLista
            {
                TxtFlag = "ArtPrecio"
            };

            Dt = EPrecio.Mostrar();
            if (Dt.Rows.Count == 0)
            {
                MensajeError("No Existen Registros Disponibles!");
            }
            else if (Dt.Rows.Count != 0)
            {
                Listado.ShowDialog();
            }
        }
Esempio n. 11
0
 private void TxtCod_precio_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.F12)
     {
         FPrecioLista Listado = new FPrecioLista();
         Dt = EPrecio.Mostrar();
         if (Dt.Rows.Count == 0)
         {
             MensajeError("No Existen Registros!");
         }
         else
         {
             Listado.TxtFlag = "TipoCliente";
             Listado.ShowDialog();
         }
     }
 }
Esempio n. 12
0
 private void TxtCod_precio_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.F12)
     {
         FPrecioLista Listado = new FPrecioLista
         {
             TxtFlag = "ArtPrecio"
         };
         Dt = EPrecio.Mostrar();
         if (Dt.Rows.Count == 0)
         {
             MensajeError("No Existen Registros Disponibles!");
         }
         else if (Dt.Rows.Count != 0)
         {
             Listado.ShowDialog();
         }
     }
 }
Esempio n. 13
0
        private void BtnEliminar_Click(object sender, EventArgs e)
        {
            try
            {
                DialogResult Opcion = MessageBox.Show("Realmente Desea Eliminar los Registros Seleccionados ?", "...::: Step One Ver 5.1:::...", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);

                if (Opcion == DialogResult.OK)
                {
                    string Rpta = "";

                    foreach (DataGridViewRow row in DataListado.Rows)
                    {
                        if (Convert.ToBoolean(row.Cells["Eliminar"].Value))
                        {
                            Rpta = EPrecio.Eliminar(Convert.ToString(row.Cells["cod_precio"].Value));
                        }
                    }

                    if (Rpta.Equals("Y"))
                    {
                        ChkEliminar.CheckState = CheckState.Unchecked;
                        MensajeOk("Se Eliminó Correctamente el registro");
                        Mostrar();
                    }
                    else
                    {
                        MensajeError(Rpta);
                        ChkEliminar.CheckState = CheckState.Unchecked;
                    }
                }
                else
                {
                    MensajeError("Cancelando la Eliminacon de Registros!");
                    ChkEliminar.CheckState = CheckState.Unchecked;
                }
            }
            catch (Exception ex)
            {
                MensajeError(ex.Message);
            }
        }
Esempio n. 14
0
        private void BtnUltimo_Click(object sender, EventArgs e)
        {
            try
            {
                Ds = EPrecio.Ultimo();

                TxtCod_precio.Text  = Ds.Tables[0].Rows[0]["cod_precio"].ToString();
                TxtDesc_precio.Text = Ds.Tables[0].Rows[0]["desc_precio"].ToString();
                TxtCampo1.Text      = Ds.Tables[0].Rows[0]["campo1"].ToString();
                TxtCampo2.Text      = Ds.Tables[0].Rows[0]["campo2"].ToString();
                TxtCampo3.Text      = Ds.Tables[0].Rows[0]["campo3"].ToString();
                TxtCampo4.Text      = Ds.Tables[0].Rows[0]["campo4"].ToString();
                TxtCampo5.Text      = Ds.Tables[0].Rows[0]["campo5"].ToString();
                TxtCampo6.Text      = Ds.Tables[0].Rows[0]["campo6"].ToString();
                TxtCod_preciov.Text = Ds.Tables[0].Rows[0]["cod_precio"].ToString();

                TxtEditar.Text = "Listar";
                Registros();
            }
            catch (Exception Exc)
            {
                string Rpta = Exc.Message;
            }
        }
Esempio n. 15
0
        public List <EPrecio> getAllPrecios()
        {
            try
            {
                using (uybusEntities db = new uybusEntities())
                {
                    List <EPrecio> lstEp = null;

                    var Prec = db.Precio;

                    foreach (var p in Prec)
                    {
                        EPrecio ep = Converter.precioAEPrecio(p);
                        lstEp.Add(ep);
                    }
                    return(lstEp);
                }
            }
            catch (System.Exception ex)
            {
                Console.WriteLine("Error en DAL_Precio, en getAllPrecios" + ex.Message);
                throw ex;
            }
        }
Esempio n. 16
0
 private void Registros()
 {
     Dt = EPrecio.Mostrar();
     LbTotalReg.Text = Convert.ToString(Dt.Rows.Count.ToString());
 }