Exemple #1
0
        protected void AddLive_Click(object sender, EventArgs e)
        {
            Image1.ImageUrl = @"~/Img_Live/" + FileUpload_img.PostedFile.FileName;
            Live live = new Live();

            live.Live_Title1 = txtName.Text.Trim();
            live.Live_Img1   = @"~/Img_Live/" + FileUpload_img.PostedFile.FileName;
            live.Live_Url1   = txtUrl.Text.Trim();
            try
            {
                if (LiveBll.addlive(live) == 1)
                {
                    txtName.Text = "";
                    txtUrl.Text  = "";
                    Page.ClientScript.RegisterClientScriptBlock(typeof(Object), "alert", "<script>alert('添加成功!');</script>");
                }
                else
                {
                    Page.ClientScript.RegisterClientScriptBlock(typeof(object), "alert", "<script>alert('添加失败!');</script>");
                }
            }
            catch (Exception ex)
            {
                Response.Write("错误原因:" + ex.Message);
            }
        }
        protected void bindlive()
        {
            DataTable a = LiveBll.allLive();

            if (a != null)
            {
                liveview.DataSource = a;
                liveview.DataBind();
            }
        }
Exemple #3
0
        //绑定主播直播间数据
        protected void bingLive()
        {
            DataTable bl = LiveBll.allLive();

            if (bl != null)
            {
                live_view.DataSource = bl;
                live_view.DataBind();
            }
        }
Exemple #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            binglive();
            int id;

            if (!IsPostBack)
            {
                if (Request.QueryString["liveid"] != null)
                {
                    id = Convert.ToInt32(Request.QueryString["liveid"].ToString());
                    LiveBll.deletelive(id);
                    binglive();
                }
            }
        }
Exemple #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int id;

            if (!IsPostBack)
            {
                if (Request.QueryString["liveid"] != null)
                {
                    id = Convert.ToInt32(Request.QueryString["liveid"].ToString());
                    SqlDataReader dt = LiveBll.selectlive(id);
                    dt.Read();
                    if (dt != null)
                    {
                        Name.Text       = dt[1].ToString().Trim();
                        Image1.ImageUrl = dt[2].ToString().Trim();
                        Url.Text        = dt[3].ToString().Trim();
                    }
                }
            }
        }
Exemple #6
0
        //修改主播信息
        protected void UpdateLive_Click(object sender, EventArgs e)
        {
            Live live = new Live();

            live.Live_ID1    = Convert.ToInt32(Request.QueryString["liveid"].ToString());
            live.Live_Title1 = txtName1.Text.Trim();
            live.Live_Img1   = @"Img_News\" + FileUpload_img.PostedFile.FileName;
            live.Live_Url1   = txtUrl.Text.Trim();
            try
            {
                if (LiveBll.updatelive(live) == 1)
                {
                    Page.ClientScript.RegisterClientScriptBlock(typeof(Object), "alert", "<script>alert('修改成功!');</script>");
                }
                else
                {
                    Page.ClientScript.RegisterClientScriptBlock(typeof(object), "alert", "<script>alert('修改失败!');</script>");
                }
            }
            catch (Exception ex)
            {
                Response.Write("错误原因:" + ex.Message);
            }
        }
Exemple #7
0
 //绑定数据
 protected void binglive()
 {
     ListView1.DataSource = LiveBll.allLive();
     ListView1.DataBind();
 }