예제 #1
0
파일: Login.xaml.cs 프로젝트: jjg0519/OA
        /// <summary>
        ///  检查登录
        /// </summary>
        private void CheckLoginUser()
        {
            try
            {
                if (!IosManager.CheckeSpace())
                {
                    try
                    {
                        if (!IosManager.AddSpace())
                        {
                            MessageBox.Show("请增加独立存储空间,否则系统无法运行");
                            return;
                        }
                    }
                    catch (Exception ex)
                    {
                        throw new Exception("增加独立存储空间出错,原因如下:" + ex.ToString());
                    }
                }

                if (!IosManager.ExistsFile(strApplicationPath))
                {
                    IosManager.CreatePath(strApplicationPath);
                    isFirstUser     = true;
                    txtUserMsg.Text = "初次访问协同办公系统,请点击上方按钮--增加系统存储空间,以确保系统能正常运行";
                }

                btnAddSpace.Visibility = System.Windows.Visibility.Collapsed;

                string strUid = string.Empty, strUserName = string.Empty;

                if (Application.Current.Resources["CurrentSysUserID"] != null)
                {
                    strUid = Application.Current.Resources["CurrentSysUserID"].ToString();
                }

                if (Application.Current.Resources["username"] != null)
                {
                    strUserName = Application.Current.Resources["username"].ToString();
                }

                if (string.IsNullOrWhiteSpace(strUid) || string.IsNullOrWhiteSpace(strUserName))
                {
                    txtUserMsg.Text = "警告!用户信息异常,不能执行当前的操作请求。";
                    if (string.IsNullOrWhiteSpace(strUid))
                    {
                        AppContext.SystemMessage("传入的用户CurrentSysUserID为空");
                        AppContext.ShowSystemMessageText();
                    }
                    if (string.IsNullOrWhiteSpace(strUserName))
                    {
                        AppContext.SystemMessage("传入的用户username为空");
                        AppContext.ShowSystemMessageText();
                    }
                    return;
                }

                if (!App.AppSettings.Contains(USERKEY))
                {
                    App.AppSettings.Add(USERKEY, strUserName);
                    isFirstUser = true;
                }
                else
                {
                    App.AppSettings[USERKEY] = strUserName;
                }

                sysloginClinet.GetUserInfobyIDAsync(strUid);
                //txtUserMsg.Text = "系统正在加载,请稍等......";
            }
            catch (Exception ex)
            {
                btnAddSpace.Visibility = System.Windows.Visibility.Visible;
                string msg = "系统错误,请联系管理员:" + ex.ToString();
                txtUserMsg.Text = msg;
                SMT.SAAS.Main.CurrentContext.AppContext.SystemMessage(msg);
                SMT.SAAS.Main.CurrentContext.AppContext.ShowSystemMessageText();
                HtmlPage.Window.Invoke("loadCompletedSL", new string[] { "false", msg });
            }
        }
예제 #2
0
        /// <summary>
        /// 系统登录
        /// </summary>
        public void userloading()
        {
            btnLogin.IsEnabled = false;
            try
            {
                if (!IosManager.CheckeSpace())
                {
                    try
                    {
                        if (!IosManager.AddSpace())
                        {
                            MessageBox.Show("请增加独立存储空间,否则系统无法运行");
                            btnLogin.IsEnabled = true;
                            return;
                        }
                    }
                    catch (Exception ex)
                    {
                        throw new Exception("增加独立存储空间出错,请联系管理员" + ex.ToString());
                    }
                }

                if (!IosManager.ExistsFile(ApplicationPath))
                {
                    IosManager.CreatePath(ApplicationPath);
                }
                if (!IsAllFilled())
                {
                    btnLogin.IsEnabled = true;
                    return;
                }
                if (!App.AppSettings.Contains(USERKEY))
                {
                    App.AppSettings.Add(USERKEY, txbUserName.Text);
                }
                else
                {
                    App.AppSettings[USERKEY] = txbUserName.Text;
                }

                string UserPwdMD5 = string.Empty;
                if (Application.Current.Resources["userpwd"] != null)
                {
                    UserPwdMD5 = Application.Current.Resources["userpwd"].ToString();
                }
                else
                {
                    UserPwdMD5 = MD5.GetMd5String(this.txbUserPassword.Password);
                }
                sysloginClinet.SystemLoginAsync(this.txbUserName.Text, UserPwdMD5);

                txtLoadingMessage.Text = "开始登录系统,请稍等......";
                DateTime dtstart = DateTime.Now;
                SMT.SAAS.Main.CurrentContext.AppContext.SystemMessage("开始登录系统,请稍等......");

                //sysloginClinet.SystemLoginAsync(this.txbUserName.Text, Utility.Encrypt(this.txbUserPassword.Password));
            }
            catch (Exception ex)
            {
                SMT.SAAS.Main.CurrentContext.AppContext.SystemMessage("系统错误,请联系管理员:" + ex.ToString());
                SMT.SAAS.Main.CurrentContext.AppContext.ShowSystemMessageText();
                btnLogin.IsEnabled = true;
            }
        }