rlzy_daxg.aspx.cs
上传用户:lishan0805
上传日期:2019-12-08
资源大小:12048k
文件大小:12k
源码类别:

OA系统

开发平台:

C#

  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 COM.OA.Entity;
  12. using COM.OA.BLL;
  13. using System.Collections.Generic;
  14. public partial class rlzy_daxg : System.Web.UI.Page
  15. {
  16.     protected void Page_Load(object sender, EventArgs e)
  17.     {
  18.         users loginuser = Session["loginuser"] as users;
  19.         if (loginuser == null)
  20.         {
  21.             this.Response.Write(string.Format(GetRedirect.ALLREDIRECT, "../login.aspx"));
  22.         }
  23.         else
  24.         {
  25.             if (!IsPostBack)
  26.             {
  27.                 string id = this.Request["id"];
  28.                 string where = "em_id =" + id;
  29.                 string name = null;
  30.                 IList<employee> ilist = employeeBLL.Select(where);
  31.                 List<employee> l = (List<employee>)ilist;
  32.                 employee em = new employee();
  33.                 em = l[0];
  34.                 name = em.em_name;
  35.                 this.txtNumber.Text = em.em_number;//编号
  36.                 this.txtName.Text = em.em_name;//姓名
  37.                 this.txtEverName.Text = em.em_evername;//曾用名
  38.                 this.ddGender.SelectedIndex = em.em_gender;//性别
  39.                 if (em.em_birth.ToString("yyyy-MM-dd").Equals("1753-01-01"))
  40.                 {
  41.                     this.wdBirth.Text = "";
  42.                 }
  43.                 else
  44.                 {
  45.                     this.wdBirth.Text = em.em_birth.ToString("yyyy-MM-dd");//出生日期
  46.                 }
  47.                 this.txtMarriage.Text = em.em_marriage;//婚姻状况
  48.                 this.ddNative.SelectedIndex = em.em_n_id - 1;//籍 贯
  49.                 this.ddProvince.SelectedIndex = em.em_p_id - 1;//户口所在地
  50.                 this.ddNation.SelectedIndex = em.em_na_id - 1;//民族
  51.                 this.txtStature.Text = em.em_stature;//身 高
  52.                 this.txtAvoirdupois.Text = em.em_avoirdupois;//体重
  53.                 this.ddVisage.SelectedIndex = em.em_v_id - 1;//政治面貌
  54.                 this.txtStatuscard.Text = em.em_statuscard;//身份证号
  55.                 this.txtHealth.Text = em.em_health;//健康状况
  56.                 this.txtBloodtype.SelectedIndex = Int32.Parse(em.em_bloodtype);//血型
  57.                 this.txtPhone.Text = em.em_phone;//目前电话
  58.                 this.txtMobile.Text = em.em_mobile;//手机
  59.                 this.txtEMail.Text = em.em_email;//邮箱
  60.                 this.txtFinishSchool.Text = em.em_finishschool;//毕业院校
  61.                 this.txtSpeciality.Text = em.em_speciality;//专业
  62.                 this.ddLearn.SelectedIndex = em.em_l_id - 1;//学历
  63.                 if (em.em_graduatetime.ToString("yyyy-MM-dd").Equals("1753-01-01"))
  64.                 {
  65.                     this.wdGraduatetime.Text = "";
  66.                 }
  67.                 else
  68.                 {
  69.                     this.wdGraduatetime.Text = em.em_graduatetime.ToString("yyyy-MM-dd");//毕业日期
  70.                 }
  71.                 this.txtDegree.Text = em.em_degree;//学位
  72.                 this.txtLanguage.Text = em.em_language;//外语语种
  73.                 this.txtLanguageLevel.Text = em.em_languagelevel;//外语水平
  74.                 this.txtLanguageLetter.Text = em.em_languageletter;//外语证书
  75.                 this.txtComputerLevel.Text = em.em_computerlevel;//计算机水平
  76.                 this.txtComputerLetter.Text = em.em_computerletter;//计算机证书
  77.                 this.txtComputerGood.Text = em.em_computergood; //计算机特长
  78.                 this.txtMandarinLevel.Text = em.em_mandarinlevel;//普通话水平
  79.                 this.txtFamilyaddress.Text = em.em_familyaddress;//家庭住址
  80.                 this.txtPostalcode.Text = em.em_postalcode; //邮编
  81.                 this.txtAddress.Text = em.em_address;//现住址
  82.                 this.txtFamilyPhone.Text = em.em_familyphone;//家庭电话
  83.                 this.txtAddresspostalcode.Text = em.em_addresspostalcode;//住址邮编
  84.                 this.txtFamilycircs.Text = em.em_familycircs;//家庭情况
  85.                 this.txtRecordLocus.Text = em.em_recordlocus;//档案存放地
  86.                 this.txtJobName.Text = em.em_jobname;//职称
  87.                 this.txtWhenJoinWork.Text = em.em_whenjoinwork;//何时参加工作
  88.                 this.txtWhenThisWork.Text = em.em_whenthiswork;//何时到本单位
  89.                 this.txtAddlEngth.Text = em.em_addlength;//累计工龄
  90.                 this.txtThisUnitLength.Text = em.em_thisunitlength;//本单位工龄
  91.                 int bumen = em.em_dept_id - 1;
  92.                 if (em.em_dept_id == 6)
  93.                 {
  94.                     bumen = bumen - 1;
  95.                 }
  96.                 else if (em.em_dept_id > 7 && em.em_dept_id <= 9)
  97.                 {
  98.                     bumen = bumen - 2;
  99.                 }
  100.                 else if(em.em_dept_id >= 11)
  101.                 {
  102.                     bumen = bumen - 3;
  103.                 }
  104.                 this.ddDepartment.SelectedIndex = bumen;//所在部门
  105.                 this.txtButy.Text = em.em_duty;//职务
  106.                 this.txtRemark.Text = em.em_remark;//备注
  107.                 //录入人
  108.                 int lrid = em.em_bookerid;
  109.                 string ww = "u_id=" + lrid;
  110.                 IList<users> ii = usersBLL.Select(ww);
  111.                 List<users> ll = (List<users>)ii;
  112.                 users us = new users();
  113.                 us = ll[0];
  114.                 int u_em_id = us.u_em_id;
  115.                 string wheres = "em_id=" + u_em_id;
  116.                 IList<employee> iii = employeeBLL.Select(wheres);
  117.                 List<employee> lll = (List<employee>)iii;
  118.                 employee employee = new employee();
  119.                 employee = lll[0];
  120.                 string Bookerid = employee.em_name;
  121.                 this.txtBookerid.Text = Bookerid;
  122.             }
  123.         }
  124.     }
  125.     protected void btnUpdate_Click(object sender, EventArgs e)
  126.     {
  127.         //取页面数据
  128.         int em_id = Int32.Parse(this.Request["id"]);
  129.         string Number = this.txtNumber.Text;//编号 
  130.         string Name = this.txtName.Text;//姓名
  131.         string EverName = this.txtEverName.Text;//曾用名
  132.         int Gender = Int32.Parse(this.ddGender.Text);//性别
  133.         string Marriage = this.txtMarriage.Text;//婚姻状况
  134.         int Native = Int32.Parse(this.ddNative.Text);//籍贯
  135.         int Province = Int32.Parse(this.ddProvince.Text);//户口所在地
  136.         int Nation = Int32.Parse(this.ddNation.Text);//民族 
  137.         DateTime Birth;//出生日期
  138.         string bi = this.wdBirth.Text;
  139.         if (bi == "")
  140.         {
  141.             Birth = DateTime.Parse("1753-01-01");
  142.         }
  143.         else
  144.         {
  145.             Birth = DateTime.Parse(this.wdBirth.Text);
  146.         } 
  147.         string Stature = this.txtStature.Text;//身高 
  148.         string Avoirdupois = this.txtAvoirdupois.Text;//体重 
  149.         int Visage = Int32.Parse(this.ddVisage.Text);//政治面貌
  150.         string Statuscard = this.txtStatuscard.Text;//身份证号
  151.         string Health = this.txtHealth.Text;//健康状况
  152.         string Bloodtype = this.txtBloodtype.Text;//血型
  153.         string Phone = this.txtPhone.Text;//目前电话
  154.         string Mobile = this.txtMobile.Text;//手机
  155.         string eMail = this.txtEMail.Text;//邮箱
  156.         string FinishSchool = this.txtFinishSchool.Text;//毕业学校
  157.         string Speciality = this.txtSpeciality.Text;//专业
  158.         int Learn = Int32.Parse(this.ddLearn.Text);//学历
  159.         DateTime Graduatetime;//毕业日期
  160.         string t = this.wdGraduatetime.Text;
  161.         if (t == "")
  162.         {
  163.             Graduatetime = DateTime.Parse("1753-01-01");
  164.         }
  165.         else
  166.         {
  167.             Graduatetime = DateTime.Parse(this.wdGraduatetime.Text);
  168.         }
  169.         string Degree = this.txtDegree.Text; //学位
  170.         string Language = this.txtLanguage.Text;//外语语种
  171.         string LanguageLevel = this.txtLanguageLevel.Text;//外语水平
  172.         string LanguageLetter = this.txtLanguageLetter.Text;//外语证书
  173.         string ComputerLevel = this.txtComputerLevel.Text;//计算机水平
  174.         string ComputerLetter = this.txtComputerLetter.Text;//计算机证书
  175.         string ComputerGood = this.txtComputerGood.Text; //计算机特长
  176.         string MandarinLevel = this.txtMandarinLevel.Text;//普通话水平
  177.         string Familyaddress = this.txtFamilyaddress.Text;//家庭住址
  178.         string Postalcode = this.txtPostalcode.Text; //邮编
  179.         string Address = this.txtAddress.Text;//现住址
  180.         string FamilyPhone = this.txtFamilyPhone.Text;//家庭电话
  181.         string Addresspostalcode = this.txtAddresspostalcode.Text;//住址邮编
  182.         string Familycircs = this.txtFamilycircs.Text;//家庭情况
  183.         string RecordLocus = this.txtRecordLocus.Text;//档案存放地
  184.         string JobName = this.txtJobName.Text;//职称
  185.         string WhenJoinWork = this.txtWhenJoinWork.Text;//何时参加工作
  186.         string WhenThisWork = this.txtWhenThisWork.Text;//何时到本单位
  187.         string Addlength = this.txtAddlEngth.Text;//累计工龄
  188.         string ThisUnitLength = this.txtThisUnitLength.Text;//本单位工龄
  189.         int Department = Int32.Parse(this.ddDepartment.Text);//所在部门
  190.         string Buty = this.txtButy.Text;//职务
  191.         string Remark = this.txtRemark.Text;//备注
  192.         DateTime Registertime = DateTime.Now;//录入时间
  193.         employee em = new employee();
  194.         em.em_id = em_id;
  195.         em.em_number = Number;
  196.         em.em_name = Name;
  197.         em.em_evername = EverName;
  198.         em.em_gender = Gender;
  199.         em.em_marriage = Marriage;
  200.         em.em_birth = Birth;
  201.         em.em_n_id = Native;
  202.         em.em_na_id = Nation;
  203.         em.em_p_id = Province;
  204.         em.em_stature = Stature;
  205.         em.em_avoirdupois = Avoirdupois;
  206.         em.em_v_id = Visage;
  207.         em.em_statuscard = Statuscard;
  208.         em.em_health = Health;
  209.         em.em_bloodtype = Bloodtype;
  210.         em.em_phone = Phone;
  211.         em.em_mobile = Mobile;
  212.         em.em_email = eMail;
  213.         em.em_finishschool = FinishSchool;
  214.         em.em_speciality = Speciality;
  215.         em.em_l_id = Learn;
  216.         em.em_graduatetime = Graduatetime;
  217.         em.em_degree = Degree;
  218.         em.em_language = Language;
  219.         em.em_languageletter = LanguageLetter;
  220.         em.em_languagelevel = LanguageLevel;
  221.         em.em_computerlevel = ComputerLevel;
  222.         em.em_computerletter = ComputerLetter;
  223.         em.em_computergood = ComputerGood;
  224.         em.em_mandarinlevel = MandarinLevel;
  225.         em.em_familyaddress = Familyaddress;
  226.         em.em_postalcode = Postalcode;
  227.         em.em_address = Address;
  228.         em.em_familyphone = FamilyPhone;
  229.         em.em_familyaddress = Familyaddress;
  230.         em.em_familyphone = FamilyPhone;
  231.         em.em_addresspostalcode = Addresspostalcode;
  232.         em.em_familycircs = Familycircs;
  233.         em.em_recordlocus = RecordLocus;
  234.         em.em_jobname = JobName;
  235.         em.em_whenjoinwork = WhenJoinWork;
  236.         em.em_whenthiswork = WhenThisWork;
  237.         em.em_addlength = Addlength;
  238.         em.em_thisunitlength = ThisUnitLength;
  239.         em.em_dept_id = Department;
  240.         em.em_duty = Buty;
  241.         em.em_remark = Remark;
  242.         users luser = Session["loginuser"] as users;
  243.         em.em_bookerid = luser.u_id;//录入人id  当前登录用户
  244.         em.em_registertime = DateTime.Now;
  245.         //em.em_photo =   照片
  246.         int i = employeeBLL.Update(em);
  247.         if (i < 0)
  248.         {
  249.             //修改 users 表中 该人部门id
  250.             //通过em_id 查users 表中 此人信息
  251.             string wheres = "u_em_id=" + em_id;
  252.             IList<users> ilist = usersBLL.Select(wheres);
  253.             List<users> l = (List<users>)ilist;
  254.             users user = l[0];
  255.             user.u_dept_id = Department;
  256.             usersBLL.Update(user);
  257.             this.Response.Write(string.Format(GetRedirect.WINALERT, "修改成功!"));
  258.             this.Response.Write(string.Format(GetRedirect.REDIRECT, "dagl.aspx"));
  259.         }
  260.         else
  261.         {
  262.             this.Response.Write(string.Format(GetRedirect.WINALERT, "修改失败请从新修改!"));
  263.         }
  264.     }
  265. }