Exemplo n.º 1
0
        protected void LogIn(object sender, EventArgs e)
        {
            using (TheatreEntitiesNew te = new TheatreEntitiesNew())
            {
                var users = te.Users;
                foreach (var u in users)
                {
                    if ((String.Equals(Email.Text, u.E_mail) && String.Equals(Password.Text, u.Pin)) && u.Type == true)
                    {
                        FailureText.Text     = String.Format("User: {0} type: {1}", u.E_mail, u.Type);
                        ErrorMessage.Visible = true;
                        //IdentityHelper.RedirectToReturnUrl(Request.QueryString["Admin"], Response);

                        Server.Transfer("Admin.aspx", true);
                        break;
                    }
                    else if ((String.Equals(Email.Text, u.E_mail) && String.Equals(Password.Text, u.Pin)))
                    {
                        FailureText.Text     = String.Format("User: {0} name: {1}", u.E_mail, u.Name);
                        ErrorMessage.Visible = true;
                        //IdentityHelper.RedirectToReturnUrl(Request.QueryString["Contact"], Response);
                        Server.Transfer("PlaceMarket.aspx", true);
                        Users temp = u;
                        break;
                    }

                    else if (String.Equals(Email.Text, u.E_mail) || String.Equals(Password.Text, u.Pin))
                    {
                        FailureText.Text     = "Invalid login attempt";
                        ErrorMessage.Visible = true;
                        break;
                    }
                }
            }
        }
Exemplo n.º 2
0
        public static string AddSpectacleJS(string Spectacle_name, string Exposition_sp, DateTime Date_sp)
        {
            string respond = "not added";

            using (TheatreEntitiesNew te = new TheatreEntitiesNew())
            {
                var actors = te.Actors;


                Spectacles s = new Spectacles
                {
                    Spectacle_name = Spectacle_name,
                    Exposition_sp  = Exposition_sp,
                    Date_sp        = Date_sp,
                    Actor1         = actorsList[0],
                    Actor2         = actorsList[1],
                    Actor3         = actorsList[2],
                    Actor4         = actorsList[3],
                    Actor5         = actorsList[4],
                    Actor6         = actorsList[5],
                    Actor7         = actorsList[6],
                    Actor8         = actorsList[7],
                    Actor9         = actorsList[8],
                    Actor10        = actorsList[9]
                };

                te.Spectacles.Add(s);
                te.SaveChanges();
                respond = String.Format("спектакль {0} доданий", s.Spectacle_name);
            }
            return(respond);
        }
Exemplo n.º 3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     ActorsCheck.Items.Clear();
     using (TheatreEntitiesNew te = new TheatreEntitiesNew())
     {
         var actors = te.Actors;
         foreach (var a in actors)
         {
             ActorsCheck.Items.Add(String.Format("{0} : {1} {2}", a.Actor_id, a.Name_actor, a.Surname_actor));
         }
     }
 }
Exemplo n.º 4
0
        protected void ClickAddSpectacle(object sender, EventArgs e)
        {
            using (TheatreEntitiesNew te = new TheatreEntitiesNew())
            {
                var actors = te.Actors;
                int n      = 0;

                for (int i = 0; i < ActorsCheck.Items.Count; ++i)
                {
                    if (ActorsCheck.Items[i] == ActorsCheck.SelectedItem)
                    {
                        foreach (var a in actors)
                        {
                            if (ActorsCheck.Items[i].ToString().Contains(a.Name_actor) && ActorsCheck.Items[i].ToString().Contains(a.Surname_actor))
                            {
                                actorsList[n] = a.Actor_id;
                                message.Text += String.Format("актор доданий {0}", actorsList[n].ToString());
                                ++n;
                            }
                        }
                    }
                }

                Spectacles s = new Spectacles {
                    Spectacle_name = TextBox1.Text,
                    Exposition_sp  = TextBox2.Text,
                    Date_sp        = Convert.ToDateTime(DateTimePicker1.Value),
                    Actor1         = actorsList[0],
                    Actor2         = actorsList[1],
                    Actor3         = actorsList[2],
                    Actor4         = actorsList[3],
                    Actor5         = actorsList[4],
                    Actor6         = actorsList[5],
                    Actor7         = actorsList[6],
                    Actor8         = actorsList[7],
                    Actor9         = actorsList[8],
                    Actor10        = actorsList[9]
                };

                te.Spectacles.Add(s);
                te.SaveChanges();
                //
                //var sp = te.Spectacles;
                //message.Text = String.Format("spectacle {0} {1} {2} {3} {4} {5} {6} {7} {8} {9} {10}", s.Spectacle_name, s.Exposition_sp,s.Date_sp,s.Actor1,s.Actor2,s.Actor3,s.Actor4,s.Actor5,s.Actor6,s.Actor7,s.Actor8);
                message.Text += String.Format("спектакль {0} доданий", s.Spectacle_name);
            }
        }
Exemplo n.º 5
0
        protected void CreateUser_Click(object sender, EventArgs e)
        {
            if (String.Equals(Password.Text, ConfirmPassword.Text))
            {
                using (TheatreEntitiesNew te = new TheatreEntitiesNew())
                {
                    Users us = new Users {
                        Name = Name.Text, Surname = Surname.Text, Address = Address.Text, Pin = Password.Text, E_mail = Email.Text, Type = false
                    };

                    te.Users.Add(us);
                    te.SaveChanges();

                    var users = te.Users.ToList();

                    ErrorMessage.Text = users[users.Count - 1].Name + " added";
                }
            }
            else
            {
                ErrorMessage.Text = "passwords not equals";
            }
        }