Пример #1
0
        /// <summary>
        /// 打开菜单
        /// </summary>
        private void OpenMenuContent(V_UserMenuPermission currentMenu)
        {
            string MenuCode    = currentMenu.MENUCODE;
            string description = currentMenu.MENUNAME;

            try
            {
                ViewModel.Context.childSystemManager.LoadChildSystemModule(MenuCode);
            }
            catch (Exception ex)
            {
                AppContext.SystemMessage(string.Format("打开模块'{0}'产生异常!", description) + ex.ToString());
                AppContext.ShowSystemMessageText();
                if (MenuPanel != null)
                {
                    MenuPanel.hideLoading();
                }
                Logging.Logger.Current.Log(
                    "10000",
                    "Platform",
                    "请求模块.",
                    String.Format("打开模块'{0}'产生异常!", description),
                    ex,
                    Logging.Category.Exception,
                    Logging.Priority.High);

                string message = string.Format("打开模块'{0}'产生异常,请联系管理员!", description);
                MessageWindow.Show("提示", message, MessageIcon.Error, MessageWindowType.Default);
            }
        }
Пример #2
0
        //1. 获取用户菜单权限
        public static void GetUserMenuPermission(V_UserMenuPermission Menu)
        {
            CurrentMenu = Menu;
            //权限检查发现有变更时,权限需要重新从服务器获取
            if (SMT.SAAS.Main.CurrentContext.AppContext.IsPermUpdate)
            {
                pmClient.GetEntityPermissionByUserAsync(SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.SysUserID, Menu.ENTITYMENUID);
                return;
            }

            //判断是否已存在此权限
            if (CheckUserPermissionIsExit(Menu))
            {
                if (OnGetUserMenuPermissionCompleted != null)
                {
                    OnGetUserMenuPermissionCompleted(null, EventArgs.Empty);
                }
            }
            else
            {
                if (!V_UserPermUILocalVM.IsExists(SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID, Menu.ENTITYMENUID))
                {
                    pmClient.GetEntityPermissionByUserAsync(SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.SysUserID, Menu.ENTITYMENUID);
                    return;
                }
                GetPermissionInfoUIByLocal(Menu);
            }
        }
Пример #3
0
        //1. 获取用户菜单权限
        public static void GetUserMenuPermission(V_UserMenuPermission Menu)
        {
            CurrentMenu = Menu;
            //权限检查发现有变更时,权限需要重新从服务器获取
            if (SMT.SAAS.Main.CurrentContext.AppContext.IsPermUpdate)
            {
                pmClient.GetEntityPermissionByUserAsync(SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.SysUserID, Menu.ENTITYMENUID);
                return;
            }

            //判断是否已存在此权限
            if (CheckUserPermissionIsExit(Menu))
            {
                if (OnGetUserMenuPermissionCompleted != null)
                {
                    OnGetUserMenuPermissionCompleted(null, EventArgs.Empty);
                }
            }
            else
            {
                if (!V_UserPermUILocalVM.IsExists(SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID, Menu.ENTITYMENUID))
                {
                    pmClient.GetEntityPermissionByUserAsync(SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.SysUserID, Menu.ENTITYMENUID);
                    return;
                }
                GetPermissionInfoUIByLocal(Menu);
            }
        }
Пример #4
0
 /// <summary>
 /// 初始化<see cref="LoadModuleCompletedEventArgs"/>的新实例。
 /// </summary>
 /// <param name="moduleInfo">模块信息。</param>
 /// <param name="error">产生的异常。</param>
 public LoadModuleEventArgs(object moduleInstance, V_UserMenuPermission moduleInfo, Exception error)
 {
     if (moduleInfo == null)
     {
         throw new ArgumentNullException("moduleInfo");
     }
     this.ModuleInstance = moduleInstance;
     this.ModuleInfo     = moduleInfo;
     this.Error          = error;
 }
Пример #5
0
        static bool CheckUserPermissionIsExit(V_UserMenuPermission Menu)
        {
            var q = from ent in SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.PermissionInfoUI
                    where ent.EntityMenuID == Menu.ENTITYMENUID
                    select ent;

            if (q.Count() > 0)
            {
                return(true);
            }
            return(false);
        }
