Exemplo n.º 1
0
    protected void btn_nuevo_Click(object sender, EventArgs e)
    {
        Limpiar();
        dv_detalle.Visible = false;
        utils.AbrirModal(this, "modalPuntos");
        ddl_puntosCambiarPreruta.Visible = false;
        OrigenBC o = new OrigenBC().ObtenerXId(1);

        hf_origen.Value = JsonConvert.SerializeObject(o);

        //  DataTable dt = new PreRutaBC().ObtenerPuntos();
        //  hf_jsonRuta.Value = JsonConvert.SerializeObject(dt);

        DateTime fh = Convert.ToDateTime(txt_buscarFecha.Text);
        //        dt = new PedidoBC().ObtenerTodo(desde: fh, hasta: fh, solo_sin_ruta: true);
        DataTable dt = new PedidoBC().ObtenerTodo(desde: fh, hasta: fh, hora_id: int.Parse(ddl_buscarHorario.SelectedValue), regi_id: 0, ciud_id: 0, comu_id: null, usua_id: 0, peru_numero: null, solo_sin_ruta: true, id_ruta: 0);

        hf_jsonPedidos.Value = JsonConvert.SerializeObject(dt);
        utils.CargaDrop(ddl_puntoNombre, "PERU_ID", "PERU_NUMERODROP", dt);

        PreRutaBC p = new PreRutaBC();

        p.FECHA_DESPACHOEXP = DateTime.Parse(txt_buscarFecha.Text);
        p.FH_CREACION       = DateTime.Now;

        p.HORARIO.HORA_COD = ddl_buscarHorario.SelectedItem.Text;
        p.HORARIO.HORA_ID  = int.Parse(ddl_buscarHorario.SelectedItem.Value);
        var random = new Random();
        var color  = String.Format("#{0:X6}", random.Next(0x1000000));

        p.RUTA_COLOR      = color;
        hf_jsonRuta.Value = JsonConvert.SerializeObject(p);

        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "map_cargar", "mapa(true);", true);
    }
Exemplo n.º 2
0
    private void LlenarDatos(PedidoBC p)
    {
        hf_idPeru.Value              = p.PERU_ID.ToString();
        txt_editNumero.Text          = p.PERU_NUMERO;
        txt_editCodigo.Text          = p.PERU_CODIGO;
        txt_editFecha.Text           = p.PERU_FECHA.ToShortDateString();
        txt_editPeso.Text            = p.PERU_PESO;
        txt_editTiempo.Text          = p.PERU_TIEMPO;
        txt_editDireccion.Text       = p.PERU_DIRECCION;
        ddl_editRegion.SelectedValue = p.COMUNA.CIUDAD.REGION.REGI_ID.ToString();
        ddl_editRegion_SelectedIndexChanged(null, null);
        ddl_editCiudad.SelectedValue = p.COMUNA.CIUDAD.CIUD_ID.ToString();
        ddl_editCiudad_SelectedIndexChanged(null, null);
        ddl_editComuna.SelectedValue = p.COMUNA.COMU_ID.ToString();
        txt_editLat.Text             = p.PERU_LATITUD.ToString();
        txt_editLon.Text             = p.PERU_LONGITUD.ToString();
        rb_editHorario.SelectedValue = p.HORA_SALIDA.HORA_ID.ToString();
        int detalle = int.Parse(System.Web.Configuration.WebConfigurationManager.AppSettings["usa_Detalle"]);

        if (detalle == 1)
        {
            ObtenerDetalle(true);
            gv_detalle.Visible      = true;
            btn_editDetalle.Visible = true;
        }
        else
        {
            gv_detalle.Visible      = false;
            btn_editDetalle.Visible = false;
        }
        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "map", "mapa();", true);
    }
