protected void Page_Load(object sender, EventArgs e) { //try //{ if (Session["name"] == null) { Response.Write("<script>alert('请先登录!');history.go(-1);</script>"); } //SpeechSynthesizer tts = new SpeechSynthesizer(); //tts.Speak("Hello"); //tts.SpeakAsyncCancelAll(); BCZWeb.Views.userProf up = new BCZWeb.Views.userProf(); int id = Convert.ToInt32(up.Session["id"]); UserCollect uc = new UserCollect(); BLL_UserCollect bu = new BLL_UserCollect(); List <UserCollect> luc = bu.SelectUserCollect(id); BLL_Coures bc = new BLL_Coures(); ucid.Text = luc[0].UC_ID.ToString(); cid.Text = luc[0].C_ID.ToString(); stime.Text = luc[0].UC_StartDay.ToShortDateString(); etime.Text = luc[0].US_EndDay.ToShortDateString(); sumday.Text = luc[0].UC_ComDay.ToString(); surday.Text = Convert.ToDateTime(etime.Text).Subtract(DateTime.Now).Days.ToString(); List <Coures> lc = bc.select(Convert.ToInt32(cid.Text)); current.Text = lc[0].C_NAME; //} //catch //{ // Response.Redirect("fix.aspx"); //} }
protected void del_Click(object sender, EventArgs e) { userProf up = new userProf(); BLL_UserCollect buc = new BLL_UserCollect(); if (buc.DeleteUserCollect(Convert.ToInt32(up.Session["id"].ToString())) > 0) { Response.Write("<script>alert('删除成功!');</script>"); } else { Response.Write("<script>alert('删除失败!');</script>"); } }
protected void add_Click(object sender, EventArgs e) { UserCollect uc = new UserCollect(); BLL_UserCollect buc = new BLL_UserCollect(); uc.U_ID = up.Session["id"].ToString(); uc.C_ID = Convert.ToInt32(bid.Text); uc.UC_EveWord = Convert.ToInt32(ew.Text); uc.UC_StartDay = Convert.ToDateTime(sday.Value); uc.US_EndDay = Convert.ToDateTime(eday.Value); uc.UC_ComDay = Convert.ToDateTime(eday.Value).Subtract(Convert.ToDateTime(sday.Value)).Days; if (buc.AddUserCollect(uc) > 0) { Response.Write("<script>alert('添加成功!');window.location.href='word.aspx';</script>"); } else { Response.Write("<script>alert('添加失败!');</script>"); } }
protected void del_Click(object sender, EventArgs e) { try { BLL_UserCollect buc = new BLL_UserCollect(); BLL_Users del = new BLL_Users(); Users us = new Users(); us.U_ID = Convert.ToInt32(uid.Text); us.U_NAME = duname.Text; buc.DeleteUserCollect(Convert.ToInt32(uid.Text)); if (del.DeleteUsers(us) > 0) { Response.Write(@"<script>alert('删除成功!');location.reload();</script>"); } } catch { Response.Write(@"<script>alert('删除失败!');history.go(-1);</script>"); } }