Пример #6
0
        private void Menu48Icon_MouseLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            ShortCut s = sender as ShortCut;

            if (s != null)
            {
                V_UserMenuPermission datecontext = s.DataContext as V_UserMenuPermission;
                if (ShortCutClick != null)
                {
                    ShortCutClick(this, new OnShortCutClickEventArgs(datecontext, null));
                }
            }
        }
Пример #7
0
        /// <summary>
        /// 打开菜单
        /// </summary>
        private void ShowModule()
        {
            V_UserMenuPermission moduleinfo = new V_UserMenuPermission();//ViewModel.Context.Managed.Catalog.FirstOrDefault(m => m.ModuleID == strCurModuleID);

            if (moduleinfo != null)
            {
                if (moduleinfo.URLADDRESS.ToUpper().Contains("MVC"))
                {
                    //string strUrl = string.Empty;
                    //try
                    //{
                    //    HtmlWindow wd = HtmlPage.Window;
                    //    strUrl = moduleinfo.ModuleType.Substring(moduleinfo.ModuleType.IndexOf("[mvc]")).Replace("[mvc]", "");
                    //    strUrl = strUrl.Split(',')[0].Replace('.', '/');
                    //    if (strUrl.IndexOf('?') > -1)
                    //    {
                    //        strUrl = strUrl + "&uid=" + SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID;
                    //    }
                    //    else
                    //    {
                    //        strUrl = strUrl + "?uid=" + SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID;
                    //    }
                    //    string strHost = SMT.SAAS.Main.CurrentContext.Common.HostAddress.ToString().Split('/')[0];
                    //    strUrl = "http://" + strHost + "/" + strUrl;
                    //    Uri uri = new Uri(strUrl);
                    //    HtmlPopupWindowOptions options = new HtmlPopupWindowOptions();
                    //    options.Directories = false;
                    //    options.Location = false;
                    //    options.Menubar = false;
                    //    options.Status = false;
                    //    options.Toolbar = false;
                    //    options.Left = 280;
                    //    options.Top = 100;
                    //    options.Width = 800;
                    //    options.Height = 600;
                    //    //HtmlPage.PopupWindow(uri, moduleinfo.ModuleCode, options);
                    //    //wd.Navigate(uri, "_bank");
                    //    string strWindow = System.DateTime.Now.ToString("yyMMddHHmsssfff");
                    //    wd.Navigate(uri, strWindow, "directories=no,fullscreen=no,menubar=no,resizable=yes,scrollbars=yes,status=no,titlebar=no,toolbar=no");
                    //}
                    //catch
                    //{
                    //    MessageBox.Show("模块链接异常:" + moduleinfo.ModuleType);
                    //}
                }
                else
                {
                    OpenMenuContent(moduleinfo);
                }
            }
        }
Пример #8
0
        private TreeViewItem CreateTreeItem(V_UserMenuPermission menu)
        {
            TreeViewItem treeItem = new TreeViewItem();

            treeItem.Header      = menu;
            treeItem.Tag         = menu;
            treeItem.DataContext = menu;
            treeItem.Margin      = new Thickness(0);

            treeItem.Style = this.Resources["TreeMenuItemStyle"] as Style;

            treeItem.Selected += new RoutedEventHandler(treeItem_Selected);

            return(treeItem);
        }
