Exemple #1
0
        protected void top_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            ImageButton action       = (ImageButton)e.CommandSource;
            string      actionString = action.ID;

            if (action.ID.Equals("join"))
            {
                try
                {
                    teacher   = new Teacher();
                    classmeet = new ClassMeeting();
                    string id = ((Label)class_data.Items[e.Item.ItemIndex].FindControl("Id")).Text;
                    classmeet.Id      = id;
                    teacher.Email     = Session["Username"].ToString();
                    classmeet.Teacher = teacher;
                    UpdateClassTeacherCommand _cmd_ = new UpdateClassTeacherCommand(classmeet);
                    _cmd_.Execute();
                    ClientScript.RegisterClientScriptBlock(this.GetType(), "random", "alertme_succ()", true);
                }
                catch (Exception ex)
                {
                }
            }
            else if (action.ID.Equals("modify"))
            {
                try
                {
                }
                catch (Exception ex)
                {
                }
            }
        }
        protected void mat_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            ImageButton action       = (ImageButton)e.CommandSource;
            string      actionString = action.ID;

            if (action.ID.Equals("join"))
            {
                try
                {
                    clase = new ClassMeeting();
                    string date = ((Label)class_data.Items[e.Item.ItemIndex].FindControl("starttime")).Text;
                    clase.StartTime = Convert.ToDateTime(date);
                    if (clase.StartTime.ToShortDateString() == DateTime.Now.ToShortDateString())
                    {
                        string joinurl = ((Label)class_data.Items[e.Item.ItemIndex].FindControl("joinurl")).Text;
                        Response.Redirect(joinurl);
                    }
                    else
                    {
                        ClientScript.RegisterClientScriptBlock(this.GetType(), "random", "alertme()", true);
                    }
                }
                catch (Exception ex)
                {
                }
            }
            else if (action.ID.Equals("cancel"))
            {
                try
                {
                    teacher   = new Teacher();
                    classmeet = new ClassMeeting();
                    string id = ((Label)class_data.Items[e.Item.ItemIndex].FindControl("Id")).Text;
                    classmeet.Id      = id;
                    teacher.Email     = "*****@*****.**";
                    classmeet.Teacher = teacher;
                    UpdateClassTeacherCommand _cmd_ = new UpdateClassTeacherCommand(classmeet);
                    _cmd_.Execute();
                    ClientScript.RegisterClientScriptBlock(this.GetType(), "random", "alertme_err()", true);
                }
                catch (Exception ex)
                {
                }
            }
        }