示例#1
0
 public static List <ListaDePrecioModels> listarListaDePrecio(ListaDePrecioModels lista)
 {
     try
     {
         using (DataContext dc = new DataContext(catalogo, "FR_ListarListaDePrecio", CommandType.StoredProcedure))
         {
             dc.parameters.AddWithValue("CodAux", lista.CodAux);
             return(dc.executeQuery <ListaDePrecioModels>());
         }
     }
     catch (Exception ex)
     {
         string error = ex.ToString();
         return(null);
     }
 }
示例#2
0
        public ActionResult NotaDeVenta(string CodAux, string NomAux, string anterior)
        {
            NotadeVentaCabeceraModels NVC = new NotadeVentaCabeceraModels();

            ViewBag.CodAux   = CodAux;
            ViewBag.NomAux   = NomAux;
            ViewBag.Anterior = anterior;
            NVC.NVNumero     = 0;
            NVC.NumOC        = "";
            NVC.NumReq       = 0;

            ClientesModels cliente = new ClientesModels
            {
                CodAux = CodAux
            };

            List <ClientesModels> clientes = ClientesDAO.GetClientes(cliente);

            ViewBag.CorreoCliente = clientes[0].EMail;

            //Se agrega la cabecera
            List <NotadeVentaCabeceraModels> lnvc = NotaDeVentaDAO.AgregarNV(NVC);


            ViewBag.numeronota = lnvc;

            CondicionVentasModels conven = new CondicionVentasModels();

            conven.CodAux = CodAux.ToString();

            //Se lista(n) la(s) condicion(es) de venta(s)
            List <CondicionVentasModels> lcondicion = CondicionesVentaDAO.listarConVen(conven);

            ViewBag.condicion = lcondicion;

            ClientesModels contacto = new ClientesModels();

            contacto.CodAux = CodAux.ToString();
            contacto.NomAux = Session["nombre"].ToString();

            //Se ubica la lista de contactos
            List <ClientesModels> contactos = ClientesDAO.BuscarContacto(contacto);

            if (contactos == null)
            {
                ViewBag.contactos  = contactos;
                ViewBag.vcontactos = 0;
            }
            else
            {
                ViewBag.contactos  = contactos;
                ViewBag.vcontactos = 1;
            }

            DireccionDespachoModels direc = new DireccionDespachoModels();

            direc.CodAxD = CodAux.ToString();

            //Se lista(n) la(s) dirección(es) de despacho
            List <DireccionDespachoModels> direciones = ClientesDAO.BuscarDirecDespach(direc);

            if (direciones == null)
            {
                ViewBag.vdirecc = 0;
            }
            else
            {
                ViewBag.vdirecc = 1;
            }

            ViewBag.direccion = direciones;
            ViewBag.codigo    = CodAux;
            ViewBag.nombre    = NomAux;

            if (anterior == "1")
            {
                ViewBag.anterior = "Mis Clientes";
                ViewBag.page     = "Misclientes";
            }
            else if (anterior == "2")
            {
                ViewBag.anterior = "Mis Clientes";
                ViewBag.page     = "";
            }
            else if (anterior == "3")
            {
                ViewBag.anterior = "Ruta";
                ViewBag.page     = "";
            }

            ListaDePrecioModels ListPrecio = new ListaDePrecioModels();

            ListPrecio.CodAux = CodAux.ToString();

            //Se listan los precios
            //List<ListaDePrecioModels> ListDePrecios = ListaDePrecioDAO.listarListaDePrecio(ListPrecio);

            //ViewBag.lista = ListDePrecios;

            //Se listan los centros de costos
            List <CentrodeCostoModels> lcc = CentroDeCostoDAO.listarCC();

            ViewBag.cc = lcc;

            //NumNV Softland
            //List<NotadeVentaCabeceraModels> NVSoft = NotaDeVentaDAO.BuscarNvNumSoft();
            //ViewBag.NVnum = NVSoft[0].NVNumero;

            return(View());
        }
