using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Models;
using LoveBLL;
namespace LoveWeb
{
    public partial class index : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                ArtiBind();
                InviBind();
                string city_name = "南宁";
                weather.WeatherWebService wea = new weather.WeatherWebService();
                string[] weathStr = wea.getWeatherbyCityName(city_name);
                Label1.Text = weathStr[0];
                Label2.Text = weathStr[1];
                Label3.Text = weathStr[5];
                Label4.Text = weathStr[6];
                Label5.Text = weathStr[7];
                //Label6.Text = weathStr[8];
                Image1.ImageUrl = "weather/" + weathStr[8];
            }
        }
        public void ArtiBind()
        {
            PagedDataSource pds = new PagedDataSource();
            pds.DataSource = ArticleManager.GetStory();
            DataList3.DataSource = pds;
            DataList3.DataBind();

        }
        public void InviBind()
        {
            PagedDataSource pds = new PagedDataSource();
            pds.DataSource = InvitationManager.GetInviClick();
            DataList1.DataSource = pds;
            DataList1.DataBind();

        }

        protected void Button3_Click(object sender, EventArgs e)
        {
            PagedDataSource pds = new PagedDataSource();
            pds.DataSource = NewsManager.SouNews(TextBox1.Text.Trim());
            int NewsNum = NewsManager.GetSouNewsNum(TextBox1.Text.Trim());
            Session["newsNum"] = NewsNum;
            Session["pds"] = pds;
            Response.Redirect("SouNewsView.aspx");
        }

        public static string GetPartString(string Arti_contents, int num)
        {
            return ArticleManager.GetPart(Arti_contents, num);
        }

    }
}
