public void GetLoginModuleData_Debug()
        {
            string filepath = AppPluginManage.getbaseinfoDataValue(_pluginName, "menuconfig");

            System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument();
            xmlDoc.Load(AppGlobal.AppRootPath + filepath);

            XmlNodeList       nl     = xmlDoc.DocumentElement.SelectNodes("modules/module");
            List <BaseModule> mdlist = new List <BaseModule>();

            foreach (XmlNode n in nl)
            {
                BaseModule bmd = new BaseModule();
                bmd.ModuleId = Convert.ToInt32(n.Attributes["ModuleId"].Value);
                bmd.Name     = n.Attributes["Name"].Value;
                mdlist.Add(bmd);
            }

            DataTable dt = ConvertExtend.ToDataTable(mdlist);

            JsonResult = RetSuccess("", JavaScriptConvert.SerializeObject(dt));
        }
        //调试免登录
        private void DebugLogin()
        {
            #region 进入调试模式

            if (AppPluginManage.getbaseinfoDataValue(_pluginName, "isdebug") == "true")
            {
                //进入调试模式
                DefaultView = frmmain as IBaseViewBusiness;

                SysLoginRight right = new SysLoginRight();
                right.UserId   = 1;
                right.EmpId    = 1;
                right.WorkId   = 1;
                right.DeptId   = 1;
                right.DeptName = "调试科室";
                right.EmpName  = "调试用户";
                right.WorkName = "调试机构";
                AppGlobal.cache.Add("RoleUser", right);

                frmmain.UserName = right.EmpName;
                frmmain.DeptName = right.DeptName;
                frmmain.WorkName = right.WorkName;
                if (AppPluginManage.getbaseinfoDataValue(_pluginName, "menuconfig") != null)
                {
                    string filepath = AppPluginManage.getbaseinfoDataValue(_pluginName, "menuconfig");
                    System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument();
                    xmlDoc.Load(filepath);

                    XmlNodeList       nl     = xmlDoc.DocumentElement.SelectNodes("modules/module");
                    List <BaseModule> mdlist = new List <BaseModule>();
                    foreach (XmlNode n in nl)
                    {
                        BaseModule bmd = new BaseModule();
                        bmd.ModuleId = Convert.ToInt32(n.Attributes["ModuleId"].Value);
                        bmd.Name     = n.Attributes["Name"].Value;
                        mdlist.Add(bmd);
                    }
                    nl = xmlDoc.DocumentElement.SelectNodes("menus/menu");
                    List <BaseMenu> menulist = new List <BaseMenu>();
                    foreach (XmlNode n in nl)
                    {
                        BaseMenu bmenu = new BaseMenu();
                        bmenu.MenuId   = Convert.ToInt32(n.Attributes["MenuId"].Value);
                        bmenu.ModuleId = Convert.ToInt32(n.Attributes["ModuleId"].Value);
                        bmenu.PMenuId  = Convert.ToInt32(n.Attributes["PMenuId"].Value);
                        bmenu.Name     = n.Attributes["Name"].Value;
                        bmenu.Image    = n.Attributes["Image"].Value;
                        bmenu.DllName  = n.Attributes["DllName"].Value;
                        bmenu.FunName  = n.Attributes["FunName"].Value;
                        menulist.Add(bmenu);
                    }
                    frmmain.modules = mdlist;
                    frmmain.menus   = menulist;
                    //frmmain.depts = NewObject<Dept>().GetHaveDept(right.EmpId);
                }
                frmmain.showSysMenu();
                ShowWeclomeForm();

                ((System.Windows.Forms.Form)frmmain).ShowIcon = true;
                ((System.Windows.Forms.Form)frmmain).Icon     = System.Drawing.Icon.ExtractAssociatedIcon(EFWCoreLib.CoreFrame.Init.AppGlobal.AppRootPath + @"images\msn.ico");
            }
            #endregion
        }
        public string GetWebserverUrl()
        {
            string val = AppPluginManage.getbaseinfoDataValue(_pluginName, "WEB_serverUrl");

            return(val ?? "");
        }
 public string GetLoginBackgroundImage()
 {
     return(AppGlobal.AppRootPath + AppPluginManage.getbaseinfoDataValue(_pluginName, "LoginBackgroundImage"));
 }
        public string GetSysName()
        {
            string val = AppPluginManage.getbaseinfoDataValue(_pluginName, "SystemName");

            return(val ?? "");
        }
        public void UserLogin()
        {
            User user    = NewObject <User>();
            bool islogin = user.UserLogin(frmlogin.usercode, frmlogin.password);

            if (islogin)
            {
                BaseUser      EbaseUser = user.GetUser(frmlogin.usercode);
                SysLoginRight right     = new SysLoginRight();
                right.UserId = EbaseUser.UserId;
                right.EmpId  = EbaseUser.EmpId;
                right.WorkId = EbaseUser.WorkId;

                Dept     dept      = NewObject <Dept>();
                BaseDept EbaseDept = dept.GetDefaultDept(EbaseUser.EmpId);
                if (EbaseDept != null)
                {
                    right.DeptId   = EbaseDept.DeptId;
                    right.DeptName = EbaseDept.Name;
                }

                BaseEmployee EbaseEmp = (BaseEmployee)NewObject <BaseEmployee>().getmodel(EbaseUser.EmpId);
                right.EmpName = EbaseEmp.Name;

                BaseWorkers EbaseWork = (BaseWorkers)NewObject <BaseWorkers>().getmodel(EbaseUser.WorkId);
                right.WorkName = EbaseWork.WorkName;

                if (EbaseWork.DelFlag == 0)
                {
                    string       regkey = EbaseWork.RegKey;
                    DESEncryptor des    = new DESEncryptor();
                    des.InputString = regkey;
                    des.DesDecrypt();
                    string[] ret = (des.OutString == null ? "" : des.OutString).Split(new char[] { '|' });
                    if (ret.Length == 2 && ret[0] == EbaseWork.WorkName && Convert.ToDateTime(ret[1]) > DateTime.Now)
                    {
                        AppGlobal.cache.Add("RoleUser", right);

                        //调用单点登录
                        //Guid TokenKey;
                        //EFWCoreLib.CoreFrame.SSO.SsoHelper.SignIn(right.UserId.ToString(), right.EmpName, out TokenKey);
                        //AppGlobal.cache.Add("TokenKey", TokenKey);

                        frmmain.UserName = right.EmpName;
                        frmmain.DeptName = right.DeptName;
                        frmmain.WorkName = right.WorkName;

                        frmmain.modules = NewObject <Module>().GetModuleList(right.UserId).OrderBy(x => x.SortId).ToList();
                        frmmain.menus   = NewObject <WinMainUIFrame.ObjectModel.RightManager.Menu>().GetMenuList(right.UserId);
                        frmmain.depts   = NewObject <Dept>().GetHaveDept(right.EmpId);

                        frmmain.showSysMenu();
                        ShowWeclomeForm();
                        ((System.Windows.Forms.Form)frmmain).ShowIcon = true;
                        ((System.Windows.Forms.Form)frmmain).Icon     = System.Drawing.Icon.ExtractAssociatedIcon(EFWCoreLib.CoreFrame.Init.AppGlobal.AppRootPath + @"images\msn.ico");
                        ((System.Windows.Forms.Form)frmmain).Show();

                        AppGlobal.winfromMain.MainForm = (System.Windows.Forms.Form)frmmain;
                        //InitMessageForm();//?

                        //登录完成后执行扩展的插件方法
                        string val = AppPluginManage.getbaseinfoDataValue(_pluginName, "LoginCompleted");
                        if (val != null && val.Split('@').Length == 3)
                        {
                            string pluginName     = val.Split('@')[0];
                            string controllerName = val.Split('@')[1];
                            string methodName     = val.Split('@')[2];
                            InvokeController(pluginName, controllerName, methodName, right);
                        }

                        CustomConfigManager.xmlDoc = null;
                    }
                    else
                    {
                        throw new Exception("登录用户的当前机构注册码不正确!");
                    }
                }
                else
                {
                    throw new Exception("登录用户的当前机构还未启用!");
                }
            }
            else
            {
                throw new Exception("输入的用户名密码不正确!");
            }
        }
        public void GetLoginFirstMenu_Debug()
        {
            int ModuleId = Convert.ToInt32(ParamsData["ModuleId"]);

            string filepath = AppPluginManage.getbaseinfoDataValue(_pluginName, "menuconfig");

            System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument();
            xmlDoc.Load(AppGlobal.AppRootPath + filepath);
            XmlNodeList     nl       = xmlDoc.DocumentElement.SelectNodes("menus/menu");
            List <BaseMenu> menulist = new List <BaseMenu>();

            foreach (XmlNode n in nl)
            {
                BaseMenu bmenu = new BaseMenu();
                bmenu.MenuId   = Convert.ToInt32(n.Attributes["MenuId"].Value);
                bmenu.ModuleId = Convert.ToInt32(n.Attributes["ModuleId"].Value);
                bmenu.PMenuId  = Convert.ToInt32(n.Attributes["PMenuId"].Value);
                bmenu.Name     = n.Attributes["Name"].Value;
                bmenu.Image    = n.Attributes["Image"].Value;
                bmenu.DllName  = n.Attributes["DllName"].Value;
                bmenu.FunName  = n.Attributes["FunName"].Value;
                bmenu.UrlName  = n.Attributes["UrlName"].Value;
                menulist.Add(bmenu);
            }

            List <BaseMenu> menuList = menulist;
            //List<BaseMenu> AllmenuList = menulist;
            List <BaseMenu> _menuList = new List <BaseMenu>();

            for (int i = 0; i < menuList.Count; i++)
            {
                if (menuList[i].PMenuId != -1)
                {
                    BaseMenu _menu = menuList.Find(x => x.MenuId == menuList[i].PMenuId);
                    if (_menuList.FindIndex(x => x.MenuId == _menu.MenuId) == -1 && menuList.FindIndex(x => x.MenuId == _menu.MenuId) == -1)
                    {
                        _menuList.Add(_menu);
                    }
                }
            }
            menuList.AddRange(_menuList);


            List <BaseMenu> menus = menuList.FindAll(x => (x.ModuleId == ModuleId && x.PMenuId == -1)).OrderBy(x => x.SortId).ToList();
            string          ret   = "";//"[{\"FirstMenu\":{},\"SecondMenu\":[]}]";

            for (int i = 0; i < menus.Count; i++)
            {
                string FirstMenu  = "{}";
                string SecondMenu = "[]";

                FirstMenu = JavaScriptConvert.SerializeObject(menus[i]);
                List <BaseMenu> secondmenus = menuList.FindAll(x => x.PMenuId == menus[i].MenuId).OrderBy(x => x.SortId).ToList();
                SecondMenu = secondmenus.Count > 0 ? JavaScriptConvert.SerializeObject(secondmenus) : "[]";
                if (ret == "")
                {
                    ret += "{\"FirstMenu\":" + FirstMenu + ",\"SecondMenu\":" + SecondMenu + "}";
                }
                else
                {
                    ret += ",{\"FirstMenu\":" + FirstMenu + ",\"SecondMenu\":" + SecondMenu + "}";
                }
            }
            JsonResult = RetSuccess("", "[" + ret + "]");
        }