Esempio n. 1
0
        public void Izvjestaji(object sender, EventArgs e)
        {
            if (ugdNarudzbenica.ActiveRow != null)
            {
                BusinessLogic.Narudzbenica.pID_Narudzbenica = BusinessLogic.Narudzbenica.IsDbNull <int>(ugdNarudzbenica.ActiveRow.Cells["ID"].Value);
                BusinessLogic.Narudzbenica objekt = new BusinessLogic.Narudzbenica();

                ReportDocument rpt = new ReportDocument();
                rpt.Load(System.Windows.Forms.Application.StartupPath + @"\Izvjestaji\crpNarudzbeniceIspis.rpt");

                // Set connection string from config in existing LogonProperties
                rpt.DataSourceConnections[0].SetConnection(Mipsed7.Core.ApplicationDatabaseInformation.ServerName, Mipsed7.Core.ApplicationDatabaseInformation.DatabaseName, true);
                rpt.DataSourceConnections[0].SetLogon(Mipsed7.Core.ApplicationDatabaseInformation.SqlUserName, Mipsed7.Core.ApplicationDatabaseInformation.SqlPassword);
                rpt.DataSourceConnections[0].IntegratedSecurity = false;

                rpt.SetDataSource(objekt.GetNarudzbenicaIspis(BusinessLogic.Narudzbenica.pID_Narudzbenica));

                ExtendedWindowWorkspace workspace = new ExtendedWindowWorkspace();
                PreviewReportWorkItem   item      = this.Controller.WorkItem.Items.Get <PreviewReportWorkItem>("Pregled");
                if (item == null)
                {
                    item = this.Controller.WorkItem.Items.AddNew <PreviewReportWorkItem>("Pregled");
                }
                item.Izvjestaj = rpt;
                item.Activate();
                item.Show(item.Workspaces["main"]);
            }
        }
Esempio n. 2
0
        private void uscNarudzbenica_Load(object sender, EventArgs e)
        {
            BusinessLogic.Narudzbenica.pNarudzbeProizvod = new DataTable();
            BusinessLogic.Narudzbenica.pNarudzbeProizvod.Columns.Add("SEL", typeof(bool));
            BusinessLogic.Narudzbenica.pNarudzbeProizvod.Columns.Add("ID Proizvod", typeof(int));
            BusinessLogic.Narudzbenica.pNarudzbeProizvod.Columns.Add("Naziv proizvoda", typeof(string));
            BusinessLogic.Narudzbenica.pNarudzbeProizvod.Columns.Add("Jedinica mjere", typeof(string));
            BusinessLogic.Narudzbenica.pNarudzbeProizvod.Columns.Add("Količina", typeof(decimal));
            BusinessLogic.Narudzbenica.pNarudzbeProizvod.Columns.Add("ID_JedinicaMjere", typeof(int));
            BusinessLogic.Narudzbenica.pOdabraniProizvodi = new List <string>();

            BusinessLogic.Narudzbenica objekt = new BusinessLogic.Narudzbenica();
            LoadPartner(objekt);
            LoadNacinIsporuke(objekt);
            LoadNacinPlacanja(objekt);

            if (FormEditMode == Enums.FormEditMode.Update || FormEditMode == Enums.FormEditMode.Copy)
            {
                LoadNarudzbeniceByID(objekt);
            }
            if (FormEditMode == Enums.FormEditMode.Insert || FormEditMode == Enums.FormEditMode.Copy)
            {
                CalculateBrojNarudzbe(objekt);
            }
        }
Esempio n. 3
0
        private void LoadGridNarudzbenica()
        {
            BusinessLogic.Narudzbenica objekt = new BusinessLogic.Narudzbenica();

            ugdNarudzbenica.DataSource = objekt.GetDataMainGrid();
            ugdNarudzbenica.DataBind();

            Utils.Tools.UltraGridStyling(ugdNarudzbenica);

            if (ugdNarudzbenica.DisplayLayout.Bands.Count > 0)
            {
                ugdNarudzbenica.DisplayLayout.Bands[0].Columns["ID"].Hidden              = true;
                ugdNarudzbenica.DisplayLayout.Bands[0].Columns["Naziv partnera"].Width   = 200;
                ugdNarudzbenica.DisplayLayout.Bands[0].Columns["Partner adresa"].Width   = 200;
                ugdNarudzbenica.DisplayLayout.Bands[1].Columns["ID_Narudzbenica"].Hidden = true;
                ugdNarudzbenica.DisplayLayout.Bands[1].Columns["Naziv proizvoda"].Width  = 200;
            }

            foreach (UltraGridRow row in ugdNarudzbenica.Rows)
            {
                if (row.Index == BusinessLogic.Narudzbenica.pSelectedIndex)
                {
                    ugdNarudzbenica.ActiveRow = row;
                }
            }
        }
