Exemplo n.º 1
0
        //METODO PARA CARGAR COMBOS
        public void cargaCombos()
        {
            ServiciosBLL serv = new ServiciosBLL();

            serv.listarRoles(cmbRol);
            serv.listarIdiomas(cmbIdioma);
        }
Exemplo n.º 2
0
        // GET: Servicios
        public ActionResult Index()
        {
            var serBLL = new ServiciosBLL();
            List <tblServicio> listaServicios = serBLL.RetrieveAll();

            var     aerBLL = new AreasBLL();
            tblArea objArea;

            vmListaServicios objTemp;

            List <vmListaServicios> listaFinal = new List <vmListaServicios>();

            foreach (var i in listaServicios)
            {
                objArea = aerBLL.RetrieveAreaByID(i.idArea);
                string nombreArea = objArea.nombreArea;

                objTemp = new vmListaServicios()
                {
                    idservicios     = i.idservicios,
                    serviciosNombre = i.serviciosNombre,
                    idArea          = nombreArea
                };
                listaFinal.Add(objTemp);
            }

            return(View(listaFinal));
        }
Exemplo n.º 3
0
        // GET: Servicios/Edit/5
        public ActionResult Edit(int id)
        {
            var            serBLL     = new ServiciosBLL();
            tblServicio    objSer     = serBLL.RetrieveServicioByID(id);
            var            areaBLL    = new AreasBLL();
            List <tblArea> listaAreas = areaBLL.RetrieveAll();

            ViewBag.idArea = new SelectList(listaAreas, "idArea", "nombreArea", objSer.idArea);
            return(View(objSer));
        }
        public void LlenarArticulo()
        {
            var lista = ServiciosBLL.GetList();

            if (lista.Count <= 0)
            {
                var servicios  = new Servicios("Lavado");
                var servicios1 = new Servicios("Planchado");
                var servicios2 = new Servicios("Lavado y Planchado");

                ServiciosBLL.Insertar(servicios);
                ServiciosBLL.Insertar(servicios1);
                ServiciosBLL.Insertar(servicios2);
            }
            ServicioscomboBox.DataSource    = lista;
            ServicioscomboBox.ValueMember   = "ServicioId";
            ServicioscomboBox.DisplayMember = "Nombre";
        }
Exemplo n.º 5
0
        public ActionResult Edit(tblServicio servicio)
        {
            var          serBLL = new ServiciosBLL();
            ActionResult Result = null;

            try
            {
                if (ModelState.IsValid)
                {
                    serBLL.Update(servicio);
                    Result = RedirectToAction("Index");
                }
            }
            catch
            {
                return(View());
            }
            return(Result);
        }
Exemplo n.º 6
0
        public JsonResult DeleteServicio(int id)
        {
            var          serBLL  = new ServiciosBLL();
            wmJsonResult objJson = new wmJsonResult();

            try
            {
                tblServicio servicio = serBLL.RetrieveServicioByID(id);

                if (servicio != null)
                {
                    bool banderita = serBLL.Delete(id);

                    if (banderita == true)
                    {
                        objJson.bandera = true;
                        objJson.mensaje = "El Servicio se eliminó correctamente";
                    }
                    else
                    {
                        objJson.bandera = false;
                        objJson.mensaje = "El Servicio NO se eliminó correctamente";
                    }
                }
                else
                {
                    objJson.bandera = false;
                    objJson.mensaje = "El Servicio no se encontró";
                }
            }
            catch
            {
                objJson.bandera = false;
                objJson.mensaje = "Ocurrio una excepcion al eliminar el Servicio";
            }

            return(Json(objJson, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 7
0
        public ActionResult Create(tblServicio servicio)
        {
            var          serBLL = new ServiciosBLL();
            ActionResult Result = null;

            try
            {
                if (ModelState.IsValid)
                {
                    serBLL.Create(servicio);
                    Result = RedirectToAction("Index");
                }
                else
                {
                    Result = RedirectToAction("Index");
                }
            }
            catch
            {
                Result = RedirectToAction("Index");
            }
            return(Result);
        }
 public void GetListTest()
 {
     Assert.IsNotNull(ServiciosBLL.GetList());
 }
        public void BuscarTest()
        {
            int s = 1;

            Assert.IsNull(ServiciosBLL.Buscar(s));
        }
 public void EliminarTest()
 {
     Assert.IsTrue(ServiciosBLL.Eliminar(new Servicios(1, "Lavado")));
 }
 public void InsertarTest()
 {
     Assert.IsTrue(ServiciosBLL.Insertar(new Servicios(1, "Lavado")));
 }