Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int personnelID = Utils.GetInt(Utils.GetQueryStringValue("personnelID"), -1);

            //绑定
            if (!IsPostBack && personnelID != -1)
            {
                EyouSoft.BLL.AdminCenterStructure.PersonnelInfo   bllPersonnel   = new EyouSoft.BLL.AdminCenterStructure.PersonnelInfo();
                EyouSoft.Model.AdminCenterStructure.PersonnelInfo modelPersonnel = bllPersonnel.GetModel(CurrentUserCompanyID, personnelID);
                this.lblPersonnelTitle.Text     = modelPersonnel.UserName;
                this.lblFileNo.Text             = modelPersonnel.ArchiveNo;
                this.lblName.Text               = modelPersonnel.UserName;
                this.lblSex.Text                = modelPersonnel.ContactSex.ToString();
                this.imgPersonnelPhoto.ImageUrl = modelPersonnel.PhotoPath;
                this.lblCardID.Text             = modelPersonnel.CardId;
                this.lblBirthday.Text           = modelPersonnel.BirthDate == null ? "" : string.Format("{0:yyyy-MM-dd}", modelPersonnel.BirthDate);
                this.lblDepartment.Text         = GetDepartmentByID(modelPersonnel.DepartmentId);  //  所属部门
                this.lblPosition.Text           = GetDutyNameByID(modelPersonnel.DutyId);
                this.lblType.Text               = modelPersonnel.PersonalType.ToString();
                this.lblState.Text              = modelPersonnel.IsLeave ? "离职" : "在职";
                this.lblEntryDate.Text          = string.Format("{0:yyyy-MM-dd}", modelPersonnel.EntryDate);
                this.lblWorkerLife.Text         = GetWorkYear(modelPersonnel.EntryDate) + "年";
                this.lblNational.Text           = modelPersonnel.National;
                Birthplace                 = GetProvinceAndCity(modelPersonnel.Birthplace);
                this.lblPolitical.Text     = modelPersonnel.Politic;
                this.lblMarriageState.Text = modelPersonnel.IsMarried ? "已婚" : "未婚";
                this.lblTel.Text           = modelPersonnel.ContactTel;
                this.lblMobile.Text        = modelPersonnel.ContactMobile;
                this.lblLeftDate.Text      = modelPersonnel.LeaveDate == null ? "" : string.Format("{0:yyyy-MM-dd}", modelPersonnel.LeaveDate);
                this.lblQQ.Text            = modelPersonnel.QQ;
                this.lblMSN.Text           = modelPersonnel.MSN;
                this.lblEmail.Text         = modelPersonnel.Email;
                this.lblAddress.Text       = modelPersonnel.ContactAddress;
                this.lblRemark.Text        = modelPersonnel.Remark;
                this.rptRecord.DataSource  = modelPersonnel.HistoryList;
                this.rptRecord.DataBind();
                this.rptEducationInfo.DataSource = modelPersonnel.SchoolList;
                this.rptEducationInfo.DataBind();
            }
        }
Example #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            #region 设置公司ID初始化省份城市列表
            ucProvince1.CompanyId = CurrentUserCompanyID;
            ucProvince1.IsFav     = true;
            ucCity1.CompanyId     = CurrentUserCompanyID;
            ucCity1.IsFav         = true;
            #endregion

            this.ucDepartemnt.SetPicture = "/images/icon_select.jpg";                        //部门选择图标
            int    PersonnelID = Utils.GetInt(Utils.GetQueryStringValue("PersonnelID"), -1); //档案ID
            string Method      = Utils.GetFormValue("hiddenMethod");                         //执行方法
            file.Visible = false;
            EyouSoft.BLL.AdminCenterStructure.PersonnelInfo   bllPersonnel;
            EyouSoft.Model.AdminCenterStructure.PersonnelInfo modelPersonnel;

            if (!IsPostBack)
            {
                DutyInit();
                this.hiddenID.Value = PersonnelID.ToString();
                if (PersonnelID != -1)
                {
                    if (!CheckGrant(global::Common.Enum.TravelPermission.行政中心_人事档案_修改档案))
                    {
                        Utils.ResponseNoPermit(global::Common.Enum.TravelPermission.行政中心_人事档案_修改档案, true);
                    }

                    //绑定修改数据
                    bllPersonnel   = new EyouSoft.BLL.AdminCenterStructure.PersonnelInfo();
                    modelPersonnel = bllPersonnel.GetModel(CurrentUserCompanyID, PersonnelID);

                    #region 基本信息
                    FileNo = modelPersonnel.ArchiveNo;
                    Name   = modelPersonnel.UserName;
                    this.dpSex.SelectedIndex = (int)modelPersonnel.ContactSex;        //性别
                    CardID   = modelPersonnel.CardId;
                    Birthday = modelPersonnel.BirthDate;
                    this.ucDepartemnt.GetDepartmentName = GetDepartmentByID(modelPersonnel.DepartmentId);//所属部门
                    this.ucDepartemnt.GetDepartId       = modelPersonnel.DepartmentId;
                    if (modelPersonnel.PhotoPath != "")
                    {
                        WorkerPicture = modelPersonnel.PhotoPath != "" ? string.Format("<a href='{0}'  target='_blank'>查看图片</a>", modelPersonnel.PhotoPath) : "";                                      //照片路径
                        file.Visible  = true;
                    }
                    else
                    {
                        file.Visible = false;
                    }

                    this.hiddenPhoto.Value = modelPersonnel.PhotoPath;
                    if (modelPersonnel.DutyId != null)
                    {
                        this.ddlJobPostion.Text = modelPersonnel.DutyId.ToString();        //职务
                    }
                    this.dpWorkerState.SelectedIndex = modelPersonnel.IsLeave ? 1 : 0;     //员工状态
                    this.dpWorkerType.SelectedIndex  = (int)modelPersonnel.PersonalType;   //类型
                    EntryDate = modelPersonnel.EntryDate == null ? "" : Convert.ToDateTime(modelPersonnel.EntryDate).ToString("yyyy-MM-dd");
                    this.dpMarriageState.SelectedIndex = modelPersonnel.IsMarried ? 1 : 0; //婚姻状态
                    LeftDate = modelPersonnel.LeaveDate == null ? "" : Convert.ToDateTime(modelPersonnel.LeaveDate).ToString("yyyy-MM-dd");
                    National = modelPersonnel.National;

                    if (modelPersonnel.Birthplace != null && modelPersonnel.Birthplace.Split(',').Length >= 2)//籍贯
                    {
                        this.ucProvince1.ProvinceId = Utils.GetInt(modelPersonnel.Birthplace.Split(',')[0]);
                        this.ucCity1.CityId         = Utils.GetInt(modelPersonnel.Birthplace.Split(',')[1]);
                        this.ucCity1.ProvinceId     = this.ucProvince1.ProvinceId;
                    }

                    Political = modelPersonnel.Politic;
                    Telephone = modelPersonnel.ContactTel;
                    Mobile    = modelPersonnel.ContactMobile;
                    QQ        = modelPersonnel.QQ;
                    Email     = modelPersonnel.Email;
                    MSN       = modelPersonnel.MSN;
                    Address   = modelPersonnel.ContactAddress;
                    Remark    = modelPersonnel.Remark;
                    #endregion

                    #region 学历信息和履历信息

                    this.rpt_Record.DataSource = modelPersonnel.SchoolList;
                    this.rpt_Record.DataBind();
                    this.rpt_Resume.DataSource = modelPersonnel.HistoryList;
                    this.rpt_Resume.DataBind();
                    #endregion
                }
                else
                {
                    if (!CheckGrant(global::Common.Enum.TravelPermission.行政中心_人事档案_新增档案))
                    {
                        Utils.ResponseNoPermit(global::Common.Enum.TravelPermission.行政中心_人事档案_新增档案, true);
                    }
                }
            }

            if (Method != "")//保存和修改
            {
                GetAddOrUpdatePersonnelInfo(out bllPersonnel, out modelPersonnel);
                string msg = string.Empty;
                if (modelPersonnel.ArchiveNo == "")
                {
                    msg += "档案编号不能回空!<br/>";
                }
                if (modelPersonnel.UserName == "")
                {
                    msg += "姓名不能为空!";
                }
                if (modelPersonnel.ArchiveNo == "" || modelPersonnel.UserName == "")
                {
                    MessageBox.Show(this.Page, msg);
                    return;
                }
                if (Method == "Save" && PersonnelID == -1)//保存
                {
                    if (bllPersonnel.Add(modelPersonnel))
                    {
                        MessageBox.ShowAndRedirect(this.Page, "保存成功!", "/administrativeCenter/personnelFiles/Default.aspx");
                    }
                    else
                    {
                        MessageBox.Show(this.Page, "保存失败!");
                    }
                }
                //else if (Method == "SaveAndAdd" && PersonnelID == -1) //保存并继续添加
                //{
                //    if (bllPersonnel.Add(modelPersonnel))
                //    {
                //        MessageBox.ShowAndRedirect(this.Page, "保存成功!", this.Request.Url.ToString());
                //    }
                //    else
                //    {
                //        MessageBox.Show(this.Page, "保存失败!");
                //    }
                //}
                else if (Method == "Update" && PersonnelID != -1) //修改
                {
                    modelPersonnel.Id = PersonnelID;
                    if (bllPersonnel.Update(modelPersonnel))
                    {
                        MessageBox.ShowAndRedirect(this.Page, "修改成功!", "/administrativeCenter/personnelFiles/Default.aspx");
                    }
                    else
                    {
                        MessageBox.Show(this.Page, "修改失败!");
                    }
                }
            }
        }