Пример #9
0
        /// <summary>
        /// 加载子系统完成事件
        /// </summary>
        /// <param name="MenuCode"></param>
        public void LoadChildSystemModule(string MenuCode)
        {
            var entityMenu = (from ent in Context.CacheMenuAll
                              where ent.MENUCODE == MenuCode
                              select ent).FirstOrDefault();

            menuInfo = entityMenu;
            var systemTypeDic = (from ent in Context.CacheSystemType
                                 where ent.DICTIONARYVALUE.Value.ToString() == entityMenu.SYSTEMTYPE
                                 select ent).FirstOrDefault();

            strSystemType = systemTypeDic.SYSTEMNEED;
            MainPageManeger.LoadXapName = systemTypeDic.SYSTEMNEED;


            if (Context.allChildSystemAssembly.ContainsKey(systemTypeDic.SYSTEMNEED))
            {
                FrameworkElement MenuPage;
                if (Context.CacheMenuUIElement.ContainsKey(menuInfo.MENUCODE))
                {
                    MenuPage = Context.CacheMenuUIElement[menuInfo.MENUCODE] as FrameworkElement;
                }
                else
                {
                    asmMain = Context.allChildSystemAssembly[systemTypeDic.SYSTEMNEED] as Assembly;
                    string pageObjName = strSystemType.Replace(".xap", "") + ".Views" + menuInfo.URLADDRESS.Replace("/", ".");
                    MenuPage = asmMain.CreateInstance(pageObjName) as FrameworkElement;
                    Context.CacheMenuUIElement.Add(menuInfo.MENUCODE, MenuPage);
                }
                if (OnSystemLoadXapPacketCompleted != null)
                {
                    LoadModuleEventArgs arg = new LoadModuleEventArgs(MenuPage, menuInfo, null);
                    this.OnSystemLoadXapPacketCompleted(null, arg);
                }
            }
            else
            {
                MainPageManeger.VertionFileName = systemTypeDic.SYSTEMNEED + ".xml";
                MainPageManeger.dllVersionUpdataCheck();
            }
        }
Пример #10
0
        void treeItem_Selected(object sender, RoutedEventArgs e)
        {
            TreeViewItem treeItem = sender as TreeViewItem;

            if (treeItem == null)
            {
                return;
            }

            V_UserMenuPermission menu = treeItem.Tag as V_UserMenuPermission;

            if (menu == null)
            {
                return;
            }

            if (menu.URLADDRESS != null)
            {
                ContentFrame.Navigate(new Uri(menu.URLADDRESS, UriKind.Relative));
            }
        }
Пример #11
0
        /// <summary>
        /// 加载子系统完成事件
        /// </summary>
        /// <param name="MenuCode"></param>
        public void LoadChildSystemModule(string MenuCode)
        {
            var entityMenu = (from ent in Context.CacheMenuAll
                                where ent.MENUCODE == MenuCode
                                select ent).FirstOrDefault();
            menuInfo = entityMenu;
            var systemTypeDic=(from ent in Context.CacheSystemType
                                where ent.DICTIONARYVALUE.Value.ToString() == entityMenu.SYSTEMTYPE
                                select ent).FirstOrDefault();
            strSystemType = systemTypeDic.SYSTEMNEED;
            MainPageManeger.LoadXapName = systemTypeDic.SYSTEMNEED;


            if (Context.allChildSystemAssembly.ContainsKey(systemTypeDic.SYSTEMNEED))
            {
                FrameworkElement MenuPage;
                if (Context.CacheMenuUIElement.ContainsKey(menuInfo.MENUCODE))
                {
                    MenuPage = Context.CacheMenuUIElement[menuInfo.MENUCODE] as FrameworkElement;
                }
                else
                {
                    asmMain = Context.allChildSystemAssembly[systemTypeDic.SYSTEMNEED] as Assembly;
                    string pageObjName = strSystemType.Replace(".xap", "") + ".Views" + menuInfo.URLADDRESS.Replace("/", ".");
                    MenuPage = asmMain.CreateInstance(pageObjName) as FrameworkElement;
                    Context.CacheMenuUIElement.Add(menuInfo.MENUCODE, MenuPage);
                }
                if (OnSystemLoadXapPacketCompleted != null)
                {
                    LoadModuleEventArgs arg = new LoadModuleEventArgs(MenuPage, menuInfo, null);
                    this.OnSystemLoadXapPacketCompleted(null, arg);
                }
            }
            else
            {
                MainPageManeger.VertionFileName = systemTypeDic.SYSTEMNEED + ".xml";
                MainPageManeger.dllVersionUpdataCheck();
            }
        }