Esempio n. 4
0
 private void ucbProizvod_ValueChanged(object sender, EventArgs e)
 {
     BusinessLogic.Narudzbenica.pID_Proizvod = BusinessLogic.Narudzbenica.IsDbNull <int>(ucbProizvod.Value);
     if (ucbProizvod.Value != null)
     {
         BusinessLogic.Narudzbenica objekt = new BusinessLogic.Narudzbenica();
         LoadJedinicaMjere(objekt);
     }
 }
Esempio n. 5
0
 private void bnDodajNacinIsporuke_Click(object sender, EventArgs e)
 {
     using (MaticniPodaci.uscNacinIsporukeForm objekt = new MaticniPodaci.uscNacinIsporukeForm(Enums.FormEditMode.Insert))
     {
         if (objekt.ShowDialogForm("Način isporuke") == DialogResult.OK)
         {
             BusinessLogic.Narudzbenica objekt2 = new BusinessLogic.Narudzbenica();
             LoadNacinIsporuke(objekt2);
         }
     }
 }
Esempio n. 6
0
 private void tsbNarudzbenicaSpremiNovi_Click(object sender, EventArgs e)
 {
     if (SaveData())
     {
         FormEditMode      = Enums.FormEditMode.Insert;
         uteNapomena.Value = null;
         ugdNarudzbenicaProizvod.DataSource = null;
         BusinessLogic.Narudzbenica.pNarudzbeProizvod.Clear();
         BusinessLogic.Narudzbenica objekt = new BusinessLogic.Narudzbenica();
         CalculateBrojNarudzbe(objekt);
     }
 }
Esempio n. 7
0
        private void tsbNarudzbenicaSpremiNovi_Click(object sender, EventArgs e)
        {
            if (SaveData())
            {
                lblJedinicaMjere.Text = null;
                ucbProizvod.Value     = null;
                uneKolicina.Value     = 0;

                BusinessLogic.Narudzbenica.pOdabraniProizvodi.Clear();
                foreach (DataRow odabrani in BusinessLogic.Narudzbenica.pNarudzbeProizvod.Rows)
                {
                    BusinessLogic.Narudzbenica.pOdabraniProizvodi.Add(odabrani["ID Proizvod"].ToString());
                }
                BusinessLogic.Narudzbenica objekt = new BusinessLogic.Narudzbenica();
                LoadProizvod(objekt);
            }
        }
