Exemplo n.º 1
0
 public FormAddEditMaske()
 {
     Baza  = new Database();
     maska = new maska();
     InitializeComponent();
     isEdit = false;
     MaskeBindingSource.DataSource = maska;
 }
Exemplo n.º 2
0
        public FormAddEditMaske(maska _maska)

        {
            InitializeComponent();
            Baza   = new Database();
            isEdit = true;
            maska  = _maska;
            MaskeBindingSource.DataSource = Baza.maska.FirstOrDefault(qq => qq.id_maska == _maska.id_maska);
        }
Exemplo n.º 3
0
        private void simpleButton2_Click(object sender, EventArgs e)
        {
            maska            maska = (maska)gridView1.GetRow(gridView1.FocusedRowHandle);
            FormAddEditMaske frm   = new FormAddEditMaske(maska);

            if (frm.ShowDialog() == DialogResult.OK)
            {
                Baza = new Database();
                gridControl1.DataSource = Baza.maska.ToList();
            }
        }
Exemplo n.º 4
0
        public bool validateime(maska maska)
        {
            var           db    = new Database();
            List <string> lista = db.maska.Where(qq => qq.id_maska != maska.id_maska).Select(qq => qq.naziv).ToList();

            if (lista.Contains(Baza.maska.FirstOrDefault(qq => qq.id_maska == maska.id_maska).naziv))
            {
                XtraMessageBox.Show("Već postoji maska sa tim imenom!", "Greska", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
            return(true);
        }
Exemplo n.º 5
0
 private void simpleButton3_Click(object sender, EventArgs e)
 {
     if (XtraMessageBox.Show("Da li ste sigurni da želite obrisati selektovanu masku?", "?", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         maska maska = (maska)gridView1.GetRow(gridView1.FocusedRowHandle);
         Baza = new Database();
         try
         {
             Baza = new Database();
             Baza.maska.Remove(Baza.maska.FirstOrDefault(qq => qq.id_maska == maska.id_maska));
             Baza.SaveChanges();
             gridControl1.DataSource = Baza.maska.ToList();
         }
         catch (Exception ex)
         {
             XtraMessageBox.Show("Došlo je do greške prilikom brisanja podataka." + Environment.NewLine + ex.Message, "Greska", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }