Ejemplo n.º 1
0
        protected void Zoom()
        {
            if (stavkaDataGridView.SelectedCells.Count == 1 && stavkaDataGridView.SelectedCells[0].ColumnIndex == 0 || stavkaDataGridView.SelectedCells[0].ColumnIndex == 1)
            {
                ArtiklForm f = new ArtiklForm();
                f.StartPosition = FormStartPosition.CenterScreen;
                if (f.ShowDialog() == DialogResult.OK)
                {
                    // Potrebno zbog bindinga na lookup u sluèaju novounesenih artikala
                    artiklBindingSource.DataSource = artiklBll.FetchAll();

                    Artikl a = (Artikl)f.Selected;
                    Stavka s = null;
                    if (stavkaDataGridView.Rows[stavkaDataGridView.SelectedCells[0].RowIndex].IsNewRow)
                    {
                        stavkaBindingSource.CancelEdit();
                        Dokument dok = (Dokument)dokumentBindingSource.Current;
                        s = new Stavka();
                        dok.Stavke.Add(s);
                    }
                    else
                    {
                        s = (Stavka)stavkaBindingSource.Current;
                    }

                    if (s != null)
                    {
                        s.SifArtikla      = a.SifArtikla;
                        s.NazArtikla      = a.NazArtikla;
                        s.JedMjereArtikla = a.JedMjere;
                        s.JedCijArtikla   = a.CijArtikla;
                    }
                }
            }
        }
Ejemplo n.º 2
0
 private void artiklToolStripMenuItem_Click(object sender, EventArgs e)
 {
     using (new StatusBusy())
     {
         ArtiklForm f = new ArtiklForm();
         f.MdiParent = this;
         f.Show();
     }
 }
Ejemplo n.º 3
0
        protected override void Zoom()
        {
            if (InEditMode)
            {
                if (idPartneraComboBox.Focused)
                {
                    PartnerForm f = new PartnerForm();
                    f.StartPosition = FormStartPosition.CenterScreen;
                    if (f.ShowDialog() == DialogResult.OK)
                    {
                        // Potrebno zbog bindinga na lookup u sluèaju novounesenih partnera
                        partnerInfoBindingSource.DataSource = partnerBll.FetchAll();

                        Partner p = (Partner)f.Selected;
                        (dokumentBindingSource.Current as Dokument).IdPartnera = p.IdPartnera;
                    }
                }
                else if (idPrethDokumentaComboBox.Focused)
                {
                    DokumentForm f = new DokumentForm();
                    f.StartPosition = FormStartPosition.CenterScreen;
                    if (f.ShowDialog() == DialogResult.OK)
                    {
                        // Potrebno zbog bindinga na lookup u sluèaju novounesenih dokumenata
                        prethDokumentBindingSource.DataSource = dokumentBll.FetchAll();

                        Dokument d = (Dokument)f.Selected;
                        (dokumentBindingSource.Current as Dokument).IdPrethDokumenta = d.IdDokumenta;
                    }
                }
                else if (stavkaDataGridView.SelectedCells.Count == 1 &&
                         stavkaDataGridView.SelectedCells[0].ColumnIndex == 0 ||
                         stavkaDataGridView.SelectedCells[0].ColumnIndex == 1)
                {
                    ArtiklForm f = new ArtiklForm();
                    f.StartPosition = FormStartPosition.CenterScreen;
                    if (f.ShowDialog() == DialogResult.OK)
                    {
                        // Potrebno zbog bindinga na lookup u sluèaju novounesenih artikala
                        artiklBindingSource.DataSource = artiklBll.FetchAll();

                        Artikl a = (Artikl)f.Selected;
                        Stavka s = null;
                        if (stavkaDataGridView.Rows[stavkaDataGridView.SelectedCells[0].RowIndex].IsNewRow)
                        {
                            stavkaBindingSource.CancelEdit();
                            Dokument dok = (Dokument)dokumentBindingSource.Current;
                            s = new Stavka();
                            dok.Stavke.Add(s);
                        }
                        else
                        {
                            s = (Stavka)stavkaBindingSource.Current;
                        }

                        s.SifArtikla      = a.SifArtikla;
                        s.NazArtikla      = a.NazArtikla;
                        s.JedMjereArtikla = a.JedMjere;
                        s.JedCijArtikla   = a.CijArtikla;
                    }
                }
                StatusBar.RefreshStatusBar();
            }
        }