//
        // GET: /CuentaGastosDetalle/Edit/5

        public ActionResult Edit(int id)
        {
            CuentaGastosDetalle cgd = new CuentaGastosDetalle()
            {
                IdCuentaGastosDetalle = id
            };
            var model = cgd.verCuentaGastosDetalle();

            ViewBag.CuentaGastoId = cgd.CuentaGastoId;
            ConceptosServiceModel        cs  = new ConceptosServiceModel();
            List <ConceptosServiceModel> lis = new List <ConceptosServiceModel>();

            //
            lis.Add(new ConceptosServiceModel
            {
                IdConcepto = 0,
                Nombre     = "Selecciona una opcion"
            });
            foreach (ConceptosServiceModel concepto in cs.GetListCuentaGastos())
            {
                lis.Add(new ConceptosServiceModel
                {
                    IdConcepto = concepto.IdConcepto,
                    Nombre     = concepto.Nombre
                });
            }
            SelectList lista = new SelectList(lis, "IdConcepto", "Nombre", 0);

            ViewBag.Lista = lista;
            return(View(model));
        }
        public JsonResult SaveCreate(ConceptosServiceModel collection)
        {
            ConceptosServiceModel cs = new ConceptosServiceModel();
            bool   status            = false;
            string message           = "";

            if (ModelState.IsValid)
            {
                // TODO: Add insert logic here()
                cs.Nombre      = collection.Nombre;
                cs.Descripcion = collection.Descripcion;
                if (cs.CreaConcepto())
                {
                    status  = true;
                    message = "Thank you for submit your query";
                }
            }
            else
            {
                message = "Failed! Please try again";
            }
            return(new JsonResult {
                Data = new { status = status, message = message }
            });
        }
        //
        // GET: /Conceptos/

        public ActionResult Index()
        {
            ConceptosServiceModel cs = new ConceptosServiceModel();

            ViewBag.Models = cs.GetListCuentaGastos();;
            return(View());
        }
        //
        // GET: /CuentaGastosDetalle/Create/1

        public ActionResult Create(int id)
        {
            if (id > 0)
            {
                CuentaGastos cg = new CuentaGastos()
                {
                    IdCuentaGastos = id
                };

                CuentaGastosDetalle cgd = new CuentaGastosDetalle();
                ViewBag.Model = cg.verCuentaGastos();
                ConceptosServiceModel        cs  = new ConceptosServiceModel();
                List <ConceptosServiceModel> lis = new List <ConceptosServiceModel>();
                //
                lis.Add(new ConceptosServiceModel
                {
                    IdConcepto = 0,
                    Nombre     = "Selecciona una opcion"
                });
                foreach (ConceptosServiceModel concepto in cs.GetListCuentaGastos())
                {
                    lis.Add(new ConceptosServiceModel {
                        IdConcepto = concepto.IdConcepto,
                        Nombre     = concepto.Nombre
                    });
                }
                SelectList lista = new SelectList(lis, "IdConcepto", "Nombre", 0);
                ViewBag.Lista = lista;
                return(View());
            }
            else
            {
                return(RedirectToAction("Index", new { id = id }));
            }
        }
        public void SConceptosBorraConcepto()
        {
            ConceptosServiceModel target = new ConceptosServiceModel(); // TODO: Initialize to an appropriate value
            bool actual;

            target.IdConcepto = 14;
            actual            = target.BorraConcepto();
            Assert.IsTrue(actual);
        }
        public void SConceptosCreaConcepto()
        {
            ConceptosServiceModel target = new ConceptosServiceModel(); // TODO: Initialize to an appropriate value
            bool actual;

            target.Nombre      = "Pruebas";
            target.Descripcion = "Esto es una cuenta de pruebas";
            actual             = target.CreaConcepto();
            Assert.IsTrue(actual);
        }
        public void SConceptosGetCuentaGastosValueTest()
        {
            ConceptosServiceModel target = new ConceptosServiceModel(); // TODO: Initialize to an appropriate value
            bool actual;

            target.IdConcepto = 1;
            actual            = target.GetCuentaGastosConceptos();
            Assert.AreNotEqual(string.Empty, target.Nombre, true);
            //Assert.Inconclusive("Verify the correctness of this test method.");
        }
        public void SConceptosGetCuentaGastosInstanciaTest()
        {
            ConceptosServiceModel target = new ConceptosServiceModel(); // TODO: Initialize to an appropriate value
            bool expected = true;                                       // TODO: Initialize to an appropriate value
            bool actual;

            target.IdConcepto = 1;
            actual            = target.GetCuentaGastosConceptos();
            Assert.AreEqual(expected, actual);
            //Assert.Inconclusive("Verify the correctness of this test method.");
        }
        //
        // GET: /CuentaGasto/Update

        public ActionResult Update(int id)
        {
            ConceptosServiceModel cs = new ConceptosServiceModel();

            cs.IdConcepto = id;
            if (cs.GetCuentaGastosConceptos())
            {
                //ViewBag.Model = cs;
            }

            return(View(cs));
        }
        public void SConceptosGetCuentaGastosInstanciaTest()
        {
            ConceptosServiceModel target = new ConceptosServiceModel(); // TODO: Initialize to an appropriate value
            bool expected = true;
            bool actual;

            target.Nombre      = "PruebaAutomatica";
            target.Descripcion = "Generacion de pruebas automaticas";
            actual             = target.CreaConcepto();
            actual             = target.GetCuentaGastosConceptos();
            Assert.AreEqual(expected, actual);
            //Assert.Inconclusive("Verify the correctness of this test method.");
            target.Descripcion = "Actualizado automaticamente";
            actual             = target.ActualizaConcepto();
            Assert.AreEqual(expected, actual);
            actual = target.BorraConcepto();
            Assert.AreEqual(expected, actual);
        }
示例#11
0
        //
        // POST: /CuentaGasto/Update

        public ActionResult Delete(int id)
        {
            ConceptosServiceModel cs = new ConceptosServiceModel();

            try
            {
                // TODO: Add insert logic here()
                cs.IdConcepto = id;
                if (cs.BorraConcepto())
                {
                    return(RedirectToAction("Index"));
                }
            }
            catch
            {
                return(View(cs));
            }
            return(View(cs));
        }
示例#12
0
        public ActionResult Create(FormCollection collection)
        {
            ConceptosServiceModel cs = new ConceptosServiceModel();

            try
            {
                // TODO: Add insert logic here()
                cs.Nombre      = collection["Nombre"];
                cs.Descripcion = collection["Descripcion"];
                if (cs.CreaConcepto())
                {
                    return(RedirectToAction("Index"));
                }
            }
            catch
            {
                return(View(cs));
            }
            return(View(cs));
        }
示例#13
0
        public JsonResult IndexRest()
        {
            ConceptosServiceModel cs = new ConceptosServiceModel();

            return(Json(cs.GetListCuentaGastos(), JsonRequestBehavior.AllowGet));
        }