void client_GetSysPermissionByIDCompleted(object sender, GetSysPermissionByIDCompletedEventArgs e) { perm = e.Result; perm.UPDATEDATE = DateTime.Now; //perm.UPDATEUSER = Common.CurrentLoginUserInfo.sysuserID; this.DataContext = perm; if (perm.ISCOMMOM == "1" || perm.ISCOMMOM == null) { rbtIsAutoyes.IsChecked = true; rbtIsAutono.IsChecked = false; this.LayoutRoot.RowDefinitions[3].Height = new GridLength(0); this.LayoutRoot.RowDefinitions[4].Height = new GridLength(0); } else { rbtIsAutoyes.IsChecked = false; rbtIsAutono.IsChecked = true; this.LayoutRoot.RowDefinitions[3].Height = new GridLength(30); this.LayoutRoot.RowDefinitions[4].Height = new GridLength(30); if (perm.ISCOMMOM == "0" && perm.T_SYS_ENTITYMENUReference.EntityKey != null) { client.GetSysMenuByIDAsync(perm.T_SYS_ENTITYMENUReference.EntityKey.EntityKeyValues[0].Value.ToString()); } } client.GetSysDictionaryByCategoryAsync("SYSTEMTYPE"); }
/// <summary> /// 权限项行加载事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void DtGrid_LoadingRow(object sender, DataGridRowEventArgs e) { T_SYS_PERMISSION MenuInfoT = (T_SYS_PERMISSION)e.Row.DataContext; CheckBox mychkBox = DtGrid.Columns[0].GetCellContent(e.Row).FindName("myChkBox") as CheckBox; mychkBox.Tag = MenuInfoT; }
//选取当前行 void DtGrid_CurrentCellChanged(object sender, EventArgs e) { DataGrid grid = sender as DataGrid; if (grid.SelectedItem != null) { Permission = (T_SYS_PERMISSION)grid.SelectedItems[0]; } }
/// <summary> /// 添加功能项对应的权限值 /// </summary> /// <param name="chkbox">单击的checkbox</param> private void PermissionGridSetPermissionByCheckBox(CheckBox chkbox) { T_SYS_PERMISSION TablePermission = new T_SYS_PERMISSION(); TablePermission = chkbox.Tag as T_SYS_PERMISSION; PermissionValue PermValue = new PermissionValue(); PermValue.Permission = TablePermission.PERMISSIONID; if (chkbox.IsChecked == true) { foreach (var ent in SelectingCustomerpermission) { //ent.PermissionValue aa = new ObservableCollection<PermissionValue>(); var ents = from a in ListPermValue where a.Permission == PermValue.Permission select a; if (ent.PermissionValue == null) { ListPermValue.Add(PermValue); } else { if (!(ents.Count() > 0)) { ListPermValue.Add(PermValue); } } if (ListPermValue.Count() > 0) { ent.PermissionValue = ListPermValue; } ListCustomerpermission.Add(ent); } SelectingCustomerpermission.Clear();//将上一次选中的功能项清空 } else //没选中 则删除 相对应的 权限 { foreach (var ent in ListCustomerpermission) { PermValue.Permission = TablePermission.PERMISSIONID; var EntPermValue = from entPerm in ent.PermissionValue where entPerm.Permission == TablePermission.PERMISSIONID select entPerm; if (EntPermValue.Count() > 0) { ent.PermissionValue.Remove(PermValue); } } } }
void ServiceClient_FindSysPermissionByTypeCompleted(object sender, FindSysPermissionByTypeCompletedEventArgs e) { cbxPerm.ItemsSource = null; if (e.Result != null) { //绑定权限名称 List <T_SYS_PERMISSION> ents = e.Result.ToList(); cbxPerm.ItemsSource = ents; cbxPerm.DisplayMemberPath = "PERMISSIONNAME"; foreach (var item in cbxPerm.Items) { T_SYS_PERMISSION tmpPerm = item as T_SYS_PERMISSION; if (tmpPerm != null && CustPerm != null && CustPerm.T_SYS_PERMISSION != null && tmpPerm.PERMISSIONID == this.CustPerm.T_SYS_PERMISSION.PERMISSIONID) { cbxPerm.SelectedItem = item; break; } } } }
public string SysPermissionUpdate(T_SYS_PERMISSION obj) { using (SysPermissionBLL bll = new SysPermissionBLL()) { string keyString = "PermissionAllPagingCache"; WCFCache.Current[keyString] = null;//清缓存 string AddkeyString = "GetSysPermissionByID" + obj.PERMISSIONID; WCFCache.Current[AddkeyString] = null; return bll.SysPermissionUpdate(obj); } }
public string SysPermissionAdd(T_SYS_PERMISSION obj) { using (SysPermissionBLL bll = new SysPermissionBLL()) { string keyString = "PermissionAllPagingCache" ; WCFCache.Current[keyString] = null;//清缓存 return bll.AddPermission(obj); } //bll.Add(obj); }
void client_GetSysPermissionByIDCompleted(object sender, GetSysPermissionByIDCompletedEventArgs e) { perm = e.Result; perm.UPDATEDATE = DateTime.Now; //perm.UPDATEUSER = Common.CurrentLoginUserInfo.sysuserID; this.DataContext = perm; if (perm.ISCOMMOM == "1" || perm.ISCOMMOM==null) { rbtIsAutoyes.IsChecked = true; rbtIsAutono.IsChecked = false; this.LayoutRoot.RowDefinitions[3].Height = new GridLength(0); this.LayoutRoot.RowDefinitions[4].Height = new GridLength(0); } else { rbtIsAutoyes.IsChecked = false; rbtIsAutono.IsChecked = true; this.LayoutRoot.RowDefinitions[3].Height = new GridLength(30); this.LayoutRoot.RowDefinitions[4].Height = new GridLength(30); if(perm.ISCOMMOM =="0" && perm.T_SYS_ENTITYMENUReference.EntityKey !=null) client.GetSysMenuByIDAsync(perm.T_SYS_ENTITYMENUReference.EntityKey.EntityKeyValues[0].Value.ToString()); } client.GetSysDictionaryByCategoryAsync("SYSTEMTYPE"); }
public void AddToT_SYS_PERMISSION(T_SYS_PERMISSION t_SYS_PERMISSION) { base.AddObject("T_SYS_PERMISSION", t_SYS_PERMISSION); }
public static T_SYS_PERMISSION CreateT_SYS_PERMISSION(string pERMISSIONID, string pERMISSIONNAME) { T_SYS_PERMISSION t_SYS_PERMISSION = new T_SYS_PERMISSION(); t_SYS_PERMISSION.PERMISSIONID = pERMISSIONID; t_SYS_PERMISSION.PERMISSIONNAME = pERMISSIONNAME; return t_SYS_PERMISSION; }
/// <summary> /// dg DAtagrd /// </summary> /// <param name="dg"></param> /// <param name="chx">checkbox</param> /// <param name="strtxt">textbox</param> /// <param name="btn">button</param> private void FillPermissionDataRangeNewfill(DataGrid dg, string chx,string btn) { if (tmpEditRoleEntityPermList.Count() == 0) return; if (dg.Columns.Count < tmpPermission.Count) return;//还没有动态生成列 if (dg.ItemsSource != null) { foreach (object obj in dg.ItemsSource) { T_SYS_ENTITYMENU menu = new T_SYS_ENTITYMENU(); if (dg.Columns[0].GetCellContent(obj) != null) { CheckBox cb1 = dg.Columns[0].GetCellContent(obj).FindName(chx) as CheckBox; //cb为 if (cb1 == null) continue; //cb1.Tag menu = cb1.Tag as T_SYS_ENTITYMENU; var bb = from a in tmpEditRoleEntityLIst where a.T_SYS_ENTITYMENU.ENTITYMENUID == menu.ENTITYMENUID select a; if (bb.Count() > 0) { cb1.IsChecked = true; T_SYS_ROLEENTITYMENU tmpRoleEntity = new T_SYS_ROLEENTITYMENU(); tmpRoleEntity = bb.FirstOrDefault(); int PermCount = 0; PermCount = tmpPermission.Count; int IndexCount = 2; //IndexCount = PermCount for (int i = 2; i < PermCount + 2; i++) { IndexCount = IndexCount + i; if (dg.Columns[i].GetCellContent(obj) != null) { T_SYS_PERMISSION tmpPerm = new T_SYS_PERMISSION(); tmpPerm = tmpPermission[i - 2]; var roles = from cc in tmpEditRoleEntityPermList where cc.T_SYS_ROLEENTITYMENU.ROLEENTITYMENUID == tmpRoleEntity.ROLEENTITYMENUID && cc.T_SYS_PERMISSION.PERMISSIONID == tmpPerm.PERMISSIONID //where cc.T_SYS_ROLEENTITYMENU.ROLEENTITYMENUID == tmpRoleEntity.ROLEENTITYMENUID select cc; if (roles.Count() > 0) { //Rating hrrate = dg.Columns[i].GetCellContent(obj).FindName("HRrating") as Rating; Button hrrate = dg.Columns[i].GetCellContent(obj).FindName(btn) as Button; switch (roles.FirstOrDefault().DATARANGE) { case "0"://集团 //hrrate.Value = 1; hrrate.Content = "★★★★★"; break; case "1"://公司 //hrrate.Value = 0.8; hrrate.Content = "★★★★"; break; case "2"://部门 //hrrate.Value = 0.6; hrrate.Content = "★★★"; break; case "3"://岗位 //hrrate.Value = 0.4; hrrate.Content = "★★"; break; case "4"://个人 //hrrate.Value = 0.2; hrrate.Content = "★"; break; } //hrrate.Value = } }// if dg.columns }// for int i }//bb.cout } }//foreach(dg) } }
/// <summary> /// 添加功能项对应的权限值 /// </summary> /// <param name="chkbox">单击的checkbox</param> private void PermissionGridSetPermissionByCheckBox(CheckBox chkbox) { T_SYS_PERMISSION TablePermission = new T_SYS_PERMISSION(); TablePermission = chkbox.Tag as T_SYS_PERMISSION; PermissionValue PermValue = new PermissionValue(); PermValue.Permission = TablePermission.PERMISSIONID; if (chkbox.IsChecked == true) { foreach (var ent in SelectingCustomerpermission) { //ent.PermissionValue aa = new ObservableCollection<PermissionValue>(); var ents = from a in ListPermValue where a.Permission == PermValue.Permission select a; if (ent.PermissionValue == null) { ListPermValue.Add(PermValue); } else { if (!(ents.Count() > 0)) ListPermValue.Add(PermValue); } if (ListPermValue.Count() > 0) ent.PermissionValue = ListPermValue; ListCustomerpermission.Add(ent); } SelectingCustomerpermission.Clear();//将上一次选中的功能项清空 } else //没选中 则删除 相对应的 权限 { foreach (var ent in ListCustomerpermission) { PermValue.Permission = TablePermission.PERMISSIONID; var EntPermValue = from entPerm in ent.PermissionValue where entPerm.Permission == TablePermission.PERMISSIONID select entPerm; if (EntPermValue.Count() > 0) ent.PermissionValue.Remove(PermValue); } } }
private void AddOrgObjectInList(TreeViewItem item) { if (item == null) { return; } if (ListCustomerpermission.Count() == 0) { return; } TreeViewItem menuitem = (TreeViewItem)treeMenu.SelectedItem; T_SYS_ENTITYMENU entMenu = menuitem.DataContext as T_SYS_ENTITYMENU; T_SYS_PERMISSION entPermission = DtGrid.SelectedItem as T_SYS_PERMISSION; ExtOrgObj obj = item.DataContext as ExtOrgObj; FrameworkUI.OrgTreeItemTypes nodeType = obj.ObjectType; OrgObject entTemp = new OrgObject(); switch (nodeType) { case FrameworkUI.OrgTreeItemTypes.Company: T_HR_COMPANY tmpOrg = (T_HR_COMPANY)obj.ObjectInstance; if (tmpOrg != null) { entTemp.OrgID = tmpOrg.COMPANYID; entTemp.OrgType = Convert.ToInt32(OrgTreeItemTypes.Company).ToString(); } break; case FrameworkUI.OrgTreeItemTypes.Department: T_HR_DEPARTMENT tmpDep = obj.ObjectInstance as T_HR_DEPARTMENT; if (tmpDep != null) { entTemp.OrgID = tmpDep.DEPARTMENTID; entTemp.OrgType = Convert.ToInt32(OrgTreeItemTypes.Department).ToString(); } break; case FrameworkUI.OrgTreeItemTypes.Post: T_HR_POST tmpPost = obj.ObjectInstance as T_HR_POST; if (tmpPost != null) { entTemp.OrgID = tmpPost.POSTID; entTemp.OrgType = Convert.ToInt32(OrgTreeItemTypes.Post).ToString(); } break; default: break; } if (!string.IsNullOrEmpty(entTemp.OrgID) && !string.IsNullOrEmpty(entTemp.OrgType)) { foreach (CustomerPermission parentitem in ListCustomerpermission) { if (parentitem.EntityMenuId != entMenu.ENTITYMENUID) { continue; } var per = from p in parentitem.PermissionValue where p.Permission == entPermission.PERMISSIONID select p; if (per.Count() == 0) { break; } foreach (PermissionValue childitem in per) { ObservableCollection <OrgObject> entsOrg = new ObservableCollection <OrgObject>(); if (childitem.OrgObjects == null) { entsOrg.Add(entTemp); childitem.OrgObjects = entsOrg; } else if (childitem.OrgObjects.Count() == 0) { entsOrg.Add(entTemp); childitem.OrgObjects = entsOrg; } else if ((childitem.OrgObjects.Count() > 0)) { var pcc = from o in childitem.OrgObjects where o.OrgID == entTemp.OrgID && o.OrgType == entTemp.OrgType select o; if (pcc.Count() == 0) { childitem.OrgObjects.Add(entTemp); } } } } this.DataContext = ListCustomerpermission; } }