Ejemplo n.º 1
0
        private void TmR_Backup_Tick(object sender, EventArgs e)
        {
            TmR_Backup.Enabled = false;

            Cls_Procedure.BackupData();

            TmR_Backup.Enabled = true;
        }
Ejemplo n.º 2
0
        private void CmD_OK_Click(object sender, EventArgs e)
        {
            OracleConnection oConnection    = new OracleConnection();
            OracleCommand    oCommandUpdate = new OracleCommand();
            OracleDataReader drReader;

            int nResult = 0;

            string sPassword = Cls_Procedure.XorEncrypt(TxT_Password_1.Text.Trim(), Bauwagen.Properties.Settings.Default.Key);

            if (TxT_Password_1.Text.Trim() == TxT_Password_2.Text.Trim())
            {
                using (oConnection)
                {
                    try
                    {
                        oConnection.ConnectionString = Frm_Haupt.sDSN;
                        oConnection.Open();

                        oCommandUpdate.Connection  = oConnection;
                        oCommandUpdate.CommandText = Cls_Query.UpdateBadLogonAnwender(LbL_Username.Text.Trim(), false, sPassword);
                        nResult = oCommandUpdate.ExecuteNonQuery();

                        oConnection.Close();

                        this.DialogResult = DialogResult.OK;
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message, "CmD_OK_Click");
                    }
                }
            }
            else
            {
                MessageBox.Show("Passwörter stimmen nicht überein!", "Fehler");
                this.DialogResult = DialogResult.Cancel;
            }
        }
