Exemplo n.º 1
0
        public frmUpPedido(int strcodigo)
        {
            //emp = be;
            InitializeComponent();

               // txtCodVendedor.Text = be.Id.ToString();
            //txtNomVendedor.Text = be.Nombres + " " + be.Apellidos;

            ped = pdl.getpedido(strcodigo);

            cli = clibl.getcliente(ped.IDCliente);

            txtCodCliente.Text = cli.IdCliente.ToString();
            txtNombreCliente.Text = cli.Nombre.ToString();
            /*NO SE CARGA EL ALMACEN POR QUE NO SE GUARDA*/
            //al = albl.getalmacen(ped.);

            modbe = modbl.getmodalidad(cli.IDModalidadCredito);

            txtmodalidad.Text = modbe.Descripcion;

            emp = empbl.getvendedor(ped.IDVendedor);
            txtCodVendedor.Text = emp.Id.ToString();
            txtNomVendedor.Text = emp.Nombres.ToString();

            dtdetalle.Columns.Add("Codigo", typeof(String));
            dtdetalle.Columns.Add("Nombre", typeof(String));
            dtdetalle.Columns.Add("Precio", typeof(Double));
            dtdetalle.Columns.Add("Cantidad", typeof(Int32));
            dtdetalle.Columns.Add("DetallePedidoId", typeof(Int32));

            actualizarDetalle();
            actualizarmontos();
        }
Exemplo n.º 2
0
        public ClienteBE getcliente(int clienteid)
        {
            ClienteBE be = new ClienteBE();

            SqlConnection con = DConexion.obtenerBD();

            string textoCmd = "sp_vt_getcliente";

            SqlCommand cmd = new SqlCommand(textoCmd, con);

            cmd.CommandType = CommandType.StoredProcedure;

            // 3. add parameter to command, which
            // will be passed to the stored procedure
            cmd.Parameters.Add(
                new SqlParameter("@CLIENTEID", clienteid));

            SqlDataReader dr = cmd.ExecuteReader();

            if (dr.HasRows)
            {
                while (dr.Read())
                {

                    if (object.ReferenceEquals(dr["ClienteId"], DBNull.Value))
                    {
                        be.IdCliente = 0;
                    }
                    else
                    {
                        be.IdCliente = int.Parse(dr["ClienteId"].ToString());
                    }

                    if (object.ReferenceEquals(dr["codigo"], DBNull.Value))
                    {
                        be.Codigo = null;
                    }
                    else
                    {
                        be.Codigo = dr["codigo"].ToString();
                    }

                    if (object.ReferenceEquals(dr["DocIdentidad"], DBNull.Value))
                    {
                        be.DocIdentidad = null;
                    }
                    else
                    {
                        be.DocIdentidad = dr["DocIdentidad"].ToString();
                    }

                    if (object.ReferenceEquals(dr["Nombre"], DBNull.Value))
                    {
                        be.Nombre = null;
                    }
                    else
                    {
                        be.Nombre = dr["Nombre"].ToString();
                    }

                    if (object.ReferenceEquals(dr["CodigoModalidad"], DBNull.Value))
                    {
                        be.IDModalidadCredito = 0;
                    }
                    else
                    {
                        be.IDModalidadCredito = int.Parse(dr["CodigoModalidad"].ToString());
                    }

                    if (object.ReferenceEquals(dr["LineaCredito"], DBNull.Value))
                    {
                        be.LineaCredito = 0;
                    }
                    else
                    {
                        be.LineaCredito = Decimal.Parse(dr["LineaCredito"].ToString());
                    }

                    if (object.ReferenceEquals(dr["TipoDocIdentidadId"], DBNull.Value))
                    {
                        be.IDTipoDocIdentidad = 0;
                    }
                    else
                    {
                        be.IDTipoDocIdentidad = int.Parse(dr["TipoDocIdentidadId"].ToString());
                    }

                }
            }

            return be;
        }