Пример #12
0
        private static void GetPermissionInfoUIByLocal(V_UserMenuPermission Menu)
        {
            try
            {
                string strEmployeeID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID;

                List <SMT.SaaS.LocalData.V_UserPermissionUI> userPermissionUIs = new List <SMT.SaaS.LocalData.V_UserPermissionUI>();

                List <V_UserPermUILocal>    userPermUILocals = V_UserPermUILocalVM.GetAllV_UserPermUILocal(strEmployeeID);
                List <V_CustomerPermission> customerPerms    = V_CustomerPermissionVM.GetAllV_CustomerPermission(strEmployeeID);
                List <V_PermissionValue>    permissionValues = V_PermissionValueVM.GetAllV_PermissionValue(strEmployeeID);
                List <V_OrgObject>          v_OrgObjects     = V_OrgObjectVM.GetAllV_OrgObject(strEmployeeID);

                if (userPermUILocals == null)
                {
                    return;
                }

                foreach (var item in userPermUILocals)
                {
                    if (item.EntityMenuID != null)
                    {
                        if (ViewModel.Context.CacheMenuPermissionList == null)
                        {
                            ViewModel.Context.CacheMenuPermissionList = new List <string>();
                        }

                        SMT.SaaS.LocalData.V_UserPermissionUI userPermissionUI = item.CloneObject <SMT.SaaS.LocalData.V_UserPermissionUI>(new SMT.SaaS.LocalData.V_UserPermissionUI());

                        V_CustomerPermission v_cusPerm = null;
                        foreach (var p in customerPerms)
                        {
                            if (p.UserModuleID != item.UserModuleID)
                            {
                                continue;
                            }

                            v_cusPerm = p;
                            break;
                        }

                        if (v_cusPerm == null)
                        {
                            userPermissionUIs.Add(userPermissionUI);
                            continue;
                        }

                        userPermissionUI.CustomerPermission = v_cusPerm.CloneObject <SMT.SaaS.LocalData.CustomerPermission>(new SMT.SaaS.LocalData.CustomerPermission());
                        List <SMT.SaaS.LocalData.PermissionValue> permValues = new List <SaaS.LocalData.PermissionValue>();
                        foreach (var d in permissionValues)
                        {
                            if (v_cusPerm == null)
                            {
                                break;
                            }

                            if (d.UserModuleID != v_cusPerm.UserModuleID)
                            {
                                continue;
                            }

                            SMT.SaaS.LocalData.PermissionValue  permValue  = d.CloneObject <SMT.SaaS.LocalData.PermissionValue>(new SaaS.LocalData.PermissionValue());
                            List <SMT.SaaS.LocalData.OrgObject> orgObjects = new List <SaaS.LocalData.OrgObject>();
                            foreach (var o in v_OrgObjects)
                            {
                                if (v_cusPerm == null)
                                {
                                    break;
                                }

                                if (o.UserModuleID != d.UserModuleID)
                                {
                                    continue;
                                }

                                SMT.SaaS.LocalData.OrgObject orgObject = o.CloneObject <SMT.SaaS.LocalData.OrgObject>(new SaaS.LocalData.OrgObject());
                                orgObjects.Add(orgObject);
                            }
                            permValue.OrgObjects.AddRange(orgObjects);
                            permValues.Add(permValue);
                        }

                        userPermissionUI.CustomerPermission.PermissionValue.AddRange(permValues);
                    }
                }
                if (userPermissionUIs != null)
                {
                    foreach (var u in userPermissionUIs)
                    {
                        if (SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.PermissionInfoUI == null)
                        {
                            SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.PermissionInfoUI = new List <SaaS.LocalData.V_UserPermissionUI>();
                        }

                        if (!SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.PermissionInfoUI.Contains(u))
                        {
                            SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.PermissionInfoUI.Add(u);
                        }
                    }
                }

                if (ViewModel.Context.CacheMenuPermissionList.Contains(Menu.ENTITYMENUID) == false)
                {
                    ViewModel.Context.CacheMenuPermissionList.Add(Menu.ENTITYMENUID);
                }
            }
            catch (Exception ex)
            {
                SMT.SAAS.Main.CurrentContext.AppContext.logAndShow(ex.ToString());
            }
            finally
            {
                if (OnGetUserMenuPermissionCompleted != null)
                {
                    OnGetUserMenuPermissionCompleted(null, EventArgs.Empty);
                }
            }
        }
