예제 #1
0
        public bool insertSale()
        {
            string eventIdStr = Request.Form["eventId"];
            string ssi        = Request.Form["ssi"];
            string amount     = Request.Form["amount"];
            string ssiDec     = UseKardoEncryption.getDecipherString(ssi);

            if (ssiDec == "KardoEncryptionError")
            {
                return(false);
            }

            int userId = Convert.ToInt32(UseKardoEncryption.getDecipherString(Session["KardoUserId"].ToString()));
            Dictionary <string, Object> theUser = DefaultModel.getUserFromUserId(userId);
            int  eventId, ssId, amountInt;
            int  kpId = (int)theUser["kardoPassoId"];
            bool isNumeric = int.TryParse(eventIdStr, out eventId);
            bool isNumeric2 = int.TryParse(ssiDec, out ssId);
            bool isNumeric3 = int.TryParse(amount, out amountInt);

            if (isNumeric && isNumeric2 && isNumeric3)
            {
                return(EventDetailModel.insertSale(eventId, ssId, kpId, amountInt, userId));
            }
            return(false);
        }
예제 #2
0
        //
        // GET: /UserProfile/
        public ActionResult Index()
        {
            if ((Session["KardoUserId"] != null && Session["KardoUserName"] != null))
            {
                int userId = Convert.ToInt32(UseKardoEncryption.getDecipherString(Session["KardoUserId"].ToString()));
                Dictionary <string, Object> theUser = DefaultModel.getUserFromUserId(userId);

                ViewBag.userInfos   = theUser;
                ViewBag.userTickets = UserProfileModel.getUserTickets((int)theUser["userId"]);
            }
            else
            {
                return(Redirect("/"));
            }

            return(View());
        }
        //
        // GET: /EditStadium/
        public ActionResult Index(string stadiumId)
        {
            if (string.IsNullOrEmpty(stadiumId))
            {
                return(Redirect("/"));
            }

            int  stadiumIdInt;
            bool isNumeric = int.TryParse(stadiumId, out stadiumIdInt);

            if (!isNumeric)
            {
                return(Redirect("/"));
            }

            if ((Session["KardoUserId"] != null && Session["KardoUserName"] != null))
            {
                int userId = Convert.ToInt32(UseKardoEncryption.getDecipherString(Session["KardoUserId"].ToString()));
                Dictionary <string, Object> theUser = DefaultModel.getUserFromUserId(userId);
                ViewBag.userInfos = theUser;
                if (!(bool)theUser["can_modify_stadium"])
                {
                    return(Redirect("/"));
                }
            }
            else
            {
                return(Redirect("/"));
            }


            Dictionary <string, Object> theStadium = EditStadiumModel.getStadium(stadiumIdInt);

            ViewBag.theStadium = theStadium;
            Dictionary <string, List <Object> > theSSections = EditStadiumModel.getSSections(stadiumIdInt);

            ViewBag.theSSections = theSSections;
            Dictionary <string, List <Object> > sportTypes = PagePanelModel.getSportTypes();

            ViewBag.sportTypes = sportTypes;
            Dictionary <string, List <Object> > secCategories = EditStadiumModel.getSecCategories();

            ViewBag.secCategories = secCategories;

            return(View());
        }
        //
        // GET: /PagePanel/
        public ActionResult Index()
        {
            if ((Session["KardoUserId"] != null && Session["KardoUserName"] != null))
            {
                int userId = Convert.ToInt32(UseKardoEncryption.getDecipherString(Session["KardoUserId"].ToString()));
                Dictionary <string, Object> theUser = DefaultModel.getUserFromUserId(userId);
                ViewBag.userInfos = theUser;

                if (!(bool)theUser["can_enter_pagePanel"])
                {
                    return(Redirect("/"));
                }

                if ((bool)theUser["can_modify_users"])
                {
                    Dictionary <string, List <Object> > users = PagePanelModel.getUsers();
                    ViewBag.users = users;
                }
            }
            else
            {
                return(Redirect("/"));
            }

            Dictionary <string, List <Object> > teams = PagePanelModel.getTeams();

            ViewBag.teams = teams;
            Dictionary <string, List <Object> > stadiums = PagePanelModel.getStadiums();

            ViewBag.stadiums = stadiums;
            Dictionary <string, List <Object> > sportTypes = PagePanelModel.getSportTypes();

            ViewBag.sportTypes = sportTypes;
            Dictionary <string, List <Object> > events = PagePanelModel.getEvents();

            ViewBag.events = events;
            Dictionary <string, List <Object> > roles = PagePanelModel.getRoles();

            ViewBag.roles = roles;

            ViewBag.newUsers = PagePanelModel.countNewUsers();
            ViewBag.newKps   = PagePanelModel.countNewKps();
            return(View());
        }
