Exemplo n.º 1
0
        private void CargaCarrito()
        {
            try
            {
                DataView dv;

                ViewState["ImporteDescuentos"]  = "0.0";
                ViewState["SubTotal"]           = "0.0";
                ViewState["ImportePagar"]       = "0.0";
                ViewState["ImportePromociones"] = "0.0";

                if (IdCarritoQueryString != null)
                {
                    objVenta             = new DLLGestionVenta.ProcesarVenta();
                    objVenta.ConexString = System.Configuration.ConfigurationManager.ConnectionStrings["MC_TDAConnectionString"].ToString();

                    /* if (Session["EsDirectivo"] != null)
                     * {
                     *   if (Session["EsDirectivo"].ToString() == "0")
                     *   {
                     *       DsPromo = objVenta.GetPromoCarritoLinea(Convert.ToInt64(IdCarritoQueryString));
                     *   }
                     * }
                     * else*/
                    DsPromo = objVenta.GetPromoCarritoLinea(Convert.ToInt64(IdCarritoQueryString));

                    AVE_CarritoObtener.SelectParameters["IdCarrito"].DefaultValue = IdCarritoQueryString.ToString();
                    if (Session["IdCarrito"] != null)
                    {
                        AVE_CarritoObtenerDirec.SelectParameters["IdCarrito"].DefaultValue = Session["IdCarrito"].ToString();
                    }
                    else
                    {
                        AVE_CarritoObtenerDirec.SelectParameters["IdCarrito"].DefaultValue = IdCarritoQueryString.ToString();
                    }

                    /* if (Session["EsDirectivo"] != null)
                     * {
                     *   if (Session["EsDirectivo"].ToString() != "0")
                     *   {
                     *       dv = (DataView)AVE_CarritoObtenerDirec.Select(DataSourceSelectArguments.Empty);
                     *   }
                     *   else
                     *       dv = (DataView)AVE_CarritoObtener.Select(DataSourceSelectArguments.Empty);
                     *
                     * }
                     * else
                     * {*/
                    dv = (DataView)AVE_CarritoObtener.Select(DataSourceSelectArguments.Empty);
                    /*}*/

                    this.gvCarrito.DataSource = dv;
                    gvCarrito.DataBind();
                }
            }
            catch (Exception e)
            {
                log.Error(e);
            }
        }
Exemplo n.º 2
0
        private void GetDatosPedido()
        {
            SqlConnection  myConnection;
            SqlCommand     myCommand;
            DataSet        dsDatosPedido;
            SqlDataAdapter adapter;

            int    idCliente;
            string pedido;

            string connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["MC_TDAConnectionString"].ToString();

            int idEmpleado = Int32.Parse(Contexto.IdEmpleado);

            GetNombreApellidosEmpleado(idEmpleado);

            myConnection = new SqlConnection(connectionString);

            myConnection.Open();
            string strSql = "SELECT CARR.IdPedidoHermes as Pedido, PED.IdEmpleado as Empleado , CARR.id_Cliente as Cliente ";

            strSql    = strSql + "FROM AVE_CARRITO_LINEA LINEA INNER JOIN AVE_PEDIDOS PED ON LINEA.idPedido = PED.IdPedido ";
            strSql    = strSql + "INNER JOIN AVE_CARRITO CARR ON LINEA.id_Carrito = CARR.IdCarrito WHERE CARR.IdCarrito = " + IdCarritoQueryString.ToString();
            myCommand = new SqlCommand(strSql, myConnection);

            dsDatosPedido = new DataSet();
            adapter       = new SqlDataAdapter(myCommand);
            adapter.Fill(dsDatosPedido, "DatosPedido");
            myConnection.Close();

            DataTable dt = dsDatosPedido.Tables[0];

            foreach (DataRow row in dt.Rows)
            {
                pedido    = Convert.ToString(row["Pedido"]);
                idCliente = Int32.Parse(row["Cliente"].ToString());
                GetNombreApellidosCliente(idCliente);
                lblNumeroPedido.Text = pedido;
            }
        }