Пример #13
0
 /// <summary>
 /// 获取WEBPART完成事件参数
 /// </summary>
 /// <param name="result">返回的webpart集合</param>
 /// <param name="error">错误信息</param>
 public OnShortCutClickEventArgs(V_UserMenuPermission result, Exception error)
 {
     this.Result = result;
     this.Error = error;
 }
Пример #14
0
 /// <summary>
 /// 获取WEBPART完成事件参数
 /// </summary>
 /// <param name="result">返回的webpart集合</param>
 /// <param name="error">错误信息</param>
 public OnShortCutClickEventArgs(V_UserMenuPermission result, Exception error)
 {
     this.Result = result;
     this.Error  = error;
 }
Пример #15
0
        private void AddSubMenu(List<V_UserMenuPermission> menulist, TreeViewItem parentItem, V_UserMenuPermission menu)
        {
            var menuItems = from m in menulist
                            where m.EntityMenuFatherID != null && m.EntityMenuFatherID == menu.ENTITYMENUID
                            orderby m.ORDERNUMBER
                            select m;
            if (menuItems == null || menuItems.Count() <= 0)
                return;

            foreach (var subMenu in menuItems)
            {

                TreeViewItem treeItem = CreateTreeItem(subMenu);

                parentItem.Items.Add(treeItem);

                AddSubMenu(menulist, treeItem, subMenu);
            }
        }
Пример #16
0
        /// <summary>
        /// 打开菜单
        /// </summary>
        private void OpenMenuContent(V_UserMenuPermission currentMenu)
        {
            string MenuCode = currentMenu.MENUCODE;
            string description = currentMenu.MENUNAME;
            try
            {
                ViewModel.Context.childSystemManager.LoadChildSystemModule(MenuCode);
            }
            catch (Exception ex)
            {
                AppContext.SystemMessage(string.Format("打开模块'{0}'产生异常!", description)+ex.ToString());
                AppContext.ShowSystemMessageText();
                if (MenuPanel != null)
                {
                    MenuPanel.hideLoading();
                }
                Logging.Logger.Current.Log(
                    "10000",
                    "Platform",
                    "请求模块.",
                    String.Format("打开模块'{0}'产生异常!", description),
                    ex,
                    Logging.Category.Exception,
                    Logging.Priority.High);

                string message = string.Format("打开模块'{0}'产生异常,请联系管理员!", description);
                MessageWindow.Show("提示", message, MessageIcon.Error, MessageWindowType.Default);
            }
        }
Пример #17
0
 /// <summary>
 /// 初始化<see cref="LoadModuleCompletedEventArgs"/>的新实例。
 /// </summary>
 /// <param name="moduleInfo">模块信息。</param>
 /// <param name="error">产生的异常。</param>
  public LoadModuleEventArgs(object moduleInstance, V_UserMenuPermission moduleInfo, Exception error)
 {
     if (moduleInfo == null)
     {
         throw new ArgumentNullException("moduleInfo");
     }
     this.ModuleInstance = moduleInstance;
     this.ModuleInfo = moduleInfo;
     this.Error = error;
 }
