示例#1
0
        public List<PedidoPresupuestoDTO> Listar(int IdPedido)
        {
            List<PedidoPresupuestoDTO> Lista = new List<PedidoPresupuestoDTO>();
              Database db = DatabaseFactory.CreateDatabase("ApplicationConnectionString");
              DbCommand dbCommand = db.GetStoredProcCommand(C_LISTAR);
              db.AddInParameter(dbCommand, "@id_pedido", DbType.Int32, IdPedido);

              using (IDataReader dr = db.ExecuteReader(dbCommand))
              {
              while (dr.Read())
              {
                  PedidoPresupuestoDTO obj = new PedidoPresupuestoDTO();
                  if (dr["id_pedido_presupuesto"] != System.DBNull.Value)
                      obj.IdPedidoPresupuesto = (int)dr["id_pedido_presupuesto"];
                  if (dr["id_pedido"] != System.DBNull.Value)
                      obj.IdPedido = (int)dr["id_pedido"];
                  if (dr["codigo_presupuesto"] != System.DBNull.Value)
                      obj.CodigoPresupuesto = (string)dr["codigo_presupuesto"];
                  if (dr["descripcion"] != System.DBNull.Value)
                      obj.Descripcion = (string)dr["descripcion"];

                  Lista.Add(obj);
              }
              }
              return Lista;
        }
示例#2
0
 public int Agregar(PedidoPresupuestoDTO obj)
 {
     Database db = DatabaseFactory.CreateDatabase("ApplicationConnectionString");
       DbCommand dbCommand = db.GetStoredProcCommand(C_AGREGAR);
       db.AddInParameter(dbCommand, "@id_pedido", DbType.Int32, obj.IdPedido);
       db.AddInParameter(dbCommand, "@codigo_presupuesto", DbType.String, obj.CodigoPresupuesto);
       db.AddInParameter(dbCommand, "@descripcion", DbType.String, obj.Descripcion);
       int id = Convert.ToInt32(db.ExecuteScalar(dbCommand));
       return id;
 }
示例#3
0
 public void Actualizar(PedidoPresupuestoDTO obj)
 {
     Database db = DatabaseFactory.CreateDatabase("ApplicationConnectionString");
       DbCommand dbCommand = db.GetStoredProcCommand(C_ACTUALIZAR);
       db.AddInParameter(dbCommand, "@id_pedido_presupuesto", DbType.Int32, obj.IdPedidoPresupuesto);
       db.AddInParameter(dbCommand, "@id_pedido", DbType.Int32, obj.IdPedido);
       db.AddInParameter(dbCommand, "@codigo_presupuesto", DbType.String, obj.CodigoPresupuesto);
       db.AddInParameter(dbCommand, "@descripcion", DbType.String, obj.Descripcion);
       db.ExecuteNonQuery(dbCommand);
 }
        protected void btnAgregar_Click(object sender, EventArgs e)
        {
            PedidoPresupuestoDTO obj = new PedidoPresupuestoDTO();

            obj.IdPedido = Convert.ToInt32(this.txtIdPedido.Text);
            obj.CodigoPresupuesto = this.txtCodigoPresupuesto.Text;
            obj.Descripcion = this.txtDescripcion.Text;

            objPedidoPresupuestoDAO.Agregar(obj);

            Listar();
        }