Ejemplo n.º 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request.QueryString["G"] == null || Session["User"] == null)
     {
         if (Request.QueryString["m"] != null)
         {
             ImDb.WebService ImDb = new ImDb.WebService();
             MovieUrl = ImDb.GetURLAddress(int.Parse(Request.QueryString["m"]));
         }
         else
         {
             Response.Redirect("HomePage.aspx");
         }
     }
     else
     {
         GroupId = int.Parse(Request.QueryString["G"]);
         //if (((GroupsDetails) Page.Application["Rooms"]).Rooms.Count != 0)
         GroupsDetails groupsDetails = (GroupsDetails)Cache.Get("Rooms");
         if (groupsDetails.Rooms.Count != 0)
         {
             //Gr = ((GroupsDetails)Page.Application["Rooms"]).GetTheSerchGroup(GroupId);
             Gr = groupsDetails.GetTheSerchGroup(GroupId);
             this.LabelCurrent.Text = Gr.CurrentTime.ToString();
             Gr.EndMovie            = int.Parse(this.LabelEend.Text);
             //startTimer(Gr.MenngerGroup, ((UserDetail)Session["User"]).UserId);
             if (Gr.Active)
             {
                 Page.ClientScript.RegisterStartupScript(this.ButtonStop.GetType(), "startVideo", "playVideo()", true);
             }
             else
             {
                 Page.ClientScript.RegisterStartupScript(this.ButtonStop.GetType(), "pauseVideo", "pauseVideo()", true);
             }
         }
         else
         {
             this.LabelCurrent.Text = "0";
         }
         ImDb.WebService ImDb = new ImDb.WebService();
         MovieUrl = ImDb.GetURLAddress(Gr.MovieID);
     }
     if (Gr != null)
     {
         PopChat();
     }
     else
     {
         this.TextBoxChat.Visible   = false;
         this.TextBoxMessge.Visible = false;
     }
 }
Ejemplo n.º 2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         if (Session["User"] == null)
         {
             Menu1.Items.Add(new MenuItem("Register", "Register", null, "~/Register.aspx"));
             Menu1.Items.Add(new MenuItem("Log in", "Login", null, "~/login.aspx"));
         }
         else
         {
             Menu1.Items.Add(new MenuItem("Update User", "UpdateUser", null, "~/UpdateUser.aspx"));
             Menu1.Items.Add(new MenuItem("Friend List", "FriendList", null, "~/FriendList.aspx"));
             Menu1.Items.Add(new MenuItem("Log Out", "LogOut", null, "~/LogOut.aspx"));
             if (((UserDetail)Session["User"]).KindUser >= 5)
             {
                 Menu1.Items.Add(new MenuItem("CreateGroupe", "CreateGroupe", null, "~/CreateGroupe.aspx"));
             }
             Menu1.Items.Add(new MenuItem("WachHistory", "WachHistory", null, "~/WachHistory.aspx"));
             Menu1.Items.Add(new MenuItem("GroupMannge", "GroupMannge", null, "~/GroupMannge.aspx"));
             if (((UserDetail)Session["User"]).KindUser == 10)
             {
                 Menu1.Items.Add(new MenuItem("MenngerPage", "MenngerPage", null, "~/MenngerPage.aspx"));
             }
             //   GroupsDetails groups=((GroupsDetails)Page.Application["Rooms"]);
             GroupsDetails groups = (GroupsDetails)Cache.Get("Rooms");
             if (groups.Rooms.Count != 0)
             {
                 this.ListBoxInvate.Items.Clear();
                 foreach (Group i in groups.Rooms)
                 {
                     if (i.IsInGroup(((UserDetail)Session["User"]).UserId))
                     {
                         ListItem ls = new ListItem(i.GroupeName, i.GroupId.ToString());
                         this.ListBoxInvate.Items.Add(ls);
                     }
                 }
             }
             PopIvateGroup();
         }
         List <UserDetail> User = (List <UserDetail>)Page.Application["Users"];
         if (User.Count != 0)
         {
             foreach (UserDetail i in User)
             {
                 this.ListBoxOnllineUser.Items.Add(i.UserName);
             }
         }
     }
 }
