private void InitParas(string CustPermID) { ServiceClient = new PermissionServiceClient(); ServiceClient.GetEntityMenuCustomPermByIDCompleted += new EventHandler <GetEntityMenuCustomPermByIDCompletedEventArgs>(ServiceClient_GetEntityMenuCustomPermByIDCompleted); //ServiceClient.GetSysMenuByTypeCompleted += new EventHandler<GetSysMenuByTypeCompletedEventArgs>(ServiceClient_GetSysMenuByTypeCompleted); ServiceClient.FindSysPermissionByTypeCompleted += new EventHandler <FindSysPermissionByTypeCompletedEventArgs>(ServiceClient_FindSysPermissionByTypeCompleted); ServiceClient.EntityMenuCustomPermAddCompleted += new EventHandler <System.ComponentModel.AsyncCompletedEventArgs>(ServiceClient_EntityMenuCustomPermAddCompleted); ServiceClient.EntityMenuCustomPermUpdateCompleted += new EventHandler <System.ComponentModel.AsyncCompletedEventArgs>(ServiceClient_EntityMenuCustomPermUpdateCompleted); if (FormType == FormTypes.New) { CustPerm = new T_SYS_ENTITYMENUCUSTOMPERM(); CustPerm.ENTITYMENUCUSTOMPERMID = Guid.NewGuid().ToString(); } //初始化角色权限 if (!string.IsNullOrEmpty(CustPermID)) { ServiceClient.GetEntityMenuCustomPermByIDAsync(CustPermID); } else { //ServiceClient.GetSysMenuByTypeAsync(""); ServiceClient.FindSysPermissionByTypeAsync(""); } }
/// <summary> /// 读取自定义权限 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void PermClient_GetCustomerPermissionByUserIDAndEntityCodeCompleted(object sender, GetCustomerPermissionByUserIDAndEntityCodeCompletedEventArgs e) { toolbar1.btnImport.Visibility = Visibility.Visible;//首先显示,为了读取失败之后不影响原有操作。 try { if (e.Error == null) { if (e.Result != null) { customerPermission = new T_SYS_ENTITYMENUCUSTOMPERM(); customerPermission = e.Result; } else { toolbar1.btnImport.Visibility = Visibility.Collapsed;//没有自定义权限则隐藏 } } else { Utility.ShowCustomMessage(MessageTypes.Message, Utility.GetResourceStr("ERROR"), e.Error.Message); } } catch (Exception ex) { Utility.ShowCustomMessage(MessageTypes.Message, Utility.GetResourceStr("ERROR"), ex.Message); } }
void DtGrid_CurrentCellChanged(object sender, EventArgs e) { DataGrid grid = (DataGrid)sender; if (grid.SelectedItem != null) { Perm = (T_SYS_ENTITYMENUCUSTOMPERM)grid.SelectedItems[0]; //获取当前选中的行数据并转换为对应的实体 } //perm.ENDDATE }
/// <summary> /// 读取自定义权限 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void PermClient_GetCustomerPermissionByUserIDAndEntityCodeCompleted(object sender, GetCustomerPermissionByUserIDAndEntityCodeCompletedEventArgs e) { ToolBar.btnImport.Visibility = Visibility.Visible;//首先显示,为了读取失败之后不影响原有操作。 if (e.Error == null) { if (e.Result != null) { customerPermission = new T_SYS_ENTITYMENUCUSTOMPERM(); customerPermission = e.Result; } else { ToolBar.btnImport.Visibility = Visibility.Collapsed; //没有自定义权限则隐藏 } } }
public void EntityMenuCustomPermUpdate(T_SYS_ENTITYMENUCUSTOMPERM obj) { using (EntityMenuCustomPermBLL bll = new EntityMenuCustomPermBLL()) { bll.EntityMenuCustomPermUpdate(obj); } }
public void SetCutomterPermissionObj(string RoleID, List<CustomerPermission> objs, ref string strResult) { try { using (EntityMenuCustomPermBLL bll = new EntityMenuCustomPermBLL()) { if (string.IsNullOrWhiteSpace(RoleID)) { return; } RoleEntityMenuBLL roleEmBll = new RoleEntityMenuBLL(); roleEmBll.UpdateRoleInfo(RoleID, strResult);//修改信息 strResult = string.Empty; IQueryable<T_SYS_ENTITYMENUCUSTOMPERM> cuspers = bll.GetCustomPermByRoleID(RoleID); //if (cuspers != null) //{ // if (cuspers.Count() > 0) // { // foreach (T_SYS_ENTITYMENUCUSTOMPERM item in cuspers) // { // string strId = item.ENTITYMENUCUSTOMPERMID; // EntityMenuCustomPermDelete(strId); // } // } //} SysPermissionBLL bllPer = new SysPermissionBLL(); T_SYS_ROLE entRole = GetSysRoleSingleInfoById(RoleID);//获取角色ID实体对象 foreach (var Menus in objs) { if (Menus.PermissionValue == null) { continue; } if (Menus.PermissionValue.Count() == 0) { continue; } T_SYS_ENTITYMENU entMenu = GetSysMenuByID(Menus.EntityMenuId); foreach (var Perms in Menus.PermissionValue) { if (Perms.OrgObjects == null) { continue; } if (Perms.OrgObjects.Count() == 0) { continue; } T_SYS_PERMISSION entPer = bllPer.GetAttachSysPermissionByID(Perms.Permission);//获取权限实体对象 foreach (var OrgIns in Perms.OrgObjects) { T_SYS_ENTITYMENUCUSTOMPERM customerPer = new T_SYS_ENTITYMENUCUSTOMPERM(); customerPer.ENTITYMENUCUSTOMPERMID = Guid.NewGuid().ToString(); customerPer.T_SYS_ROLEReference.EntityKey = entRole.EntityKey; customerPer.T_SYS_ROLE = entRole; //customerPer.T_SYS_ENTITYMENU = entMenu; customerPer.T_SYS_ENTITYMENUReference.EntityKey = entMenu.EntityKey; customerPer.T_SYS_ENTITYMENU = entMenu; //customerPer.T_SYS_PERMISSION = entPer; customerPer.T_SYS_PERMISSIONReference.EntityKey = entPer.EntityKey; customerPer.T_SYS_PERMISSION = entPer; switch (OrgIns.OrgType) { //公司 case "0": customerPer.COMPANYID = OrgIns.OrgID; break; case "1"://部门 customerPer.DEPARTMENTID = OrgIns.OrgID; break; case "2"://岗位 customerPer.POSTID = OrgIns.OrgID; break; } customerPer.CREATEDATE = DateTime.Now; customerPer.UPDATEDATE = DateTime.Now; EntityMenuCustomPermAdd(customerPer); } } } } } catch (Exception ex) { strResult = ex.Message; } }
void PermClient_GetCustomerPermissionByUserIDAndEntityCodeCompleted(object sender, GetCustomerPermissionByUserIDAndEntityCodeCompletedEventArgs e) { if (e.Error == null) { if (e.Result != null) { customerPermission = new T_SYS_ENTITYMENUCUSTOMPERM(); customerPermission = e.Result; } } else { Utility.ShowCustomMessage(MessageTypes.Message,"aaaaaaa",e.Error.Message); } }
private void InitParas(string CustPermID) { ServiceClient = new PermissionServiceClient(); ServiceClient.GetEntityMenuCustomPermByIDCompleted += new EventHandler<GetEntityMenuCustomPermByIDCompletedEventArgs>(ServiceClient_GetEntityMenuCustomPermByIDCompleted); //ServiceClient.GetSysMenuByTypeCompleted += new EventHandler<GetSysMenuByTypeCompletedEventArgs>(ServiceClient_GetSysMenuByTypeCompleted); ServiceClient.FindSysPermissionByTypeCompleted += new EventHandler<FindSysPermissionByTypeCompletedEventArgs>(ServiceClient_FindSysPermissionByTypeCompleted); ServiceClient.EntityMenuCustomPermAddCompleted += new EventHandler<System.ComponentModel.AsyncCompletedEventArgs>(ServiceClient_EntityMenuCustomPermAddCompleted); ServiceClient.EntityMenuCustomPermUpdateCompleted += new EventHandler<System.ComponentModel.AsyncCompletedEventArgs>(ServiceClient_EntityMenuCustomPermUpdateCompleted); if (FormType == FormTypes.New) { CustPerm = new T_SYS_ENTITYMENUCUSTOMPERM(); CustPerm.ENTITYMENUCUSTOMPERMID = Guid.NewGuid().ToString(); } //初始化角色权限 if (!string.IsNullOrEmpty(CustPermID)) { ServiceClient.GetEntityMenuCustomPermByIDAsync(CustPermID); } else { //ServiceClient.GetSysMenuByTypeAsync(""); ServiceClient.FindSysPermissionByTypeAsync(""); } }
public void AddToT_SYS_ENTITYMENUCUSTOMPERM(T_SYS_ENTITYMENUCUSTOMPERM t_SYS_ENTITYMENUCUSTOMPERM) { base.AddObject("T_SYS_ENTITYMENUCUSTOMPERM", t_SYS_ENTITYMENUCUSTOMPERM); }
public static T_SYS_ENTITYMENUCUSTOMPERM CreateT_SYS_ENTITYMENUCUSTOMPERM(string eNTITYMENUCUSTOMPERMID) { T_SYS_ENTITYMENUCUSTOMPERM t_SYS_ENTITYMENUCUSTOMPERM = new T_SYS_ENTITYMENUCUSTOMPERM(); t_SYS_ENTITYMENUCUSTOMPERM.ENTITYMENUCUSTOMPERMID = eNTITYMENUCUSTOMPERMID; return t_SYS_ENTITYMENUCUSTOMPERM; }
/// <summary> /// 读取自定义权限 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void PermClient_GetCustomerPermissionByUserIDAndEntityCodeCompleted(object sender, GetCustomerPermissionByUserIDAndEntityCodeCompletedEventArgs e) { ToolBar.btnImport.Visibility = Visibility.Visible;//首先显示,为了读取失败之后不影响原有操作。 if (e.Error == null) { if (e.Result != null) { customerPermission = new T_SYS_ENTITYMENUCUSTOMPERM(); customerPermission = e.Result; } else { ToolBar.btnImport.Visibility = Visibility.Collapsed;//没有自定义权限则隐藏 } } }