private void ShowInfo(int id) { HEemployeeBB eemployeeBB = new HEemployeeBB(); vHEemployeeData model = new vHEemployeeData(); try { model = eemployeeBB.GetVModel(id); this.empNo.Text = model.empNo; this.empNm.Text = model.empNm; this.gender.Text = model.gender; this.nowDepartId.Text = model.departNm; this.mobile.Text = model.mobile; this.email.Text = model.email; //if (this.style.Items.FindByValue(model.style.ToString()) != null) //{ // this.style.SelectedValue = model.style.ToString(); //} this.mark.Text = model.mark; this.isEffect.Text = model.isEffectDesc; } finally { eemployeeBB.Dispose(); } }
/// <summary> /// �õ�һ����ͼmodel /// </summary> /// <param name="empId">����ֵ</param> /// <returns>model</returns> public vHEemployeeData GetVModel(int empId) { StringBuilder strSql = new StringBuilder(); strSql.Append(@"select empId,empNo,empNm,password,gender,nowDepartId,userType,style,mark,isEffect,isDel, isrtDt,isrtEmpId,updtDt,updtEmpId,departNo,departNm,uppDepartId,departLeader,departIsEffect,leaderNm, isEffectDesc,isrtEmpNm,updtEmpNm,roleIds,roleNms,mobile,email from vHEemployee"); strSql.Append(" where empId = @empId "); SqlParameter[] parameters = { new SqlParameter("@empId", SqlDbType.Int) }; parameters[0].Value = empId; vHEemployeeData model = new vHEemployeeData(); DataSet ds = SqlHelper.ExecuteDataset(this.connection, this.transaction, CommandType.Text, strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { DataRow row = ds.Tables[0].Rows[0]; if (row["empId"] != DBNull.Value) { model.empId = Convert.ToInt32(row["empId"]); } if (row["empNo"] != DBNull.Value) { model.empNo = Convert.ToString(row["empNo"]); } if (row["empNm"] != DBNull.Value) { model.empNm = Convert.ToString(row["empNm"]); } if (row["password"] != DBNull.Value) { model.password = Convert.ToString(row["password"]); } if (row["gender"] != DBNull.Value) { model.gender = Convert.ToString(row["gender"]); } if (row["nowDepartId"] != DBNull.Value) { model.nowDepartId = Convert.ToInt32(row["nowDepartId"]); } if (row["userType"] != DBNull.Value) { model.userType = Convert.ToString(row["userType"]); } if (row["style"] != DBNull.Value) { model.style = Convert.ToInt32(row["style"]); } if (row["mark"] != DBNull.Value) { model.mark = Convert.ToString(row["mark"]); } if (row["isEffect"] != DBNull.Value) { model.isEffect = Convert.ToBoolean(row["isEffect"]); } if (row["isDel"] != DBNull.Value) { model.isDel = Convert.ToBoolean(row["isDel"]); } if (row["isrtDt"] != DBNull.Value) { model.isrtDt = Convert.ToString(row["isrtDt"]); } if (row["isrtEmpId"] != DBNull.Value) { model.isrtEmpId = Convert.ToInt32(row["isrtEmpId"]); } if (row["updtDt"] != DBNull.Value) { model.updtDt = Convert.ToString(row["updtDt"]); } if (row["updtEmpId"] != DBNull.Value) { model.updtEmpId = Convert.ToInt32(row["updtEmpId"]); } if (row["departNo"] != DBNull.Value) { model.departNo = Convert.ToString(row["departNo"]); } if (row["departNm"] != DBNull.Value) { model.departNm = Convert.ToString(row["departNm"]); } if (row["uppDepartId"] != DBNull.Value) { model.uppDepartId = Convert.ToInt32(row["uppDepartId"]); } if (row["departLeader"] != DBNull.Value) { model.departLeader = Convert.ToInt32(row["departLeader"]); } if (row["departIsEffect"] != DBNull.Value) { model.departIsEffect = Convert.ToBoolean(row["departIsEffect"]); } if (row["leaderNm"] != DBNull.Value) { model.leaderNm = Convert.ToString(row["leaderNm"]); } if (row["isEffectDesc"] != DBNull.Value) { model.isEffectDesc = Convert.ToString(row["isEffectDesc"]); } if (row["isrtEmpNm"] != DBNull.Value) { model.isrtEmpNm = Convert.ToString(row["isrtEmpNm"]); } if (row["updtEmpNm"] != DBNull.Value) { model.updtEmpNm = Convert.ToString(row["updtEmpNm"]); } if (row["roleIds"] != DBNull.Value) { model.roleIds = Convert.ToString(row["roleIds"]); } if (row["roleNms"] != DBNull.Value) { model.roleNms = Convert.ToString(row["roleNms"]); } if (row["mobile"] != DBNull.Value) { model.mobile = Convert.ToString(row["mobile"]); } if (row["email"] != DBNull.Value) { model.email = Convert.ToString(row["email"]); } return model; } else { return null; } }