Пример #18
0
 /// <summary>
 /// 打开菜单
 /// </summary>
 private void ShowModule()
 {
     V_UserMenuPermission moduleinfo = new V_UserMenuPermission();//ViewModel.Context.Managed.Catalog.FirstOrDefault(m => m.ModuleID == strCurModuleID);
     if (moduleinfo != null)
     {
         if (moduleinfo.URLADDRESS.ToUpper().Contains("MVC"))
         {
             //string strUrl = string.Empty;
             //try
             //{
             //    HtmlWindow wd = HtmlPage.Window;
             //    strUrl = moduleinfo.ModuleType.Substring(moduleinfo.ModuleType.IndexOf("[mvc]")).Replace("[mvc]", "");
             //    strUrl = strUrl.Split(',')[0].Replace('.', '/');
             //    if (strUrl.IndexOf('?') > -1)
             //    {
             //        strUrl = strUrl + "&uid=" + SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID;
             //    }
             //    else
             //    {
             //        strUrl = strUrl + "?uid=" + SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID;
             //    }
             //    string strHost = SMT.SAAS.Main.CurrentContext.Common.HostAddress.ToString().Split('/')[0];
             //    strUrl = "http://" + strHost + "/" + strUrl;
             //    Uri uri = new Uri(strUrl);
             //    HtmlPopupWindowOptions options = new HtmlPopupWindowOptions();
             //    options.Directories = false;
             //    options.Location = false;
             //    options.Menubar = false;
             //    options.Status = false;
             //    options.Toolbar = false;
             //    options.Left = 280;
             //    options.Top = 100;
             //    options.Width = 800;
             //    options.Height = 600;
             //    //HtmlPage.PopupWindow(uri, moduleinfo.ModuleCode, options);
             //    //wd.Navigate(uri, "_bank");
             //    string strWindow = System.DateTime.Now.ToString("yyMMddHHmsssfff");
             //    wd.Navigate(uri, strWindow, "directories=no,fullscreen=no,menubar=no,resizable=yes,scrollbars=yes,status=no,titlebar=no,toolbar=no");
             //}
             //catch
             //{
             //    MessageBox.Show("模块链接异常:" + moduleinfo.ModuleType);
             //}
         }
         else
         {
             OpenMenuContent(moduleinfo);
         }
     }
 }
Пример #19
0
 static bool CheckUserPermissionIsExit(V_UserMenuPermission Menu)
 {
     var q = from ent in SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.PermissionInfoUI
             where ent.EntityMenuID == Menu.ENTITYMENUID
             select ent;
     if(q.Count()>0)
     {
         return true;
     }
     return false;
 }
Пример #20
0
        private void AddSubMenu(List <V_UserMenuPermission> menulist, TreeViewItem parentItem, V_UserMenuPermission menu)
        {
            var menuItems = from m in menulist
                            where m.EntityMenuFatherID != null && m.EntityMenuFatherID == menu.ENTITYMENUID
                            orderby m.ORDERNUMBER
                            select m;

            if (menuItems == null || menuItems.Count() <= 0)
            {
                return;
            }

            foreach (var subMenu in menuItems)
            {
                TreeViewItem treeItem = CreateTreeItem(subMenu);

                parentItem.Items.Add(treeItem);

                AddSubMenu(menulist, treeItem, subMenu);
            }
        }
