public bool UserRoleApplyBatchAddRoleEntityPermissionInfos(T_SYS_ROLE EntRole, string StrTmpList, string StrAdduser) { using (RoleEntityMenuBLL bll = new RoleEntityMenuBLL()) { string keyString = "RoleEntityID" + EntRole.ROLEID; String KeyNewString = "GetRoleEntityIDListInfosByRoleIDNew" + EntRole.ROLEID;//修改后的视图的显示 string keyStringPermission = "GetPermissionByRoleIDSecond" + EntRole.ROLEID; //WCFCache.Current.Remove(WCFCache.Current[keyString]); WCFCache.Current[keyString] = null; WCFCache.Current[KeyNewString] = null; //WCFCache.Current.Remove(WCFCache.Current[keyStringPermission]); WCFCache.Current[keyStringPermission] = null; return bll.UserRoleApplyEntityMenuBatchAddInfosList(EntRole, StrTmpList, StrAdduser); //return bll.RoleEntityMenuBatchAddInfosList(StrTmpList, EntRole.ROLEID, StrAdduser); //return false; } }
//添加用户角色 public bool UserRoleBatchAddInfos(T_SYS_ROLE[] RoleList, T_SYS_USER userobj, string StrUserName, DateTime AddDate) { using (SysUserRoleBLL UserRoleBll = new SysUserRoleBLL()) { //先清缓存GetSysUserRoleByUser string keyString = "GetSysUserRoleByUser" + userobj.SYSUSERID; WCFCache.Current[keyString] = null; return UserRoleBll.BatchAddUserRoleInfo(userobj, RoleList, StrUserName, AddDate); } }
//增 public string SysRoleInfoAdd(T_SYS_ROLE obj) { using (SysRoleBLL RoleBll = new SysRoleBLL()) { string returnStr = ""; if (!this.IsExistSysRoleInfoByRoleNameAndCompanyAndDepartmentid(obj.ROLENAME, obj.OWNERCOMPANYID,obj.OWNERDEPARTMENTID)) { bool sucess = RoleBll.AddSysRoleInfo(obj); if (sucess == false) { returnStr = "添加系统角色失败"; } } else { returnStr = "系统角色已经存在"; } return returnStr; } }
//改 public void SysRoleInfoUpdate(T_SYS_ROLE obj, ref string StrResult) { using (SysRoleBLL RoleBll = new SysRoleBLL()) { StrResult = RoleBll.SysRoleUpdate(obj, ref StrResult); } }
static void Main(string[] args) { string strSql = @"select c.cname, dd.departmentname, pd.postname, e.employeecname, ei.entrydate, pm.cardid, ei.employeeentryid, e.employeeid, ep.employeepostid, p.postid, d.departmentid, c.companyid from t_hr_company c inner join t_hr_department d on c.companyid =d.companyid inner join t_hr_departmentdictionary dd on d.departmentdictionaryid=dd.departmentdictionaryid inner join t_hr_post p on d.departmentid=p.departmentid inner join t_hr_postdictionary pd on p.postdictionaryid=pd.postdictionaryid inner join t_hr_employeepost ep on ep.postid=p.postid inner join t_hr_employee e on e.employeeid=ep.employeeid left join T_HR_EmployeeEntry ei on e.employeeid=ei.employeeid left join T_HR_PensionMaster pm on e.employeeid=pm.employeeid --where e.employeecname='初始化管理员' order by c.cname"; object obj = ExecuteCustomerSql(strSql, null); using (SMT_System_EFModelContext context = new SMT_System_EFModelContext()) { T_SYS_ROLE role = new T_SYS_ROLE(); //create //T_HR_DICTIONARY entUser = new T_HR_DICTIONARY(); //entUser.DICTIONARYID = "user1"; //try //{ // context.AddToTEST_USERS(entUser); // context.SaveChanges(); //} //catch (Exception ex) //{ //} //read var ta = from a in context.T_SYS_USER select a; ta.ToList(); //foreach (var d in ta) //{ // Console.WriteLine(d.NICKNAME+" "+d.PASSWORD+" "+ d.USERNAME+" "+d.PASSWORD+" "+d.EMAIL); //} Console.ReadLine(); ////delete //var deluser = (from a in context.TEST_USERS // where a.USERNAME.Contains("entityFramwork2") // select a).FirstOrDefault(); //context.DeleteObject(deluser); //context.SaveChanges(); //update //var updateEnt = (from ent in context.TEST_USERS // where ent.USERNAME.Equals("entityFramwork2") // select ent).FirstOrDefault(); //updateEnt.PASSWORD = "******"; //context.SaveChanges(); } }