예제 #1
0
        public void cargarDatos(int?eventid)
        {
            EventOnEntities context = new EventOnEntities();

            this.ListBusiness = context.Businesses.ToList();
            this.ListCategory = context.Categories.ToList();

            tieneValor = false;
            if (eventid.HasValue)
            {
                Event objEvent = context.Events
                                 .Include("Business")
                                 .Include("Category")
                                 .FirstOrDefault(x => x.idEvent == eventid);

                this.eventID         = eventid;
                objectEvent.idEvent  = objEvent.idEvent;
                objectEvent.name     = objEvent.name;
                objectEvent.place    = objEvent.place;
                objectEvent.date     = objEvent.date;
                objectEvent.Business = objEvent.Business;
                objectEvent.Category = objEvent.Category;
                tieneValor           = true;
            }
        }
예제 #2
0
        public ActionResult Login(LoginViewModel objViewModel)
        {
            try
            {
                EventOnEntities context    = new EventOnEntities();
                User            objUsuario = context.Users
                                             .FirstOrDefault(x => x.userName == objViewModel.userName && x.password == objViewModel.password);

                if (objUsuario == null)
                {
                    Console.WriteLine("ZAVAMON");
                    TempData["MensajeLogin"] = "******";
                    return(View(objViewModel));
                }
                FormsAuthentication.SetAuthCookie(objUsuario.userName, false);
                Session["objUsuario"] = objUsuario;

                return(RedirectToAction("Index", "Home"));
            }
            catch (Exception ex)
            {
                //Console.WriteLine("ZAVAMON");
                TempData["MensajeLoginError"] = "Error! " + ex.Message.ToString();
                return(View(objViewModel));
            }
        }
예제 #3
0
        public void RegistrarSector(Sector _objSector)
        {
            EventOnEntities context = new EventOnEntities();

            _objSector.estado = "A";
            context.Sectors.Add(_objSector);
            context.SaveChanges();
        }
예제 #4
0
        public void EliminarEvent(int EventId)
        {
            EventOnEntities context  = new EventOnEntities();
            Event           objEvent = context.Events.FirstOrDefault(x => x.idEvent == EventId);

            objEvent.estado = "I";
            context.SaveChanges();
        }
예제 #5
0
        public void RegistrarBusiness(Business _objBusiness)
        {
            EventOnEntities context = new EventOnEntities();

            _objBusiness.estado = "A";
            context.Businesses.Add(_objBusiness);
            context.SaveChanges();
        }
예제 #6
0
        public void RegistrarEvento(Event _objEvent)
        {
            EventOnEntities context = new EventOnEntities();

            _objEvent.estado = "A";
            context.Events.Add(_objEvent);
            context.SaveChanges();
        }
예제 #7
0
        public IndexValueViewModel()
        {
            EventOnEntities context = new EventOnEntities();

            nroBusiness = context.Businesses.Count();
            nroEvent    = context.Events.Count();
            nroSector   = context.Sectors.Count();
        }
예제 #8
0
        public void EliminarBusiness(int BusinessId)
        {
            EventOnEntities context     = new EventOnEntities();
            Business        objBusiness = context.Businesses.FirstOrDefault(x => x.idBusiness == BusinessId);

            objBusiness.estado = "I";
            context.SaveChanges();
        }
예제 #9
0
        public void EliminarSector(int sectorId)
        {
            EventOnEntities context   = new EventOnEntities();
            Sector          objSector = context.Sectors.FirstOrDefault(x => x.idSector == sectorId);

            objSector.estado = "I";
            context.SaveChanges();
        }
예제 #10
0
        public void ModificarSector(Sector _objSector)
        {
            EventOnEntities context   = new EventOnEntities();
            Sector          objSector = context.Sectors.FirstOrDefault(x => x.idSector == _objSector.idSector);

            objSector.sectorName = _objSector.sectorName;
            objSector.estado     = "A";
            context.SaveChanges();
        }
예제 #11
0
        public bool SectorExiste(string _nombresector)
        {
            EventOnEntities context   = new EventOnEntities();
            Sector          objSector = context.Sectors.FirstOrDefault(x => x.sectorName == _nombresector);

            if (objSector != null)
            {
                return(true);
            }
            return(false);
        }
예제 #12
0
        public void fill()
        {
            EventOnEntities context = new EventOnEntities();

            if (!string.IsNullOrEmpty(Filtro))
            {
                ListSector = context.Sectors
                             .Where(x => x.estado == "A" && x.sectorName.ToUpper().Contains(Filtro.ToUpper()))
                             .ToList();
            }
        }
