/// <summary> /// 添加角色 /// </summary> /// <param name="dicRoleInfo">角色信息</param> /// <param name="listFunc">权限ID列表</param> /// <returns></returns> public string AddRole(Dictionary <string, string> dicRoleInfo, List <string> listFunc) { if (dicRoleInfo.Count <= 0 || listFunc.Count <= 0) { return(string.Format("添加角色失败:新增角色信息不完全")); } foreach (string key in dicRoleInfo.Keys) { switch (key) { case ColumnName.RoleID: m_RoleID = dicRoleInfo[key]; break; case ColumnName.RoleName: m_RoleName = dicRoleInfo[key]; break; } } DataTable pDt = m_DbOperate.GetTable(TableName.TRole, string.Format("{0}='{1}'", ColumnName.RoleID, m_RoleID)); if (pDt != null && pDt.Rows.Count > 0) { return(string.Format("添加角色失败:角色ID以存在")); } if (!m_DbOperate.AddRow(TableName.TRole, new List <string> { ColumnName.RoleID, ColumnName.RoleName }, m_RoleID, m_RoleName)) { return(string.Format("添加角色失败:写入数据失败")); } return(UpdateRoleFunction(listFunc)); }
/// <summary> /// 检查是否可以进行登录,只是进行用户名和密码匹配 /// </summary> /// <returns></returns> public string CheckLogin() { DataTable dtUser = m_dbOperate.GetTable(TableName.VUserInfo, string.Format("{0}='{1}'", ColumnName.UserCode, m_UserCode)); if (dtUser == null || dtUser.Rows.Count <= 0) { return(string.Format("未知帐号")); } DataRow pRow = dtUser.Rows[0]; string UserPass = Encryption.Decrypt(pRow[ColumnName.UserPassword].ToString()); if (m_UserPassword != UserPass) { return(string.Format("密码错误!")); } m_UserRole = new Role(pRow[ColumnName.RoleID].ToString(), m_dbOperate); m_UserName = pRow[ColumnName.UserName].ToString(); return(string.Empty); }
private void InitializeConfig() { if (m_Dboperate == null) { LogManage.WriteLog("初始化系统设置失败:无数据库连接信息!"); return; } DataTable pConfigDt = m_Dboperate.GetTable(TableName.TSysConfig, string.Empty); if (pConfigDt == null || pConfigDt.Rows.Count == 0) { LogManage.WriteLog("初始化系统设置失败:无法获取系统设置数据"); } foreach (DataRow pRow in pConfigDt.Rows) { if (pRow[ColumnName.ConfigCode].ToString().Trim() == ColumnName.SystemName) { m_SystemName = pRow[ColumnName.ConfigValue].ToString(); } else if (pRow[ColumnName.ConfigCode].ToString().Trim() == ColumnName.TempDbConfigCode) { m_TempDbConfig = new DBConfig(); m_TempDbConfig.ReadConfigFromStr(pRow[ColumnName.ConfigValue].ToString()); } else if (pRow[ColumnName.ConfigCode].ToString().Trim() == ColumnName.HisDbConfigCode) { m_HisDbConfig = new DBConfig(); m_HisDbConfig.ReadConfigFromStr(pRow[ColumnName.ConfigValue].ToString()); } else if (pRow[ColumnName.ConfigCode].ToString().Trim() == ColumnName.OfficDbConfigCode) { m_OfficialDbConfig = new DBConfig(); m_OfficialDbConfig.ReadConfigFromStr(pRow[ColumnName.ConfigValue].ToString()); } } }