Exemple #1
0
 private void UserListRefresh()
 {
     FileRw.ReadDatFilePassWord(PVar.BZ_ParameterPath + "\\PassWord.dat", PVar.Login);
     for (var i = 0; i <= 20; i++)
     {
         if (PVar.Login.NewUser[i] != "")
         {
             if (UserListBox.Items.Count > 0)
             {
                 for (var j = 0; j <= (UserListBox.Items.Count - 1); j++)
                 {
                     if (j <= (UserListBox.Items.Count - 1))
                     {
                         string ss;
                         string FF;
                         ss = System.Convert.ToString(UserListBox.Items[j]);
                         FF = System.Convert.ToString(Frm_Main.fMain.MainUserName.Items[j]);
                         if (ss == NewUserName.Text)
                         {
                             UserListBox.Items.Remove(PVar.Login.NewUser[(int)j]);
                             Frm_Main.fMain.MainUserName.Items.Remove(PVar.Login.NewUser[(int)j]);
                             Frm_Login.fLogin.MainUserName.Items.Remove(PVar.Login.NewUser[(int)j]);
                         }
                     }
                 }
             }
         }
     }
     NewUserName.Text = "";
     FileRw.ReadDatFilePassWord(PVar.BZ_ParameterPath + "\\PassWord.dat", PVar.Login);
 }
Exemple #2
0
 private void UserListDisplay()
 {
     UserListBox.Items.Clear();
     FileRw.ReadDatFilePassWord(PVar.BZ_ParameterPath + "\\PassWord.dat", PVar.Login);
     for (var i = 0; i <= 20; i++)
     {
         if (PVar.Login.NewUser[i] != "" && PVar.Login.NewUser[i] != null)
         {
             UserListBox.Items.Add(PVar.Login.NewUser[(int)i]);
         }
     }
 }
Exemple #3
0
 private void MainUserNameDisplay()
 {
     MainUserName.Items.Clear();
     FileRw.ReadDatFilePassWord(PVar.BZ_ParameterPath + "PassWord.dat", PVar.Login);
     for (var i = 0; i <= 20; i++)
     {
         if (PVar.Login.NewUser[(int)i] != "" && PVar.Login.NewUser[(int)i] != null)
         {
             MainUserName.Items.Add(PVar.Login.NewUser[(int)i]);
         }
     }
     MainUserName.SelectedIndex = 0;
     MainPassword.Focus();
     //Call Start_NumberKey_Process()
     //MainPassword.SelectionStart = 0     '选取的起始位置设为0,即从头开始进行文本框内容的选取
     //MainPassword.SelectionLength = Len(MainPassword.Text)       '选取内容的长度为文本框已经接受的文本长度
 }
Exemple #4
0
        private void MainUserNameDisplay()
        {
            FileRw.ReadDatFilePassWord(PVar.BZ_ParameterPath + "PassWord.dat", PVar.Login);
            for (var i = 0; i <= 20; i++)
            {
                if (PVar.Login.NewUser[i] != "" && PVar.Login.NewUser[i] != null)
                {
                    MainUserName.Items.Add(PVar.Login.NewUser[(int)i]);

                    if (Frm_Login.fLogin == null || Frm_Login.fLogin.IsDisposed)
                    {
                        Frm_Login.fLogin = new Frm_Login();
                    }
                    Frm_Login.fLogin.MainUserName.Items.Add(PVar.Login.NewUser[(int)i]);
                }
            }
            if (MainUserName.Items.Count > 0)
            {
                MainUserName.SelectedIndex = 0;
            }
        }
Exemple #5
0
 private void UserDelete_Click(object sender, EventArgs e)
 {
     FileRw.ReadDatFilePassWord(PVar.BZ_ParameterPath + "\\PassWord.dat", PVar.Login);
     if (UserListBox.Items.Count > 0)
     {
         for (var i = 0; i <= 20; i++)
         {
             if ((string)UserListBox.SelectedItem == PVar.Login.NewUser[(int)i] && PVar.Login.NewUser[i] != "")
             {
                 UserListBox.Items.Remove(PVar.Login.NewUser[(int)i]);
                 Frm_Main.fMain.MainUserName.Items.Remove(PVar.Login.NewUser[(int)i]);
                 Frm_Login.fLogin.MainUserName.Items.Remove(PVar.Login.NewUser[(int)i]);
                 PVar.Login.NewUser[(int)i]            = "";
                 NewUserName.Text                      = PVar.Login.NewUser[(int)i];
                 PVar.Login.NewPassword[(int)i]        = "";
                 PVar.Login.NewPasswordChecked[(int)i] = "";
                 PVar.Login.NewUserAuthority[(int)i]   = (short)-1;
                 FileRw.WriteDatFilePassWord(PVar.BZ_ParameterPath + "\\PassWord.dat", PVar.Login);
             }
         }
     }
 }
