示例#1
0
        static public List <WarehouseItems> DohvatiSveNaSkladistu()
        {
            List <WarehouseItems> artikli = new List <WarehouseItems>();


            NpgsqlConnection connection = DBCon.BuildConnection();

            connection.Open();
            NpgsqlCommand    command    = new NpgsqlCommand("SELECT * FROM \"TBP_ERA\".warehouse order by articlename", connection);
            NpgsqlDataReader dataReader = command.ExecuteReader();

            for (int i = 0; dataReader.Read(); i++)
            {
                WarehouseItems artikl = new WarehouseItems();
                artikl.ID              = int.Parse(dataReader[0].ToString());
                artikl.ArticleName     = dataReader[1].ToString();
                artikl.CurrentQuantity = int.Parse(dataReader[2].ToString());
                artikl.MinimumQuantity = int.Parse(dataReader[3].ToString());


                artikli.Add(artikl);
            }
            connection.Close();
            return(artikli);
        }
示例#2
0
        private void inputPotvrdiUnos_Click(object sender, EventArgs e)
        {
            WarehouseItems artikl = new WarehouseItems();

            try
            {
                //artikl.ArticleName = inputNazivArtikla.Text;
                //artikl.CurrentQuantity = int.Parse (inputTrenutnoStanje.Text);
                //artikl.MinimumQuantity = int.Parse(inputMinimalnaKolicina.Text);
                //artikl.MaximumQuantity = int.Parse(inputMaksimalnaKolicina.Text);
                //artikl.DeliveryDate = DateTime.Parse(inputDostavljen.Value.ToString());
                //artikl.ExpirationDate = DateTime.Parse(inputRokTrajanja.Value.ToString());
                //artikli.Add(artikl);

                ////unos u bazu : RUČAN 29.12
                //connection.Open();
                //NpgsqlCommand command = new NpgsqlCommand("INSERT INTO \"TBP_ERA\".warehouse(ID,articlename,currentquantity,minimumquantity," +
                //    "maximumquantity,deliverydate,expirationdate,deliveredby,registeredby)" +
                //    "VALUES(default,'"+artikl.ArticleName+"',"+artikl.CurrentQuantity+","+artikl.MinimumQuantity+","+artikl.MaximumQuantity+"," +
                //    "'"+artikl.DeliveryDate+"','"+artikl.ExpirationDate+"',1,1);", connection);
                //NpgsqlDataReader dataReader = command.ExecuteReader();

                //connection.Close();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            OsvjeziPrikaz();
        }
        public void OsvjeziPrikaz()
        {
            artikli                      = WarehouseItems.DohvatiSveNaSkladistu();
            kupciUProcesu                = Buyer.DohvatiKupceUProcesu();
            kupciZavrseni                = Buyer.DohvatiKupceKrajNarudzbe();
            narudzbe                     = Buyer.DohvatiKupce();
            kupci                        = Buyer.DohvatiKupceObjekt();
            outputNarudzbe.Text          = string.Join(Environment.NewLine, narudzbe);
            dgvPrikazUProcesu.DataSource = kupciUProcesu;
            dgvPrikazUProcesu.FirstDisplayedScrollingRowIndex = dgvPrikazUProcesu.RowCount - 1;
            dgvKrajNarudzbe.DataSource = kupciZavrseni;
            dgvKrajNarudzbe.FirstDisplayedScrollingRowIndex = dgvKrajNarudzbe.RowCount - 1;
            outputKupac.DataSource           = kupci;
            prikazStanjaSkladista.DataSource = artikli;
            prikazStanjaSkladista.Series["Minimalnakolicina"].XValueMember  = "ArticleName";
            prikazStanjaSkladista.Series["Minimalnakolicina"].YValueMembers = "MinimumQuantity";
            prikazStanjaSkladista.Series["Trenutnakolicina"].XValueMember   = "ArticleName";
            prikazStanjaSkladista.Series["Trenutnakolicina"].YValueMembers  = "CurrentQuantity";
            prikazStanjaSkladista.ChartAreas["ChartArea1"].AxisX.Interval   = 1;
            prikazStanjaSkladista.ChartAreas["ChartArea1"].AxisY.Minimum    = 0;
            prikazStanjaSkladista.ChartAreas["ChartArea1"].AxisY.Maximum    = 100;
            outputUProcesu.Text = Buyer.BrojZapocetihNarudzbi().ToString();
            outputZavrsene.Text = Buyer.BrojZavrsenih().ToString();

            prikazStanjaSkladista.DataBind();
        }
 private void inputPopuniSkladiste_Click(object sender, EventArgs e)
 {
     WarehouseItems.IsprazniSkladiste();
     WarehouseItems.PopuniSkladiste();
 }