using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Smobiler.Core;
using Smobiler.Core.Controls;
using SmoONE.DTOs;

namespace SmoONE.UI.Layout
{
    ////ToolboxItemÓÃÓÚ¿ØÖÆÊÇ·ñÌí¼Ó×Ô¶¨Òå¿Ø¼þµ½¹¤¾ßÏä£¬trueÌí¼Ó£¬false²»Ìí¼Ó
    //[System.ComponentModel.ToolboxItem(true)]
    partial class LeftPage : Smobiler.Core.Controls.MobileUserControl
    {
        #region "definition"
        AutofacConfig AutofacConfig = new AutofacConfig();//µ÷ÓÃÅäÖÃÀà
       
        #endregion

        /// <summary>
        /// ÏêÏ¸ÐÅÏ¢
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void plPerson_Press(object sender, EventArgs e)
        {
            SmoONE.UI.UserInfo. frmUserDetail frmUserDetail = new SmoONE.UI.UserInfo.frmUserDetail();
            frmUserDetail.U_ID = Client.Session["U_ID"].ToString();
            this.Form .Show(frmUserDetail);
        }

        private void plExit_Press(object sender, EventArgs e)
        {
            //this.Client.Exit();
            //this.Form .Close();
       
            this.Client.ReStart();
            
        }
        /// <summary>
        /// Êý¾Ý¼ÓÔØ
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void LeftPage_Load(object sender, EventArgs e)
        {
            getUser();
        }

        public  void getUser()
        {
            try
            {
                DTOs.UserDetailDto user = AutofacConfig.userService.GetUserByUserID(Client.Session["U_ID"].ToString());
                if (user != null)
                {
                    lblPhone.Text = Client.Session["U_ID"].ToString();
                    lblName.Text = user.U_Name;
                    if (string.IsNullOrEmpty(user.U_Portrait) == true)
                    {
                        switch (user.U_Sex)
                        {
                            case (int)Sex.ÄÐ:
                                user.U_Portrait = "boy";
                                break;
                            case (int)Sex.Å®:
                                user.U_Portrait = "girl";
                                break;
                        }
                    }
                    imgPortrait.ResourceID = user.U_Portrait;
                }
            }
            catch (Exception ex)
            {
                this.Form.Toast(ex.Message, ToastLength.SHORT);
            }
            
        }
    }
}