Esempio n. 1
0
        /// <summary>
        /// loginBtnClick
        /// </summary>
        /// <param name="viewParam"></param>
        private void loginBtnClick(OpenNewViewParam viewParam)
        {
            if (viewParam == null)
            {
                return;
            }
            //
            try
            {
                //var v=(System.Security.SecureString)(viewParam.NewViewInitValue);
                //IntPtr p = System.Runtime.InteropServices.Marshal.SecureStringToBSTR(v);

                //// 使用.NET内部算法把IntPtr指向处的字符集合转换成字符串
                //string password = System.Runtime.InteropServices.Marshal.PtrToStringBSTR(p);

                string password = "";
                System.Windows.Controls.PasswordBox pwdBox = viewParam.ParamValueFromCurrentView as System.Windows.Controls.PasswordBox;
                if (pwdBox != null)
                {
                    password = pwdBox.Password;
                }
                //
                if ((this.userCode ?? "").Trim().Length == 0)
                {
                    MessageBox.Show("用户名不能空白!");
                    //ModernDialog.ShowMessage("用户名不能空白!", "notice", System.Windows.MessageBoxButton.OK, viewParam.CurrentView);
                    return;
                }
                //
                if ((this.LoginLocationCode ?? "").Trim().Length == 0 || (this.LoginLocationType ?? "").Trim().Length == 0)
                {
                    MessageBox.Show("请选择登录店铺位置!");
                    //ModernDialog.ShowMessage("请选择登录店铺位置!", "notice", System.Windows.MessageBoxButton.OK, viewParam.CurrentView);
                    return;
                }
                //check user
                UserObject userobj = RemoteApi.UserLogin(this.userCode, password);
                if (userobj == null || !string.Equals(userobj.UserCode, this.userCode, StringComparison.OrdinalIgnoreCase))//说明不成功
                {
                    MessageBox.Show("登录失败,请检查用户名和密码是否正确!");
                    //ModernDialog.ShowMessage("登录失败,请检查用户名和密码是否正确!", "notice", System.Windows.MessageBoxButton.OK, viewParam.CurrentView);
                    return;
                }
                //说明成功,记录数据
                OpenNewView newView = new OpenNewView(viewParam.NewViewType);
                newView.Show();
            }
            catch (Exception ex)
            {
                CoreLibrary.NlogHelper.LogToFile(ex.ToString());
                return;
            }
            //
            if (viewParam.CurrentView != null)
            {
                //viewParam.CurrentView.Close();
            }
        }
Esempio n. 2
0
 private void iniData()
 {
     LoctionLst = RemoteApi.GetAccessShop(Global.CurrentLoginIP, LoginType, Global.CurrentLangCode);
 }