public void SaveRoleRightRel() { int num = 0; int @int = base.GetInt("txtRoleID", 0); string @string = base.GetString("currRightIDsStr"); try { PEIS.Model.SysRole model = PEIS.BLL.SysRole.Instance.GetModel(@int); num = CommonRight.Instance.OperateRoleRight(@int, @string, this.LoginUserModel.UserID, model.CreateDate.Value); } catch (Exception ex) { Log4J.Instance.Error(string.Concat(new string[] { Public.GetClientIP(), ",", this.LoginUserModel.UserName, ",角色 错误信息:", ex.Message })); num = 0; } this.OutPutMessage(num.ToString()); }
protected void GetEditRoleInfo(int RoleID, ref VelocityContext vltContext) { if (RoleID > 0) { PEIS.Model.SysRole model = PEIS.BLL.SysRole.Instance.GetModel(RoleID); if (null != model) { vltContext.Put("RoleID", model.RoleID); vltContext.Put("RoleName", model.RoleName); vltContext.Put("DispOrder", model.DispOrder); vltContext.Put("Is_Default", (model.Is_DefaultRole == 1) ? "True" : "False"); vltContext.Put("Note", model.Remark); } } }
public bool Update(PEIS.Model.SysRole model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update SysRole set "); strSql.Append("RoleName=@RoleName,"); strSql.Append("DispOrder=@DispOrder,"); strSql.Append("Is_Locked=@Is_Locked,"); strSql.Append("Remark=@Remark,"); strSql.Append("CreateDate=@CreateDate,"); strSql.Append("OperatorID=@OperatorID,"); strSql.Append("Is_DefaultRole=@Is_DefaultRole"); strSql.Append(" where RoleID=@RoleID "); SqlParameter[] parameters = { new SqlParameter("@RoleName", SqlDbType.NVarChar, 30), new SqlParameter("@DispOrder", SqlDbType.Int, 4), new SqlParameter("@Is_Locked", SqlDbType.Int, 4), new SqlParameter("@Remark", SqlDbType.VarChar, 200), new SqlParameter("@CreateDate", SqlDbType.DateTime), new SqlParameter("@OperatorID", SqlDbType.Int, 4), new SqlParameter("@Is_DefaultRole", SqlDbType.Int, 4), new SqlParameter("@RoleID", SqlDbType.Int, 4) }; parameters[0].Value = model.RoleName; parameters[1].Value = model.DispOrder; parameters[2].Value = model.Is_Locked; parameters[3].Value = model.Remark; parameters[4].Value = model.CreateDate; parameters[5].Value = model.OperatorID; parameters[6].Value = model.Is_DefaultRole; parameters[7].Value = model.RoleID; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
public List <PEIS.Model.SysRole> DataTableToList(DataTable dt) { List <PEIS.Model.SysRole> list = new List <PEIS.Model.SysRole>(); int count = dt.Rows.Count; if (count > 0) { for (int i = 0; i < count; i++) { PEIS.Model.SysRole sysRole = new PEIS.Model.SysRole(); if (dt.Rows[i]["RoleID"].ToString() != "") { sysRole.RoleID = int.Parse(dt.Rows[i]["RoleID"].ToString()); } sysRole.RoleName = dt.Rows[i]["RoleName"].ToString(); if (dt.Rows[i]["DispOrder"].ToString() != "") { sysRole.DispOrder = int.Parse(dt.Rows[i]["DispOrder"].ToString()); } if (dt.Rows[i]["Is_Locked"].ToString() != "") { sysRole.Is_Locked = int.Parse(dt.Rows[i]["Is_Locked"].ToString()); } sysRole.Remark = dt.Rows[i]["Remark"].ToString(); if (dt.Rows[i]["CreateDate"].ToString() != "") { sysRole.CreateDate = new DateTime?(DateTime.Parse(dt.Rows[i]["CreateDate"].ToString())); } if (dt.Rows[i]["OperatorID"].ToString() != "") { sysRole.OperatorID = new int?(int.Parse(dt.Rows[i]["OperatorID"].ToString())); } if (dt.Rows[i]["Is_DefaultRole"].ToString() != "") { sysRole.Is_DefaultRole = new int?(int.Parse(dt.Rows[i]["Is_DefaultRole"].ToString())); } list.Add(sysRole); } } return(list); }
public PEIS.Model.SysRole DataRowToModel(DataRow row) { PEIS.Model.SysRole model = new PEIS.Model.SysRole(); if (row != null) { if (row["RoleID"] != null && row["RoleID"].ToString() != "") { model.RoleID = int.Parse(row["RoleID"].ToString()); } if (row["RoleName"] != null) { model.RoleName = row["RoleName"].ToString(); } if (row["DispOrder"] != null && row["DispOrder"].ToString() != "") { model.DispOrder = int.Parse(row["DispOrder"].ToString()); } if (row["Is_Locked"] != null && row["Is_Locked"].ToString() != "") { model.Is_Locked = int.Parse(row["Is_Locked"].ToString()); } if (row["Remark"] != null) { model.Remark = row["Remark"].ToString(); } if (row["CreateDate"] != null && row["CreateDate"].ToString() != "") { model.CreateDate = DateTime.Parse(row["CreateDate"].ToString()); } if (row["OperatorID"] != null && row["OperatorID"].ToString() != "") { model.OperatorID = int.Parse(row["OperatorID"].ToString()); } if (row["Is_DefaultRole"] != null && row["Is_DefaultRole"].ToString() != "") { model.Is_DefaultRole = int.Parse(row["Is_DefaultRole"].ToString()); } } return(model); }
public int Add(PEIS.Model.SysRole model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into SysRole("); strSql.Append("RoleID,RoleName,DispOrder,Is_Locked,Remark,CreateDate,OperatorID,Is_DefaultRole)"); strSql.Append(" values ("); strSql.Append("@RoleID,@RoleName,@DispOrder,@Is_Locked,@Remark,@CreateDate,@OperatorID,@Is_DefaultRole)"); SqlParameter[] parameters = { new SqlParameter("@RoleID", SqlDbType.Int, 4), new SqlParameter("@RoleName", SqlDbType.NVarChar, 30), new SqlParameter("@DispOrder", SqlDbType.Int, 4), new SqlParameter("@Is_Locked", SqlDbType.Int, 4), new SqlParameter("@Remark", SqlDbType.VarChar, 200), new SqlParameter("@CreateDate", SqlDbType.DateTime), new SqlParameter("@OperatorID", SqlDbType.Int, 4), new SqlParameter("@Is_DefaultRole", SqlDbType.Int, 4) }; parameters[0].Value = model.RoleID; parameters[1].Value = model.RoleName; parameters[2].Value = model.DispOrder; parameters[3].Value = model.Is_Locked; parameters[4].Value = model.Remark; parameters[5].Value = model.CreateDate; parameters[6].Value = model.OperatorID; parameters[7].Value = model.Is_DefaultRole; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(0); } else { return(1); } }
public PEIS.Model.SysRole GetModel(int RoleID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 RoleID,RoleName,DispOrder,Is_Locked,Remark,CreateDate,OperatorID,Is_DefaultRole from SysRole "); strSql.Append(" where RoleID=@RoleID "); SqlParameter[] parameters = { new SqlParameter("@RoleID", SqlDbType.Int, 4) }; parameters[0].Value = RoleID; PEIS.Model.SysRole model = new PEIS.Model.SysRole(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
public void SaveRoleInfo() { int RoleID = base.GetInt("RoleID", 0); string text = base.GetString("RoleName"); text = Input.URLDecode(text); int int2 = base.GetInt("DispOrder", 500); int arg_47_0 = (base.GetInt("Is_DefaultRole", 0) == 1) ? 1 : 0; string text2 = base.GetString("Remark"); text2 = Input.URLDecode(text2); SqlConditionInfo[] conditions = new SqlConditionInfo[] { new SqlConditionInfo("@RoleName", text, TypeCode.String) }; string querySqlCode = "QueryRoleNameIsExis_Param"; try { DataSet dataSet = CommonConfig.Instance.ExcuteQuerySql(querySqlCode, conditions); if (dataSet != null && dataSet.Tables[0].Rows.Count > 0) { if (RoleID <= 0 || dataSet.Tables[0].Rows.Count != 1 || int.Parse(dataSet.Tables[0].Rows[0][0].ToString()) != RoleID) { this.OutPutMessage("-1".ToString()); return; } } } catch (Exception ex) { return; } PEIS.Model.SysRole sysRole; if (RoleID <= 0) { sysRole = new PEIS.Model.SysRole(); } else { sysRole = PEIS.BLL.SysRole.Instance.GetModel(RoleID); } sysRole.RoleID = RoleID; if (RoleID <= 0) { sysRole.CreateDate = new DateTime?(DateTime.Now); } sysRole.RoleName = text; sysRole.DispOrder = int2; sysRole.Remark = text2; sysRole.OperatorID = new int?(this.LoginUserModel.UserID); int num = CommonConfig.Instance.SaveRole(sysRole); int num2 = (RoleID > 0) ? RoleID : num; string text3 = (RoleID > 0) ? "修改" : "新增"; if (num > 0) { Log4J.Instance.Info(string.Concat(new object[] { Public.GetClientIP(), ",", this.LoginUserModel.UserName, ",", text3, "角色 名称:", text, ",编号:", num2 })); } else { Log4J.Instance.Error(string.Concat(new object[] { Public.GetClientIP(), ",", this.LoginUserModel.UserName, ",", text3, "角色失败 名称:", text, ",编号:", num2 })); } this.OutPutMessage(num.ToString()); }
public void DeleteRoleNodeItem() { int @int = base.GetInt("txtRoleID", 0); int num = 0; SqlConditionInfo[] conditions = new SqlConditionInfo[] { new SqlConditionInfo("@ID_Role", @int, TypeCode.Int32) }; string querySqlCode = "QueryRoleUsedCount_Param"; try { DataSet dataSet = CommonRight.Instance.ExcuteQuerySql(querySqlCode, conditions); num = int.Parse(dataSet.Tables[0].Rows[0][0].ToString()); } catch (Exception ex) { Log4J.Instance.Error(string.Concat(new string[] { Public.GetClientIP(), ",", this.LoginUserModel.UserName, ",删除角色 错误信息:", ex.Message })); } int num2; if (num > 0) { num2 = -1; } else { PEIS.Model.SysRole model = PEIS.BLL.SysRole.Instance.GetModel(@int); if (model.Is_DefaultRole == 1) { num2 = -2; } else { num2 = CommonRight.Instance.DeleteRole(@int); if (num2 > 0) { Log4J.Instance.Info(string.Concat(new object[] { Public.GetClientIP(), ",", this.LoginUserModel.UserName, ",删除角色 ID_Role:", model.RoleID })); } else { Log4J.Instance.Error(string.Concat(new object[] { Public.GetClientIP(), ",", this.LoginUserModel.UserName, ",删除角色失败 ID_Role:", model.RoleID })); } } } this.OutPutMessage(num2.ToString()); }
public void SaveRoleNodeItem() { int num = 0; int @int = base.GetInt("type", 0); int int2 = base.GetInt("txtRoleID", 0); string @string = base.GetString("txtRoleName"); int int3 = base.GetInt("txtDispOrder", 0); int int4 = base.GetInt("IsLockedRole", 0); string string2 = base.GetString("currRightIDsStr"); switch (@int) { case 1: case 2: break; default: num = -2; break; } if (num >= 0) { PEIS.Model.SysRole sysRole = new PEIS.Model.SysRole(); if (@int == 2) { if (int2 > 0) { sysRole = PEIS.BLL.SysRole.Instance.GetModel(int2); } sysRole.RoleID = int2; } sysRole.RoleName = Input.URLDecode(@string); sysRole.DispOrder = int3; sysRole.Is_Locked = int4; sysRole.OperatorID = new int?(this.LoginUserModel.UserID); sysRole.CreateDate = new DateTime?(DateTime.Now); SqlConditionInfo[] conditions = new SqlConditionInfo[] { new SqlConditionInfo("@RoleName", sysRole.RoleName, TypeCode.String) }; string querySqlCode = "QueryRoleNameInfo_Param"; try { DataSet dataSet = CommonRight.Instance.ExcuteQuerySql(querySqlCode, conditions); int count = dataSet.Tables[0].Rows.Count; switch (@int) { case 1: if (count > 0) { num = -1; } else { sysRole.Is_DefaultRole = new int?(0); num = PEIS.BLL.SysRole.Instance.Add(sysRole); if (num > 0) { Log4J.Instance.Info(string.Concat(new object[] { Public.GetClientIP(), ",", this.LoginUserModel.UserName, ",新增角色 角色名称:", sysRole.RoleName, ",ID_Role:", num })); } else { Log4J.Instance.Error(string.Concat(new object[] { Public.GetClientIP(), ",", this.LoginUserModel.UserName, ",新增角色失败 角色名称:", sysRole.RoleName, ",ID_Role:", num })); } } break; case 2: if (count > 0 && int.Parse(dataSet.Tables[0].Rows[0][0].ToString()) != sysRole.RoleID) { num = -1; } else { num = (PEIS.BLL.SysRole.Instance.Update(sysRole) ? 1 : 0); if (num > 0) { Log4J.Instance.Info(string.Concat(new object[] { Public.GetClientIP(), ",", this.LoginUserModel.UserName, ",修改角色 角色名称:", sysRole.RoleName, ",ID_Role:", sysRole.RoleID })); } else { Log4J.Instance.Error(string.Concat(new object[] { Public.GetClientIP(), ",", this.LoginUserModel.UserName, ",修改角色失败 角色名称:", sysRole.RoleName, ",ID_Role:", sysRole.RoleID })); } } break; default: num = -2; break; } if (num > 0) { int iD_Role; if (@int == 2) { iD_Role = int2; } else { iD_Role = num; } num = 1 + CommonRight.Instance.OperateRoleRight(iD_Role, string2, this.LoginUserModel.UserID, sysRole.CreateDate.Value); } } catch (Exception ex) { Log4J.Instance.Error(string.Concat(new string[] { Public.GetClientIP(), ",", this.LoginUserModel.UserName, ",角色 错误信息:", ex.Message })); num = 0; } } this.OutPutMessage(num.ToString()); }
public int SaveRole(PEIS.Model.SysRole RoleModel) { return(CommonConfig.dal.SaveRole(RoleModel)); }
public bool Update(PEIS.Model.SysRole model) { return(this.dal.Update(model)); }
public int Add(PEIS.Model.SysRole model) { return(this.dal.Add(model)); }