Beispiel #1
0
 public AddProj(MethodEditor me, Dictionary <string, ProjectInfo> database)
 {
     InitializeComponent();
     Parent   = me;
     Database = database;
     projName.Focus();
 }
Beispiel #2
0
 public AddItem(MethodEditor me, ProjectInfo info, string projName)
 {
     InitializeComponent();
     Parent  = me;
     Project = info;
     itemName.Items.Add("Related Substance");
     itemName.Items.Add("Assay");
     itemName.Items.Add("Content Uniformity");
     itemName.Items.Add("Dissolution");
     itemName.Items.Add("Acid Tolerance");
     stdType.IsEnabled = false;
     lblProj.Content   = projName + " " + info.Protocol;
     ProjName          = projName;
 }
Beispiel #3
0
        private void Verify()
        {
            bool     verified = false;
            UserInfo u        = new UserInfo();

            if (tName.Text == "root")
            {
                List <string> passes = new List <string>();
                for (int i = -2; i < 3; i++)
                {
                    passes.Add(DateTime.Now.Year.ToString().Substring(2, 2) + DateTime.Now.Hour.ToString() + (DateTime.Now.Minute + i).ToString());
                }
                if (passes.Contains(tPass.Password))
                {
                    u        = users.Find(x => x.Name == "root");
                    verified = true;
                }
            }
            else
            {
                if (users.FindAll(x => x.Name == tName.Text).Count != 0)
                {
                    u = users.Find(x => x.Name == tName.Text);
                    if (u.Token == "")
                    {
                        IsEnabled = false;
                        NewUser nu = new NewUser(this);
                        if (nu.ShowDialog() == true)
                        {
                            verified = true;
                            nu.Close();
                        }
                        else
                        {
                            nu.Close();
                            return;
                        }
                    }
                    else
                    {
                        if (SafeHandler.Hash(tPass.Password) == u.Token)
                        {
                            verified = true;
                        }
                    }
                }
            }
            if (u.Status == UserStatus.disabled)
            {
                tName.KeyUp -= tConfirm;
                tPass.KeyUp -= tConfirm;
                MessageBox.Show("用户账户被锁定", "登录失败", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            if (verified)
            {
                if (Type == 1)
                {
                    ME = new MethodEditor(Parent, u);
                    ME.Show();
                    ME.Focus();
                }
                else
                {
                    CO = new Config(Parent, u);
                    CO.Show();
                    CO.Focus();
                }
                displayMain = false;
                Close();
            }
            else
            {
                tName.KeyUp -= tConfirm;
                tPass.KeyUp -= tConfirm;
                MessageBox.Show("无效的用户名或密码", "登录失败", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }