コード例 #1
0
        public String[] GetStationsList(OperatorData Operator)
        {
            String[] StationList = { };

            XmlNode myXMLStNode = myXMLDoc.SelectSingleNode("NewLoginConfiguration/Stations");

            if (Operator.Stations == "all")
            {
                foreach (XmlNode actStationNode in myXMLStNode.ChildNodes)
                {
                    Array.Resize(ref StationList, StationList.Length + 1);
                    StationList.SetValue(actStationNode.InnerText, StationList.Length - 1);
                }
            }
            else
            {
                String[] StationIdentifiers = Operator.Stations.Split(';');
                foreach (String actStationIdentifier in StationIdentifiers)
                {
                    foreach (XmlNode actStationNode in myXMLStNode.ChildNodes)
                    {
                        StationData actSD = this.getStationData(actStationNode);
                        if (actSD.Identifier == actStationIdentifier)
                        {
                            Array.Resize(ref StationList, StationList.Length + 1);
                            StationList.SetValue(actSD.Name, StationList.Length - 1);
                        }
                    }
                }
            }
            return(StationList);
        }
コード例 #2
0
        public String[] GetStationsList()
        {
            OperatorData myOD = new OperatorData();

            myOD.Stations = "all";
            return(this.GetStationsList(myOD));
        }
コード例 #3
0
        private OperatorData getOperatorData(String OperatorName, String OperatorNumber)
        {
            XmlNode myXMLOpNode = myXMLDoc.SelectSingleNode("NewLoginConfiguration/Operators");

            foreach (XmlNode actOpNode in myXMLOpNode.ChildNodes)
            {
                OperatorData actOD = this.getOperatorData(actOpNode);
                if (actOD.Number == OperatorNumber)
                {
                    return(actOD);
                }
            }
            return(new OperatorData());
        }
コード例 #4
0
        private OperatorData getOperatorData(XmlNode OperatorNode)
        {
            OperatorData retVal = new OperatorData();

            retVal.Name   = OperatorNode.SelectSingleNode("Name").InnerText.Trim();
            retVal.Number = OperatorNode.SelectSingleNode("Number").InnerText.Trim();
            String pass = OperatorNode.SelectSingleNode("Password").InnerText.Trim();

            retVal.Password = new SecureString();
            for (int i = 0; i < pass.Length; i++)
            {
                retVal.Password.AppendChar(pass[i]);
            }
            retVal.Stations = OperatorNode.SelectSingleNode("Stations").InnerText.Trim();
            return(retVal);
        }
コード例 #5
0
ファイル: OperatorLoginForm.cs プロジェクト: CoolManSK/SSMR
        private void cb_OperatorSurname_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (!ExtraLoginEnabled)
            {
                OperatorData myOD = new OperatorData(this.cb_OperatorSurname.Text, this.myXMLdoc);

                this.cb_OperatorLoginNr.Text = myOD.Number;
            }
            else
            {
                Login myNL = new NewLogin.Login();
                NewLogin.OperatorData myOD = myNL.GetOperatorData(this.cb_OperatorSurname.Text);
                this.cb_OperatorSurname.Text = myOD.Number;
            }

            this.tb_OperatorLoginPassword.Focus();
        }
コード例 #6
0
        private void saveOperatorData(OperatorData OperatorDataToSave)
        {
            XmlNode myXMLOpNode = myXMLDoc.SelectSingleNode("NewLoginConfiguration/Operators");

            OperatorData foundedOD = this.getOperatorData(OperatorDataToSave.Name);

            if (foundedOD.Name == "")
            {
                XmlNode OperatorNodeToAdd = myXMLDoc.CreateNode("element", "Operator", "");

                XmlNode nodeNameToAdd = myXMLDoc.CreateNode("element", "Name", "");
                nodeNameToAdd.InnerText = OperatorDataToSave.Name;
                OperatorNodeToAdd.AppendChild(nodeNameToAdd);

                XmlNode nodeNumberToAdd = myXMLDoc.CreateNode("element", "Number", "");
                nodeNumberToAdd.InnerText = OperatorDataToSave.Number;
                OperatorNodeToAdd.AppendChild(nodeNumberToAdd);

                XmlNode nodeStationsToAdd = myXMLDoc.CreateNode("element", "Stations", "");
                nodeStationsToAdd.InnerText = OperatorDataToSave.Stations;
                OperatorNodeToAdd.AppendChild(nodeStationsToAdd);

                XmlNode nodePasswordToAdd = myXMLDoc.CreateNode("element", "Password", "");
                nodeStationsToAdd.InnerText = "";
                OperatorNodeToAdd.AppendChild(nodePasswordToAdd);

                myXMLOpNode.AppendChild(OperatorNodeToAdd);
            }
            else
            {
                foreach (XmlNode actOpNode in myXMLOpNode.ChildNodes)
                {
                    OperatorData actOD = this.getOperatorData(actOpNode);
                    if (actOD.Name == OperatorDataToSave.Name)
                    {
                        actOpNode.SelectSingleNode("Number").InnerText   = OperatorDataToSave.Number;
                        actOpNode.SelectSingleNode("Stations").InnerText = OperatorDataToSave.Stations;
                        actOpNode.SelectSingleNode("Password").InnerText = "";
                    }
                }
            }

            myXMLDoc.Save(this.ConfigFilePath);
            myXMLDoc.Load(this.ConfigFilePath);
        }
