Exemplo n.º 1
0
        /// <summary>
        /// 通过元数据加载菜单
        /// </summary>
        public void LoadMenus()
        {
            //IMenuService menuService = (IMenuService)application.GetService(typeof(IMenuService));
            MainMenuPages.Clear();
            MenuDict.Clear();

            using (CommonService.CommonServiceClient _cs = new CommonService.CommonServiceClient())
            {
                UserMenuList = _cs.GetAllMenus(SessionClass.CurrentSinoUser.CurrentPost.PostID).ToList <SinoMenuItem>();
            }
            if (UserMenuList != null)
            {
                var _TopLevelMenuList = from _c in UserMenuList
                                        where _c.FatherID == "0"
                                        orderby _c.DisplayOrder
                                        select _c;
                foreach (SinoMenuItem _smi in _TopLevelMenuList)
                {
                    if (_smi.MenuType.Length > 3 && _smi.MenuType.Substring(0, 3) == "WEB")
                    {
                        //这是WEB的菜单
                    }
                    else if (_smi.MenuType.Length > 3 && _smi.MenuType.Substring(0, 3) == "SL_")
                    {
                        //这是Silverlight的菜单
                    }
                    else
                    {
                        FrmMenuPage _fmp = new FrmMenuPage(_smi.MenuID, _smi.MenuTitle, _smi.CanUse);
                        this.AddMainMenuPage(_fmp);
                        AddSubMenu(_smi, UserMenuList, _fmp);
                    }
                }
            }
        }
Exemplo n.º 2
0
        private void frmVersionShow_Load(object sender, EventArgs e)
        {
            Assembly asm = Assembly.GetExecutingAssembly();

            Stream pStream = asm.GetManifestResourceStream("SinoSZClientBase.VersionInfo.txt");

            string str = "";

            StreamReader m_streamReader = new StreamReader(pStream, System.Text.Encoding.Unicode);

            //使用StreamReader类来读取文件

            m_streamReader.BaseStream.Seek(0, SeekOrigin.Begin);

            // 从数据流中读取每一行,直到文件的最后一行,并在richTextBox1中显示出内容
            string strLine = m_streamReader.ReadLine();

            while (strLine != null)
            {
                str    += strLine + Environment.NewLine;
                strLine = m_streamReader.ReadLine();
            }
            //关闭此StreamReader对象
            m_streamReader.Close();

            this.textBox1.Text = str;



            //显示各版本号

            StringBuilder _sb = new StringBuilder();

            //提取客户端版本号
            _sb.AppendLine("客户端版本清单:");
            _sb.AppendLine("主程序版本号:" + SessionClass.SysAssemblyName.Version.ToString());
            //客户端插件版本
            AddDLLList(_sb);


            //提取服务端版本号
            _sb.AppendLine("");
            _sb.AppendLine("");
            _sb.AppendLine("服务器端版本清单:");
            using (CommonService.CommonServiceClient _cs = new CommonService.CommonServiceClient())
            {
                string _serverInfo = _cs.GetServerVersionList();
                _sb.Append(_serverInfo);
            }

            this.tb_version.Text = _sb.ToString();
        }
Exemplo n.º 3
0
        public void LoadStartupPage()
        {
            List <firstPageItem> _startupMenus;

            using (CommonService.CommonServiceClient _cs = new CommonService.CommonServiceClient())
            {
                _startupMenus = _cs.GetfirstPage().ToList <firstPageItem>();
            }
            foreach (firstPageItem _menu in _startupMenus)
            {
                if (MenuDict.ContainsKey(_menu.ItemParam))
                {
                    FrmMenuItem _mitem = MenuDict[_menu.ItemParam];
                    if (_mitem.MenuCommand != null)
                    {
                        _mitem.MenuCommand.RunCommand(_mitem.MenuID);
                    }
                }
            }
        }
Exemplo n.º 4
0
        public void Login()
        {
            SinoUser _su;

            try
            {
                string ls_name      = textUser.EditValue.ToString().Trim();
                string ls_pass      = textPass.EditValue.ToString();
                string ls_checktype = ConvertToCheckType(cb_CheckType.EditValue.ToString());

                if (ls_checktype == "windows")
                {
                    string cdn = GetDomainName();

                    if (cdn == "")
                    {
#if DEBUG
                        ls_name = "lijianlin";
#else
                        throw new Exception("未登录到域,不可进行域认证!");
#endif
                    }

                    ls_pass = StrUtils.EncodeByDESC(ls_name, "DOMAINCK");
                }

                // 取数据接口
                using (AuthorizeService.AuthorizeServiceClient _client = new AuthorizeService.AuthorizeServiceClient())
                {
                    _su = _client.LoginSys(ConfigFile.SystemID, ls_name, ls_pass, ls_checktype);
                }

                if (_su != null)
                {
                    SessionClass.CurrentLogonName     = ls_name;
                    SessionClass.CurrentLogonPass     = ls_pass;
                    SessionClass.CurrentSinoUser      = _su;
                    SessionClass.CurrentCheckType     = ls_checktype;
                    SessionClass.CurrentTicket        = new SinoSZTicketInfo(_su.UserID, _su.IPAddress, _su.EncryptedTicket);
                    SinoBestTicketCache.CurrentTicket = _su.EncryptedTicket;

                    using (CommonService.CommonServiceClient _cs = new CommonService.CommonServiceClient())
                    {
                        SessionClass.ServerConfigData = _cs.GetServerConfig();

                        DataRow[] _drs = _UserDs.User.Select(string.Format("Username='******'", ls_name));
                        if (_drs.Length == 0)
                        {
                            DataRow row = _UserDs.User.NewRow();
                            row["Username"] = ls_name;
                            _UserDs.User.Rows.Add(row);
                            _UserDs.WriteXml(_schemaFile, XmlWriteMode.IgnoreSchema);
                        }

                        _su.DwID = _su.CurrentPost.PostDwID;

                        loginTimes = 0;
                        System.ComponentModel.ISynchronizeInvoke synchronizer = this;
                        MethodInvoker invoker = new MethodInvoker(LoginSuccess);
                        synchronizer.Invoke(invoker, null);
                    }
                }
                else
                {
                    XtraMessageBox.Show("用户名/口令不正确或过期!", "系统提示");
                    System.ComponentModel.ISynchronizeInvoke synchronizer = this;
                    MethodInvoker invoker = new MethodInvoker(ResetForm);
                    synchronizer.Invoke(invoker, null);
                }


                loginTimes++;

                if (loginTimes > 2)
                {
                    System.ComponentModel.ISynchronizeInvoke synchronizer = this;
                    MethodInvoker invoker = new MethodInvoker(CancelApplicaton);
                    synchronizer.Invoke(invoker, null);
                }
            }
            catch (Exception e)
            {
                ShowMessageDelegate showProgress = new ShowMessageDelegate(ShowMessage);
                string _msg = string.Format("发生错误:{0}", e.Message);
                this.Invoke(showProgress, new object[] { _msg });
            }
        }