예제 #1
0
        private void CmD_Systemsteuerung_Click(object sender, EventArgs e)
        {
            Frm_Login frm_login = new Frm_Login();
            Frm_Admin frm_admin = new Frm_Admin();

            frm_login.LbL_Status.Text = "admin";
            if (frm_login.ShowDialog() == DialogResult.OK)
            {
                frm_admin.ShowDialog();

                for (int i = nAnzahlAnwender - 1; i >= 0; i--)
                {
                    GetAnwenderControlByName("CmD_Anwender_" + i.ToString().PadLeft(2, '0')).Visible = false;
                    GetAnwenderControlByName("CmD_Anwender_" + i.ToString().PadLeft(2, '0')).Dispose();
                }
                for (int i = nAnzahlGüter - 1; i >= 0; i--)
                {
                    GetGüterControlByName("CmD_Gueter_" + i.ToString().PadLeft(2, '0')).Visible = false;
                    GetGüterControlByName("CmD_Gueter_" + i.ToString().PadLeft(2, '0')).Dispose();
                }
                CreateButtons();
            }
        }
예제 #2
0
        private void buttonNamen_Clicked(object sender, EventArgs e)
        {
            bBlockRefresh = true;

            string sSammeluser = "";

            XmlDocument doc = new XmlDocument();

            doc.Load("Settings.xml");

            XmlNode nodeSammelUser = doc.SelectSingleNode("/Bauwagen/Software/Gemeinschaftsuser");

            sSammeluser = nodeSammelUser.FirstChild.Value;

            Button angeklickterButton = (Button)sender;

            string sName           = angeklickterButton.Text.Trim();
            int    nPositionReturn = sName.IndexOf("\n", 0);

            if (nPositionReturn < 0)
            {
                nPositionReturn = sName.Length;
            }

            sName = sName.Substring(0, nPositionReturn);

            if (sName == "Bauwogn Gmeinschaft")
            {
                sName = sSammeluser;
            }

            Frm_Login frm_login = new Frm_Login();

            frm_login.LbL_Status.Text   = "user";
            frm_login.LbL_Username.Text = sName;

            if (frm_login.ShowDialog() == DialogResult.OK)
            {
                EnableGüter();
                CmD_GebModus.Enabled = true;

                CmD_Systemsteuerung.Enabled = false;

                OracleConnection oConnection    = new OracleConnection();
                OracleCommand    oCommandSelect = new OracleCommand();
                OracleCommand    oCommandUpdate = new OracleCommand();
                OracleDataReader drReader;

                int nResult = 0;

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

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

                        oCommandSelect.CommandText = Cls_Query.GetAnwenderDaten(sName, false, "");
                        drReader = oCommandSelect.ExecuteReader();

                        while (drReader.Read())
                        {
                            LbL_Budget.Text = String.Format("{0:0.00}", Convert.ToDouble(drReader.GetValue(8))) + " €";
                            LbL_Kredit.Text = String.Format("{0:0.00}", Convert.ToDouble(drReader.GetValue(9))) + " €";
                        }
                        drReader.Close();

                        sButtonClicked = angeklickterButton.Name;

                        LbL_User.Text = sName;

                        oConnection.Clone();
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message, "buttonNamen_Clicked");
                    }
                }
            }
            else
            {
                DisableGüter();
                CmD_Systemsteuerung.Enabled = true;

                bBlockRefresh = false;
            }
        }