Пример #21
0
        private static void GetPermissionInfoUIByLocal(V_UserMenuPermission Menu)
        {
            try
            {
                string strEmployeeID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID;

                List<SMT.SaaS.LocalData.V_UserPermissionUI> userPermissionUIs = new List<SMT.SaaS.LocalData.V_UserPermissionUI>();

                List<V_UserPermUILocal> userPermUILocals = V_UserPermUILocalVM.GetAllV_UserPermUILocal(strEmployeeID);
                List<V_CustomerPermission> customerPerms = V_CustomerPermissionVM.GetAllV_CustomerPermission(strEmployeeID);
                List<V_PermissionValue> permissionValues = V_PermissionValueVM.GetAllV_PermissionValue(strEmployeeID);
                List<V_OrgObject> v_OrgObjects = V_OrgObjectVM.GetAllV_OrgObject(strEmployeeID);

                if (userPermUILocals == null)
                {
                    return;
                }

                foreach (var item in userPermUILocals)
                {
                    if (item.EntityMenuID != null)
                    {
                        if (ViewModel.Context.CacheMenuPermissionList == null)
                        {
                            ViewModel.Context.CacheMenuPermissionList = new List<string>();
                        }

                        SMT.SaaS.LocalData.V_UserPermissionUI userPermissionUI = item.CloneObject<SMT.SaaS.LocalData.V_UserPermissionUI>(new SMT.SaaS.LocalData.V_UserPermissionUI());

                        V_CustomerPermission v_cusPerm = null;
                        foreach (var p in customerPerms)
                        {
                            if (p.UserModuleID != item.UserModuleID)
                            {
                                continue;
                            }

                            v_cusPerm = p;
                            break;
                        }

                        if (v_cusPerm == null)
                        {
                            userPermissionUIs.Add(userPermissionUI);
                            continue;
                        }

                        userPermissionUI.CustomerPermission = v_cusPerm.CloneObject<SMT.SaaS.LocalData.CustomerPermission>(new SMT.SaaS.LocalData.CustomerPermission());
                        List<SMT.SaaS.LocalData.PermissionValue> permValues = new List<SaaS.LocalData.PermissionValue>();
                        foreach (var d in permissionValues)
                        {
                            if (v_cusPerm == null)
                            {
                                break;
                            }

                            if (d.UserModuleID != v_cusPerm.UserModuleID)
                            {
                                continue;
                            }

                            SMT.SaaS.LocalData.PermissionValue permValue = d.CloneObject<SMT.SaaS.LocalData.PermissionValue>(new SaaS.LocalData.PermissionValue());
                            List<SMT.SaaS.LocalData.OrgObject> orgObjects = new List<SaaS.LocalData.OrgObject>();
                            foreach (var o in v_OrgObjects)
                            {
                                if (v_cusPerm == null)
                                {
                                    break;
                                }

                                if (o.UserModuleID != d.UserModuleID)
                                {
                                    continue;
                                }

                                SMT.SaaS.LocalData.OrgObject orgObject = o.CloneObject<SMT.SaaS.LocalData.OrgObject>(new SaaS.LocalData.OrgObject());
                                orgObjects.Add(orgObject);
                            }
                            permValue.OrgObjects.AddRange(orgObjects);
                            permValues.Add(permValue);
                        }

                        userPermissionUI.CustomerPermission.PermissionValue.AddRange(permValues);
                    }
                }
                if (userPermissionUIs != null)
                {
                    foreach (var u in userPermissionUIs)
                    {
                        if (SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.PermissionInfoUI == null)
                        {
                            SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.PermissionInfoUI = new List<SaaS.LocalData.V_UserPermissionUI>();
                        }

                        if (!SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.PermissionInfoUI.Contains(u))
                        {
                            SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.PermissionInfoUI.Add(u);
                        }
                    }
                }

                if (ViewModel.Context.CacheMenuPermissionList.Contains(Menu.ENTITYMENUID) == false)
                {
                    ViewModel.Context.CacheMenuPermissionList.Add(Menu.ENTITYMENUID);
                }

            }
            catch (Exception ex)
            {
                SMT.SAAS.Main.CurrentContext.AppContext.logAndShow(ex.ToString());
            }
            finally
            {
                if (OnGetUserMenuPermissionCompleted != null)
                {
                    OnGetUserMenuPermissionCompleted(null, EventArgs.Empty);
                }
            }
        }
Пример #22
0
        private void menu_ShortCutClick(object sender, OnShortCutClickEventArgs e)
        {
            //礼品特殊处理
            V_UserMenuPermission currentMenu = e.Result;

            if (currentMenu.URLADDRESS.ToUpper().Contains("MVC"))
            {
                string strUrl = string.Empty;
                try
                {
                    #region 打开外部Url链接
                    HtmlWindow wd = HtmlPage.Window;
                    strUrl = currentMenu.URLADDRESS.Substring(currentMenu.URLADDRESS.IndexOf("[mvc]")).Replace("[mvc]", "");
                    strUrl = strUrl.Split(',')[0].Replace('.', '/');
                    if (strUrl.IndexOf('?') > -1)
                    {
                        strUrl = strUrl + "&uid=" + SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID;
                    }
                    else
                    {
                        strUrl = strUrl + "?uid=" + SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID;
                    }
                    string strHost = SMT.SAAS.Main.CurrentContext.Common.HostAddress.ToString().Split('/')[0];
                    strUrl = "http://" + strHost + "/" + strUrl;
                    Uri uri = new Uri(strUrl);

                    HtmlPopupWindowOptions options = new HtmlPopupWindowOptions();
                    options.Directories = false;
                    options.Location    = false;
                    options.Menubar     = false;
                    options.Status      = false;
                    options.Toolbar     = false;
                    options.Status      = false;
                    options.Resizeable  = true;
                    options.Left        = 280;
                    options.Top         = 100;
                    options.Width       = 800;
                    options.Height      = 600;
                    //HtmlPage.PopupWindow(uri, info.ModuleCode, options);
                    string strWindow = System.DateTime.Now.ToString("yyMMddHHmsssfff");
                    wd.Navigate(uri, strWindow, "directories=no,fullscreen=no,menubar=no,resizable=yes,scrollbars=yes,status=no,titlebar=no,toolbar=no");
                    #endregion
                }
                catch
                {
                    MessageBox.Show("模块链接异常:" + currentMenu.MENUNAME);
                }
            }
            else
            {
                _fromMenu = true;
                if (MenuPanel != null)
                {
                    MenuPanel.showLoading();
                }

                dragShortCut.Visibility = System.Windows.Visibility.Collapsed;
                MainPage.isDrag         = false;
                //1. 检测菜单权限
                // CheckPermission(e.Result);
                _currentClickModule = currentMenu;
                //1. 获取用户菜单权限
                UserPermissionHelper.OnGetUserMenuPermissionCompleted += new EventHandler((obj, arg) => {
                    OpenMenuContent(currentMenu);
                });
                UserPermissionHelper.GetUserMenuPermission(_currentClickModule);
            }
        }
