Exemple #1
0
        async Task auth(bool is_admin)
        {
            MySQLServer.InputStatus status = await MySQLServer.login(loginBox.Value,
                                                                     passwordBox.Value,
                                                                     Response,
                                                                     is_admin);

            loginError.Text    = "<br />";
            passwordError.Text = "<br />";
            if (status == MySQLServer.InputStatus.LoginRequired)
            {
                loginError.Text = "Login required";
            }
            if (status == MySQLServer.InputStatus.PasswordRequired)
            {
                passwordError.Text = "Password required";
            }
            if (status == MySQLServer.InputStatus.NoSuchUser)
            {
                loginError.Text = "No such user";
            }
            if (status == MySQLServer.InputStatus.IncorrectPassword)
            {
                passwordError.Text = "Incorrect password";
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!(MySQLServer.auth_chech(Request) && MySQLServer.admin_check(Request)))
     {
         Response.Redirect("~/", false);
     }
 }
        private void loadMeta()
        {
            List <string> items = MySQLServer.get_orders_information();

            orders.Text += String.Format("<tr><th>User</th><th>Film title</th><th>Date and time</th><th>Places</th><th>Cost</th><th>Status</th></tr>");
            for (int i = 0; i < items.Count / 7; ++i)
            {
                string id     = items[i * 7 + 0];
                string user   = items[i * 7 + 1];
                string film   = items[i * 7 + 2];
                string date   = items[i * 7 + 3];
                string status = items[i * 7 + 4];
                string cost   = items[i * 7 + 5];
                string places = items[i * 7 + 6];
                if (status == "pending confirmation")
                {
                    orders.Text += String.Format("<tr><td>{0}</td><td>{1}</td><td>{2}</td><td>{3}</td><td>{5}</td><td class=\"flex\"><input class=\"sub-button\" onClick=\"approve(this)\" id=\"a{4}\" type = \"submit\" value=\"Accept\"/><input class=\"dec-button\" onClick=\"approve(this)\" id=\"d{4}\" type = \"submit\" value=\"Decline\"/></td></tr>", user, film, date, places, id, cost);
                }
                else
                {
                    orders.Text += String.Format("<tr><td>{0}</td><td>{1}</td><td>{2}</td><td>{3}</td><td>{5}</td><td class=\"flex\">{4}</td></tr>", user, film, date, places, status, cost);
                }
            }
            orders.Text = "<table  cellspacing=\"0\">" + orders.Text + "</table>";
        }
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "application/pdf";
            context.Response.AddHeader("content-disposition", "inline; filename=ticket.pdf");

            List <string> items = MySQLServer.get_orders_information(int.Parse(context.Request["id"]));

            if (items.Count == 0 ||
                items[1] != context.Request.Cookies["login"].Value.ToUpper() ||
                items[4] != "confirmed")
            {
                context.Response.Redirect("~/Account/Profile");
            }

            QRCodeEncoder encoder = new QRCodeEncoder();
            Bitmap        QRImage = encoder.Encode(SignGenerator.GetSign(items[0] + items[1]));

            Document  doc    = new Document(iTextSharp.text.PageSize.A4, 40, 40, 42, 35);
            PdfWriter writer = PdfWriter.GetInstance(doc, context.Response.OutputStream);

            doc.Open();

            doc.Add(new Paragraph("User: "******"Film: " + items[2]));
            doc.Add(new Paragraph("Date: " + items[3].Split(' ')[0]));
            doc.Add(new Paragraph("Time: " + items[3].Split(' ')[1]));
            doc.Add(new Paragraph("\n"));
            doc.Add(new Paragraph("Cost: " + items[5]));
            doc.Add(new Paragraph("\n"));
            doc.Add(new Paragraph("Places: " + items[6]));
            doc.Add(new Paragraph("\n"));
            iTextSharp.text.Image i = iTextSharp.text.Image.GetInstance(QRImage, ImageFormat.Jpeg);
            doc.Add(i);
            doc.Close();
        }
