public ActionResult Index()
        {
            ViewBag.homeid = "home";

            EventBL           _evBl            = new EventBL();
            RegistrationBL    _reg             = new RegistrationBL();
            RegistrationModel regmodel         = new RegistrationModel();
            RegistrationModel regmodelCanceled = new RegistrationModel();

            List <EventModel> EventList = new List <EventModel>();

            if (Convert.ToInt32(Session["ROLE_ID"]) == 1)
            {
                if (Session["StarsIdProfile"] != null)
                {
                    if (!_reg.CheckIsSelectBy(Session["StarsIdProfile"].ToString()))
                    {
                        regmodel = _reg.GetRegistrationByStarsId(Session["StarsIdProfile"].ToString());
                    }
                    else
                    {
                        return(RedirectToAction("NoAuthorized", "HttpErrors"));
                    }
                }
                else
                {
                    return(RedirectToAction("Welcome", "LBC"));
                }
            }
            else
            {
                if (Session["StarsIdProfile"] != null)
                {
                    regmodel = _reg.GetRegistrationByStarsId(Session["StarsIdProfile"].ToString());
                }
                else
                {
                    return(RedirectToAction("Welcome", "LBC"));
                }
            }
            ViewBag.lbcCert   = regmodel.LBC_CERT;
            ViewBag.regStatus = regmodel.REGD_STATUS;
            if (regmodel.EVENT_ID != 0)
            {
                ViewBag.eventid    = regmodel.EVENT_ID;
                ViewBag.registered = 1;
            }
            else
            {
                ViewBag.eventid    = 0;
                ViewBag.registered = 0;
            }
            EventList = _evBl.GetAll(Session["StarsIdProfile"].ToString());
            return(View(EventList));
        }
            public EventListProvider(string defaultText = null)
            {
                if (!string.IsNullOrEmpty(defaultText))
                {
                    Add(string.Empty, defaultText);
                }

                EventBL _event = new EventBL();

                List <EventModel> lst = _event.GetAll();

                Add("", "EVENT");
                for (int i = 0; i < lst.Count; i++)
                {
                    EventModel item = new EventModel()
                    {
                        EVENT_ID      = lst.ElementAt(i).EVENT_ID,
                        EVENT_SESSION = lst.ElementAt(i).EVENT_SESSION
                    };
                    Add(item.EVENT_ID.ToString(), item.EVENT_SESSION);
                }
            }
Ejemplo n.º 3
0
        public override JsonResultEntity Get([FromBody] DBParamEntity dbParamEntity)
        {
            EventBL          eventBL  = new EventBL();
            JsonResultEntity response = new JsonResultEntity();

            try
            {
                var result = eventBL.GetAll(dbParamEntity);

                if (result.HasWarning())
                {
                    response.Message = String.Join(",", result.Warning);
                    return(response);
                }

                var dataFound  = eventBL.GetTotalRows(dbParamEntity);
                var totalPages = Convert.ToInt32(Math.Ceiling(dataFound.Value / Convert.ToDouble(dbParamEntity.Limit)));

                response.Success  = true;
                response.Data     = result.Value;
                response.MetaInfo = new MetaInfoEntity
                {
                    DataFound   = dataFound.Value,
                    DataPerPage = dbParamEntity.Limit,
                    Page        = dbParamEntity.Page,
                    TotalPages  = totalPages == 0 ? 1 : totalPages
                };
            }
            catch (Exception ex)
            {
                response.Message = ex.Message;
                LoggerHelper.Error(ex);
            }

            return(response);
        }