/// <summary> /// 获得update或者insert时传入参数数组 /// </summary> /// <returns></returns> private string[] myGetParm(UserPowerDetail info) { string[] strParm = { info.Dept.ID, //科室编码 info.User.ID, //用户编码 info.Class1Code, //一级权限编码 info.Class2Code, //二级权限编码 info.PowerLevelClass.Class3Code, //三级权限编码 info.GrantDept, //授权科室 info.GrantEmpl, //授权人 Neusoft.FrameWork.Function.NConvert.ToInt32(info.GrantFlag).ToString(), //是否可以授权他人 this.Operator.ID, //操作人编码 info.Memo //备注 }; return(strParm); }
/// <summary> /// 取拥有特定权限的人员列表如果不确定时可以传class1Code,class2Code,class3Code /// </summary> /// <returns>NeuObject数组</returns> public ArrayList QueryAllPrivUser(string class1Code, string class2Code, string class3code) { string strSql = string.Empty; //取SQl语句 strSql = PrepareSQL("Manager.UserPowerDetailManager.LoadAllUser", class1Code, class2Code, class3code); ArrayList al = new ArrayList(); if (strSql == string.Empty) { return(null); } try { UserPowerDetail info; this.ExecQuery(strSql); while (this.Reader.Read()) { info = new UserPowerDetail(); //取字段数据 info.User.ID = this.Reader[0].ToString(); //编码 info.User.Name = this.Reader[1].ToString(); //姓名 info.Class1Code = this.Reader[2].ToString(); //一级权限分类码,权限类型 info.Dept.ID = this.Reader[3].ToString(); //权限部门 info.User01 = this.Reader[4].ToString(); //性别 info.User02 = this.Reader[5].ToString(); //人员所在科室 info.User03 = this.Reader[6].ToString(); //人员所在病区 al.Add(info); } this.Reader.Close(); } catch (Exception ex) { this.ErrCode = ex.Message; this.Err = ex.Message; al.Clear(); } return(al); }
/// <summary> /// 根据传入的SQL语句,执行数据库查询操作,返回数组 /// </summary> /// <returns></returns> private ArrayList myGetList(string strSQL) { if (strSQL == null) { return(null); } ArrayList UserPowerDetails = new ArrayList(); try { UserPowerDetail info; this.ExecQuery(strSQL); while (this.Reader.Read()) { info = new UserPowerDetail(); info.Dept.ID = this.Reader[0].ToString(); //科室编码 info.User.ID = this.Reader[1].ToString(); //用户编码 info.Class1Code = this.Reader[2].ToString(); //一级权限编码 info.Class2Code = this.Reader[3].ToString(); //二级权限编码 info.PowerLevelClass.Class3Code = this.Reader[4].ToString(); //三级权限编码 info.GrantDept = this.Reader[5].ToString(); //授权科室 info.GrantEmpl = this.Reader[6].ToString(); //授权人 info.GrantFlag = FrameWork.Function.NConvert.ToBoolean(this.Reader[7].ToString()); //是否可以授权 info.Memo = this.Reader[8].ToString(); //备注 UserPowerDetails.Add(info); } this.Reader.Close(); } catch (Exception ex) { this.ErrCode = ex.Message; this.Err = ex.Message; return(null); } return(UserPowerDetails); }
/// <summary> /// 更新人员权限明细表中一条记录 /// </summary> /// <param name="info"></param> /// <returns></returns> public int UpdateUserPowerDetail(UserPowerDetail info) { string strSql = ""; //获取SQL语句 if (this.Sql.GetSql("Manager.UserPowerDetailManager.UpdateUserPowerDetail", ref strSql) == -1) { return(-1); } //获取参数 try { string[] strParm = myGetParm(info); //取参数列表 strSql = string.Format(strSql, strParm); //替换SQL语句中的参数。 } catch (Exception ex) { this.Err = "付数值时候出错!" + ex.Message; this.WriteErr(); return(-1); } return(this.ExecNoQuery(strSql)); }