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_Info : System.Web.UI.Page
    {
        public MODEL.MMember model = new MODEL.MMember();
        protected void Page_Load(object sender, EventArgs e)
        {


            BLL.Models.MemberModels models_member = new BLL.Models.MemberModels();
            string _username = models_member.CheckUserId();
            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();
            model.Msn = Convert.IsDBNull(dt.Rows[0]["msn"]) == true ? "" : dt.Rows[0]["msn"].ToString();
            string _Id = Request["id"] == null ? "0" : Request["id"].ToString();
            string _Name = Request["name"] == null ? "" : Request["name"].ToString();
            string _QQ = Request["qq"] == null ? "" : Request["qq"].ToString();
            string _Email = Request["email"] == null ? "" : Request["email"].ToString();
            string _Phone = Request["phone"] == null ? "" : Request["phone"].ToString();
            string _Mobile = Request["mobile"] == null ? "" : Request["mobile"].ToString();
            string _Sex = Request["sex"] == null ? "0" : Request["sex"].ToString();
            string _Address = Request["Address"] == null ? "" : Request["address"].ToString();
            string _ZipCode = Request["ZipCode"] == null ? "" : Request["ZipCode"].ToString();
            string _Msn = Request["msn"] == null ? "" : Request["msn"].ToString();
            if (_Id != "0")
            {


                model.Name = _Name;
                model.Qq = _QQ;
                model.Email = _Email;
                model.Phone = _Phone;
                model.Mobile = _Mobile;
                model.Sex = Convert.ToInt32(_Sex);
                model.Address = _Address;
                model.ZipCode = _ZipCode;
                model.Msn = _Msn;
                models_member.UpdateCenterUser(model);
            }

        }
    }
}