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

public partial class personal_detaileduser : PageBase
{
    SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["constring"].ConnectionString);
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            DataTable tb = new DataTable();
            string strnumber;
            string intnumber;
            strnumber = Request.QueryString["name"];
            intnumber = Request.QueryString["name1"];

            Lnumber.Text = intnumber.ToString();


            string indexTopMainStr = "SELECT  [departmentname],[PersonnelName], [LoginName], [Pwd],  [WorkName], [Sex], [IdCardNum],[Birthday],[CallPhone],[Phone],[FamilyAddress],[ContactAddress],[WorkEmail],[WorkQQ],[PersonalEmail],[PersonalQQ],[UrgetRelationName],[UrgetRelationRelation],[UrgetRelationPhone],[workname],[pid],[number] FROM [v_tabp_work] where pid like '%" + strnumber + "%'";
            conn.Open();
            SqlDataAdapter rst = new SqlDataAdapter(indexTopMainStr, conn);
            conn.Close();
            rst.Fill(tb);

            string strdepartmentname = tb.Rows[0][0].ToString();
            string strworkname = tb.Rows[0][19].ToString();
            string strPersonnelName = tb.Rows[0][1].ToString();
            string strPwd = tb.Rows[0][3].ToString();
            string nsex = tb.Rows[0][5].ToString();
            string strLoginName = tb.Rows[0][2].ToString();
            string strIdCardNum = tb.Rows[0][6].ToString();
            DateTime strBirthday =ConvertHelper.GetDateTime(tb.Rows[0][7]);
            string strCallPhone = tb.Rows[0][8].ToString();
            string strPhone = tb.Rows[0][9].ToString();
            string strFamilyAddress = tb.Rows[0][10].ToString();
            string strContactAddress = tb.Rows[0][11].ToString();
            string strWorkEmail = tb.Rows[0][12].ToString();
            string strWorkQQ = tb.Rows[0][13].ToString();
            string strPersonalEmail = tb.Rows[0][14].ToString();
            string strPersonalQQ = tb.Rows[0][15].ToString();
            string strUrgetRelationName = tb.Rows[0][16].ToString();
            string strUrgetRelationRelation = tb.Rows[0][17].ToString();
            string strUrgetRelationPhone = tb.Rows[0][18].ToString();
            string strid = tb.Rows[0][20].ToString();

            labNumber.Text = tb.Rows[0][21].ToString();

            deparename.Text = strdepartmentname;

            workname.Text = strworkname;
            TextUrgetRelationPhone.Text = strUrgetRelationPhone;
            TextUrgetRelationRelation.Text = strUrgetRelationRelation;
            TextUrgetRelationName.Text = strUrgetRelationName;
            TextBox15.Text = strPersonalQQ;
            TextBox14.Text = strPersonalEmail;
            TextBox13.Text = strWorkQQ;
            TextEmail.Text = strWorkEmail;
            TextBox19.Text = strContactAddress;
            TextFamilyAddress.Text = strFamilyAddress;
            TextPhone.Text = strPhone;

            TextPersonnelName.Text = strPersonnelName;
            TextLoginName.Text = strLoginName;

            TextIdCardNum.Text = strIdCardNum;
            TextBox20.Text = strBirthday.ToString("yyyy-MM-dd");
            TextCallPhone.Text = strCallPhone;


            if (nsex == "0")
            {
                sex.Text = "男";
            }
            else
            {
                sex.Text = "女";
            }

        }

    }

    protected void Button3_Click(object sender, EventArgs e)
    {
        if (Lnumber.Text == "1")

            Response.Write("<script>window.location='Staffmanagemen.aspx'</script>");
        else
        {
            Response.Write("<script>window.location='audituser.aspx'</script>");

        }
    }
}
