Exemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text == "" || textBox2.Text == "")
            {
                MessageBox.Show("Brak nazwy (loginu) lub hasła. Nie można zapisać takiego użytkownika");
                return;
            }

            string sAktywny = "0";
            fbLogowanie = new fblog();
            if (checkBox1.Checked == true) sAktywny = "1";
            if (textBox4.Text != "")
                fbLogowanie.fAktualizujUser(textBox1.Text, textBox2.Text, textBox3.Text, sAktywny);
            else
            {
                if (fbLogowanie.fCzyJestLogin(textBox1.Text) == "0")
                    fbLogowanie.fDodajUserRAKS(textBox1.Text, textBox3.Text, textBox2.Text, sAktywny);
                else
                    MessageBox.Show("Już jest użytkownik o identyfikatorze(Login): " + textBox1.Text + "", "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            fUserList();
            textBox1.Text = "";
            textBox2.Text = "";
            textBox3.Text = "";
            textBox4.Text = "";
            checkBox1.Checked = false;
            textBox1.Enabled = true;
        }
Exemplo n.º 2
0
        private void dataGridView1_DoubleClick(object sender, EventArgs e)
        {
            try
            {
                DialogResult dlr;
                //string sID = dataGridView1.CurrentRow.Cells[0].Value.ToString();
                string sLogin = dataGridView1.CurrentRow.Cells[0].Value.ToString();
                //string sPass = dataGridView1.CurrentRow.Cells[2].Value.ToString();
                string sNazwisko = dataGridView1.CurrentRow.Cells[1].Value.ToString();
                //string sAktywny = dataGridView2.CurrentRow.Cells[4].Value.ToString();

                fbLogowanie = new fblog();
                if (fbLogowanie.fCzyJestLogin(sLogin) == "0")
                {
                    //dodawanie do spisu
                    fbLogowanie.fDodajUserRAKS(sLogin, sNazwisko);
                }
                else
                {
                    //edycja
                    dlr = MessageBox.Show("Już jest użytkownik o identyfikatorze(Login): " + sLogin + "", "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    if (dlr == DialogResult.Yes)
                    {
                        //aktualizacja wpisu
                        //fbLogowanie.fAktualizujMagazyn(sID, sNumer, sNazwa, sMaska, sDok);
                    }
                }
                fUserList();
            }
            catch (NullReferenceException) { }
        }