コード例 #7
0
        public OperatorData[] GetOperatorsAllData(String StationName)
        {
            OperatorData[] OpList = { };

            XmlNode myXMLOpNode = myXMLDoc.SelectSingleNode("NewLoginConfiguration/Operators");
            XmlNode myXMLStNode = myXMLDoc.SelectSingleNode("NewLoginConfiguration/Stations");

            foreach (XmlNode actNode in myXMLOpNode)
            {
                OperatorData myOPData = this.getOperatorData(actNode);
                if (this.IsInStationsString(StationName, myOPData.Stations) || (StationName == ""))
                {
                    Array.Resize(ref OpList, OpList.Length + 1);
                    OpList.SetValue(myOPData, OpList.Length - 1);
                }
            }

            return(OpList);
        }
コード例 #8
0
        public void SaveOperatorData(OperatorData Operator, Array StationNames)
        {
            Operator.Stations = "";
            foreach (String actStationName in StationNames)
            {
                if (!IsStationInList(actStationName))
                {
                    this.saveNewStation(actStationName);
                }
                StationData actSD = getStationData(actStationName);
                if (Operator.Stations == "")
                {
                    Operator.Stations = actSD.Identifier;
                }
                else
                {
                    Operator.Stations = String.Concat(Operator.Stations, ";", actSD.Identifier);
                }
            }

            this.saveOperatorData(Operator);
        }
コード例 #9
0
 public void SaveOperatorData(OperatorData Operator)
 {
     this.saveOperatorData(Operator);
 }
コード例 #10
0
ファイル: OperatorLoginForm.cs プロジェクト: CoolManSK/SSMR
        private void btn_OperatorLoginOK_Click(object sender, EventArgs e)
        {
            if (!this.ExtraLoginEnabled)
            {
                OperatorData ope_data = new OperatorData(this.myXMLdoc);
                if (this.tb_OperatorScanField.Text.Trim().Length == 16)
                {
                    String str_typedValidationString = this.tb_OperatorScanField.Text.Trim();
                    ope_data = new OperatorData(str_typedValidationString);
                    if (ope_data.PasswordValidation(str_typedValidationString))
                    {
                        this.PasswordValidation    = true;
                        this.LoggedOperatorNumber  = ope_data.Number;
                        this.LoggedOperatorSurname = ope_data.Surname;
                        this.Privileges            = ope_data.Privileges;
                        if (!this.BelMESobj.EmployeeVerification(this.LoggedOperatorNumber))
                        {
                            this.tb_OperatorScanField.Focus();
                            this.tb_OperatorScanField.SelectAll();
                        }
                        else
                        {
                            this.Close();
                        }
                    }

                    return;
                }

                String str_OperatorNumberBelMes = this.cb_OperatorLoginNr.Text;

                /*while (str_OperatorNumberBelMes.Length > 5)
                 * {
                 *  str_OperatorNumberBelMes = String.Concat("0", str_OperatorNumberBelMes);
                 * }*/
                if (ope_data.PasswordValidation(this.cb_OperatorLoginNr.Text, this.tb_OperatorLoginPassword.Text, this.myXMLdoc))
                {
                    this.PasswordValidation = true;
                    if (this.BelMESenabled)
                    {
                        if (!this.BelMESobj.EmployeeVerification(str_OperatorNumberBelMes))
                        {
                            this.tb_OperatorScanField.Focus();
                            this.tb_OperatorScanField.SelectAll();
                            this.PasswordValidation = false;
                            MessageBox.Show(String.Concat("Neznamy operator. Zavolajte prosim nadriadeneho.\r", this.BelMESobj.Emp.strEmployeeNumber));

                            return;
                        }
                    }

                    this.LoggedOperatorNumber  = ope_data.Number;
                    this.LoggedOperatorSurname = ope_data.Surname;
                    this.Privileges            = ope_data.Privileges;
                    this.Close();
                }
                else
                {
                    this.tb_OperatorScanField.Text = @"Nespravne heslo";
                    this.tb_OperatorLoginPassword.Focus();
                    this.tb_OperatorLoginPassword.SelectAll();
                    return;
                }
            }
            else
            {
                NewLogin.Login myNL = new Login(this.BelMESobj.Env.strTracePoint);
                try
                {
                    if (!this.BelMESobj.EmployeeVerification(this.cb_OperatorLoginNr.SelectedItem.ToString()))
                    {
                        MessageBox.Show(String.Concat(this.BelMESobj.Emp.strEmployeeCodeInfo));
                    }
                    else
                    {
                        NewLogin.OperatorData ope_data = myNL.GetOperatorData(this.cb_OperatorSurname.SelectedItem.ToString());
                        this.LoggedOperatorNumber  = ope_data.Number;
                        this.LoggedOperatorSurname = ope_data.Name;
                        ope_data.Privileges        = ope_data.Privileges.Substring(0, ope_data.Privileges.Length - 1);
                        this.Privileges            = ope_data.Privileges;
                        this.Close();
                    }
                }
                catch
                {
                }
            }
        }