예제 #5
0
        //
        // GET: /EventDetailAdmin/
        public ActionResult Index(string eventId)
        {
            if (string.IsNullOrEmpty(eventId))
            {
                return(Redirect("/"));
            }

            int  eventIdInt;
            bool isNumeric = int.TryParse(eventId, out eventIdInt);

            if (!isNumeric)
            {
                return(Redirect("/"));
            }

            if ((Session["KardoUserId"] != null && Session["KardoUserName"] != null))
            {
                int userId = Convert.ToInt32(UseKardoEncryption.getDecipherString(Session["KardoUserId"].ToString()));
                Dictionary <string, Object> theUser = DefaultModel.getUserFromUserId(userId);
                ViewBag.userInfos = theUser;

                if (!(bool)theUser["can_examine_salesDetails"])
                {
                    return(Redirect("/"));
                }
            }
            else
            {
                return(Redirect("/"));
            }


            Dictionary <string, Object> theEvent = EventDetailModel.getEventInfo(eventIdInt);

            ViewBag.theEvent = theEvent;
            Dictionary <string, List <Object> > ticketInfos = EventDetailModel.getEventTicketInfo(eventIdInt);

            ViewBag.ticketInfos = ticketInfos;


            return(View());
        }
예제 #6
0
        //
        // GET: /EventDetail/
        public ActionResult Index(string eventId)
        {
            if (string.IsNullOrEmpty(eventId))
            {
                return(Redirect("/"));
            }

            string eventIdStr = UseKardoEncryption.getDecipherString(eventId);

            if (eventIdStr == "KardoEncryptionError")
            {
                return(Redirect("/"));
            }

            int  eventIdInt;
            bool isNumeric = int.TryParse(eventIdStr, out eventIdInt);

            if (!isNumeric)
            {
                return(Redirect("/"));
            }

            Dictionary <string, Object>         theEvent    = EventDetailModel.getEventInfo(eventIdInt);
            Dictionary <string, List <Object> > ticketInfos = EventDetailModel.getEventTicketInfo(eventIdInt);

            ViewBag.theEvent    = theEvent;
            ViewBag.ticketInfos = ticketInfos;

            if ((Session["KardoUserId"] != null && Session["KardoUserName"] != null))
            {
                int userId = Convert.ToInt32(UseKardoEncryption.getDecipherString(Session["KardoUserId"].ToString()));
                Dictionary <string, Object> theUser = DefaultModel.getUserFromUserId(userId);

                ViewBag.userInfos   = theUser;
                ViewBag.userTickets = UserProfileModel.getUserTickets((int)theUser["userId"]);
            }

            return(View());
        }
        //
        // GET: /Permissions/
        public ActionResult Index()
        {
            if ((Session["KardoUserId"] != null && Session["KardoUserName"] != null))
            {
                int userId = Convert.ToInt32(UseKardoEncryption.getDecipherString(Session["KardoUserId"].ToString()));
                Dictionary <string, Object> theUser = DefaultModel.getUserFromUserId(userId);
                ViewBag.userInfos = theUser;
                if (!(bool)theUser["can_edit_permissions"])
                {
                    return(Redirect("/"));
                }
            }
            else
            {
                return(Redirect("/"));
            }


            Dictionary <string, List <Object> > roles = PermissionsModel.getRoles();

            ViewBag.roles = roles;

            return(View());
        }
 public Dictionary <string, Object> getUserInfos(int userId)
 {
     return(DefaultModel.getUserFromUserId(userId));
 }
        //
        // GET: /Default/
        public ActionResult Index()
        {
            if (Request.Cookies["KardoLanguagePreference"] == null || Request.Cookies["KardoLanguagePreference"].Value == "" || Request.Cookies["KardoLanguagePreference"].Value == "null")
            {
                Session.Add("KardoLanguagePreference", "tr-TR");
                if (Request.Cookies["KardoLanguagePreference"] != null)
                {
                    Response.Cookies["KardoLanguagePreference"].Value   = "tr-TR";
                    Response.Cookies["KardoLanguagePreference"].Expires = DateTime.Now.AddYears(99);
                }
            }
            if ((Session["KardoUserId"] == null && Session["KardoUserName"] == null))
            {
                if (Request.Cookies["KardoUserInfos"] != null)
                {
                    if (Request.Cookies["KardoUserInfos"]["userId"] != null && Request.Cookies["KardoUserInfos"]["status"] != null)
                    {
                        string[] savedAccounts = Request.Cookies["KardoUserInfos"]["userId"].Split('_');
                        string[] status        = Request.Cookies["KardoUserInfos"]["status"].Split('_');
                        //string[] priority = Request.Cookies["KardoUserInfos"]["priority"].Split('_');
                        if (savedAccounts.Length == status.Length)
                        {
                            string tempUserId = null;
                            for (int i = 0; i < savedAccounts.Length; i++)
                            {
                                if (status[i] == "active")
                                {
                                    tempUserId = savedAccounts[i];
                                    break;
                                }
                            }

                            if (tempUserId != null)
                            {
                                /*KardoModel kardoModel = new KardoModel("kardo");
                                 * kardoModel.selectOnlyFirstData("users", "*");
                                 * kardoModel.addInnerJoin("users", "profils", "userId");*/
                                string tempStr = UseKardoEncryption.getDecipherString(Request.Cookies["KardoUserInfos"]["userId"]);
                                if (tempStr == "KardoEncryptionError")
                                {
                                    Response.Cookies["KardoUserInfos"].Expires = DateTime.Now.AddDays(-1);
                                    Response.Redirect("/Default/Index");
                                }
                                else
                                {
                                    int userId = Convert.ToInt32(tempStr);
                                    Dictionary <string, Object> theUser = DefaultModel.getUserFromUserId(userId);
                                    string userName = (string)theUser["username"];

                                    Session.Add("KardoUserId", Request.Cookies["KardoUserInfos"]["userId"]);
                                    Session.Add("KardoUserName", UseKardoEncryption.getEncryptedString(userName, 50));
                                    Session.Add("KardoLanguagePreference", (string)theUser["languagePreference"]);

                                    ViewBag.userInfos = theUser;
                                }
                            }
                        }
                        else
                        {
                            Response.Cookies["KardoUserInfos"].Expires = DateTime.Now.AddDays(-1);
                        }
                    }
                    else
                    {
                        Response.Cookies["KardoUserInfos"].Expires = DateTime.Now.AddDays(-1);
                    }
                }

                /*else if (Request.Cookies["KardoVisitorInfos"] != null && (Session["KardoVisitorId"] == null && Session["KardoVisitorName"] == null))
                 * {
                 *  KardoModel kardoModel = new KardoModel("kardo");
                 *  kardoModel.selectOnlyFirstData("visitors", "*");
                 *  string tempStr = UseKardoEncryption.getDecipherString(Request.Cookies["KardoVisitorInfos"]["visitorId"]);
                 *  if (tempStr == "KardoEncryptionError")
                 *  {
                 *      Response.Cookies["KardoVisitorInfos"].Expires = DateTime.Now.AddDays(-1);
                 *      Response.Redirect("/Kardo/Index");
                 *  }
                 *  else
                 *  {
                 *      kardoModel.addWhere("visitorId", Convert.ToInt32(tempStr));
                 *      ArrayList results = kardoModel.selectResults();
                 *      kardoModel.close();
                 *
                 *      string visitorName = KardoModel.getFirstValueFromColumnName(results, "visitorName");
                 *
                 *      Session.Add("KardoVisitorId", Request.Cookies["KardoVisitorInfos"]["visitorId"]);
                 *      Session.Add("KardoVisitorName", visitorName);
                 *      Session.Add("KardoLanguagePreference", Request.Cookies["KardoLanguagePreference"].Value);
                 *  }
                 * }*/
                else
                {
                    // will be creat new visitor // first visit or cookieEnabled is false
                }
            }
            else if ((Session["KardoUserId"] != null && Session["KardoUserName"] != null))
            {
                int userId = Convert.ToInt32(UseKardoEncryption.getDecipherString(Session["KardoUserId"].ToString()));
                Dictionary <string, Object> theUser = DefaultModel.getUserFromUserId(userId);

                ViewBag.userInfos = theUser;
            }

            //****************************************************

            Dictionary <string, List <Object> > events = DefaultModel.getEvents();

            ViewBag.Events = events;
            Dictionary <string, List <Object> > eventsCities = DefaultModel.getEventsCities();

            ViewBag.EventsCities = eventsCities;
            Dictionary <string, List <Object> > eventsTeams = DefaultModel.getEventsTeams();

            ViewBag.EventsTeams = eventsTeams;


            return(View());
        }