private void LoadData() { try { bool isNew = (StationCode == ""); EntityData ds = null; if (isNew) { ds = new EntityData("Standard_Station"); DataRow dr = ds.GetNewRecord(); dr["StationCode"] = DAL.EntityDAO.SystemManageDAO.GetNewSysCode("StationCode"); dr["UnitCode"] = this.txthUnit.Value; ds.AddNewRecord(dr); ds.SetCurrentRow(0); } else { ds = OBSDAO.GetStandard_StationByCode(StationCode); } if (ds.HasRecord()) { this.lblStationName.Text = ds.GetString("StationName"); this.lblDescription.Text = ds.GetString("Description"); this.lblUnit.Text = BLL.SystemRule.GetUnitName(ds.GetString("UnitCode")); this.lblRoleName.Text = BLL.SystemRule.GetRoleName(ds.GetString("RoleCode")); int roleLevel = ds.GetInt("RoleLevel"); //Session["roleLevel"]=roleLevel; ViewState["roleLevel"] = roleLevel; string accessRangeUnitCode = ds.GetString("AccessRangeUnitCode"); if (roleLevel == 0) { this.lblRoleLevelName.Text = "集团"; } else if (roleLevel == 4) { this.lblRoleLevelName.Text = "个人"; } else { this.lblRoleLevelName.Text = "部门"; } //this.lblRoleLevelName.Text = BLL.SystemRule.GetUnitName(accessRangeUnitCode); } this.txtUnitName.Value = BLL.SystemRule.GetUnitName(this.txthUnit.Value); //记录当前的用户代码 this.txtReturnUserCodes.Value = BLL.ConvertRule.Concat(ds.Tables["UserRole"], "UserCode", ","); this.dgList.DataSource = ds.Tables["UserRole"]; this.dgList.DataBind(); Session["StationEntityData"] = ds; ds.Dispose(); //entity.Dispose(); } catch (Exception ex) { ApplicationLog.WriteLog(this.ToString(), ex, ""); Response.Write(Rms.Web.JavaScript.Alert(true, "显示出错")); } }
private void LoadData() { string stationCode = txtStationCode.Value; string unitCode = this.txthUnit.Value; try { bool isNew = (stationCode == ""); EntityData ds = null; if (isNew) { ds = new EntityData("Standard_Station"); DataRow dr = ds.GetNewRecord(); dr["StationCode"] = DAL.EntityDAO.SystemManageDAO.GetNewSysCode("StationCode"); dr["UnitCode"] = this.txthUnit.Value; ds.AddNewRecord(dr); ds.SetCurrentRow(0); } else { ds = OBSDAO.GetStandard_StationByCode(stationCode); } //ds = OBSDAO.GetStandard_UnitByCode(unitCode); EntityData ds1 = OBSDAO.GetStandard_UnitByCode(unitCode); if (ds.HasRecord()) { this.txtStationName.Text = ds.GetString("StationName"); this.txtDescription.Text = ds.GetString("Description"); this.txthUnit.Value = ds.GetString("UnitCode"); try { switch (ds1.GetString("UnitType")) { case "项目": rblRoleLevel.SelectedValue = "0"; break; case "部门": rblRoleLevel.SelectedValue = "3"; break; default: rblRoleLevel.SelectedValue = "4"; break; } //this.rblRoleLevel.SelectedValue = ds.GetInt("RoleLevel").ToString(); //修改前 } catch {} sltAccessRangeUnit.Value = unitCode; this.sltRole.Value = ds.GetString("RoleCode"); this.sltAccessRangeUnit.Value = ds.GetString("AccessRangeUnitCode"); } this.txtUnitName.Value = BLL.SystemRule.GetUnitName(this.txthUnit.Value); //记录当前的用户代码 this.txtReturnUserCodes.Value = BLL.ConvertRule.Concat(ds.Tables["UserRole"], "UserCode", ","); this.dgList.DataSource = ds.Tables["UserRole"]; this.dgList.DataBind(); Session["StationEntityData"] = ds; ds.Dispose(); } catch (Exception ex) { ApplicationLog.WriteLog(this.ToString(), ex, ""); Response.Write(Rms.Web.JavaScript.Alert(true, "加载页面错误。")); } }