Ejemplo n.º 1
0
        /// <summary>
        /// 从WCF获取所有菜单
        /// </summary>
        private void PrepareMenus()
        {
            var factory = new Common.ClientFactory <IMenu>();

            try
            {
                var client = factory.CreateClient();
                Menus = client.GetAllMenu();
            }
            catch (Exception ex)
            {
                Utils.OnException(ex);
            }
            factory.Dispose();
        }
Ejemplo n.º 2
0
        private void LoginBtn_Click(object sender, EventArgs e)
        {
            var       factory = new Common.ClientFactory <ILogin>();
            UserModel CurUser = null;

            try
            {
                var client = factory.CreateClient();
                CurUser = client.Login(UserNameTB.Text.Trim(), PassWordTB.Text.Trim());
            }
            catch (Exception ex)
            {
                Utils.OnException(ex);
            }
            factory.Dispose();
            if (CurUser == null)
            {
                Utils.Alert("用户名或者密码错误;请重新登录!");
                return;
            }
            CacheStrategy.CurUser = CurUser;
            DialogResult          = System.Windows.Forms.DialogResult.OK;
        }