Ejemplo n.º 3
0
 protected void ListBoxGroup_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (ListBoxGroup.SelectedValue == "Null")
     {
         Response.Redirect("TheViewMovie.aspx?m=" + MovieId);
     }
     else
     {
         Group        Group        = new Group();
         GroupServies Groupcommand = new GroupServies();
         Group = Groupcommand.GetGroupToWatch(int.Parse(ListBoxGroup.SelectedValue), int.Parse(MovieId));
         //((GroupsDetails)Application["Rooms"]).AddToGroup(Group);
         GroupsDetails g = (GroupsDetails)Cache.Get("Rooms");
         g.AddToGroup(Group);
         Cache.Insert("Rooms", g);
         UserServies Command = new UserServies();
         Command.AddToGoupHistory(Group.MovieID, Group.GroupId, ((UserDetail)Session["User"]).UserId);
         Response.Redirect("TheViewMovie.aspx?G=" + Group.GroupId);
     }
 }
Ejemplo n.º 4
0
    private static void timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
    {
        // Do whatever you want to do on each tick of the timer
        //if (System.Web.HttpContext.Current != null)

        //  HttpRuntime.Cache.
        //for (int i = 0; i < ((GroupsDetails)System.Web.HttpContext.Current.Application["Rooms"]).Rooms.Count; i++)
        GroupsDetails groupsDetails = (GroupsDetails)HttpRuntime.Cache.Get("Rooms");

        for (int i = 0; i < groupsDetails.Rooms.Count; i++)
        {
            //	Group Mark = ((GroupsDetails)System.Web.HttpContext.Current.Application["Rooms"]).Rooms[i];
            Group Mark = groupsDetails.Rooms[i];
            if (Mark.Active)
            {
                Mark.CurrentTime += 1;
            }

            //((GroupsDetails)System.Web.HttpContext.Current.Application["Rooms"]).Rooms.Remove(Mark);

            //        System.Web.HttpContext.Current.Response.Redirect("TheViewMovie.aspx ? m =" + Mark.MovieID);
        }
    }
Ejemplo n.º 5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request.QueryString["G"] == null || Session["User"] == null)
     {
         if (Request.QueryString["m"] != null)
         {
             ImDb.WebService ImDb = new ImDb.WebService();
             MovieUrl = ImDb.GetURLAddress(int.Parse(Request.QueryString["m"]));
         }
         else
         {
             Response.Redirect("HomePage.aspx");
         }
     }
     else
     {
         GroupId = int.Parse(Request.QueryString["G"]);
         //if (((GroupsDetails) Page.Application["Rooms"]).Rooms.Count != 0)
         GroupsDetails groupsDetails = (GroupsDetails)Cache.Get("Rooms");
         if (groupsDetails.Rooms.Count != 0)
         {
             //Gr = ((GroupsDetails)Page.Application["Rooms"]).GetTheSerchGroup(GroupId);
             Gr = groupsDetails.GetTheSerchGroup(GroupId);
             this.LabelCurrent.Text = Gr.CurrentTime.ToString();
             Gr.EndMovie            = int.Parse(this.LabelEend.Text);
             //startTimer(Gr.MenngerGroup, ((UserDetail)Session["User"]).UserId);
             UserName = ((UserDetail)Session["User"]).UserName;
         }
         else
         {
             GroupId = 0;
             this.LabelCurrent.Text = "0";
         }
         ImDb.WebService ImDb = new ImDb.WebService();
         MovieUrl = ImDb.GetURLAddress(Gr.MovieID);
     }
 }
Ejemplo n.º 6
0
    public override void OnMessage(string message)
    {
        string[]      words = message.Split(',');
        GroupsDetails Rooms = (GroupsDetails)HttpRuntime.Cache.Get("Rooms");
        Group         Group = Rooms.GetTheSerchGroup(int.Parse(words[1]));

        switch (words[0])
        {
        case "start":
            Group.Active = true;
            Clients.Broadcast("{\"Command\":\"start\", \"Sec\":\"" + Group.CurrentTime + "\", \"Group\":\"" + Group.GroupId + "\"}");
            break;

        case "stop":
            Group.Active = false;
            Clients.Broadcast("{\"Command\":\"stop\", \"Sec\":\"" + Group.CurrentTime + "\", \"Group\":\"" + Group.GroupId + "\"}");
            break;

        default:
            string send = name + ": " + words[0];
            Clients.Broadcast("{\"Command\":\"" + send + "\", \"Sec\":\"" + Group.CurrentTime + "\", \"Group\":\"" + Group.GroupId + "\"}");
            break;
        }
    }