示例#3
0
        public ActionResult NotaDeVenta(string CodAux, string NomAux, string anterior)
        {
            if (Session["VenCod"] == null)
            {
                return(RedirectToAction("SesionExpirada", "Error"));
            }
            var id_    = Session["ID"].ToString();
            var VenCod = Session["VenCod"].ToString();
            var id     = id_;

            NotadeVentaCabeceraModels NVC = new NotadeVentaCabeceraModels();

            ViewBag.CodAux   = CodAux;
            ViewBag.NomAux   = NomAux;
            ViewBag.Anterior = anterior;
            NVC.NVNumero     = 0;
            NVC.NumOC        = "";
            NVC.NumReq       = 0;

            ClientesModels cliente = new ClientesModels
            {
                CodAux = CodAux
            };

            List <ClientesModels> contactoCorreos = ClientesDAO.GetContacto(cliente);
            List <ClientesModels> clientes        = ClientesDAO.GetClientes(cliente);
            List <ClientesModels> Contacto        = ClientesDAO.GetInfoContacto(cliente);

            if (Contacto == null || Contacto.Count < 0)
            {
                TempData["Mensaje"] = "CLIENTE NO TIENE CONTACTO<br>";
                return(RedirectToAction("MisClientes", "Ventas", new { cod = VenCod, ID = id }));
            }
            for (int i = 0; i < Contacto.Count; i++)
            {
                if (Contacto[i].EMail == "" || Contacto[i].EMail == null)
                {
                    TempData["Mensaje"] = "CLIENTE SELECCIONADO NO CUENTA CON CORREO EN CONTACTOS. " + Contacto[i].NomCon + "<br>";
                    return(RedirectToAction("MisClientes", "Ventas", new { cod = VenCod, ID = id }));
                }
                else
                {
                    ViewBag.CorreoCliente = Contacto[i].EMail;
                }
            }


            //Se agrega la cabecera
            List <NotadeVentaCabeceraModels> lnvc = NotaDeVentaDAO.AgregarNV(NVC);


            ViewBag.numeronota = lnvc;

            CondicionVentasModels conven = new CondicionVentasModels();

            conven.CodAux = CodAux.ToString();

            //Se lista(n) la(s) condicion(es) de venta(s)
            List <CondicionVentasModels> lcondicion = CondicionesVentaDAO.listarConVen(conven);

            ViewBag.condicion = lcondicion;

            ClientesModels contacto = new ClientesModels();

            contacto.CodAux = CodAux.ToString();
            contacto.NomAux = Session["nombre"].ToString();

            //Se ubica la lista de contactos
            List <ClientesModels> contactos = ClientesDAO.BuscarContacto(contacto);

            if (contactos == null)
            {
                ViewBag.contactos  = contactos;
                ViewBag.vcontactos = 0;
            }
            else
            {
                ViewBag.contactos  = contactos;
                ViewBag.vcontactos = 1;
            }

            DireccionDespachoModels direc = new DireccionDespachoModels();

            direc.CodAxD = CodAux.ToString();

            //Se lista(n) la(s) dirección(es) de despacho
            List <DireccionDespachoModels> direciones = ClientesDAO.BuscarDirecDespach(direc);

            if (direciones == null)
            {
                ViewBag.vdirecc = 0;
            }
            else
            {
                ViewBag.vdirecc = 1;
            }

            ViewBag.direccion = direciones;
            ViewBag.codigo    = CodAux;
            ViewBag.nombre    = NomAux;

            if (anterior == "1")
            {
                ViewBag.anterior = "Mis Clientes";
                ViewBag.page     = "Misclientes";
            }
            else if (anterior == "2")
            {
                ViewBag.anterior = "Mis Clientes";
                ViewBag.page     = "";
            }
            else if (anterior == "3")
            {
                ViewBag.anterior = "Ruta";
                ViewBag.page     = "";
            }

            ListaDePrecioModels ListPrecio = new ListaDePrecioModels();

            ListPrecio.CodAux = CodAux.ToString();

            //Se listan los precios
            List <ListaDePrecioModels> ListDePrecios = ListaDePrecioDAO.listarListaDePrecio(ListPrecio);

            ViewBag.lista = ListDePrecios;

            //Se listan los centros de costos
            List <CentrodeCostoModels> lcc = CentroDeCostoDAO.listarCC();

            ViewBag.cc = lcc;

            return(View());
        }