Exemplo n.º 1
0
        public List <CENPuntoEntrega> ListarPuntosEntrega(Int32 auxCodPersona)
        {
            List <CENPuntoEntrega> listPuntosEntrega = new List <CENPuntoEntrega>();

            //DESCRIPCION: Lista de Puntos de Entrega del Cliente
            CADConexion   CadCx = new CADConexion(); //conexion
            SqlDataReader dr;                        //Data reader

            try
            {
                using (SqlConnection connection = new SqlConnection(CadCx.CxSQL()))
                {
                    connection.Open();
                    using (SqlCommand command = new SqlCommand("pa_listar_puntosEntrega_Cliente", connection))
                    {
                        command.CommandType = CommandType.StoredProcedure;
                        command.Parameters.Add("@p_codPersona", SqlDbType.Int).Value = auxCodPersona;

                        command.CommandTimeout = CENConstante.g_const_0;
                        dr = command.ExecuteReader();

                        while (dr.Read())
                        {
                            CENPuntoEntrega dataPuntoEntrega = new CENPuntoEntrega();

                            dataPuntoEntrega.ntraPuntoEntrega = Convert.ToInt32(dr["ntraPuntoEntrega"]);
                            if (dr["ordenEntrega"] != DBNull.Value)
                            {
                                dataPuntoEntrega.ordenEntrega = Convert.ToInt16(dr["ordenEntrega"]);
                            }
                            if (dr["codUbigeo"] != DBNull.Value)
                            {
                                dataPuntoEntrega.codUbigeo = Convert.ToString(dr["codUbigeo"]);
                            }
                            else
                            {
                                dataPuntoEntrega.codUbigeo = "";
                            }
                            dataPuntoEntrega.coordenadaX = Convert.ToString(dr["coordenadaX"]);
                            dataPuntoEntrega.coordenadaY = Convert.ToString(dr["coordenadaY"]);
                            dataPuntoEntrega.direccion   = Convert.ToString(dr["direccion"]);
                            if (dr["referencia"] != DBNull.Value)
                            {
                                dataPuntoEntrega.referencia = Convert.ToString(dr["referencia"]);
                            }

                            listPuntosEntrega.Add(dataPuntoEntrega);
                        }
                    }
                    dr.Close();
                    connection.Close();
                }
                return(listPuntosEntrega);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
 public void registrarEliminarPuntoEntrega(int tPro, CENPuntoEntrega data)
 {
     try
     {
         CADCliente consulta = new CADCliente();
         consulta.registrarEliminarPuntoEntrega(tPro, data);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 3
0
        public void registrarEliminarPuntoEntrega(int tPro, CENPuntoEntrega data)
        {
            //DESCRIPCION: Registrar los Puntos de Entrega del Cliente
            CADConexion CadCx = new CADConexion();

            try
            {
                using (SqlConnection connection = new SqlConnection(CadCx.CxSQL()))
                {
                    connection.Open();
                    using (SqlCommand command = new SqlCommand("pa_registrar_modificar_punto_entrega", connection))
                    {
                        command.CommandType = CommandType.StoredProcedure;
                        command.Parameters.Add("@p_proceso", SqlDbType.TinyInt).Value = tPro;
                        command.Parameters.Add("@p_ntra", SqlDbType.Int).Value        = data.ntraPuntoEntrega;
                        command.Parameters.Add("@p_coordenadaX", SqlDbType.VarChar, CENConstante.g_const_100).Value = data.coordenadaX;
                        command.Parameters.Add("@p_coordenadaY", SqlDbType.VarChar, CENConstante.g_const_100).Value = data.coordenadaY;
                        command.Parameters.Add("@p_codUbigeo", SqlDbType.Char, CENConstante.g_const_6).Value        = data.codUbigeo;
                        command.Parameters.Add("@p_direccion", SqlDbType.VarChar, CENConstante.g_const_200).Value   = data.direccion;
                        command.Parameters.Add("@p_referencia", SqlDbType.VarChar, CENConstante.g_const_200).Value  = data.referencia;
                        command.Parameters.Add("@p_ordenEntrega", SqlDbType.SmallInt).Value = data.ordenEntrega;
                        command.Parameters.Add("@p_codPersona", SqlDbType.Int).Value        = data.codPersona;
                        command.Parameters.Add("@p_usuario", SqlDbType.VarChar, CENConstante.g_const_20).Value = "";
                        command.Parameters.Add("@p_ip", SqlDbType.VarChar, CENConstante.g_const_20).Value      = "";
                        command.Parameters.Add("@p_mac", SqlDbType.VarChar, CENConstante.g_const_20).Value     = "";

                        command.CommandTimeout = CENConstante.g_const_0;
                        command.ExecuteReader();
                    }
                    connection.Close();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }