private void InitUserInfo() { UserProfileBLL bll = new UserProfileBLL(); UserProfileInfo up = bll.GetUserProfile(UserCode); //UserProfile up = DBManager.GetUserProfile(UserCode); txtADAccount.Text = up.ADAccount; txtBirthDate.Text = up.Birthdate; txtCellPhone.Text = up.CellPhone; txtCHNName.Text = up.CHName; txtCostCenter.Text = up.CostCenter; txtEmail.Text = up.Email; txtENName.Text = up.ENName; txtHireDate.Text = up.HireDate; txtManagerAccount.Text = up.ManagerAccount; txtOfficePhone.Text = up.OfficePhone; txtFax.Text = up.FAX; txtBlackBerry.Text = up.BlackBerry; txtGraduateFrom.Text = up.GraduateFrom; txtOAC.Text = up.OAC; txtPA.Text = up.PoliticalAffiliation; txtPositionDesc.Text = up.PositionName; txtEductionBackground.Text = up.EducationalBackground; txtWorkExperienceBefore.Text = up.WorkExperienceBefore; txtWorkExperienceNow.Text = up.WorkExperienceNow; txtOrderNO.Text = up.OrderNo.ToString(); txtPhotoUrl.Text = up.PhotoUrl; imgPhono.ImageUrl = string.IsNullOrEmpty(up.PhotoUrl) ? imgPhono.ImageUrl : up.PhotoUrl; ddlGender.SelectedIndex = ddlGender.Items.IndexOf(ddlGender.Items.FindByValue(up.Gender)); ddlPosition.SelectedIndex = ddlPosition.Items.IndexOf(ddlPosition.Items.FindByValue(up.PositionGuid.ToString())); ddlWorkPlace.SelectedIndex = ddlWorkPlace.Items.IndexOf(ddlWorkPlace.Items.FindByValue(up.WorkPlace)); }
/// <summary> /// LoadEmployeeInfo 根据员工ID获取员工信息 /// </summary> private void LoadEmployeeInfo(string Code) { UserProfileBLL bll = new UserProfileBLL(); UserProfileInfo info = bll.GetUserProfile(Code); SubmitName.Value = info.CHName; SubmitID.Value = info.ID.ToString(); ApplicantName.Value = SubmitName.Value; lbl_date.Text = DateTime.Now.ToString("yyyy-MM-dd"); }
private void InitUserInfo() { //UserProfile up = DBManager.GetUserProfile(UserCode); UserProfileBLL bll = new UserProfileBLL(); UserProfileInfo up = bll.GetUserProfile(UserCode); txtADAccount.Text = up.ADAccount; txtBirthDate.Text = up.Birthdate; txtCellPhone.Text = up.CellPhone; txtCHNName.Text = up.CHName; txtCostCenter.Text = up.CostCenter; txtEmail.Text = up.Email; txtENName.Text = up.ENName; txtHireDate.Text = up.HireDate; txtManagerAccount.Text = up.ManagerAccount; txtOfficePhone.Text = up.OfficePhone; txtFax.Text = up.FAX; txtBlackBerry.Text = up.BlackBerry; txtGraduateFrom.Text = up.GraduateFrom; txtOAC.Text = up.OAC; txtPA.Text = up.PoliticalAffiliation; txtEductionBackground.Text = up.EducationalBackground; txtWorkExperienceBefore.Text = up.WorkExperienceBefore; txtWorkExperienceNow.Text = up.WorkExperienceNow; txtOrderNO.Text = up.OrderNo.ToString(); txtPhotoUrl.Text = up.PhotoUrl; imgPhono.ImageUrl = string.IsNullOrEmpty(up.PhotoUrl) ? imgPhono.ImageUrl : up.PhotoUrl; ddlGender.SelectedIndex = ddlGender.Items.IndexOf(ddlGender.Items.FindByValue(up.Gender)); ddlPosition.SelectedIndex = ddlPosition.Items.IndexOf(ddlPosition.Items.FindByValue(up.PositionGuid.ToString())); ddlWorkPlace.SelectedIndex = ddlWorkPlace.Items.IndexOf(ddlWorkPlace.Items.FindByValue(up.WorkPlace)); //DataTable dt = DBManager.GetUserMainDepartmentByCode(UserCode); //if (dt != null && dt.Rows.Count > 0) // txtMainDeptName.Text = dt.Rows[0]["Department"].ToString(); DataTable dt = DBManager.GetUserMainDepartmentByCode(UserCode); if (dt != null && dt.Rows.Count != 0) { foreach (DataRow dr in dt.Rows) { try { if (Boolean.Parse(dr["IsMainDept"].ToString())) { txtMainDeptName.Text = dr["DeptName"].ToString(); } } catch { } } } }
protected void btnSave_Click(object sender, ImageClickEventArgs e) { if (action == "new") { UserProfileBLL bll = new UserProfileBLL(); UserProfileInfo up = GetUserInfo(); if (!bll.IsExist(up)) { if (bll.CreateUserProfile(up)) { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>AlertAndNewLoad('添加成功');</script>"); } else { ExecAlertScritp("添加失败!"); } } else { ExecAlertScritp("用户已存在"); } } else if (action == "edit") { UserProfileBLL bll = new UserProfileBLL(); UserProfileInfo up = bll.GetUserProfile(UserCode); UserProfileInfo upi = GetUserInfo(); upi.ID = up.ID; bll.UpdateUserProfile(up); using (System.Transactions.TransactionScope ts = new System.Transactions.TransactionScope()) { //添加扩展属性值 for (int i = 0; i < dlExtendInfo.Items.Count; i++) { HiddenField hfId = dlExtendInfo.Items[i].FindControl("hfPropertyID") as HiddenField; TextBox txtValue = dlExtendInfo.Items[i].FindControl("txtPropertyValue") as TextBox; if (hfId != null && txtValue != null) { //DBManager.AddExtValue(hfId.Value, txtValue.Text, UserCode); bll.AddExtValue(hfId.Value, txtValue.Text, UserCode); } } ts.Complete(); //提交事务 } if (ddlMainDept.SelectedItem != null) { if (bll.UpdateMainDepartment(UserCode, ddlMainDept.SelectedItem.Value)) { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>AlertAndNewLoad('操作成功');</script>"); } else { ExecAlertScritp("操作失败!"); } } } }