Beispiel #1
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            //对登陆界面的帐号密码进行判断并对XML 进行重新配置
            if (CheckData(this.txtUserName.Text.Trim(), this.txtPassword.Text.Trim()))
            {
                try
                {
                    CallRemotingService.SelectServerSite(site);
                    DataSet   ds        = new DataSet();
                    DataTable dataTable = CreateUserTable();//创建一张自定义结构的表
                    Dictionary <string, string> rowData = new Dictionary <string, string>()
                    {
                        { RBAC_USER_FIELDS.FIELD_USERNAME, txtUserName.Text.Trim() }
                    };
                    FanHai.Hemera.Utils.Common.Utils.AddRowDataToDataTable(ref dataTable, rowData); //把rowData中的数据添加在表dataTable中
                    ds.Tables.Add(dataTable);                                                       //把表dataTable添加到表集ds中
                    DataSet dataUser = new DataSet();

                    IServerObjFactory isof       = CallRemotingService.GetRemoteObject();//创建工厂接口对象
                    IUserEngine       userEngine = isof.CreateIUserEngine();

                    dataUser = userEngine.CheckUser(ds); //通过传入的帐号查询返回该帐号对应的信息

                    if (CheckUser(dataUser))             //数据库信息和用户信息进行对比返回bool类型
                    {
                        UpdateLanguageInfo();
                        UpdateServerSitList();
                        //对登录用户的信息进行登记
                        UpdateLoginUserInfo();

                        DialogResult = DialogResult.OK;
                        this.Close();
                        StatusBarService.SetCaretPosition(30, 70, 0);
                    }
                }
                catch (Exception ex)
                {
                    MessageService.ShowMessage(ex.Message);
                }
                finally
                {
                    CallRemotingService.UnregisterChannel();
                }
            }
            Xmlproper();
        }