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 Page_Load(object sender, EventArgs e) { BLL_Coures bc = new BLL_Coures(); list.DataSource = bc.SeleteCoures(); list.DataBind(); }
private void Btn_Click(object sender, EventArgs e) { Button t = (Button)sender; Coures c = new Coures(); BLL_Coures bc = new BLL_Coures(); bname.Text = t.Text; bid.Text = t.ID; }
protected void Page_Load(object sender, EventArgs e) { Coures c = new Coures(); BLL_Coures bc = new BLL_Coures(); List <Coures> lc = bc.SeleteCoures(); for (int i = 0; i < bc.SeleteCoures().Count; i++) { Button btn = new Button(); btn.Width = 100; btn.Height = 100; btn.ID = Convert.ToString(lc[i].C_ID); btn.CssClass = "book btn btn-info"; btn.Text = lc[i].C_NAME; btn.Click += Btn_Click; panel.Controls.Add(btn); } }
protected void del_Click(object sender, EventArgs e) { try { Coures cs = new Coures(); cs.C_ID = Convert.ToInt32(wbid.Text); cs.C_NAME = wbname.Text; BLL_Coures del = new BLL_Coures(); del.DeleteCoures(cs); if (del.DeleteCoures(cs) > 0) { Response.Write(@"<script>alert('删除成功!');location.reload();</script>"); } else { Response.Write(@"<script>alert('删除失败!');history.go(-1);</script>"); } } catch { Response.Write(@"<script>alert('删除失败!'); history.go(-1);</script>"); } }
protected void save_Click(object sender, EventArgs e) { try { Coures cs = new Coures(); cs.C_NAME = wbname.Text; cs.CCT_ID = wbtype.SelectedIndex; cs.C_RELEASEDATE = DateTime.Now; BLL_Coures save = new BLL_Coures(); save.AddCoures(cs); if (save.AddCoures(cs) > 0) { Response.Write(@"<script>alert('保存成功!'); </script>"); } else { Response.Write(@"<script>alert('保存失败!');history.go(-1);</script>"); } } catch { Response.Write(@"<script>alert('保存失败!'); history.go(-1);</script>"); } }