protected void AddShowtime_Click(object sender, EventArgs e)
        {
            myDAL    objmyDAl  = new myDAL();
            int      mid       = int.Parse(Movieid.Text);
            int      cid       = int.Parse(CinemaID.Text);
            String   time      = hours.Text + ':' + minutes.Text + ':' + seconds.Text;
            DateTime date      = SDate.SelectedDate;
            int      seats     = int.Parse(ASeats.Text);
            int      cost      = int.Parse(SCost.Text);
            String   screening = SType.Text;

            DateTime datetime;

            bool flag = true;

            if (int.MinValue == cid)
            {
                Movieid.CssClass = Movieid.CssClass + " redBorder";
                Message.Text     = "Some Fields are empty!";
                Message.CssClass = "alert alert-danger";
                flag             = false;
            }
            if (int.MinValue == cid)
            {
                Movieid.CssClass = CinemaID.CssClass + " redBorder";
                Message.Text     = "Some Fields are empty!";
                Message.CssClass = "alert alert-danger";
                flag             = false;
            }
            if (string.IsNullOrWhiteSpace(time))
            {
                flag             = false;
                hours.CssClass   = hours.CssClass + " redBorder";
                minutes.CssClass = minutes.CssClass + " redBorder";
                seconds.CssClass = seconds.CssClass + " redBorder";
                Message.CssClass = "alert alert-danger";
                Message.Text     = "Some Fields are empty!";
            }
            if (SDate.SelectedDate.Date == DateTime.MinValue)
            {
                flag             = false;
                SDate.CssClass   = SDate.CssClass + " redBorder";
                Message.CssClass = "alert alert-danger";
                Message.Text     = "Showtime date is not selected";
            }
            if (int.MinValue == seats)
            {
                flag             = false;
                ASeats.CssClass  = ASeats.CssClass + " redBorder";
                Message.CssClass = "alert alert-danger";
                Message.Text     = "Some Fields are empty!";
            }
            if (int.MinValue == cost)
            {
                flag             = false;
                SCost.CssClass   = SCost.CssClass + " redBorder";
                Message.CssClass = "alert alert-danger";
                Message.Text     = "Some Fields are empty!";
            }
            if (string.IsNullOrWhiteSpace(screening))
            {
                flag             = false;
                SType.CssClass   = SType.CssClass + " redBorder";
                Message.CssClass = "alert alert-danger";
                Message.Text     = "Some Fields are empty!";
            }
            if (flag)
            {
                datetime = date.Add(TimeSpan.Parse(time));

                int result = 0;
                int found  = 1;
                found = objmyDAl.AddShowtime_DAL(mid, cid, datetime, seats, cost, screening, ref result);
                if (found != 1)
                {
                    Message.Text = "Error connecting to server please try later";
                }
                else
                {
                    if (result == 0)
                    {
                        Message.CssClass = "alert alert-success";
                        Message.Text     = "Showtime has been added!";
                        Response.AddHeader("REFRESH", "1;URL=/adminHome.aspx");
                    }
                    else if (result == 1)
                    {
                        Message.CssClass = "alert alert-danger";
                        Message.Text     = "Showtime already exists.";
                    }
                    else if (result == 2)
                    {
                        Message.CssClass = "alert alert-danger";
                        Message.Text     = "Showtime can only have '2d' or '3d' screening type.";
                    }
                    else if (result == 3)
                    {
                        Message.CssClass = "alert alert-danger";
                        Message.Text     = "Cinema doesn't exist.";
                    }
                    else if (result == 4)
                    {
                        Message.CssClass = "alert alert-danger";
                        Message.Text     = "Movie doesn't exist.";
                    }
                }
            }
        }
        protected void AddConcert_Click(object sender, EventArgs e)
        {
            myDAL    objmyDAl     = new myDAL();
            String   concertVenue = venue.Text;
            String   cTime        = hours.Text + ':' + minutes.Text + ':' + seconds.Text;
            DateTime Date         = CDate.SelectedDate;

            String concertPerformer  = performer.Text;
            String concertOrganizers = organizers.Text;
            int    tickets           = int.Parse(ATickets.Text);
            int    cost      = int.Parse(CCost.Text);
            String imageLink = @"\images\" + ImageUpload.FileName;

            DateTime datetime;

            bool flag = true;

            if (string.IsNullOrWhiteSpace(concertVenue))
            {
                venue.CssClass   = venue.CssClass + " redBorder";
                Message.Text     = "Some Fields are empty!";
                Message.CssClass = "alert alert-danger";
                flag             = false;
            }
            if (string.IsNullOrWhiteSpace(cTime))
            {
                flag             = false;
                hours.CssClass   = hours.CssClass + " redBorder";
                minutes.CssClass = minutes.CssClass + " redBorder";
                seconds.CssClass = seconds.CssClass + " redBorder";
                Message.CssClass = "alert alert-danger";
                Message.Text     = "Some Fields are empty!";
            }
            if (CDate.SelectedDate.Date == DateTime.MinValue)
            {
                flag             = false;
                CDate.CssClass   = CDate.CssClass + " redBorder";
                Message.CssClass = "alert alert-danger";
                Message.Text     = "Release date is not selected";
            }
            if (string.IsNullOrWhiteSpace(concertPerformer))
            {
                performer.CssClass = performer.CssClass + " redBorder";
                Message.Text       = "Some Fields are empty!";
                Message.CssClass   = "alert alert-danger";
                flag = false;
            }
            if (string.IsNullOrWhiteSpace(concertOrganizers))
            {
                organizers.CssClass = organizers.CssClass + " redBorder";
                Message.Text        = "Some Fields are empty!";
                Message.CssClass    = "alert alert-danger";
                flag = false;
            }
            if (int.MinValue == tickets)
            {
                flag = false;
                ATickets.CssClass = ATickets.CssClass + " redBorder";
                Message.CssClass  = "alert alert-danger";
                Message.Text      = "Some Fields are empty!";
            }
            if (int.MinValue == cost)
            {
                flag             = false;
                CCost.CssClass   = CCost.CssClass + " redBorder";
                Message.CssClass = "alert alert-danger";
                Message.Text     = "Some Fields are empty!";
            }

            if (flag)
            {
                StringBuilder sb = new StringBuilder();

                if (ImageUpload.HasFile)
                {
                    try
                    {
                        sb.AppendFormat(" Uploading file: {0}", ImageUpload.FileName);
                        //Showing the file information
                        sb.AppendFormat("<br/> Save As: {0}", ImageUpload.PostedFile.FileName);
                        sb.AppendFormat("<br/> File type: {0}", ImageUpload.PostedFile.ContentType);
                        sb.AppendFormat("<br/> File length: {0}", ImageUpload.PostedFile.ContentLength);
                        sb.AppendFormat("<br/> File name: {0}", ImageUpload.PostedFile.FileName);
                    }
                    catch (Exception ex)
                    {
                        sb.Append("<br/> Error <br/>");
                        sb.AppendFormat("Unable to save file <br/> {0}", ex.Message);
                    }
                }

                datetime = Date.Add(TimeSpan.Parse(cTime));

                int result = 0;
                int found  = 1;
                found = objmyDAl.AddConcert_DAL(concertVenue, datetime, concertPerformer, concertOrganizers, tickets, cost, imageLink, ref result);
                if (found != 1)
                {
                    Message.Text = "Error connecting to server please try later";
                }
                else
                {
                    if (result == 0)
                    {
                        //saving the file
                        ImageUpload.SaveAs(Server.MapPath(@"~\images\" + ImageUpload.FileName));
                        Message.CssClass = "alert alert-success";
                        Message.Text     = "Concert has been added!";
                        Response.AddHeader("REFRESH", "1;URL=/adminHome.aspx");
                    }
                    else if (result == 1)
                    {
                        Message.CssClass = "alert alert-danger";
                        Message.Text     = "Concert already exists.";
                    }
                }
            }
        }
Exemplo n.º 3
0
        protected void AddMovie_Click(object sender, EventArgs e)
        {
            myDAL    objmyDAl     = new myDAL();
            String   movieName    = movie.Text;
            String   directorName = director.Text;
            String   writerName   = writer.Text;
            String   rTime        = hours.Text + ':' + minutes.Text + ':' + seconds.Text;
            DateTime ReleaseDate  = RDate.SelectedDate;
            String   movieGenre   = Genre.Text;
            String   movieCast    = Cast.Text;
            String   imageLink    = @"\images\" + ImageUpload.FileName;

            bool flag = true;

            if (string.IsNullOrWhiteSpace(movieName))
            {
                movie.CssClass   = movie.CssClass + " redBorder";
                Message.Text     = "Some Fields are empty!";
                Message.CssClass = "alert alert-danger";
                flag             = false;
            }
            if (string.IsNullOrWhiteSpace(rTime))
            {
                flag             = false;
                hours.CssClass   = hours.CssClass + " redBorder";
                minutes.CssClass = minutes.CssClass + " redBorder";
                seconds.CssClass = seconds.CssClass + " redBorder";
                Message.CssClass = "alert alert-danger";
                Message.Text     = "Some Fields are empty!";
            }
            if (RDate.SelectedDate.Date == DateTime.MinValue)
            {
                flag             = false;
                RDate.CssClass   = RDate.CssClass + " redBorder";
                Message.CssClass = "alert alert-danger";
                Message.Text     = "Release date is not selected";
            }
            if (string.IsNullOrWhiteSpace(movieGenre))
            {
                flag             = false;
                Genre.CssClass   = Genre.CssClass + " redBorder";
                Message.CssClass = "alert alert-danger";
                Message.Text     = "Some Fields are empty!";
            }


            if (!(ImageUpload.HasFile))
            {
                flag = false;
                ImageUpload.CssClass = ImageUpload.CssClass + " redBorder";
                Message.CssClass     = "alert alert-danger";
                Message.Text         = "Image isn't uploaded!";
            }

            if (flag)
            {
                StringBuilder sb = new StringBuilder();

                if (ImageUpload.HasFile)
                {
                    try
                    {
                        sb.AppendFormat(" Uploading file: {0}", ImageUpload.FileName);
                        //Showing the file information
                        sb.AppendFormat("<br/> Save As: {0}", ImageUpload.PostedFile.FileName);
                        sb.AppendFormat("<br/> File type: {0}", ImageUpload.PostedFile.ContentType);
                        sb.AppendFormat("<br/> File length: {0}", ImageUpload.PostedFile.ContentLength);
                        sb.AppendFormat("<br/> File name: {0}", ImageUpload.PostedFile.FileName);
                    }
                    catch (Exception ex)
                    {
                        sb.Append("<br/> Error <br/>");
                        sb.AppendFormat("Unable to save file <br/> {0}", ex.Message);
                    }
                }

                int result = 0;
                int found  = 1;
                found = objmyDAl.AddMovie_DAL(movieName, directorName, writerName, rTime, ReleaseDate, movieGenre, movieCast, imageLink, ref result);
                if (found != 1)
                {
                    Message.Text = "Error connecting to server please try later";
                }
                else
                {
                    if (result == 0)
                    {
                        //saving the file
                        ImageUpload.SaveAs(Server.MapPath(@"~\images\" + ImageUpload.FileName));
                        Message.CssClass = "alert alert-success";
                        Message.Text     = "Movie has been added!";
                        Response.AddHeader("REFRESH", "1;URL=/adminHome.aspx");
                    }
                    else if (result == 1)
                    {
                        Message.CssClass = "alert alert-danger";
                        Message.Text     = "Movie already exists.";
                    }
                }
            }
        }
Exemplo n.º 4
0
        protected void SignUpButton_Click(object sender, EventArgs e)
        {
            myDAL  objmyDAl      = new myDAL();
            String InputEmail    = Email.Text;
            String InputPassword = Password.Text;
            String InputFname    = Fname.Text;
            String InputLname    = Lname.Text;
            String InputPhone    = Phone.Text;
            String InputGender   = Gender.Text;
            String InputCity     = City.Text;
            bool   flag          = true;

            if (string.IsNullOrWhiteSpace(InputEmail))
            {
                Email.CssClass   = Email.CssClass + " redBorder";
                Message.Text     = "Some Fields are empty!";
                Message.CssClass = "alert alert-danger";
                flag             = false;
            }
            if (string.IsNullOrWhiteSpace(InputPassword))
            {
                flag = false;
                Password.CssClass = Password.CssClass + " redBorder";
                Message.CssClass  = "alert alert-danger";
                Message.Text      = "Some Fields are empty!";
            }
            if (string.IsNullOrWhiteSpace(InputPhone))
            {
                flag             = false;
                Phone.CssClass   = Phone.CssClass + " redBorder";
                Message.CssClass = "alert alert-danger";
                Message.Text     = "Some Fields are empty!";
            }
            if (string.IsNullOrWhiteSpace(InputFname))
            {
                flag             = false;
                Fname.CssClass   = Fname.CssClass + " redBorder";
                Message.CssClass = "alert alert-danger";
                Message.Text     = "Some Fields are empty!";
            }
            if (string.IsNullOrWhiteSpace(InputLname))
            {
                flag             = false;
                Lname.CssClass   = Lname.CssClass + " redBorder";
                Message.CssClass = "alert alert-danger";
                Message.Text     = "Some Fields are empty!";
            }
            if (string.IsNullOrWhiteSpace(ConfirmPassword.Text))
            {
                flag = false;
                ConfirmPassword.CssClass = ConfirmPassword.CssClass + " redBorder";
                Message.CssClass         = "alert alert-danger";
                Message.Text             = "Some Fields are empty!";
            }
            if (Password.Text != ConfirmPassword.Text)
            {
                flag             = false;
                Message.CssClass = "alert alert-danger";
                Message.Text     = "Password does't match!";
            }
            if (flag)
            {
                int result = 0;
                int found  = 1;
                found = objmyDAl.SignUp_DAL(InputFname, InputLname, InputCity, InputGender, InputPhone, InputEmail, InputPassword, ref result);
                if (found != 1)
                {
                    Message.Text = "Error connecting to server please try later";
                }
                else
                {
                    if (result == 0)
                    {
                        Message.CssClass = "alert alert-success";
                        Message.Text     = "Congratulations, sign up successful!";
                        Session["user"]  = InputEmail;
                        Session["type"]  = 1;
                        Response.Redirect("./Home.aspx");
                    }
                    else if (result == 1)
                    {
                        Message.CssClass = "alert alert-danger";
                        Message.Text     = "Invalid email address provided.";
                    }
                    else if (result == 2)
                    {
                        Message.CssClass = "alert alert-danger";
                        Message.Text     = "An account for this email address already exists.";
                    }
                    else if (result == 3)
                    {
                        Message.CssClass = "alert alert-danger";
                        Message.Text     = "Invalid phone number specified. Use 923xxxxxxxxx format.";
                    }
                    else if (result == 4)
                    {
                        Message.CssClass = "alert alert-danger";
                        Message.Text     = "Invalid gender specified. Use the dropdown to select appropriate gender.";
                    }
                }
            }
        }
        protected void LogInButton_Click(object sender, EventArgs e)
        {
            myDAL  objmyDAl      = new myDAL();
            String InputEmail    = Email.Text;
            String InputPassword = Password.Text;

            Session["user"] = null;
            Session["type"] = null;


            bool flag = true;

            if (string.IsNullOrWhiteSpace(InputEmail))
            {
                Email.CssClass   = Email.CssClass + " redBorder";
                Message.Text     = "Some important fields are empty!";
                Message.CssClass = "alert alert-danger alert-dismissible";
                flag             = false;
            }
            if (string.IsNullOrWhiteSpace(InputPassword))
            {
                flag = false;
                Password.CssClass = Password.CssClass + " redBorder";
                Message.CssClass  = "alert alert-danger alert-dismissible";
                Message.Text      = "Some important fields are empty!";
            }
            if (flag)
            {
                int result = 0;
                int found  = 1;
                found = objmyDAl.Login_DAL(InputEmail, InputPassword, ref result);
                if (found != 1)
                {
                    Message.Text = "Error connecting to server please try later";
                }
                else
                {
                    if (result == -1)
                    {
                        Message.CssClass = "alert alert-danger alert-dismissible";
                        Message.Text     = "No user found";
                    }
                    else if (result == 0)
                    {
                        Message.CssClass = "alert alert-success";
                        Message.Text     = "Logged in!";
                        Session["user"]  = InputEmail;
                        Session["type"]  = 1;
                        Response.Redirect("./Home.aspx");
                    }
                    else if (result == 3)
                    {
                        Message.CssClass = "alert alert-success";
                        Message.Text     = "Logged in as admin!";
                        Session["user"]  = InputEmail;
                        Session["type"]  = 2;
                        Response.Redirect("./adminHome.aspx");
                    }
                }
            }
        }