示例#1
0
文件: Form1.cs 项目: Ubnub/SiuntosRN
 private void DeleteItem_Click(object sender, EventArgs e)
 {
     Katalogas.Remove(Selected);
     Selected                   = null;
     CurrentItem.Text           = "-";
     PrekiuKatalogas.DataSource = null;
     PrekiuKatalogas.DataSource = Katalogas;
 }
示例#2
0
文件: Form2.cs 项目: Ubnub/SiuntosRN
 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();
 }
示例#3
0
文件: Form1.cs 项目: Ubnub/SiuntosRN
 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;
             }
         }
     }
 }
示例#4
0
文件: Form1.cs 项目: Ubnub/SiuntosRN
 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;
 }
示例#5
0
文件: Form1.cs 项目: Ubnub/SiuntosRN
 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;
     }
 }