Exemple #6
0
        public void UserLogin()
        {
            int i = 0;

            FileRw.ReadDatFilePassWord(PVar.BZ_ParameterPath + "PassWord.dat", PVar.Login);
            for (i = 0; i <= MainUserName.Items.Count - 1; i++)
            {
                #region IsOpenFrmLogin true
                if (PVar.IsOpenFrmLogin)
                {
                    if (PVar.sOpenTargetForm == "Frm_Engineering" && MainUserName.Text == PVar.Login.NewUser[i] && PVar.Login.NewUserAuthority[i] == 3)
                    {
                        Interaction.MsgBox("该用户无权限,请重新选择用户!", Constants.vbOKOnly, "提示");
                        return;
                    }
                    if ((Frm_Login.fLogin.MainUserName.Text == PVar.Login.NewUser[i] && Frm_Login.fLogin.MainPassword.Text == PVar.Login.NewPassword[i] && Convert.ToString(Frm_Login.fLogin.MainUserName.Items[i]) != "") && (PVar.Login.NewUserAuthority[i] == 1 || PVar.Login.NewUserAuthority[i] == 2 || PVar.Login.NewUserAuthority[i] == 3))
                    {
                        if (PVar.Login.NewGroup[0] == "Post Safe" && PVar.Login.NewUserAuthority[i] == 1)
                        {
                            Temp = true;
                            PVar.isShowAxisPara = false;
                            break;
                        }
                        if (PVar.Login.NewGroup[1] == "Engineering" && PVar.Login.NewUserAuthority[i] == 2)
                        {
                            Temp = true;
                            PVar.isShowAxisPara = true;
                            break;
                        }
                        if (PVar.Login.NewGroup[2] == "FE2" && PVar.Login.NewUserAuthority[i] == 3)
                        {
                            Temp = true;
                            PVar.isShowAxisPara = false;
                            break;
                        }
                    }
                    else
                    {
                        Temp = false;
                    }
                }
                #endregion
                #region isOpenFrmlogion false
                else
                {
                    if (PVar.sOpenTargetForm == "Frm_Engineering" && MainUserName.Text == PVar.Login.NewUser[i] && PVar.Login.NewUserAuthority[i] == 3)
                    {
                        Interaction.MsgBox("该用户无权限,请重新选择用户!", Constants.vbOKOnly, "提示");
                        return;
                    }
                    if ((MainUserName.Text == PVar.Login.NewUser[i] && MainPassword.Text == PVar.Login.NewPassword[i] && Convert.ToString(MainUserName.Items[i]) != "") && (PVar.Login.NewUserAuthority[i] == 0 || PVar.Login.NewUserAuthority[i] == 1 || PVar.Login.NewUserAuthority[i] == 2 || PVar.Login.NewUserAuthority[i] == 3))
                    {
                        if (PVar.Login.NewGroup[0] == "Post Safe" && PVar.Login.NewUserAuthority[i] == 1)
                        {
                            Temp = true;
                            break;
                        }
                        if (PVar.Login.NewGroup[1] == "Engineering" && PVar.Login.NewUserAuthority[i] == 2)
                        {
                            Temp = true;
                            break;
                        }
                        if (PVar.Login.NewGroup[2] == "FE2" && PVar.Login.NewUserAuthority[i] == 3)
                        {
                            Temp = true;
                            break;
                        }
                        else
                        {
                            Temp = true;
                            break;
                        }
                    }
                    else
                    {
                        Temp = false;
                    }
                }
                #endregion
            }
            #region password OK
            if (Temp == true)
            {
                if (PVar.Login.NewUserAuthority[i] == 1) //Post Safe
                {
                    PVar.LoginFrmEngineeringEnable = true;
                    PVar.LoginFrmParEnable         = true;
                    PVar.LoginFrmParCCDEnable      = true;
                    PVar.LoginMachineParEnable     = true;
                    PVar.LoginOutputEnable         = true;
                    PVar.LoginManualEnable         = true;
                }
                if (PVar.Login.NewUserAuthority[i] == 2) //Engineering
                {
                    PVar.LoginFrmEngineeringEnable = true;
                    PVar.LoginFrmParEnable         = true;
                    PVar.LoginFrmParCCDEnable      = true;
                    PVar.LoginOutputEnable         = true;
                    PVar.LoginMachineParEnable     = true;
                    PVar.LoginManualEnable         = true;
                }
                if (PVar.Login.NewUserAuthority[i] == 3) //FE2
                {
                    PVar.LoginFrmEngineeringEnable = false;
                    PVar.LoginFrmParEnable         = false;
                    PVar.LoginOutputEnable         = true;
                }
                FunctionSub.Close_NumberKey_Process();
                //Temp = False
            }
            #endregion
            #region password err
            else
            {
                PVar.LoginFrmEngineeringEnable = false;
                PVar.LoginFrmParEnable         = false;
                PVar.LoginFrmParCCDEnable      = false;
                PVar.LoginOutputEnable         = false;
                PVar.LoginManualEnable         = false;
                PVar.LoginMachineParEnable     = false;
                if (Interaction.MsgBox("密码输入错误,请重新输入!", Constants.vbOKOnly, "提示") == Constants.vbOK)
                {
                    if (PVar.IsOpenFrmLogin)
                    {
                        Frm_Login.fLogin.MainPassword.Text = "";
                        Frm_Login.fLogin.MainPassword.Focus();
                    }
                    else
                    {
                        this.MainPassword.Text = "";
                        this.MainPassword.Focus();
                    }
                    return;
                }
            }
            #endregion
        }