Example #1
0
        //Gumb za prijavo
        private void button1_Click(object sender, EventArgs e)
        {
            string uporabnik = uporabnikComboBox.Text.Trim();
            string geslo     = textBox2.Text;

            if (DBHandle.IsValidLogin(uporabnik, geslo))
            {
                LogonSuccessfull = true;
                Logger.Log(LoggerAction.Prijava, uporabnik);
                Program.IDUporabnika = (from u in db.Uporabniki where u.Uporabnik == uporabnik select u.SifraOsebe).Single();
                this.Close();
            }
            else
            {
                if (!DBHandle.DoesUserExist(uporabnik))
                {
                    MessageBox.Show("Uporabnik se ne ujema z nobenim v bazi.", "Baza", MessageBoxButtons.OK, MessageBoxIcon.Question);
                }
                else
                {
                    if (!DBHandle.DoesUserHavePassword(uporabnik))
                    {
                        MessageBox.Show("Uporabnik nima nastavljenega gesla in zato nima vstop v program.", "Ni gesla", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    else if (!DBHandle.HasLoginPermission(uporabnik))
                    {
                        MessageBox.Show("Uporabniku je bilodvzet dostop do programa.", "Ni dostopa", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    else
                    {
                        MessageBox.Show("Geslo se ne ujema z uporabnikom.", "Napačno geslo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }
Example #2
0
 private void btnPotrdi_Click(object sender, EventArgs e)
 {
     this.Validate();
     System.Drawing.Color myColor;
     try
     {
         myColor = System.Drawing.ColorTranslator.FromHtml(txtBarva.Text);
     }
     catch
     {
         MessageBox.Show("Napaka pri vnosu barve. Uporabljate lahko vse HTML barve.", "Barva", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         return;
     }
     try
     {
         DBHandle.SaveUserColor(myColor);
     }
     catch
     {
         MessageBox.Show("Napaka pri shranjevanju.", "Barva", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return;
     }
     this.DialogResult = DialogResult.OK;
     this.Close();
 }
Example #3
0
        private void Osebe_Load(object sender, EventArgs e)
        {
            try
            {
                // TODO: This line of code loads data into the 'posojilaDataSet.Oseba' table. You can move, or remove it, as needed.
                this.osebaTableAdapter.Fill(this.posojilaDataSet.Oseba);
            }
            catch
            {
                DBHandle.DBError();
            }
            var slovarKrajev = new Dictionary <Object, String>();

            slovarKrajev.Add(DBNull.Value, "ni določen");
            foreach (var row in DBHandle.db.Posta.OrderBy(p => p.PostnaStevilka))
            {
                slovarKrajev.Add(row.PostnaStevilka.ToString(), row.PostnaStevilka + " " + row.Kraj);
            }

            var val = "Value";
            var key = "Key";

            dataGridViewTextBoxColumn5.DataSource    = new BindingSource(slovarKrajev, null);
            dataGridViewTextBoxColumn5.DisplayMember = val;
            dataGridViewTextBoxColumn5.ValueMember   = key;
        }
Example #4
0
 private void uporabnikComboBox_Leave(object sender, EventArgs e)
 {
     if (!DBHandle.DoesUserExist(uporabnikComboBox.Text.Trim()))
     {
         uporabnikComboBox.Focus();
         MessageBox.Show("Uporabnik se ne ujema z nobenim v bazi.", "Baza", MessageBoxButtons.OK, MessageBoxIcon.Question);
     }
 }
Example #5
0
 private void UserManagment_Load(object sender, EventArgs e)
 {
     try
     {
         // TODO: This line of code loads data into the 'bazaDataSet.Uporabniki' table. You can move, or remove it, as needed.
         this.uporabnikiTableAdapter.Fill(this.bazaDataSet.Uporabniki);
     }
     catch
     {
         DBHandle.DBError();
     }
 }
Example #6
0
 private void Valute_Load(object sender, EventArgs e)
 {
     try
     {
         // TODO: This line of code loads data into the 'bazaDataSet.Posta' table. You can move, or remove it, as needed.
         this.postaTableAdapter.Fill(this.bazaDataSet.Posta);
     }
     catch
     {
         DBHandle.DBError();
     }
 }
Example #7
0
 public void FillAll()
 {
     try
     {
         // TODO: This line of code loads data into the 'db.Uporabniki' table. You can move, or remove it, as needed.
         this.uporabnikiTableAdapter.Fill(bazaDataSet.Uporabniki);
     }
     catch
     {
         DBHandle.DBError();
     }
 }
Example #8
0
        private void fillByImeToolStripButton_Click(object sender, EventArgs e)
        {
            var ime     = imeToolStripTextBox.Text.Trim() == "" ? "" : imeToolStripTextBox.Text + "%";
            var priimek = priimekToolStripTextBox.Text.Trim() == "" ? "" : priimekToolStripTextBox.Text + "%";

            try
            {
                this.osebaTableAdapter.FillByIme(this.posojilaDataSet.Oseba, ime, priimek);
            }
            catch
            {
                DBHandle.DBError();
            }
        }
Example #9
0
        private void uporabnikiToolStripMenuItem_Click(object sender, EventArgs e)
        {
            bool isadmin = DBHandle.IsUserAdmin();

            if (isadmin.Equals(true))
            {
                var umfrm = new UserManagment();
                umfrm.ShowIcon      = false;
                umfrm.ShowInTaskbar = false;
                umfrm.ShowDialog();
            }
            else
            {
                MessageBox.Show("Uporabnik ni Administrator.", "Baza", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Example #10
0
 public void FillAll()
 {
     try
     {
         // TODO: This line of code loads data into the 'bazaDataSet.Oseba' table. You can move, or remove it, as needed.
         this.osebaTableAdapter.Fill(this.bazaDataSet.Oseba);
         // TODO: This line of code loads data into the 'bazaDataSet.Posojila' table. You can move, or remove it, as needed.
         this.posojilaTableAdapter.Fill(this.bazaDataSet.Posojila);
         // TODO: This line of code loads data into the 'bazaDataSet.Valute' table. You can move, or remove it, as needed.
         this.valuteTableAdapter.Fill(this.bazaDataSet.Valute);
     }
     catch
     {
         DBHandle.DBError();
     }
 }
Example #11
0
        private void LoginForm_Load(object sender, EventArgs e)
        {
            FillAll();
            var frm = new AddInitialUser();

            if (DBHandle.AreThereAnyUsers() == false)
            {
                frm.ShowInTaskbar = false;
                frm.ControlBox    = false;
                frm.ShowDialog();
                if (!frm.success)
                {
                    Application.Exit();
                }
                FillAll();
            }
        }
Example #12
0
        private void Main_Load(object sender, EventArgs e)
        {
            FillAll();
            toolStripStatusLabel.Text = "Prijavljen: " + DBHandle.GetUserFullName();
            //ustvari slovarja oseb
            var slovarOseb = new Dictionary <long, string>();

            foreach (DataRow row in DBHandle.db.Oseba)
            {
                slovarOseb.Add(Convert.ToInt64(row["ID"]), row["Ime"] + " " + row["Priimek"]);
            }
            var val = "Value";
            var key = "Key";

            dataGridViewTextBoxColumn2.DataSource    = new BindingSource(slovarOseb, null);
            dataGridViewTextBoxColumn2.DisplayMember = val;
            dataGridViewTextBoxColumn2.ValueMember   = key;
            dataGridViewTextBoxColumn3.DataSource    = new BindingSource(slovarOseb, null);
            dataGridViewTextBoxColumn3.DisplayMember = val;
            dataGridViewTextBoxColumn3.ValueMember   = key;
            posojevalecComboBox.DataSource           = new BindingSource(slovarOseb, null);
            posojevalecComboBox.DisplayMember        = val;
            posojevalecComboBox.ValueMember          = key;
            izposojevalecComboBox.DataSource         = new BindingSource(slovarOseb, null);
            izposojevalecComboBox.DisplayMember      = val;
            izposojevalecComboBox.ValueMember        = key;

            var colorString = DBHandle.GetUserColor();

            System.Drawing.Color myColor;
            try
            {
                myColor = System.Drawing.ColorTranslator.FromHtml(colorString);
            }
            catch
            {
                MessageBox.Show("Napaka pri vnosu barve. Uporabljate lahko vse HTML barve.", "Barva", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
            this.BackColor = myColor;
        }
Example #13
0
 private void Main_FormClosing(object sender, FormClosingEventArgs e)
 {
     SaveAll();
     Logger.Log(LoggerAction.Odjava, DBHandle.GetUserName());
 }
Example #14
0
 private void LoginForm_Load(object sender, EventArgs e)
 {
     txtBarva.Text = DBHandle.GetUserColor();
 }