private void lvSiparisler_DoubleClick(object sender, EventArgs e) { if (lvSiparisler.Items.Count > 0) { if (lvSiparisler.SelectedItems[0].SubItems[4].Text != "0") { cSiparis saveOrder = new cSiparis(); saveOrder.setDeleteOrder(Convert.ToInt32(lvSiparisler.SelectedItems[0].SubItems[4].Text)); } else { for (int i = 0; i < lvYeniEklenenler.Items.Count; i++) { if (lvYeniEklenenler.Items[i].SubItems[4].Text == lvSiparisler.SelectedItems[0].SubItems[5].Text) { lvYeniEklenenler.Items.RemoveAt(i); } } } lvSiparisler.Items.RemoveAt(lvSiparisler.SelectedItems[0].Index); } }
private void btnSiparis_Click(object sender, EventArgs e) { /* * 1 - Masa Boş * 2 - Masa Dolu * 3 - Masa Rezerve * 4 - Dolu rezerve */ cMasalar masa = new cMasalar(); frmMasalar ms = new frmMasalar(); cAdisyon newAddition = new cAdisyon(); cSiparis saveOrder = new cSiparis(); bool sonuc = false; if (masa.TableGetbyState(tableId, 1) == true) { newAddition.ServisTurNo = 1; newAddition.PersonelId = 1; newAddition.MasaId = tableId; newAddition.Tarih = DateTime.Now; sonuc = newAddition.setByAdditionNew(newAddition); masa.setChangeTableState(cGenel._ButtonName, 2); if (lvSiparisler.Items.Count > 0) { for (int i = 0; i < lvSiparisler.Items.Count; i++) { saveOrder.MasaId = tableId; saveOrder.UrunId = Convert.ToInt32(lvSiparisler.Items[i].SubItems[2].Text); saveOrder.AdisyonId = newAddition.getByAddition(tableId); saveOrder.Adet = Convert.ToInt32(lvSiparisler.Items[i].SubItems[1].Text); saveOrder.setSaveOrder(saveOrder); } this.Close(); ms.Show(); } } else if (masa.TableGetbyState(tableId, 2) == true || masa.TableGetbyState(tableId, 4) == true) { if (lvYeniEklenenler.Items.Count > 0) { for (int i = 0; i < lvYeniEklenenler.Items.Count; i++) { saveOrder.MasaId = tableId; saveOrder.UrunId = Convert.ToInt32(lvYeniEklenenler.Items[i].SubItems[1].Text); saveOrder.AdisyonId = newAddition.getByAddition(tableId); saveOrder.Adet = Convert.ToInt32(lvYeniEklenenler.Items[i].SubItems[2].Text); saveOrder.setSaveOrder(saveOrder); } } if (silinenler.Count > 0) { foreach (string item in silinenler) { saveOrder.setDeleteOrder(Convert.ToInt32(item)); } } this.Close(); ms.Show(); } else if (masa.TableGetbyState(tableId, 3) == true) { newAddition.ServisTurNo = 1; newAddition.PersonelId = 1; newAddition.MasaId = tableId; newAddition.Tarih = DateTime.Now; sonuc = newAddition.setByAdditionNew(newAddition); masa.setChangeTableState(cGenel._ButtonName, 4); if (lvSiparisler.Items.Count > 0) { for (int i = 0; i < lvSiparisler.Items.Count; i++) { saveOrder.MasaId = tableId; saveOrder.UrunId = Convert.ToInt32(lvSiparisler.Items[i].SubItems[2].Text); saveOrder.AdisyonId = newAddition.getByAddition(tableId); saveOrder.Adet = Convert.ToInt32(lvSiparisler.Items[i].SubItems[1].Text); saveOrder.setSaveOrder(saveOrder); } this.Close(); ms.Show(); } } }