Ejemplo n.º 3
0
        private void CheckPassword()
        {
            #region Prüfen der Berechtigung zum öffnen des Adminportals
            if (LbL_Status.Text == "admin")
            {
                string sAdminPassword1 = Cls_Procedure.XorEncrypt("뇛뇙뇟뇛뇚뇝뇚뇛뇛뇝", Bauwagen.Properties.Settings.Default.Key);
                string sAdminPassword2 = Cls_Procedure.XorEncrypt("뇛뇛뇛뇙뇓뇓뇟뇝뇙뇚", Bauwagen.Properties.Settings.Default.Key);

                if (sAdminPassword1 == TxT_Password.Text | sAdminPassword2 == TxT_Password.Text)
                {
                    this.DialogResult = DialogResult.OK;
                }
                else
                {
                    MessageBox.Show("Password falsch!", "Fehler", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    this.DialogResult = DialogResult.Abort;
                }

                if (System.Environment.MachineName == "EMARW001" |
                    System.Environment.MachineName == "EMARL001" |
                    System.Environment.MachineName == "EMARL002")
                {
                    this.DialogResult = DialogResult.OK;
                }
            }
            else if (LbL_Status.Text == "user")
            {
                OracleConnection oConnection    = new OracleConnection();
                OracleCommand    oCommandSelect = new OracleCommand();
                OracleCommand    oCommandUpdate = new OracleCommand();
                OracleDataReader drReader;

                int nResult = 0;

                string sPassword = "";

                bool bChangePW = false;

                using (oConnection)
                {
                    oConnection.ConnectionString = Frm_Haupt.sDSN;
                    oConnection.Open();

                    oCommandSelect.Connection = oConnection;
                    oCommandUpdate.Connection = oConnection;

                    oCommandSelect.CommandText = Cls_Query.GetAnwenderDaten(LbL_Username.Text.Trim(), false, "");
                    drReader = oCommandSelect.ExecuteReader();

                    while (drReader.Read())
                    {
                        sPassword = Cls_Procedure.XorEncrypt(drReader.GetValue(3).ToString().Trim(), Bauwagen.Properties.Settings.Default.Key);

                        if (drReader.GetValue(10).ToString().Trim() == "1")
                        {
                            bChangePW = true;
                        }
                        else
                        {
                            bChangePW = false;
                        }
                    }
                    drReader.Close();

                    if (sPassword == TxT_Password.Text && bChangePW == false)
                    {
                        oCommandUpdate.CommandText = Cls_Query.UpdateBadLogonAnwender(LbL_Username.Text.Trim(), false, "");
                        nResult           = oCommandUpdate.ExecuteNonQuery();
                        this.DialogResult = DialogResult.OK;
                    }
                    else if (sPassword == TxT_Password.Text && bChangePW == true)
                    {
                        MessageBox.Show("Passwort muss geändert werden", "Info");
                        Frm_ChangePassword frm_ChangePassword = new Frm_ChangePassword();
                        frm_ChangePassword.LbL_Username.Text = LbL_Username.Text.Trim();

                        if (frm_ChangePassword.ShowDialog() == DialogResult.OK)
                        {
                            oCommandUpdate.CommandText = Cls_Query.UpdateBadLogonAnwender(LbL_Username.Text.Trim(), false, "");
                            nResult           = oCommandUpdate.ExecuteNonQuery();
                            this.DialogResult = DialogResult.OK;
                        }
                        else
                        {
                            oCommandUpdate.CommandText = Cls_Query.UpdateBadLogonAnwender(LbL_Username.Text.Trim(), true, "");
                            nResult           = oCommandUpdate.ExecuteNonQuery();
                            this.DialogResult = DialogResult.Abort;
                        }
                    }
                    else
                    {
                        MessageBox.Show("Password falsch!", "Fehler", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        oCommandUpdate.CommandText = Cls_Query.UpdateBadLogonAnwender(LbL_Username.Text.Trim(), true, "");
                        nResult           = oCommandUpdate.ExecuteNonQuery();
                        this.DialogResult = DialogResult.Abort;
                    }

                    oConnection.Close();
                }
            }
            #endregion
        }
Ejemplo n.º 4
0
        private void TxT_Unverschlüsselt_TextChanged(object sender, EventArgs e)
        {
            string sAdminPassword = Cls_Procedure.XorEncrypt(TxT_Unverschlüsselt.Text.Trim(), Bauwagen.Properties.Settings.Default.Key);

            TxT_Verschlüsselt.Text = sAdminPassword;
        }
Ejemplo n.º 5
0
        private void LoadUser()
        {
            OracleConnection oConnection = new OracleConnection();
            OracleCommand    oCommand    = new OracleCommand();
            OracleDataReader drReader;

            try
            {
                using (oConnection)
                {
                    oConnection.ConnectionString = Frm_Haupt.sDSN;
                    oConnection.Open();

                    oCommand.Connection  = oConnection;
                    oCommand.CommandText = Cls_Query.GetAnwenderDaten(CmB_User.Text.Trim(), true, "");
                    drReader             = oCommand.ExecuteReader();

                    if (drReader.HasRows)
                    {
                        while (drReader.Read())
                        {
                            string sPassword = Cls_Procedure.XorEncrypt(drReader.GetValue(3).ToString().Trim(), Bauwagen.Properties.Settings.Default.Key);

                            TxT_Vorname.Text = drReader.GetValue(1).ToString().Trim();

                            TxT_Password.Text = sPassword;

                            TxT_Budget.Text = drReader.GetValue(8).ToString().Trim();
                            TxT_Kredit.Text = drReader.GetValue(9).ToString().Trim();

                            TxT_TokenID.Text = drReader.GetValue(11).ToString().Trim();

                            NuD_Layer.Value = Convert.ToDecimal(drReader.GetValue(12));

                            if (drReader.GetValue(10).ToString().Trim() == "1")
                            {
                                ChK_ChangePW.Checked = true;
                            }
                            else
                            {
                                ChK_ChangePW.Checked = false;
                            }
                            if (Convert.ToInt32(drReader.GetValue(6)) <= 5)
                            {
                                ChK_Aktiv.Checked = true;
                            }
                            else
                            {
                                ChK_Aktiv.Checked = false;
                            }
                        }
                    }
                    drReader.Close();

                    oConnection.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "LoadUser");
            }
        }
Ejemplo n.º 6
0
        private void CmD_Create_Click(object sender, EventArgs e)
        {
            OracleConnection oConnection    = new OracleConnection();
            OracleCommand    oCommandInsert = new OracleCommand();
            OracleCommand    oCommandSelect = new OracleCommand();
            OracleDataReader drReader;

            int nResult = 0;

            bool bValid  = false;
            bool bUpdate = false;

            string sPassword = Cls_Procedure.XorEncrypt(TxT_Password.Text.Trim(), Bauwagen.Properties.Settings.Default.Key);
            string sChangePW = "";
            string sAktiv    = "";

            if (ChK_ChangePW.Checked)
            {
                sChangePW = "1";
            }
            else
            {
                sChangePW = "0";
            }
            if (ChK_Aktiv.Checked)
            {
                sAktiv = "1";
            }
            else
            {
                sAktiv = "0";
            }

            if (NuD_Layer.Value > 0 && NuD_Layer.Value <= 2)
            {
                bValid = true;
            }
            else
            {
                bValid = false;
            }

            if (bValid == true)
            {
                using (oConnection)
                {
                    try
                    {
                        oConnection.ConnectionString = Frm_Haupt.sDSN;
                        oConnection.Open();

                        oCommandInsert.Connection = oConnection;
                        oCommandSelect.Connection = oConnection;

                        oCommandSelect.CommandText = Cls_Query.GetAnwenderDaten(TxT_Vorname.Text.Trim(), true, "");
                        drReader = oCommandSelect.ExecuteReader();

                        while (drReader.Read())
                        {
                            bUpdate = true;
                        }
                        drReader.Close();

                        oCommandInsert.CommandText = Cls_Query.InsertUser(bUpdate, TxT_Vorname.Text.Trim(), sPassword,
                                                                          TxT_Budget.Text.Trim(), TxT_Kredit.Text.Trim(), TxT_TokenID.Text.Trim(), sChangePW, sAktiv, Convert.ToInt32(NuD_Layer.Value));
                        nResult = oCommandInsert.ExecuteNonQuery();

                        MessageBox.Show("Erfolgreich gespeichert", "Info");
                        oConnection.Close();
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message, "CmD_Create_Click");
                    }
                }
            }
            else
            {
                MessageBox.Show("Eingaben üngültig bitte das Layer prüfen", "Fehler", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 7
0
        private void Frm_Haupt_Load(object sender, EventArgs e)
        {
            OracleConnection oConnection = new OracleConnection();
            OracleCommand    oCommand    = new OracleCommand();
            OracleDataReader dataReader;

            bool bRun = true;

            int nCounter = 0;

            string sSammeluser = "";

            XmlDocument doc = new XmlDocument();

            doc.Load("Settings.xml");

            XmlNode nodeSchema = doc.SelectSingleNode("/Bauwagen/Database/Schema");

            sSchema = nodeSchema.FirstChild.Value;
            XmlNode nodeSchemaPassword = doc.SelectSingleNode("/Bauwagen/Database/SchemaPassword");

            sSchemaPassword = nodeSchemaPassword.FirstChild.Value;
            XmlNode nodeDatabase = doc.SelectSingleNode("/Bauwagen/Database/Adress");

            sDatabase = nodeDatabase.FirstChild.Value;
            XmlNode nodeListener = doc.SelectSingleNode("/Bauwagen/Database/ListenerPort");

            sListenerPort = nodeListener.FirstChild.Value;
            XmlNode nodeBackupPfad = doc.SelectSingleNode("/Bauwagen/Database/BackupPfad");

            sBackupPfad = nodeBackupPfad.FirstChild.Value;
            XmlNode nodeRestorePfad = doc.SelectSingleNode("/Bauwagen/Database/RestorePfad");

            sRestorePfad = nodeRestorePfad.FirstChild.Value;
            XmlNode nodeHostAutomat  = doc.SelectSingleNode("/Bauwagen/Software/HostName_Automat");
            XmlNode nodeHostCocktail = doc.SelectSingleNode("/Bauwagen/Software/HostName_CocktailMixer");
            XmlNode nodeSammelUser   = doc.SelectSingleNode("/Bauwagen/Software/Gemeinschaftsuser");

            sSammeluser = nodeSammelUser.FirstChild.Value;

            CmD_Automatenbuchung.Visible = false;
            CmD_Cocktailmixer.Visible    = false;

            if (nodeHostAutomat.InnerText == System.Environment.MachineName.ToUpper().Trim())
            {
                CmD_Automatenbuchung.Visible = true;
            }
            if (nodeHostCocktail.InnerText == System.Environment.MachineName.ToUpper().Trim())
            {
                CmD_Cocktailmixer.Visible = true;
            }

            if (!Directory.Exists(sBackupPfad))
            {
                Directory.CreateDirectory(sBackupPfad);
            }
            if (!Directory.Exists(sRestorePfad))
            {
                Directory.CreateDirectory(sRestorePfad);
            }

            string sTemp = Cls_Procedure.XorEncrypt(sSchemaPassword, Bauwagen.Properties.Settings.Default.Key);

            sDSN = "Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=" + sDatabase + ")(PORT=" + sListenerPort + ")))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=xe)));User Id=" + sSchema + "; Password="******";";

            LbL_Summe.Text     = "0,00 €";
            LbL_Budget.Text    = "0,00 €";
            LbL_Verfügbar.Text = "0,00 €";
            LbL_Kredit.Text    = "0,00 €";

            while (bRun == true)
            {
                try
                {
                    oConnection.ConnectionString = sDSN;
                    oConnection.Open();

                    oCommand.Connection  = oConnection;
                    oCommand.CommandText = Cls_Query.GetAnwenderDaten(sSammeluser, false, "");
                    dataReader           = oCommand.ExecuteReader();

                    if (!dataReader.HasRows)
                    {
                        MessageBox.Show("Fehler in der Konfiguration, der angegebene Sammeluser existiert nicht!\n" + sSammeluser);
                    }

                    oConnection.Close();
                    bRun = false;
                }
                catch (Exception ex)
                {
                    bRun = true;
                    Thread.Sleep(1000);
                    nCounter += 1;
                }

                if (nCounter > 1000)
                {
                    MessageBox.Show("Datenbankfehler Anwendung wird geschlossen!");
                    this.Close();
                }
            }

            CreateButtons();

            Cls_Procedure.BackupData();
            bLoad = false;
        }