Пример #23
0
        private void menu_ShortCutClick(object sender, OnShortCutClickEventArgs e)
        {
            //礼品特殊处理
            V_UserMenuPermission currentMenu = e.Result;
            if (currentMenu.URLADDRESS.ToUpper().Contains("MVC") )
            {
                string strUrl = string.Empty;
                try
                {
                    #region 打开外部Url链接
                    HtmlWindow wd = HtmlPage.Window;
                    strUrl = currentMenu.URLADDRESS.Substring(currentMenu.URLADDRESS.IndexOf("[mvc]")).Replace("[mvc]", "");
                    strUrl = strUrl.Split(',')[0].Replace('.', '/');
                    if (strUrl.IndexOf('?') > -1)
                    {
                        strUrl = strUrl + "&uid=" + SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID;
                    }
                    else
                    {
                        strUrl = strUrl + "?uid=" + SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID;
                    }
                    string strHost = SMT.SAAS.Main.CurrentContext.Common.HostAddress.ToString().Split('/')[0];
                    strUrl = "http://" + strHost + "/" + strUrl;
                    Uri uri = new Uri(strUrl);

                    HtmlPopupWindowOptions options = new HtmlPopupWindowOptions();
                    options.Directories = false;
                    options.Location = false;
                    options.Menubar = false;
                    options.Status = false;
                    options.Toolbar = false;
                    options.Status = false;
                    options.Resizeable = true;
                    options.Left = 280;
                    options.Top = 100;
                    options.Width = 800;
                    options.Height = 600;
                    //HtmlPage.PopupWindow(uri, info.ModuleCode, options);
                    string strWindow = System.DateTime.Now.ToString("yyMMddHHmsssfff");
                    wd.Navigate(uri, strWindow, "directories=no,fullscreen=no,menubar=no,resizable=yes,scrollbars=yes,status=no,titlebar=no,toolbar=no");
                    #endregion
                }
                catch
                {
                    MessageBox.Show("模块链接异常:" + currentMenu.MENUNAME);
                }
            }
            else
            {
                _fromMenu = true;
                if (MenuPanel != null)
                {
                    MenuPanel.showLoading();
                }

                dragShortCut.Visibility = System.Windows.Visibility.Collapsed;
                MainPage.isDrag = false;
                //1. 检测菜单权限
               // CheckPermission(e.Result);
                _currentClickModule = currentMenu;
                //1. 获取用户菜单权限
                UserPermissionHelper.OnGetUserMenuPermissionCompleted+=new EventHandler((obj, arg) => {
                    OpenMenuContent(currentMenu);
                });
                UserPermissionHelper.GetUserMenuPermission(_currentClickModule);
            }
        }
Пример #24
0
        private TreeViewItem CreateTreeItem(V_UserMenuPermission menu)
        {
            TreeViewItem treeItem = new TreeViewItem();
            treeItem.Header = menu;
            treeItem.Tag = menu;
            treeItem.DataContext = menu;
            treeItem.Margin = new Thickness(0);

            treeItem.Style = this.Resources["TreeMenuItemStyle"] as Style;

            treeItem.Selected += new RoutedEventHandler(treeItem_Selected);

            return treeItem;
        }