예제 #1
0
    /// <summary>
    /// 删除日程
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnDelete_Click(object sender, EventArgs e)
    {
        this.lblTime.Text = Convert.ToString(Request.QueryString["today"]);
        User             user      = UserManager.GetUserById(Convert.ToString(Request.QueryString["userId"]));
        IList <Schedule> schedules = ScheduleManager.SearchSchedule(lblTime.Text, -1, user.UserName, false);

        if (schedules.Count != 0)
        {
            int scheduleId = 0;
            foreach (Schedule schedule in schedules)
            {
                scheduleId = schedule.ScheduleId;
                int i = ScheduleManager.DeleteScheduleById(scheduleId);
                if (i > 0)
                {
                    Response.Redirect("PersonSchedule.aspx");
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this, GetType(), "key", "alert('删除失败!')", true);
                }
            }
        }
    }