Example #1
0
        // GET: Aporte/Edit/5
        public ActionResult Edit(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            string idDecrypted = MiUtil.desEncriptar(id);
            int    intId       = Convert.ToInt32(idDecrypted);


            //socio socio = db.socio.Find(intSocioId);

            //ViewBag.socioNombre = socio.Nombre;

            aporte aporte = db.aporte.Find(intId);

            if (aporte == null)
            {
                return(HttpNotFound());
            }

            int empresaId = 0;

            if (Session["EmpresaId"] != null)
            {
                Int32.TryParse(Session["EmpresaId"].ToString(), out empresaId);
            }

            ViewBag.idSocio          = aporte.SocioId.ToString();
            ViewBag.EmpresaId        = empresaId;
            ViewBag.ConceptoAporteId = new SelectList(db.conceptoaporte.Where(c => c.Estado == true && c.EmpresaId == empresaId).OrderBy(e => e.Nombre), "ConceptoAporteId", "Nombre", aporte.ConceptoAporteId);
            ViewBag.SocioId          = new SelectList(db.socio.Where(c => c.Estado == true).OrderBy(e => e.Nit), "SocioId", "Nit", aporte.SocioId);
            return(View(aporte));
        }
Example #2
0
        // GET: Aporte/Create
        public ActionResult Create(string id)
        {
            int empresaId = 0;

            if (Session["EmpresaId"] != null)
            {
                Int32.TryParse(Session["EmpresaId"].ToString(), out empresaId);
            }
            string socioDecrypted = MiUtil.desEncriptar(id);
            int    intSocioId     = Convert.ToInt32(socioDecrypted);

            socio socio = db.socio.Find(intSocioId);

            ViewBag.idSocio     = intSocioId.ToString();
            ViewBag.socioNombre = socio.Nombre;

            ViewBag.ConceptoAporteId = new SelectList(db.conceptoaporte.Where(c => c.Estado == true && c.EmpresaId == empresaId).OrderBy(e => e.Nombre), "ConceptoAporteId", "Nombre");
            ViewBag.EmpresaId        = empresaId;

            // ViewBag.SocioId = new SelectList(db.socio.Where(c=>c.Estado==true).OrderBy(e=>e.Nit), "SocioId", "Nit");
            aporte a = new aporte();

            a.SocioId = intSocioId;
            a.Fecha   = DateTime.Now;
            a.Estado  = true;
            return(View(a));

            //return View();
        }
Example #3
0
        public ActionResult DeleteConfirmed(int id)
        {
            aporte aporte = db.aporte.Find(id);

            db.aporte.Remove(aporte);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #4
0
        // GET: Aporte/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            aporte aporte = db.aporte.Find(id);

            if (aporte == null)
            {
                return(HttpNotFound());
            }
            return(View(aporte));
        }
Example #5
0
 public ActionResult Create([Bind(Include = "AporteId,Valor,Fecha,SocioId,ConceptoAporteId,Observacion,Estado,CreadoPor,FechaCreacion,ModificadoPor,FechaModificacion")] aporte aporte,
                            int?EmpresaId)
 {
     if (ModelState.IsValid)
     {
         db.aporte.Add(aporte);
         db.SaveChanges();
         return(RedirectToAction("Index", new { socioId = MiUtil.encriptar(aporte.SocioId.ToString()) }));
     }
     ViewBag.EmpresaId        = EmpresaId;
     ViewBag.idSocio          = aporte.SocioId.ToString();
     ViewBag.ConceptoAporteId = new SelectList(db.conceptoaporte.Where(c => c.Estado == true && c.EmpresaId == EmpresaId).OrderBy(e => e.Nombre), "ConceptoAporteId", "Nombre", aporte.ConceptoAporteId);
     ViewBag.SocioId          = new SelectList(db.socio.Where(c => c.Estado == true).OrderBy(e => e.Nit), "SocioId", "Nit", aporte.SocioId);
     return(View(aporte));
 }
Example #6
0
        // GET: Aporte/Details/5
        public ActionResult Details(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            string socioDecrypted = MiUtil.desEncriptar(id);
            int    intSocioId     = Convert.ToInt32(socioDecrypted);
            aporte aporte         = db.aporte.Find(intSocioId);

            ViewBag.idSocio = aporte.SocioId.ToString();
            if (aporte == null)
            {
                return(HttpNotFound());
            }
            return(View(aporte));
        }
Example #7
0
        public ActionResult Edit([Bind(Include = "AporteId,Valor,Fecha,SocioId,ConceptoAporteId,Observacion,Estado,CreadoPor,FechaCreacion,ModificadoPor,FechaModificacion")] aporte aporte,
                                 int EmpresaId)
        {
            if (ModelState.IsValid)
            {
                db.Entry(aporte).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index", new { socioId = MiUtil.encriptar(aporte.SocioId.ToString()) }));
            }
            ViewBag.idSocio   = aporte.SocioId.ToString();
            ViewBag.EmpresaId = EmpresaId;
            //int intSocioId = Convert.ToInt32(socioDecrypted);
            // socio socio = db.socio.Find(intSocioId);
            //ViewBag.idSocio = intSocioId.ToString();

            ViewBag.ConceptoAporteId = new SelectList(db.conceptoaporte.Where(c => c.Estado == true && c.EmpresaId == EmpresaId).OrderBy(e => e.Nombre), "ConceptoAporteId", "Nombre", aporte.ConceptoAporteId);
            ViewBag.SocioId          = new SelectList(db.socio.Where(c => c.Estado == true).OrderBy(e => e.Nit), "SocioId", "Nit", aporte.SocioId);
            return(View(aporte));
        }