Exemplo n.º 1
0
    protected void btnEdit_Click(object sender, EventArgs e)
    {
        gameNews gn = new gameNews();
        gn.gameNewsAuthor = "admin";
        gn.gameNewsContent = editor.Value;
        gn.gameNewsTitle = txtTitle.Text;
        gn.gameType = typeRadioButtonList.SelectedValue;

        //解析地址经纬度
        string strlatitude, strlongitude;
        Geo.GetLocation(locationTextBox.Text, out strlongitude, out strlatitude);
        gn.longitude = double.Parse(strlongitude);
        gn.latitude = double.Parse(strlatitude);

        gn.url = txtUrl.Text;
        gn.gameNewsHitTimes = 1;
        gn.gameNewsEditTimes = 1;
        gn.gameNewsCreatedTime = DateTime.Now;
        gn.gameNewsKeyWords = "news";
        gn.gameNewsPriority = 1;

        NewsHandler newHandler = new NewsHandler(gn);
        newHandler.Insert();
        Response.Write("<script>alert('添加成功!')</script>");
        Response.Redirect("NewsManage.aspx");
    }
Exemplo n.º 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        NewsHandler newsHandler = new NewsHandler();
        newsListRepeater.DataSource = newsHandler.getNewsList();
        newsListRepeater.DataBind();

        if (Request.QueryString["operate"] == "delete")
        {
            newsHandler.SetCurrentNewsById(int.Parse(Request.QueryString["newsId"]));
            newsHandler.Delete();
            Response.Write("<script>alert('删除成功!');</script>");
            Response.Redirect("NewsManage.aspx");
        }
    }