예제 #13
0
        public bool EventExiste(string _nombreevento)
        {
            EventOnEntities context  = new EventOnEntities();
            Event           objEvent = context.Events.FirstOrDefault(x => x.name == _nombreevento);

            if (objEvent != null)
            {
                return(true);
            }
            return(false);
        }
예제 #14
0
        public bool BusinessExiste(string _nombrebusiness)
        {
            EventOnEntities context     = new EventOnEntities();
            Business        objBusiness = context.Businesses.FirstOrDefault(x => x.businessName == _nombrebusiness);

            if (objBusiness != null)
            {
                return(true);
            }
            return(false);
        }
예제 #15
0
        public void fill()
        {
            EventOnEntities context = new EventOnEntities();

            if (!string.IsNullOrEmpty(Filtro))
            {
                ListBusiness = context.Businesses
                               .Where(x => x.estado == "A" && x.businessName.ToUpper().Contains(Filtro.ToUpper()))
                               .ToList();
            }
        }
예제 #16
0
        public void cargarDatos(int?sectorid)
        {
            EventOnEntities context = new EventOnEntities();

            tieneValor = false;
            if (sectorid.HasValue)
            {
                Sector objSector = context.Sectors.FirstOrDefault(x => x.idSector == sectorid);
                this.sectorID           = sectorid;
                objectSector.idSector   = objSector.idSector;
                objectSector.sectorName = objSector.sectorName;
                tieneValor = true;
            }
        }
예제 #17
0
        public void ModificarEvent(Event _objEvent)
        {
            EventOnEntities context  = new EventOnEntities();
            Event           objEvent = context.Events.FirstOrDefault(x => x.idEvent == _objEvent.idEvent);

            objEvent.name     = _objEvent.name;
            objEvent.place    = _objEvent.place;
            objEvent.date     = _objEvent.date;
            objEvent.Business = _objEvent.Business;
            objEvent.Category = _objEvent.Category;

            objEvent.estado = "A";
            context.SaveChanges();
        }
예제 #18
0
        public void ModificarBusiness(Business _objBusiness)
        {
            EventOnEntities context     = new EventOnEntities();
            Business        objBusiness = context.Businesses.FirstOrDefault(x => x.idBusiness == _objBusiness.idBusiness);

            objBusiness.businessName  = _objBusiness.businessName;
            objBusiness.RUCNumber     = _objBusiness.RUCNumber;
            objBusiness.businessPhone = _objBusiness.businessPhone;
            objBusiness.contactName   = _objBusiness.contactName;
            objBusiness.contactPhone  = _objBusiness.contactPhone;
            objBusiness.User          = _objBusiness.User;
            objBusiness.Sector        = _objBusiness.Sector;
            objBusiness.estado        = "A";
            context.SaveChanges();
        }
예제 #19
0
        public void cargarDatos(int?businessid)
        {
            EventOnEntities context = new EventOnEntities();

            this.ListSectors = context.Sectors.ToList();
            this.ListUsers   = context.Users.ToList();

            tieneValor = false;
            if (businessid.HasValue)
            {
                Business objBusiness = context.Businesses.FirstOrDefault(x => x.idBusiness == businessid);
                this.businessID              = businessid;
                objectBusiness.idBusiness    = objBusiness.idBusiness;
                objectBusiness.businessName  = objBusiness.businessName;
                objectBusiness.RUCNumber     = objBusiness.RUCNumber;
                objectBusiness.businessPhone = objBusiness.businessPhone;
                objectBusiness.contactName   = objBusiness.contactName;
                objectBusiness.contactPhone  = objBusiness.contactPhone;
                objectBusiness.User          = objBusiness.User;
                objectBusiness.Sector        = objBusiness.Sector;
                tieneValor = true;
            }
        }
예제 #20
0
        public ListEventsViewModel()
        {
            EventOnEntities context = new EventOnEntities();

            ListEvents = context.Events.Where(x => x.estado == "A").ToList();
        }
예제 #21
0
        public ListBusinessViewModel()
        {
            EventOnEntities context = new EventOnEntities();

            ListBusiness = context.Businesses.Where(x => x.estado == "A").ToList();
        }
예제 #22
0
        public ListSectorsViewModel()
        {
            EventOnEntities context = new EventOnEntities();

            ListSector = context.Sectors.Where(x => x.estado == "A").ToList();
        }