Esempio n. 8
0
        public void Delete(object sender, EventArgs e)
        {
            if (ugdNarudzbenica.ActiveRow != null)
            {
                BusinessLogic.Narudzbenica.pID_Narudzbenica = Convert.ToInt32(ugdNarudzbenica.ActiveRow.Cells["ID"].Value);

                if (MessageBox.Show(string.Format("Obrisati narudžbenicu '{0}-{1}'?", BusinessLogic.Narudzbenica.pID_Narudzbenica, ugdNarudzbenica.ActiveRow.Cells["Broj narudžbe"].Value),
                                    "Brisanje narudžbenice", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    BusinessLogic.Narudzbenica objekt = new BusinessLogic.Narudzbenica();
                    if (!objekt.Delete())
                    {
                        MessageBox.Show("Dogodila se greška prilikom brisanja narudžbenice.\nKontaktirajte administratora [Error:00020]");
                    }
                    LoadGridNarudzbenica();
                }
            }
        }
Esempio n. 9
0
        private bool SaveData()
        {
            lblValidationMessages.ResetText();

            BusinessLogic.Narudzbenica.pID_Partner   = (int?)ucbPartner.Value;
            BusinessLogic.Narudzbenica.pBrojNarudzbe = uteBrojNarudzbe.Value.ToString();
            if (uteNapomena.Value != null)
            {
                BusinessLogic.Narudzbenica.pNapomena = uteNapomena.Value.ToString();
            }
            BusinessLogic.Narudzbenica.pDatumNarudzbe = (DateTime?)udtDatumNarudzbe.Value;
            BusinessLogic.Narudzbenica.pNacinIsporuke = (int?)ucbNacinIsporuke.Value;
            BusinessLogic.Narudzbenica.pNacinPlacanja = (int?)ucbNacinPlacanja.Value;

            StringBuilder message = ValidateDataInput();

            if (message.Length == 0)
            {
                BusinessLogic.Narudzbenica objekt = new BusinessLogic.Narudzbenica();

                if (FormEditMode == Enums.FormEditMode.Insert || FormEditMode == Enums.FormEditMode.Copy)
                {
                    if (objekt.Insert(message, ugdNarudzbenicaProizvod))
                    {
                        FormEditMode = Enums.FormEditMode.Update;
                        return(true);
                    }
                }
                else if (this.FormEditMode == Enums.FormEditMode.Update)
                {
                    if (objekt.Update(message, ugdNarudzbenicaProizvod))
                    {
                        return(true);
                    }
                }
            }

            lblValidationMessages.Text = message.ToString();
            return(false);
        }
Esempio n. 10
0
        private void LoadNarudzbeniceByID(BusinessLogic.Narudzbenica objekt)
        {
            if (objekt.NarudzbenicaByID())
            {
                ucbPartner.Value                   = BusinessLogic.Narudzbenica.pID_Partner;
                uteBrojNarudzbe.Value              = BusinessLogic.Narudzbenica.pBrojNarudzbe;
                udtDatumNarudzbe.Value             = BusinessLogic.Narudzbenica.pDatumNarudzbe;
                uteNapomena.Value                  = BusinessLogic.Narudzbenica.pNapomena;
                ugdNarudzbenicaProizvod.DataSource = BusinessLogic.Narudzbenica.pNarudzbeProizvod.DefaultView;
                ucbNacinPlacanja.Value             = BusinessLogic.Narudzbenica.pNacinPlacanja;
                ucbNacinIsporuke.Value             = BusinessLogic.Narudzbenica.pNacinIsporuke;

                Utils.Tools.UltraGridStyling(ugdNarudzbenicaProizvod);

                if (ugdNarudzbenicaProizvod.DisplayLayout.Bands.Count > 0)
                {
                    ugdNarudzbenicaProizvod.DisplayLayout.Bands[0].Columns["SEL"].Style               = Infragistics.Win.UltraWinGrid.ColumnStyle.CheckBox;
                    ugdNarudzbenicaProizvod.DisplayLayout.Bands[0].Columns["SEL"].CellActivation      = Infragistics.Win.UltraWinGrid.Activation.AllowEdit;
                    ugdNarudzbenicaProizvod.DisplayLayout.Bands[0].Columns["ID_JedinicaMjere"].Hidden = true;
                }
            }
        }
Esempio n. 11
0
 private void LoadPartner(BusinessLogic.Narudzbenica objekt)
 {
     ucbPartner.DataSource = objekt.GetPartner();
     ucbPartner.DataBind();
 }
Esempio n. 12
0
 private void NarudzbenicaProizvodForm_Load(object sender, EventArgs e)
 {
     BusinessLogic.Narudzbenica objekt = new BusinessLogic.Narudzbenica();
     LoadProizvod(objekt);
 }
Esempio n. 13
0
 private void LoadProizvod(BusinessLogic.Narudzbenica objekt)
 {
     ucbProizvod.DataSource = objekt.GetProizvod();
     ucbProizvod.DataBind();
 }
Esempio n. 14
0
 private void LoadJedinicaMjere(BusinessLogic.Narudzbenica objekt)
 {
     lblJedinicaMjere.Text = objekt.GetJedinicaMjere();
 }
Esempio n. 15
0
 private void CalculateBrojNarudzbe(BusinessLogic.Narudzbenica objekt)
 {
     uteBrojNarudzbe.Value = objekt.GetBrojNarudzbe();
 }
Esempio n. 16
0
 private void LoadNacinPlacanja(BusinessLogic.Narudzbenica objekt)
 {
     ucbNacinPlacanja.DataSource = objekt.GetNacinPlacanja();
     ucbNacinPlacanja.DataBind();
 }
Esempio n. 17
0
 private void LoadNacinIsporuke(BusinessLogic.Narudzbenica objekt)
 {
     ucbNacinIsporuke.DataSource = objekt.GetNacinIsporuke();
     ucbNacinIsporuke.DataBind();
 }