Exemplo n.º 1
0
 private void DeleteItem_Click(object sender, EventArgs e)
 {
     Katalogas.Remove(Selected);
     Selected                   = null;
     CurrentItem.Text           = "-";
     PrekiuKatalogas.DataSource = null;
     PrekiuKatalogas.DataSource = Katalogas;
 }
Exemplo n.º 2
0
 private void SaveNewItem_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(NameNewItem.Text) || string.IsNullOrWhiteSpace(NameNewItem.Text) || string.IsNullOrEmpty(PriceNewItem.Text) || string.IsNullOrWhiteSpace(PriceNewItem.Text) || string.IsNullOrEmpty(AmmNewItem.Text) || string.IsNullOrWhiteSpace(AmmNewItem.Text))
     {
         MessageBox.Show("Visi laukai turi buti uzpildyti");
     }
     else
     {
         int   a = GenerateUniqueID();
         Preke B = new Preke(a, Convert.ToInt32(PriceNewItem.Text), NameNewItem.Text, Convert.ToInt32(AmmNewItem.Text));
         addList.Add(B);
     }
     Refresh(addList);
     Close();
 }
Exemplo n.º 3
0
 private void PrekiuKatalogas_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     if (PrekiuKatalogas.Rows[e.RowIndex].Cells[e.ColumnIndex].Value != null)
     {
         PrekiuKatalogas.CurrentRow.Selected = true;
         CurrentItem.Text = PrekiuKatalogas.Rows[e.RowIndex].Cells["Pavadinimas"].FormattedValue.ToString();
         foreach (var item in Katalogas)
         {
             if (item.ID == Convert.ToInt32(PrekiuKatalogas.Rows[e.RowIndex].Cells["ID"].FormattedValue))
             {
                 Selected = item;
                 break;
             }
         }
     }
 }
Exemplo n.º 4
0
 private void RemoveKrepselisButton_Click(object sender, EventArgs e)
 {
     foreach (var item in Katalogas)
     {
         if (item.ID == SelectedKrepselis.ID)
         {
             item.Likutis++;
             break;
         }
     }
     Krepselis.Remove(SelectedKrepselis);
     SelectedKrepselis            = null;
     CurrentPurchItem.Text        = "-";
     PrekiuKrepselisDG.DataSource = null;
     PrekiuKrepselisDG.DataSource = Krepselis;
     PrekiuKatalogas.DataSource   = null;
     PrekiuKatalogas.DataSource   = Katalogas;
 }
Exemplo n.º 5
0
 private void AddKrepselisButton_Click(object sender, EventArgs e)
 {
     if (Selected != null)
     {
         Preke a = new Preke(Selected.ID, Selected.Kaina, Selected.Pavadinimas, 1);
         foreach (var item in Katalogas)
         {
             if (item.ID == Selected.ID)
             {
                 item.Likutis--;
                 break;
             }
         }
         Krepselis.Add(a);
         PrekiuKatalogas.DataSource   = null;
         PrekiuKatalogas.DataSource   = Katalogas;
         PrekiuKrepselisDG.DataSource = null;
         PrekiuKrepselisDG.DataSource = Krepselis;
     }
 }