Exemple #1
0
        public void StartSilverlight(string strmoduleid, string stropttype, string strmessageid, string strconfig, string strUid, string strUserName)
        {
            try
            {
                ibLogin.Visibility    = System.Windows.Visibility.Collapsed;
                spAddSpace.Visibility = System.Windows.Visibility.Visible;
                btnAddSpace.IsEnabled = true;
                if (string.IsNullOrWhiteSpace(strUid) || string.IsNullOrWhiteSpace(stropttype) || string.IsNullOrWhiteSpace(strUserName))
                {
                    txtUserMsg.Text = "关键信息未获取到,操作被阻止!";
                    return;
                }


                //txtUserMsg.Text += "[" + strUid + ";" + stropttype + ";" + strUserName + "]";

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

                Application.Current.Resources.Add("CurrentSysUserID", strUid);

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

                //标明第一次打开
                if (Application.Current.Resources["isFirstOpen"] != null)
                {
                    Application.Current.Resources.Remove("isFirstOpen");
                }
                Application.Current.Resources.Add("isFirstOpen", true);

                List <string> MvcSourcelist = new List <string>();
                MvcSourcelist.Add(strmoduleid);
                MvcSourcelist.Add(stropttype);
                MvcSourcelist.Add(strmessageid);
                MvcSourcelist.Add(strconfig);
                AppContext.SystemMessage("StartSilverlight-------------"
                                         + "strModuleid:" + strmoduleid + System.Environment.NewLine
                                         + "strOptType:" + stropttype + System.Environment.NewLine
                                         + "strMessageid:" + strmessageid + System.Environment.NewLine
                                         + "strConfig:" + strconfig + System.Environment.NewLine
                                         + "strUid:" + strUid + System.Environment.NewLine
                                         + "strUserName:"******"MvcOpenRecordSource"] != null)
                {
                    Application.Current.Resources.Remove("MvcOpenRecordSource");
                }

                Application.Current.Resources.Add("MvcOpenRecordSource", MvcSourcelist);

                //SMT.SAAS.Main.CurrentContext.AppContext.ShowSystemMessageText();
                if (IosManager.CheckeSpace())
                {
                    CheckLoginUser();
                }
            }
            catch (Exception ex)
            {
                AppContext.logAndShow("StartSilverlight 异常:" + ex.ToString());
            }
        }
Exemple #2
0
        /// <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 });
            }
        }
Exemple #3
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;
            }
        }