Exemplo n.º 3
0
    protected void btnenviar_Click(object sender, EventArgs e)
    {
        PedidoBC gd = new PedidoBC();
        int      id = 0;

        try
        {
            if (gd.CrearEnvio(hseleccionado.Value.ToString(), user.USUA_ID, out id))
            {
                hf_idEnvio.Value = id.ToString();
                lbl_cedible.Text = string.Format("Envío cedible N°{0}", id);
                Session["ID_Seleccionados_1"] = hseleccionado.Value;
                //UpdatePanel1.Update();
                // utils.AbrirModal(this, "modalFOTO");
                //     utils.ShowMessage(this, "Enviado", "success", true);
                btnzip_Click(null, null);
            }
            else
            {
                utils.ShowMessage(this, "Error", "error", false);
            }
            //   ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "reiniciar", "reinicia();", true);
        }
        catch (Exception ex)
        {
            //  ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "reiniciar", "reinicia();", true);
            utils.ShowMessage(this, ex.Message, "error", false);
        }
        finally
        {
            ObtenerPedidos(true);
        }
    }
Exemplo n.º 4
0
        public static void Comprar()
        {
            PedidoBC  objPedidoBC  = new PedidoBC();
            CarritoBC objCarritoBC = new CarritoBC();
            MailBC    objMailBC    = new MailBC();

            try
            {
                CarritoBE objCarritoBE = (CarritoBE)HttpContext.Current.Session["CARRITO"];
                UsuarioBE objUsuarioBE = (UsuarioBE)HttpContext.Current.Session["USUARIO"];

                PedidoBE objPedidoBE = LlenarPedido();

                objPedidoBE.Id_Pedido = objPedidoBC.Insert_Pedido_Completo(objPedidoBE);
                objCarritoBC.Delete_Carrito_Total(objUsuarioBE.Id_Usuario);

                objMailBC.Confirmar_Compra(objUsuarioBE, objCarritoBE);

                HttpContext.Current.Session["CARRITO"] = new CarritoBE();
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemplo n.º 5
0
        private void LlenarOrdenes()
        {
            PedidoBC objPedidoBC = new PedidoBC();
            Label    lblOrden    = new Label();

            try
            {
                List <PedidoBE> lstPedidoBE = objPedidoBC.Select_Pedido_Usuario(((UsuarioBE)Session["USUARIO"]).Id_Usuario);

                if (lstPedidoBE != null)
                {
                    foreach (PedidoBE p in lstPedidoBE)
                    {
                        lblOrden.Text += GetOrdenItem(p);
                    }
                }
                else
                {
                    lblOrden.Text = "<tr><td class=\"price\" colspan='6'>NO HAY PEDIDOS REGISTRADOS</td></tr>";
                }

                bodyOrdenes.Controls.Add(lblOrden);
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemplo n.º 6
0
    protected void btn_AgendarMasivo_Click(object sender, EventArgs e)
    {
        DateTime desde, hasta;

        if (ddl_edithorario.SelectedValue != "0")
        {
            desde = Convert.ToDateTime(string.Format("{0} {1}", this.txt_fechaAg.Text, this.ddl_edithorario.SelectedItem.Text));
        }
        else
        {
            desde = Convert.ToDateTime(string.Format("{0}", this.txt_fechaAg.Text));
        }

        PedidoBC pedido = new PedidoBC();

        if (pedido.ModificarFechaAgendamiento(hseleccionado.Value, desde, int.Parse(ddl_edithorario.SelectedValue)))
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "reiniciar", "reinicia();", true);
            utils.ShowMessage(this, "Fecha Modificada correctamente.", "success", true);
            utils.CerrarModal(this, "modalFechaAg");
        }
        else
        {
            utils.ShowMessage(this, "Ocurrió un error al agendar. Revise los datos.", "error", false);
        }
        this.btnBuscar_Click(null, null);
    }
Exemplo n.º 7
0
    protected void btn_editGuardar_Click(object sender, EventArgs e)
    {
        try
        {
            PedidoBC p = new PedidoBC()
            {
                PERU_NUMERO    = txt_editNumero.Text,
                PERU_CODIGO    = txt_editCodigo.Text,
                PERU_FECHA     = Convert.ToDateTime(txt_editFecha.Text),
                PERU_PESO      = txt_editPeso.Text,
                PERU_TIEMPO    = txt_editTiempo.Text,
                PERU_DIRECCION = txt_editDireccion.Text,
                PERU_LATITUD   = Convert.ToDecimal(txt_editLat.Text),
                PERU_LONGITUD  = Convert.ToDecimal(txt_editLon.Text)
            };
            p.HORA_SALIDA.HORA_ID = Convert.ToInt32(rb_editHorario.SelectedValue);
            //if (rb_editHoraAm.Checked) p.PERU_HORASALIDA = "AM";
            //else if (rb_editHoraPm.Checked) p.PERU_HORASALIDA = "PM";
            p.COMUNA.COMU_ID = Convert.ToInt32(ddl_editComuna.SelectedValue);
            p.USUARIO_PEDIDO = user;
            if (string.IsNullOrEmpty(hf_idPeru.Value))
            {
                if (p.Guardar())
                {
                    utils.ShowMessage2(this, "guardar", "success_nuevo");
                    utils.CerrarModal(this, "modalEdit");
                }
                else
                {
                    utils.ShowMessage2(this, "guardar", "error");
                }
            }
            else
            {
                p.PERU_ID = Convert.ToInt64(hf_idPeru.Value);

                if (p.Guardar())
                {
                    utils.ShowMessage2(this, "guardar", "success_nuevo");
                    utils.CerrarModal(this, "modalEdit");
                }
                else
                {
                    utils.ShowMessage2(this, "guardar", "error");
                }
            }
        }
        catch (Exception ex)
        {
            utils.ShowMessage(this, ex.Message, "error", true);
        }
        finally
        {
            ObtenerEnvio(true);
        }
    }
Exemplo n.º 8
0
 protected void btn_editGuardar_Click(object sender, EventArgs e)
 {
     try
     {
         PedidoBC p = new PedidoBC()
         {
             PERU_NUMERO    = txt_editNumero.Text,
             PERU_CODIGO    = txt_editCodigo.Text,
             PERU_FECHA     = Convert.ToDateTime(txt_editFecha.Text),
             PERU_PESO      = txt_editPeso.Text,
             PERU_TIEMPO    = txt_editTiempo.Text,
             PERU_DIRECCION = txt_editDireccion.Text,
             PERU_LATITUD   = Convert.ToDecimal(txt_editLat.Text.Replace(".", ",")),
             PERU_LONGITUD  = Convert.ToDecimal(txt_editLon.Text.Replace(".", ","))
         };
         p.HORA_SALIDA.HORA_ID = Convert.ToInt32(rb_editHorario.SelectedValue);
         //if (rb_editHoraAm.Checked) p.PERU_HORASALIDA = "AM";
         //else if (rb_editHoraPm.Checked) p.PERU_HORASALIDA = "PM";
         p.COMUNA.COMU_ID = Convert.ToInt32(ddl_editComuna.SelectedValue);
         p.USUARIO_PEDIDO = user;
         if (string.IsNullOrEmpty(hf_idPeru.Value))
         {
             DataTable dt = ((DataTable)ViewState["detalle"]).DefaultView.ToTable(false
                                                                                  , "PEDE_ID"
                                                                                  , "PERU_ID"
                                                                                  , "CODIGO_PRODUCTO"
                                                                                  , "PEDE_DESC_PRODUCTO"
                                                                                  , "CODIGO_CLIENTE"
                                                                                  , "DIRECCION_CLIENTE"
                                                                                  , "NOMBRE_CLIENTE"
                                                                                  , "ID_COMUNA_CLIENTE"
                                                                                  , "NUMERO_GUIA"
                                                                                  , "PESO_PEDIDO"
                                                                                  , "PEDE_CANTIDAD");
             p.Guardar(dt);
             utils.ShowMessage2(this, "guardar", "success_nuevo");
             utils.CerrarModal(this, "modalEdit");
         }
         else
         {
             p.PERU_ID = Convert.ToInt64(hf_idPeru.Value);
             p.Guardar();
             ObtenerDetalle(true);
             utils.ShowMessage2(this, "guardar", "success_modificar");
         }
     }
     catch (Exception ex)
     {
         utils.ShowMessage(this, ex.Message, "error", true);
     }
     finally
     {
         ObtenerPedidos(true);
     }
 }
Exemplo n.º 9
0
    private void ObtenerPuntosRuta(bool forzarBD)
    {
        DateTime  fh      = Convert.ToDateTime(txt_buscarFecha.Text);
        int       hora_id = Convert.ToInt32(ddl_buscarHorario.SelectedValue);
        PreRutaBC p       = new PreRutaBC().ObtenerXId(Convert.ToInt32(hf_idRuta.Value), true);

        hf_jsonRuta.Value = JsonConvert.SerializeObject(p);
        hf_circular.Value = p.RETORNO;
        DataTable dt;

        dt = new PedidoBC().ObtenerTodo(desde: fh, hasta: fh, solo_sin_ruta: true, id_ruta: p.ID);
        utils.CargaDrop(ddl_puntoNombre, "PERU_ID", "PERU_NUMERODROP", dt);

        ddl_puntosCambiarPreruta.Visible       = true;
        ddl_puntosCambiarPreruta.SelectedValue = p.ID.ToString();
        hf_origen.Value = JsonConvert.SerializeObject(p.ORIGEN);
        ddl_vehiculoTipo.SelectedValue = p.TRAILER.TRAILER_TIPO.TRTI_ID.ToString();
        ddl_vehiculoTipo_SelectedIndexChanged(null, null);
        ddl_vehiculoTrailer.SelectedValue = p.TRAILER.TRAI_ID.ToString();
        lbl_puntoTracto.Text    = (string.IsNullOrEmpty(p.TRACTO.TRAC_PLACA)) ? "Sin tracto" : "Tracto: " + p.TRACTO.TRAC_PLACA;
        lbl_puntoTrailer.Text   = (string.IsNullOrEmpty(p.TRAILER.TRAI_PLACA)) ? "Sin trailer" : "Trailer: " + p.TRAILER.TRAI_PLACA;
        lbl_puntoConductor.Text = (string.IsNullOrEmpty(p.CONDUCTOR.COND_NOMBRE)) ? "Sin conductor" : "Conductor: " + p.CONDUCTOR.COND_NOMBRE;
        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "map_cargar", "abrirModal('modalPuntos'); mapa(false);", true);

        ddl_vehiculoTracto.Items.Clear();
        ddl_vehiculoTracto.Items.Add(new RadComboBoxItem("Sin Tracto", "0"));
        dt = new TractoBC().ObtenerTodo(fecha: fh, hora_id: hora_id);
        foreach (DataRow dr in dt.Rows)
        {
            RadComboBoxItem cb = new RadComboBoxItem(dr["TRAC_PLACA"].ToString(), dr["TRAC_ID"].ToString());
            if (dr["ID_RUTA"] != DBNull.Value)
            {
                long id_ruta = Convert.ToInt32(dr["ID_RUTA"]);
                cb.Enabled = (id_ruta.ToString() == hf_idRuta.Value);
            }
            ddl_vehiculoTracto.Items.Add(cb);
        }
        ddl_vehiculoTracto.SelectedValue = p.TRACTO.TRAC_ID.ToString();
        txt_editNombre.Text = p.NUMERO;
        ddl_vehiculoConductor.Items.Clear();
        ddl_vehiculoConductor.Items.Add(new RadComboBoxItem("Sin Conductor", "0"));
        dt = new ConductorBC().ObtenerTodo(fecha: fh, hora_id: hora_id, cond_activo: true, cond_bloqueado: false);
        foreach (DataRow dr in dt.Rows)
        {
            RadComboBoxItem cb = new RadComboBoxItem((dr["COND_RUT"].ToString() + " - " + dr["COND_NOMBRE"].ToString()), dr["COND_ID"].ToString());
            if (dr["ID_RUTA"] != DBNull.Value)
            {
                long id_ruta = Convert.ToInt32(dr["ID_RUTA"]);
                cb.Enabled = (id_ruta.ToString() == hf_idRuta.Value);
            }
            ddl_vehiculoConductor.Items.Add(cb);
        }
        ddl_vehiculoConductor.SelectedValue = p.CONDUCTOR.COND_ID.ToString();
    }
Exemplo n.º 10
0
        private void LlenarPedidos()
        {
            PedidoBC objPedidoBC = new PedidoBC();

            try
            {
                gvPedidos.DataSource = ViewState["PEDIDOS"];
                gvPedidos.DataBind();
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemplo n.º 11
0
        private void LlenarPedidosTodos()
        {
            PedidoBC objPedidoBC = new PedidoBC();

            try
            {
                ViewState["PEDIDOS"] = objPedidoBC.Select_Pedido();
                LlenarPedidos();
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemplo n.º 12
0
        protected void btnCambiarEstado_Click(object sender, EventArgs e)
        {
            PedidoBC objPedidoBC = new PedidoBC();

            try
            {
                objPedidoBC.Update_Pedido_Estado(Convert.ToInt32(hdIdPedidoSel.Value), (int)EstadoPedido.Entregado);
                LlenarPedidos();
            }
            catch (Exception ex)
            {
                Tools.Error(GetType(), this, ex);
            }
        }
Exemplo n.º 13
0
        private void CambioEstado(EstadoPedido estado)
        {
            PedidoBC objPedidoBC = new PedidoBC();
            MailBC   objMailBC   = new MailBC();

            try
            {
                PedidoBE objPedidoBE = objPedidoBC.Get_Pedido_Completo_Cip(ViewState["CIP"].ToString());
                objPedidoBC.Update_Pedido_Estado_Cip(ViewState["CIP"].ToString(), (int)estado);
                objMailBC.Cambio_Estado_Pedido(objPedidoBE, estado);
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemplo n.º 14
0
    private void ObtenerPedidos(bool forzarBD)
    {
        if (ViewState["listar"] == null || forzarBD)
        {
            hseleccionado.Value = "";
            DateTime      desde   = (string.IsNullOrEmpty(txt_buscarDesde.Text)) ? DateTime.MinValue : Convert.ToDateTime(txt_buscarDesde.Text);
            DateTime      hasta   = (string.IsNullOrEmpty(txt_buscarHasta.Text)) ? DateTime.MinValue : Convert.ToDateTime(txt_buscarHasta.Text);
            int           regi_id = Convert.ToInt32(ddl_buscarRegion.SelectedValue);
            int           ciud_id = Convert.ToInt32(ddl_buscarCiudad.SelectedValue);
            StringBuilder comu_id = new StringBuilder();
            foreach (RadComboBoxItem item in ddl_buscarComuna.CheckedItems)
            {
                if (comu_id.Length > 0)
                {
                    comu_id.Append(',');
                }
                comu_id.Append(item.Value);
            }
            int hora_id = Convert.ToInt32(ddl_buscarHorario.SelectedValue);
            ViewState["listar"] = new PedidoBC().ObtenerTodo(
                desde: desde
                , hasta: hasta
                , hora_id: hora_id
                , regi_id: regi_id
                , ciud_id: ciud_id
                , comu_id: comu_id.ToString()
                , usua_id: user.USUA_ID
                , peru_numero: txt_buscarNro.Text);
            List <PedidoBC> arrPedido = new PedidoBC().ObtenerArray(
                desde: desde
                , hasta: hasta
                , hora_id: hora_id);
            hf_jsonPedidos.Value = JsonConvert.SerializeObject(arrPedido);
        }
        DataView dw = new DataView((DataTable)ViewState["listar"]);

        if (ViewState["sortExpresion"] != null && ViewState["sortExpresion"].ToString() != "")
        {
            dw.Sort = (String)ViewState["sortExpresion"];
        }
        gv_listar.DataSource = dw.ToTable();
        gv_listar.DataBind();
        utils.TableSPag(this, gv_listar);
    }
Exemplo n.º 15
0
        protected void btnBuscar_Click(object sender, EventArgs e)
        {
            PedidoBC objPedidoBC = new PedidoBC();

            try
            {
                ViewState["PEDIDOS"] = objPedidoBC.Get_Pedido_Buscar(
                    !string.IsNullOrEmpty(txtPedidoFechaInicioBuscar.Text.Trim()) ? (DateTime?)Convert.ToDateTime(txtPedidoFechaInicioBuscar.Text.Trim()) : null,
                    !string.IsNullOrEmpty(txtPedidoFechaFinBuscar.Text.Trim()) ? (DateTime?)Convert.ToDateTime(txtPedidoFechaFinBuscar.Text.Trim()) : null,
                    txtPedidoUsuarioBuscar.Text.Trim(),
                    ddlPedidoEstadoBuscar.SelectedValue != "-1" ? (int?)Convert.ToInt32(ddlPedidoEstadoBuscar.SelectedValue) : null);

                LlenarPedidos();
            }
            catch (Exception ex)
            {
                Tools.Error(GetType(), this, ex);
            }
        }
Exemplo n.º 16
0
 protected void gv_listar_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "EDITAR")
     {
         Limpiar();
         int      peru_id = Convert.ToInt32(e.CommandArgument);
         PedidoBC p       = new PedidoBC().ObtenerXId(peru_id);
         LlenarDatos(p);
         up_modalEdit.Update();
         //utils.AbrirModal(this, "modalEdit");
     }
     if (e.CommandName == "ELIMINAR")
     {
         hf_idPeru.Value      = e.CommandArgument.ToString();
         lbl_confTitulo.Text  = "Eliminar Pedido";
         lbl_confMensaje.Text = "Se eliminará el pedido seleccionado ¿Desea continuar?";
         utils.AbrirModal(this, "modalConf");
     }
 }
Exemplo n.º 17
0
    private void ObtenerRutas()
    {
        DateTime         fecha     = Convert.ToDateTime(txt_buscarFecha.Text);
        int              hora_id   = Convert.ToInt32(ddl_buscarHorario.SelectedValue);
        List <OrigenBC>  arrOrigen = new OrigenBC().ObtenerArray();
        List <PreRutaBC> arrRuta   = new PreRutaBC().ObtenerArray(desde: fecha, hasta: fecha, hora_id: hora_id, puntos_ruta: true);
        List <PedidoBC>  arrPedido = new PedidoBC().ObtenerArray(desde: fecha, hasta: fecha, hora_id: hora_id, solo_sin_ruta: true);

        ScriptManager.RegisterStartupScript(this.Page
                                            , this.GetType()
                                            , "mapilla"
                                            , string.Format("jsonPedidos = {0};" +
                                                            "jsonOrigenes = {1};" +
                                                            "jsonRutas = {2};" +
                                                            "mapa();"
                                                            , JsonConvert.SerializeObject(arrPedido)
                                                            , JsonConvert.SerializeObject(arrOrigen)
                                                            , JsonConvert.SerializeObject(arrRuta))
                                            , true);
    }
Exemplo n.º 18
0
    protected void btnenviar_Click(object sender, EventArgs e)
    {
        PedidoBC gd = new PedidoBC();
        int      id = 0;

        try
        {
            if (gd.CrearEnvio(hseleccionado.Value.ToString(), user.USUA_ID, out id))
            {
                hf_idEnvio.Value = id.ToString();
                //lbl_cedible.Text = string.Format("Envío rut N°{0}",id);
                Session["ID_Seleccionados_1"] = hseleccionado.Value;
                UpdatePanel1.Update();
                // utils.AbrirModal(this, "modalFOTO");
                EnvioBC   envio    = new EnvioBC(id);
                DataTable enviados = envio.detalle();
                envio.archivo(enviados);
                try
                {
                    envio.archivo2(enviados, id);
                }
                catch (Exception ex)
                {
                    utils.ShowMessage(this.Page, ex.Message, "error", true, "msg_error");
                    return;
                }
            }
            else
            {
                utils.ShowMessage(this, "Error", "error", false);
            }
        }
        catch (Exception ex)
        {
            utils.ShowMessage(this, ex.Message, "error", false);
        }
        finally
        {
            ObtenerEnvio(true);
        }
    }
Exemplo n.º 19
0
 private void LlenarDatos(PedidoBC p)
 {
     hf_idPeru.Value              = p.PERU_ID.ToString();
     txt_editNumero.Text          = p.PERU_NUMERO;
     txt_editCodigo.Text          = p.PERU_CODIGO;
     txt_editFecha.Text           = p.PERU_FECHA.ToShortDateString();
     txt_editPeso.Text            = p.PERU_PESO;
     txt_editTiempo.Text          = p.PERU_TIEMPO;
     txt_editDireccion.Text       = p.PERU_DIRECCION;
     ddl_editRegion.SelectedValue = p.COMUNA.CIUDAD.REGION.REGI_ID.ToString();
     ddl_editRegion_SelectedIndexChanged(null, null);
     ddl_editCiudad.SelectedValue = p.COMUNA.CIUDAD.CIUD_ID.ToString();
     ddl_editCiudad_SelectedIndexChanged(null, null);
     ddl_editComuna.SelectedValue = p.COMUNA.COMU_ID.ToString();
     txt_editLat.Text             = p.PERU_LATITUD.ToString();
     txt_editLon.Text             = p.PERU_LONGITUD.ToString();
     rb_editHorario.SelectedValue = p.HORA_SALIDA.HORA_ID.ToString();
     //if (p.PERU_HORASALIDA == "AM") rb_editHoraAm.Checked = true;
     //else rb_editHoraPm.Checked = true;
     ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "map", "mapa();", true);
 }
Exemplo n.º 20
0
    private void ObtenerRutas(bool forzarBD, bool refrescar_combo = true)
    {
        if (ViewState["listar"] == null || forzarBD)
        {
            DateTime desde   = (string.IsNullOrEmpty(txt_buscarFecha.Text)) ? DateTime.MinValue : Convert.ToDateTime(txt_buscarFecha.Text);
            DateTime hasta   = (string.IsNullOrEmpty(txt_buscarFecha.Text)) ? DateTime.MinValue : Convert.ToDateTime(txt_buscarFecha.Text);
            int      regi_id = Convert.ToInt32(ddl_buscarRegion.SelectedValue);
            int      ciud_id = Convert.ToInt32(ddl_buscarCiudad.SelectedValue);
            int      comu_id = Convert.ToInt32(ddl_buscarComuna.SelectedValue);
            int      hora_id = Convert.ToInt32(ddl_buscarHorario.SelectedValue);
            string   envio   = txt_buscaenvio.Text;
            ViewState["listar"] = new PreRutaBC().ObtenerTodo(desde: desde
                                                              , hasta: hasta
                                                              , regi_id: regi_id
                                                              , ciud_id: ciud_id
                                                              , comu_id: comu_id
                                                              , usua_id: user.USUA_ID
                                                              , peru_numero: txt_buscarNro.Text
                                                              , hora_id: hora_id
                                                              , envio: envio);
        }
        DataView dw = new DataView((DataTable)ViewState["listar"]);

        if (ViewState["sortExpresion"] != null && ViewState["sortExpresion"].ToString() != "")
        {
            dw.Sort = (String)ViewState["sortExpresion"];
        }

        if (refrescar_combo == true)
        {
            utils.CargaDropNormal(ddl_puntosCambiarPreruta, "ID", "NUMERO", dw.ToTable());
        }
        DateTime        fh   = Convert.ToDateTime(txt_buscarFecha.Text);
        List <PedidoBC> cosa = new PedidoBC().ObtenerArray(desde: fh, hasta: fh, solo_sin_ruta: true);

        hf_jsonPedidos.Value = JsonConvert.SerializeObject(cosa);

        gv_listar.DataSource = dw;
        gv_listar.DataBind();
    }
Exemplo n.º 21
0
        public static PedidoBE VerOrden(int idOrden)
        {
            PedidoBC objPedidoBC = new PedidoBC();

            try
            {
                PedidoBE objPedidoBE = objPedidoBC.Get_Pedido_Completo(idOrden);

                for (int i = objPedidoBE.lstPedido_ProductoBE.Count - 1; i >= 0; i--)
                {
                    objPedidoBE.Productos_Texto += GetProductoItem(objPedidoBE.lstPedido_ProductoBE[i]);
                }

                objPedidoBE.Direccion_Envio_Texto       = objPedidoBE.objDireccionEnvioBE.Direccion + ", " + objPedidoBE.objDireccionEnvioBE.Distrito + ", " + objPedidoBE.objDireccionEnvioBE.Provincia + ", " + objPedidoBE.objDireccionEnvioBE.Departamento;
                objPedidoBE.Direccion_Facturacion_Texto = objPedidoBE.objDireccionFacturacionBE.Direccion + ", " + objPedidoBE.objDireccionFacturacionBE.Distrito + ", " + objPedidoBE.objDireccionFacturacionBE.Provincia + ", " + objPedidoBE.objDireccionFacturacionBE.Departamento;

                return(objPedidoBE);
            }
            catch (Exception ex)
            {
                LogFile.EscribirLog(ex);
                throw;
            }
        }
Exemplo n.º 22
0
        protected void lnkContinuar_Click(object sender, EventArgs e)
        {
            PedidoBC objPedidoBC = new PedidoBC();
            //PedidoBE objPedidoBE = new PedidoBE();
            //Pedido_DireccionBC objPedidoDireccionBC = new Pedido_DireccionBC();
            //Pedido_ProductoBC objPedidoProductoBC = new Pedido_ProductoBC();
            //Pedido_ProductoBE objPedidoProductoBE = new Pedido_ProductoBE();
            CarritoBC objCarritoBC = new CarritoBC();

            try
            {
                if (Tools.EstaLogueado())
                {
                    CarritoBE objCarritoBE = (CarritoBE)Session["CARRITO"];

                    //objPedidoBE.Id_Pedido = objPedidoBC.Insert_Pedido_Completo(objPedidoBE);
                    //objCarritoBC.Delete_Carrito_Total(((UsuarioBE)Session["USUARIO"]).Id_Usuario);

                    //Enviar_Confirmacion();

                    if (objCarritoBE.Id_Forma_Pago == (int)FormaPago.PagoEfectivo)
                    {
                        Response.Redirect("/PagoEfectivo");
                    }
                    else
                    {
                        Response.Redirect("/Inicio");
                        Session["CARRITO"] = new CarritoBE();
                    }
                }
            }
            catch (Exception ex)
            {
                Tools.Error(GetType(), this, ex);
            }
        }
Exemplo n.º 23
0
    private bool LeerArchivoExcel(string RutaCompleta, string Hoja, string extension)
    {
        try
        {
            string ConexionString = string.Format("Data Source={0}", RutaCompleta);

            if (extension == ".xls")
            {
                ConexionString += string.Format(";Provider=Microsoft.Jet.OLEDB.4.0;Extended Properties='Excel 8.0;HDR=NO;IMEX=1'");
            }
            else
            {
                ConexionString += string.Format(";Provider=Microsoft.ACE.OLEDB.12.0;Extended Properties='Excel 12.0 Xml;HDR=NO;IMEX=1'");
            }


            using (OleDbConnection Conexion = new OleDbConnection(ConexionString))
            {
                Conexion.Open();
                DataTable dtSchema = Conexion.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, new object[] { null, null, null, "TABLE" });
                string    Sheet1   = dtSchema.Rows[0].Field <string>("TABLE_NAME");
                //   Conexion.Close();

                string Sql = string.Format("SELECT * FROM [{0}]", Sheet1);

                OleDbDataAdapter Adapter = new OleDbDataAdapter(Sql, Conexion);
                DataTable        DT      = new DataTable("Excel");
                Adapter.Fill(DT);
                DataTable dtIn = new DataTable();
                int       y    = 0;
                while (y < DT.Columns.Count) //Definir columnas datatable y sus nombres
                {
                    if (String.IsNullOrWhiteSpace(DT.Rows[0][y].ToString()))
                    {
                        break;
                    }
                    dtIn.Columns.Add(DT.Rows[0][y].ToString(), Type.GetType("System.String"));
                    if (!string.IsNullOrEmpty(DT.Rows[0][y].ToString()))
                    {
                        DT.Columns[y].ColumnName = DT.Rows[0][y].ToString();
                    }
                    else
                    {
                        break;
                    }
                    y++;
                }
                DT.Rows.RemoveAt(0);
                foreach (DataRow dr in DT.Rows)
                {
                    int x = 0;
                    while (x < y)
                    {
                        if (!String.IsNullOrWhiteSpace(dr[x].ToString()))
                        {
                            dtIn.ImportRow(dr);
                            break;
                        }
                        x++;
                    }
                }

                DataTable dtOut = new PedidoBC().IngresarExcel(dtIn, user.USUA_ID);
                gv_listar.DataSource = dtOut;
                gv_listar.DataBind();
                btn_procesar.Enabled = true;
                Conexion.Close();
                return(true);
            }
        }
        catch (Exception ex)
        {
            btn_procesar.Enabled = false;
            utils.ShowMessage(this, ex.Message, "error", false);
            return(false);
        }
    }