my_form.aspx.cs
上传用户:xrffrp
上传日期:2022-03-25
资源大小:22155k
文件大小:2k
源码类别:

OA系统

开发平台:

ASP/ASPX

  1. using System;
  2. using System.Data;
  3. using System.Configuration;
  4. using System.Collections;
  5. using System.Web;
  6. using System.Web.Security;
  7. using System.Web.UI;
  8. using System.Web.UI.WebControls;
  9. using System.Web.UI.WebControls.WebParts;
  10. using System.Web.UI.HtmlControls;
  11. using System.Data.SqlClient;
  12. public partial class web_probationership_check_form : System.Web.UI.Page
  13. {
  14.     protected void Page_Load(object sender, EventArgs e)
  15.     {
  16.         if (!IsPostBack)
  17.         {
  18.             this.SetBasic();
  19.         }
  20.     }
  21.     protected void SetBasic()
  22.     {
  23.         if (Session["user"] != null)
  24.         {
  25.             User user = (User)Session["user"];
  26.             LblEmpName.Text = user.Emp_name;
  27.             if (user.IsMale)
  28.             {
  29.                 LblSex.Text = "男";
  30.             }
  31.             else
  32.             {
  33.                 LblSex.Text = "女";
  34.             }
  35.             LblEmpNo.Text = user.Emp_no;
  36.             LblDepartment.Text = user.Department.Full_name;
  37.             SqlConnection conn = dbConnection.getConnection();
  38.             conn.Open();
  39.             SqlCommand cmd = new SqlCommand("select active_date from OA_EMPLOYEE where id=" + user.Id, conn);
  40.             string active = cmd.ExecuteScalar().ToString();
  41.             LblActiveDate.Text = active;
  42.             try
  43.             {
  44.                 string[] days = active.Split(new char[] { '-' });
  45.                 int year = Convert.ToInt32(days[0]);
  46.                 int month = Convert.ToInt32(days[1]);
  47.                 if (month > 10)
  48.                 {
  49.                     month = month + 2 - 12;
  50.                     year++;
  51.                 }
  52.                 else
  53.                 {
  54.                     month = month + 2;
  55.                 }
  56.                 LblProbationDate.Text = year + "-" + month + "-" + days[2];
  57.             }
  58.             catch { }
  59.             conn.Close();
  60.         }
  61.     }
  62. }