Пример #1
0
        public bool ModificarCai(CAIModelo cai)
        {
            DAOMaster dao    = new DAOMaster();
            bool      result = false;

            try
            {
                dao.SetearQuery("Update CAI set nro_cai=@nro_cai, punto_venta=@punto_venta, fecha_inicio=@fecha_inicio, fecha_fin=@fecha_fin Where id_cai=@id_cai");
                dao.AgregarParametro("@id_cai", cai.id_cai);
                dao.AgregarParametro("@nro_cai", cai.nro_cai);
                dao.AgregarParametro("@punto_venta", cai.punto_venta);
                dao.AgregarParametro("@fecha_inicio", cai.fecha_inicio);
                dao.AgregarParametro("@fecha_fin", cai.fecha_fin);
                dao.EjecutarAccion();
                result = true;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                dao.CerrarConexion();
            }
            return(result);
        }
Пример #2
0
        public CAIModelo ListarUnCAI(int id)
        {
            CAIModelo cai = new CAIModelo();
            DAOMaster dao = new DAOMaster();

            try
            {
                dao.SetearQuery("select * from CAI Where id_cai=@id_cai");
                dao.AgregarParametro("@id_cai", id);
                dao.EjecutarLector();
                while (dao.lector.Read())
                {
                    cai.id_cai       = dao.lector.GetInt32(0);
                    cai.nro_cai      = Convert.ToInt64(dao.lector.GetInt64(1));
                    cai.punto_venta  = dao.lector.GetInt32(2);
                    cai.fecha_inicio = Convert.ToDateTime(dao.lector.GetDateTime(3));
                    cai.fecha_fin    = Convert.ToDateTime(dao.lector.GetDateTime(4));
                    return(cai);
                }
                return(cai);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                dao.CerrarConexion();
            }
        }
Пример #3
0
        public List <CAIModelo> ListarCAI()
        {
            List <CAIModelo> lista = new List <CAIModelo>();
            CAIModelo        aux;
            DAOMaster        dao = new DAOMaster();

            try
            {
                dao.SetearQuery("select * from CAI");
                dao.EjecutarLector();
                while (dao.lector.Read())
                {
                    aux              = new CAIModelo();
                    aux.id_cai       = dao.lector.GetInt32(0);
                    aux.nro_cai      = Convert.ToInt64(dao.lector.GetInt64(1));
                    aux.punto_venta  = dao.lector.GetInt32(2);
                    aux.fecha_inicio = Convert.ToDateTime(dao.lector.GetDateTime(3));
                    aux.fecha_fin    = Convert.ToDateTime(dao.lector.GetDateTime(4));
                    lista.Add(aux);
                }
                return(lista);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                dao.CerrarConexion();
            }
        }
Пример #4
0
 protected void btnAlta_Click(object sender, EventArgs e)
 {
     if (IsValid)
     {
         CAIModelo cai = new CAIModelo();
         cai.nro_cai      = Convert.ToInt64(tbNro_cai.Text);
         cai.punto_venta  = Convert.ToInt32(tbPunto_venta.Text);
         cai.fecha_inicio = Convert.ToDateTime(tbFecha_inicio.Text);
         cai.fecha_fin    = Convert.ToDateTime(tbFecha_fin.Text);
         DAOCai dao = new DAOCai();
         if (dao.AgregarCai(cai))
         {
             tbNro_cai.Text              = "";
             tbPunto_venta.Text          = "";
             tbFecha_inicio.Text         = "";
             tbFecha_fin.Text            = "";
             confirmacionEstado.CssClass = "text-success";
             confirmacionEstado.Text     = "CAI agregado correctamente";
         }
         else
         {
             confirmacionEstado.CssClass = "text-danger";
             confirmacionEstado.Text     = "CAI NO SE PUDO AGREGAR correctamente";
         }
     }
 }
Пример #5
0
        public bool AgregarCai(CAIModelo cai)
        {
            DAOMaster dao    = new DAOMaster();
            bool      result = false;

            try
            {
                dao.SetearQuery("Insert into CAI values(@nro_cai, @punto_venta, @fecha_inicio, @fecha_fin)");
                dao.AgregarParametro("@nro_cai", cai.nro_cai);
                dao.AgregarParametro("@punto_venta", cai.punto_venta);
                dao.AgregarParametro("@fecha_inicio", cai.fecha_inicio);
                dao.AgregarParametro("@fecha_fin", cai.fecha_fin);
                dao.EjecutarAccion();
                result = true;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(result);
        }
Пример #6
0
 protected void btnModificacion_Click(object sender, EventArgs e)
 {
     if (IsValid)
     {
         cai              = new CAIModelo();
         cai.id_cai       = Convert.ToInt32(Session[Session.SessionID + "idItemSelected"]);
         cai.nro_cai      = Convert.ToInt64(tbNro_cai.Text);
         cai.punto_venta  = Convert.ToInt32(tbPunto_venta.Text);
         cai.fecha_inicio = Convert.ToDateTime(tbFecha_inicio.Text);
         cai.fecha_fin    = Convert.ToDateTime(tbFecha_fin.Text);
         DAOCai dao = new DAOCai();
         if (dao.ModificarCai(cai))
         {
             confirmacionEstado.CssClass = "text-success";
             confirmacionEstado.Text     = "CAI modificada correctamente";
         }
         else
         {
             confirmacionEstado.CssClass = "text-danger";
             confirmacionEstado.Text     = "CAI NO SE PUDO modificar correctamente";
         }
     }
 }