Exemple #5
0
        protected void Check(object sender, EventArgs e)
        {
            time.Items.Clear();
            string date      = Calendar1.SelectedDate.ToShortDateString();
            string mySQLDate = date.Split('.')[2] +
                               '-' + date.Split('.')[1] +
                               '-' + date.Split('.')[0];

            Debug.WriteLine(mySQLDate);

            List <string> items = MySQLServer.get_times(mySQLDate);

            bool[] used = new bool[12];
            foreach (string item in items)
            {
                int begin = int.Parse(item.Split(':')[0]);


                for (int hour = begin - 1; hour < begin + 2; ++hour)
                {
                    if (hour - 10 >= 0)
                    {
                        used[hour - 10] = true;
                    }
                }
            }
            for (int hour = 10; hour < 22; ++hour)
            {
                if (!used[hour - 10])
                {
                    string h = hour.ToString() + ":00:00";
                    time.Items.Add(new ListItem(h));
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            String[] info = Request.FilePath.Split('/');
            if (info.Length < 3)
            {
                Response.Redirect("~/");
            }
            id   = info[info.Length - 1];
            time = info[info.Length - 2];
            date = info[info.Length - 3];
            List <string> show = MySQLServer.get_show_information(id, date + " " + time + ":00:00");

            if (show.Count == 0)
            {
                Response.Redirect("~/");
            }
            session_id        = show[0];
            title             = show[1];
            cost              = show[2];
            film_cost.Text    = "<h3 style=\"header-text\">Film cost: " + cost + "</h3>";
            film.Text         = "<h1 style=\"header-text\">" + title + "</h1>";
            session_date.Text = "<h3>Date: " + date + "</h3>";
            session_time.Text = "<h3>Time: " + time + ":00</h3>";
            seats.Text        = "";
            loadSeats();

            if (Request.Cookies["login"] != null)
            {
                move.Text = "<input class=\"sub-button\" type=\"submit\" value=\"Book\" style=\"width: 290px\" runat=\"server\" onclick=\"get()\" />";
            }
            else
            {
                move.Text = "<p class=\"lower-text\">New to Cinema?<a href = \"../../../Account/Register\"> Create an account.</a><p/>";
            }
        }
        protected async void Page_Load(object sender, EventArgs e)
        {
            connection = new MySqlConnection(MySQLServer.connectionString);
            await connection.OpenAsync();

            if (MySQLServer.auth_chech(Request))
            {
                Response.Redirect("~/Account/Profile", false);
            }
        }
        protected async void submit_Click(object sender, EventArgs e)
        {
            MySQLServer.InputStatus[] status = await MySQLServer.register(loginBox.Value,
                                                                          passwordBox.Value,
                                                                          emalBox.Value,
                                                                          Response);

            if (status[0] == MySQLServer.InputStatus.Succeed && status[0] == status[1] && status[0] == status[2])
            {
                await MySQLServer.login(loginBox.Value,
                                        passwordBox.Value,
                                        Response,
                                        false);
            }
            else
            {
                loginError.Text        = "This will be your username.";
                emailError.Text        = "We'll occasionally send updates about your account to this inbox.";
                passwordError.Text     = "Use at least one lowercase letter, one numeral, and seven characters.";
                loginError.CssClass    = "lower-text";
                emailError.CssClass    = "lower-text";
                passwordError.CssClass = "lower-text";
                if (status[0] == MySQLServer.InputStatus.LoginRequired)
                {
                    loginError.CssClass = "error-string";
                    loginError.Text     = "Login required";
                }
                if (status[1] == MySQLServer.InputStatus.EmailRequired)
                {
                    emailError.CssClass = "error-string";
                    emailError.Text     = "E-mail required";
                }
                if (status[2] == MySQLServer.InputStatus.PasswordRequired)
                {
                    passwordError.CssClass = "error-string";
                    passwordError.Text     = "Password required";
                }
                if (status[0] == MySQLServer.InputStatus.LoginAlreadyTaken)
                {
                    loginError.CssClass = "error-string";
                    loginError.Text     = "This login already taken";
                }
                if (status[1] == MySQLServer.InputStatus.EmailAlreadyTaken)
                {
                    emailError.CssClass = "error-string";
                    emailError.Text     = "This e-mail already taken";
                }
                if (status[2] == MySQLServer.InputStatus.ShortPassword)
                {
                    passwordError.CssClass = "error-string";
                    passwordError.Text     = "Password must be longer than 6 characters";
                }
            }
        }
Exemple #9
0
        private void loadMeta()
        {
            List <string> items = MySQLServer.get_films();

            films_id = new List <string>();
            foreach (string item in items)
            {
                films.Items.Add(new ListItem(item.ToString().Split('&')[1]));
                films_id.Add(item.ToString().Split('&')[0]);
            }
        }
Exemple #10
0
        protected async void submit_Click(object sender, EventArgs e)
        {
            string date      = Calendar1.SelectedDate.ToShortDateString();
            string mySQLDate = date.Split('.')[2] +
                               '-' + date.Split('.')[1] +
                               '-' + date.Split('.')[0] +
                               " " +
                               time.SelectedValue;
            await MySQLServer.add_session(films_id[films.SelectedIndex], mySQLDate, cost.SelectedValue);

            Response.Redirect("~/Shows/", false);
        }
Exemple #11
0
        protected async void Page_Load(object sender, EventArgs e)
        {
            if (!(MySQLServer.auth_chech(Request) && MySQLServer.admin_check(Request)))
            {
                Response.Redirect("~/", false);
            }


            if (category.Items.Count == 0)
            {
                loadMeta();
            }
        }
        protected void HiddenField1_ValueChanged(object sender, EventArgs e)
        {
            string id = HiddenField1.Value;

            if (id[0] == 'a')
            {
                MySQLServer.confirm(id.Substring(1));
            }
            else
            {
                MySQLServer.decline(id.Substring(1));
            }
            Response.Redirect("~/Manage/Orders");
        }
Exemple #13
0
        private void loadMeta()
        {
            List <string> items = MySQLServer.get_categories();

            foreach (string item in items)
            {
                category.Items.Add(new ListItem(item.ToString()));
            }
            items = MySQLServer.get_coutries();
            foreach (string item in items)
            {
                country.Items.Add(item);
            }
        }
        protected void HiddenField1_ValueChanged(object sender, EventArgs e)
        {
            string[]      list   = HiddenField1.Value.Split(',');
            List <string> places = new List <string>();

            for (int i = 0; i < list.Length; ++i)
            {
                if (list[i] == "true")
                {
                    places.Add((i + 1).ToString());
                }
            }
            MySQLServer.add_order(Request.Cookies["login"].Value, session_id, places);
            Response.Redirect("~/Account/Profile");
        }
Exemple #15
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            /***********
            * Debug w/o eFlash MySQL: set localDB = useDB.none; start your own server
            *   Debug w/eFlash MySQL: install eFlash; set localDB = useDB.debug; change path below
            *       Production build: set localDB = useDB.release; build installer
            ***********/
            useMySQL localDB = useMySQL.release;

            if (localDB != useMySQL.none)
            {
                Form loadScreen = new eFlash.GUI.Loading();
                loadScreen.Visible = true;

                string pwd = AppHelper.GetPresentWorkingDirectory();

                if (localDB == useMySQL.debug)
                {
                    // Path to your MySQL bin directory, i.e.:
                    pwd = "C:\\Program Files\\eFlash\\Data\\MySQL\\bin\\";
                }
                else if (localDB == useMySQL.release)
                {
                    pwd = AppHelper.GetPresentWorkingDirectory() + "\\Data\\MySQL\\bin\\";
                }
                MySQLServer.mybin = pwd;
                MySQLServer.StartAndWait();

                loadScreen.Visible = false;
            }

            Application.Run(new eFlash.GUI.Profile.profile_selector());
            //Application.Run(new main());
            //Application.Run(new eFlash.GUI.File.importScreen());
            //Application.Run(new eFlash.GUI.File.exportScreen());
            //Application.Run(new eFlash.GUI.Network.welcome());
            //Application.Run(new eFlash.GUI.Creator.LayoutEditor(null, null));
            //Application.Run(new eFlash.GUI.Network.browser());
            //eFlash.dbAccess.remoteDB.test();

            if (localDB != useMySQL.none)
            {
                MySQLServer.StopAndWait();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            HttpCookie loginCookie = Request.Cookies["login"];
            HttpCookie signCookie  = Request.Cookies["sign"];

            if (!MySQLServer.auth_chech(Request))
            {
                Response.Redirect("../Accounts/Login.aspx");
                return;
            }
            name       = loginCookie.Value.ToUpper();
            login.Text = "<h1>" + name + "</h1>";

            loadMeta();


            //QRCode();
        }
 private void loadSeats()
 {
     for (int row = 1; row <= 5; ++row)
     {
         string places = string.Empty;
         for (int column = 1; column <= 6; ++column)
         {
             int place = (row - 1) * 6 + column;
             if (!MySQLServer.check_seat(session_id, place.ToString()))
             {
                 places += String.Format("<li class=\"seat\"><input type=\"checkbox\" id=\"{0}\" onchange=\"update_cost(this)\" /><label for=\"{0}\">{0}</label></li>", place);
             }
             else
             {
                 places += String.Format("<li class=\"seat\"><input type=\"checkbox\" disabled id=\"{0}\" /><label for=\"{0}\">Occupied</label></li>", place);
             }
         }
         places      = "<ol class=\"seats\" type=\"A\">" + places + "</ol>";
         seats.Text += String.Format("<li class=\"row row--{0}\">{1}</li>", row.ToString(), places);
     }
 }
        protected async void Page_Load(object sender, EventArgs e)
        {
            String URL = Request.FilePath.Split('/').Last();

            if (await MySQLServer.URL_check(URL))
            {
                List <String> list = await MySQLServer.get_film_information(URL);

                title.Text       = list[1];
                description.Text = list[2];
                durability.Text  = list[3];
                producer.Text    = list[4];
                year.Text        = list[5];
                country.Text     = list[6];
                genre.Text       = list[7];
                poster.ImageUrl  = "~/Posters/" + URL + ".jpg";
            }
            else
            {
                Response.Redirect("~/", false);
            }
        }
Exemple #19
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            myLoginButton.TouchUpInside += delegate {
                var username = myUsername;
                var password = myPassword;
                if (password.Text.Length == 0 || username.Text.Length == 0)
                {
                    Alert.Message(Alert.error, "Username or password is emty!", Alert.buttonOk);
                    MySQLServer.GetArticles();
                    //AppAlert.Message(AppAlert.error, "Username or password is emty!", AppAlert.buttonOk);
                    return;
                }
                Alert.Message(Alert.info, username.Text.ToString() + "\n" + password.Text.ToString() + "\n" + MySQLServer.article[2].Title, Alert.buttonOk);
                //AppAlert.Message(AppAlert.info, username.Text.ToString() + "\n" + password.Text.ToString(), AppAlert.buttonOk);
            };
            myPassword.ShouldReturn = (textField) => {
                textField.ResignFirstResponder();
                return(true);
            };
        }
        private void loadMeta()
        {
            List <string> items = MySQLServer.get_orders_information(name);

            orders.Text += String.Format("<tr><th>Film title</th><th>Date and time</th><th>Places</th><th>Cost</th><th>Status</th><th>Get PDF</th></tr>");
            for (int i = 0; i < items.Count / 7; ++i)
            {
                string id     = items[i * 7 + 0];
                string user   = items[i * 7 + 1];
                string film   = items[i * 7 + 2];
                string date   = items[i * 7 + 3];
                string status = items[i * 7 + 4];
                string cost   = items[i * 7 + 5];
                string places = items[i * 7 + 6];
                string PDF    = "<a runat=\"server\" class = \"pdf\" href=\"Ticket.ashx?id=" + id + "\">Download</a>";
                if (status != "confirmed")
                {
                    PDF = "";
                }
                orders.Text += String.Format("<tr><td>{0}</td><td>{1}</td><td>{2}</td><td>{4}</td><td class=\"flex\">{3}</td><td>{5}<td></tr>", film, date, places, status, cost, PDF);
            }
            orders.Text = "<table  cellspacing=\"0\">" + orders.Text + "</table>";
        }
Exemple #21
0
        protected async void submit_Click(object sender, EventArgs e)
        {
            MySQLServer.InputStatus[] status = await MySQLServer.add_film(title.Text,
                                                                          description.Text,
                                                                          durability.Text,
                                                                          poster,
                                                                          URL.Text,
                                                                          year.Text,
                                                                          producer.Value,
                                                                          country.SelectedValue,
                                                                          category,
                                                                          Response,
                                                                          Server);

            if (!(status[0] == MySQLServer.InputStatus.Succeed &&
                  status[0] == status[1] && status[0] == status[2] &&
                  status[2] == status[3] && status[3] == status[4]))
            {
                title_error.Text       = "Enter film title.";
                description_error.Text = "Fill out a short description of the film.";
                image_error.Text       = "Select an image for the poster.";
                durability_error.Text  = "Enter the length of the movie (in minutes).";
                category_error.Text    = "Select at least one category.";
                producer_error.Text    = "Producer's name.";
                year_error.Text        = "Enter year of film.";
                URL_error.Text         = "Enter the URL (must be unique).";
                poster_path.Value      = "";


                category_error.CssClass    = "lower-text";
                producer_error.CssClass    = "lower-text";
                durability_error.CssClass  = "lower-text";
                title_error.CssClass       = "lower-text";
                description_error.CssClass = "lower-text";
                image_error.CssClass       = "lower-text";
                year_error.CssClass        = "lower-text";
                URL_error.CssClass         = "lower-text";

                if (status[0] == MySQLServer.InputStatus.EmptyString)
                {
                    title_error.CssClass = "error-string";
                    title_error.Text     = "Title required";
                }
                if (status[1] == MySQLServer.InputStatus.EmptyString)
                {
                    description_error.CssClass = "error-string";
                    description_error.Text     = "Description required";
                }
                if (status[2] == MySQLServer.InputStatus.EmptyString)
                {
                    durability_error.CssClass = "error-string";
                    durability_error.Text     = "Durability required";
                }
                else
                if (status[2] == MySQLServer.InputStatus.IncorrectNumber)
                {
                    durability_error.CssClass = "error-string";
                    durability_error.Text     = "Must be a positive number not greater than 500";
                }

                if (status[3] == MySQLServer.InputStatus.WrongPosterExp)
                {
                    image_error.CssClass = "error-string";
                    image_error.Text     = "File must be in '*.jpg' format.";
                }

                if (status[4] == MySQLServer.InputStatus.NoCategoriesSelected)
                {
                    category_error.CssClass = "error-string";
                    category_error.Text     = "No categories selected";
                }

                if (status[5] == MySQLServer.InputStatus.EmptyString)
                {
                    producer_error.CssClass = "error-string";
                    producer_error.Text     = "Producer required.";
                }

                if (status[6] == MySQLServer.InputStatus.IncorrectNumber)
                {
                    year_error.CssClass = "error-string";
                    year_error.Text     = "Wrong year.";
                }

                if (status[7] != MySQLServer.InputStatus.Succeed)
                {
                    URL_error.CssClass = "error-string";
                    URL_error.Text     = "Wrong URL or already exist.";
                }
            }
            else
            {
                Response.Redirect("~/Films/" + URL.Text, false);
            }
        }
Exemple #22
0
        protected void Page_Load(object sender, EventArgs e)
        {
            List <string>  Shows          = MySQLServer.get_shows();
            List <DayShow> Days           = new List <DayShow>();
            String         first_date     = String.Empty;
            String         last_show_date = String.Empty;

            Tabs.Text = string.Empty;
            for (int show = 0; show < Shows.Count / 6; show++)
            {
                String film_id     = Shows[show * 6 + 0];
                String film_name   = Shows[show * 6 + 1];
                String URL         = Shows[show * 6 + 2];
                String country     = Shows[show * 6 + 3];
                String continuance = Shows[show * 6 + 4];
                String show_date   = Shows[show * 6 + 5];
                if (first_date == String.Empty)
                {
                    first_date = show_date.Split(' ')[0];
                }
                if (show_date.Split(' ').First() != last_show_date.Split(' ').First())
                {
                    last_show_date = show_date;

                    Days.Add(new DayShow());

                    Days.Last().film_list.Add(new DayShow.Film());
                    Days.Last().film_list.Last().film_id = film_id;
                    Days.Last().film_list.Last().film_name = film_name;
                    Days.Last().film_list.Last().URL = URL;
                    Days.Last().film_list.Last().country = country;
                    Days.Last().film_list.Last().continuance = continuance;
                    Days.Last().film_list.Last().time.Add(show_date.Split(' ').Last());
                    Days.Last().date = show_date.Split(' ').First();
                }
                else
                {
                    int film_is_found = -1;
                    for (int film = 0; film < Days.Last().film_list.Count; ++film)
                    {
                        if (Days.Last().film_list[film].film_name == film_name)
                        {
                            film_is_found = film;
                            break;
                        }
                    }
                    if (film_is_found != -1)
                    {
                        Days.Last().film_list[film_is_found].time.Add(show_date.Split(' ').Last());
                    }
                    else
                    {
                        Days.Last().film_list.Add(new DayShow.Film());
                        Days.Last().film_list.Last().film_id = film_id;
                        Days.Last().film_list.Last().film_name = film_name;
                        Days.Last().film_list.Last().URL = URL;
                        Days.Last().film_list.Last().country = country;
                        Days.Last().film_list.Last().continuance = continuance;
                        Days.Last().film_list.Last().time.Add(show_date.Split(' ').Last());
                    }
                }
            }

            //**DEBUG**//

            /*
             * for (int i = 0; i < Days.Count; ++i)
             * {
             *  Debug.WriteLine("Date: " + Days[i].date);
             *  Debug.WriteLine("Hall: " + Days[i].hall_name);
             *  Debug.WriteLine("Films:");
             *  for (int j = 0; j < Days[i].film_list.Count; ++j)
             *  {
             *      Debug.WriteLine(Days[i].film_list[j].film_name + " " + Days[i].film_list[j].film_id + ":");
             *      for (int k = 0; k < Days[i].film_list[j].time.Count; ++k)
             *      {
             *          Debug.WriteLine(Days[i].film_list[j].time[k]);
             *      }
             *  }
             *  Debug.WriteLine("");
             * }
             */

            for (int i = 0; i < Days.Count; ++i)
            {
                string tabclass = "tablinks";
                if (int.Parse(selectedTab.Value) == i)
                {
                    tabclass = "tablinks active";
                }
                Tabs.Text += String.Format("<button id=\"T" + i + "\" class=\"" + tabclass + "\" onclick=\"openTab(event,this, '{0}')\">{0}</button>", Days[i].date);
                String content = String.Empty;
                for (int j = 0; j < Days[i].film_list.Count; ++j)
                {
                    String sessions = String.Empty;
                    for (int k = 0; k < Days[i].film_list[j].time.Count; ++k)
                    {
                        string[] d    = Days[i].date.Split('.').Reverse().ToArray();
                        string   date = string.Empty;
                        foreach (string s in d)
                        {
                            date += s + "-";
                        }
                        sessions += String.Format("<a class=\"link\" href=\"{0}/{1}/{2}\">{3}</a>",
                                                  date.Substring(0, date.Length - 1),
                                                  Days[i].film_list[j].time[k].Split(':').First(),
                                                  Days[i].film_list[j].film_id,
                                                  Days[i].film_list[j].time[k]);
                    }
                    string genres = MySQLServer.get_films_genres(Days[i].film_list[j].film_id);
                    content += String.Format("<ul class=\"list\"><li><img src=\"../Posters/{0}.jpg\" alt=\"\" /><a class=\"link\"href=\"../Films/{0}\">{1}</a><br />Country: {2}<br/>Genres: {3}<br/>Durability: {4} <br/>Sessions: {5} <br/></li></ul>",
                                             Days[i].film_list[j].URL,
                                             Days[i].film_list[j].film_name,
                                             Days[i].film_list[j].country,
                                             genres,
                                             Days[i].film_list[j].continuance,
                                             sessions);
                }
                generateInfo.Text += String.Format("<div id = \"{0}\" class=\"tabcontent\"><div class=\"content\">{1}</div></div>", Days[i].date, content);
            }

            Page.ClientScript.RegisterStartupScript(this.GetType(), "selectFirst", "selectFirst('" + first_date + "')", true);
        }