using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;

namespace Mall.Member
{
    public partial class Member_Center : System.Web.UI.Page
    {
       public MODEL.MMember model = new MODEL.MMember();
       public MODEL.MAD model_ad = new MODEL.MAD();
        protected void Page_Load(object sender, EventArgs e)
        {
 
            BLL.Models.MemberModels models_member = new BLL.Models.MemberModels();
            BLL.Models.MAdModels models_mad = new BLL.Models.MAdModels();
            string _username = models_member.CheckUserId();
            model_ad = models_mad.GetAdById("23");


            DataTable dt = new DataTable();
            dt = models_member.GetuserInfoByFiter("  Username='" + _username + "' ");
            model.Id = Convert.ToInt32(dt.Rows[0]["id"].ToString());
            model.UserName = Convert.IsDBNull(dt.Rows[0]["username"]) == true ? "" : dt.Rows[0]["username"].ToString();
            model.Point = Convert.IsDBNull(dt.Rows[0]["point"]) == true ? 0 : Convert.ToInt32(dt.Rows[0]["point"].ToString());
            model.Name = Convert.IsDBNull(dt.Rows[0]["Name"]) == true ? "" : dt.Rows[0]["name"].ToString();
            model.Qq = Convert.IsDBNull(dt.Rows[0]["qq"]) == true ? "" : dt.Rows[0]["qq"].ToString();
            model.Email = Convert.IsDBNull(dt.Rows[0]["email"]) == true ? "" : dt.Rows[0]["email"].ToString();
            model.Phone = Convert.IsDBNull(dt.Rows[0]["phone"]) == true ? "" : dt.Rows[0]["phone"].ToString();
            model.Mobile = Convert.IsDBNull(dt.Rows[0]["mobile"]) == true ? "" : dt.Rows[0]["mobile"].ToString();
            model.Sex = Convert.IsDBNull(dt.Rows[0]["sex"]) == true ? 1 : Convert.ToInt32(dt.Rows[0]["sex"].ToString());
            model.Address = Convert.IsDBNull(dt.Rows[0]["address"]) == true ? "" : dt.Rows[0]["address"].ToString();
            model.ZipCode = Convert.IsDBNull(dt.Rows[0]["zipcode"]) == true ? "" : dt.Rows[0]["zipcode"].ToString();
            //ViewData["Member_Center_ModelMember"] = model;

        }
    }
}