예제 #1
0
        //更新
        public void Update()
        {
            try
            {
                if (Session["LoginName"].ToString() == "")
                {
                    Response.Redirect("login.aspx");
                    Alert.Show("登录超时!");
                }
                UserInfo NewUser = new UserInfo();
                NewUser.UserName = T_UserName.Text.Trim();
                if (rbtnBoy.Checked == true)
                {
                    NewUser.Sex = true;
                }
                else
                {
                    NewUser.Sex = false;
                }
                NewUser.Nation   = DropDownListNation.SelectedItem.Text;
                NewUser.Hometown = T_Hometown.Text.Trim();
                if (DatePickerBirth.SelectedDate.HasValue)
                {
                    NewUser.Birth = DatePickerBirth.SelectedDate;
                }
                NewUser.JobTitle        = T_JobTitle.Text.Trim();
                NewUser.AgencyID        = bllAgency.SelectAgencyID(DropDownListAgencyP.SelectedText);
                NewUser.TeleNum         = T_Telenum.Text.Trim();
                NewUser.HomeNum         = T_HomeTetlum.Text.Trim();
                NewUser.OfficeNum       = T_Officenum.Text.Trim();
                NewUser.DocumentsNum    = T_DocumentsNum.Text.Trim();
                NewUser.DocumentsType   = DropDownListDocumentsType.SelectedItem.Text;
                NewUser.PoliticalStatus = DropDownListPoliticalStatus.SelectedItem.Text;
                NewUser.Profile         = TextAreaProfile.Text.Trim();
                NewUser.Education       = DropDownListEducation.SelectedItem.Text;
                NewUser.Degree          = DropDownListDegree.SelectedItem.Text;
                NewUser.StaffType       = DropDownListStaffType.SelectedItem.Text;
                NewUser.Specialty       = T_Specilty.Text.Trim();
                if (ISMarriage.Checked == true)
                {
                    NewUser.Marriage = true;
                }
                else
                {
                    NewUser.Marriage = false;
                }
                NewUser.Fax         = T_Fax.Text.Trim();
                NewUser.HomeAddress = T_HomeAddress.Text.Trim();
                NewUser.PostalCode  = T_PostalCode.Text.Trim();
                NewUser.qqNum       = T_QQnum.Text.Trim();
                NewUser.Remark      = T_Remark.Text.Trim();
                NewUser.UnitName    = T_UnitName.Text.Trim();
                //NewUser.StaffType = T_StaffType.Text.Trim();
                //NewUser.UserInfoBH = T_UserInfoBH.Text.Trim();
                NewUser.LoginName = T_LoginName.Text.Trim();
                //密码没有修改
                NewUser.LoginPWD = bllUser.IsUser(bllUser.FindByUserID(Convert.ToInt32(Session["UserInfoID"]))).LoginPWD;
                NewUser.Email    = T_Email.Text.Trim();
                NewUser.TeleNum  = T_Telenum.Text.Trim();
                NewUser.AdministrativeLevelName = DropDownListAdmin.SelectedItem.Text;
                NewUser.Domicile        = T_Domicile.Text.Trim();
                NewUser.SubjectSortName = DropDownListSubjectSortP.SelectedItem.Text;
                if (DatePickerJobTitleTime.SelectedDate.HasValue)
                {
                    NewUser.JobTitleTime = DatePickerJobTitleTime.SelectedDate;
                }
                if (DatePickerPoliticalStatusTime.SelectedDate.HasValue)
                {
                    NewUser.PoliticalStatusTime = DatePickerPoliticalStatusTime.SelectedDate;
                }
                if (IsDoctorTeacher.Checked == true)
                {
                    NewUser.IsDocdorTeacher = true;
                }
                else
                {
                    NewUser.IsDocdorTeacher = false;
                }
                if (IsMasterTeacher.Checked == true)
                {
                    NewUser.IsMasteTeacher = true;
                }
                else
                {
                    NewUser.IsMasteTeacher = false;
                }
                if (DatePickerMasterTeacherTime.SelectedDate.HasValue)
                {
                    NewUser.MasterTeacherTime = DatePickerMasterTeacherTime.SelectedDate;
                }
                if (DatePickerDoctorTeacherTime.SelectedDate.HasValue)
                {
                    NewUser.DoctorTeacherTime = DatePickerDoctorTeacherTime.SelectedDate;
                }
                NewUser.SecrecyLevel      = Convert.ToInt32(DropDownListSecrecyLevel.SelectedIndex + 1);
                NewUser.ResearchDirection = T_Reserch.Text.Trim();
                NewUser.LastSchool        = LastSchool.Text.Trim();
                NewUser.EnterSchoolTime   = DatePickerEnterSchoolTime.SelectedDate;    //入校时间;
                NewUser.StudySource       = DropDownListStudySource.SelectedItem.Text; //学缘
                //照片
                //int AttachmentID = bllUser.FindAttachmentID(Convert.ToInt32(Session["UserInfoID"]));
                int    PhotoID        = bllUser.FindPhotoID(Convert.ToInt32(Session["UserInfoID"]));
                string attachmentPath = BLLattachment.FindPath(PhotoID);
                string photoPath      = BLLattachment.FindPath(PhotoID);

                if (Session["AttachID"] != null)
                {
                    NewUser.PhotoID = int.Parse(Session["AttachID"].ToString());
                }


                NewUser.EntryPerson = bllUser.Find(Convert.ToInt32(Session["UserInfoID"]), true).EntryPerson;
                if (Convert.ToInt32(Session["SecrecyLevel"]) == 5)
                {
                    NewUser.IsPass     = true;
                    NewUser.UserInfoID = Convert.ToInt32(Session["UserInfoID"]);
                    bllUser.Update(NewUser);//更新人员基本信息表
                    PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("人员基本信息修改完成!"));
                }
                else
                {
                    NewUser.IsPass = false;
                    bllUser.ChangePass(Convert.ToInt32(Session["UserInfoID"]), false);
                    bllUser.Insert(NewUser);//插入人员基本信息表
                    //向操作日志表中插入
                    OperationLog operate = new OperationLog();
                    operate.LoginName        = NewUser.EntryPerson;
                    operate.LoginIP          = "";
                    operate.OperationType    = "更新";
                    operate.OperationContent = "UserInfo";
                    operate.OperationDataID  = Convert.ToInt32(Session["UserInfoID"]);
                    operate.OperationTime    = System.DateTime.Now;
                    operate.Remark           = NewUser.UserInfoID.ToString();
                    bllOperate.Insert(operate);
                    PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("人员基本信息已提交审核!"));
                }
            }
            catch (Exception ex)
            {
                publicmethod.SaveError(ex, this.Request);
            }
        }