private void btnOk_Click(object sender, EventArgs e)
        {
            //add new

            dgv = new Bunifu.Framework.UI.BunifuCustomDataGrid();
            CRUDfunkcije crud = new CRUDfunkcije();

            crud.UserMail(UserMail, UserID);
            crud.Insert(myProperty);
            PopulateGrid();
            //PopulateGrid(myProperty);
        }
Example #2
0
        //Insert operacija
        private void btnInsert_Click(object sender, EventArgs e)
        {
            //Metoda za upisivanje Mail-a i ID korisnika
            crud.UserMail(UserMail, UserID);

            //Pozivanje metode INSERT za zadatu Property klasu
            crud.Insert(myForm);

            //Popunjavanje DGV-a nakon zavrsene metode INSERT
            PopulateGrid(myProperty);

            if (myForm.GetType() == typeof(PropertyVozilo))
            {
                if (brojRedovaDGVAVozila < dgv.Rows.Count)
                {
                    PropertyInterface pom = myProperty;

                    //Kupljenje ID vozila iz DGV selektovanog reda
                    string ID = dgv.Rows[dgv.Rows.Count - 1].Cells[0].Value.ToString();

                    //Kreiranje objekta PropertyCijena i popunjavanje tabele sa cijenama
                    PropertyCijena cijenaTabela = new PropertyCijena();
                    myForm = cijenaTabela;
                    PopulateGrid(myForm);
                    myProperty = pom;
                    //Visible = false;

                    //Metoda za upisivanje Mail-a i ID korisnika
                    crud.UserMail(UserMail, UserID);

                    //Pozivanje metode UPDATE sa PropertyCijena, selektovani ID i dgv sa popunjenim podacima cijena
                    crud.Update(myForm, ID, dgv);
                    // Visible = true;

                    //Popunjavanje DGV-a nakon zavrsene metode UPDATE
                    PopulateGrid(myProperty);
                }
            }
        }
Example #3
0
        private void detaljiVozila_Click(object sender, EventArgs e)
        {
            PropertyInterface pom = myProperty;
            string            ID  = dgv.SelectedRows[0].Cells[0].Value.ToString();

            PopulateGrid(myForm);
            myProperty = pom;
            //Visible = false;
            CRUDfunkcije crud = new CRUDfunkcije("detalji");

            crud.UserMail(UserMail, UserID);
            crud.Update(myForm, ID, dgv);
            // Visible = true;
            PopulateGrid(myProperty);
        }
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            PropertyInterface pom = myProperty;
            string            ID  = dgv.SelectedRows[0].Cells[0].Value.ToString();

            PopulateGrid();
            myProperty = pom;
            Visible    = false;
            CRUDfunkcije crud = new CRUDfunkcije();

            crud.UserMail(UserMail, UserID);
            crud.Update(myProperty, ID, dgv);

            Visible = true;
            try
            {
                PopulateGrid();
            }
            catch { }
        }
        private void btnDelete_Click(object sender, EventArgs e)
        {
            DialogResult myResult = MetroMessageBox.Show(this, "Do you really want to delete this item?", "Delete Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Error);

            if (myResult == DialogResult.Yes)
            {
                int          SelektovaniRed = dgv.SelectedRows[0].Index;
                CRUDfunkcije crud           = new CRUDfunkcije();
                crud.UserMail(UserMail, UserID);
                crud.Delete(myProperty, SelektovaniRed, dgv);
                try
                {
                    PopulateGrid();
                }
                catch
                {
                    DialogResult dr = MetroMessageBox.Show(this, "\n\nNemoguce je obrisati ovaj red zbog povezanosti sa drugim tabelama!!!\n\n", "Greska pri brisanju!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                //No delete
            }
        }