public bool setSaveOrder(cSiparis Bilgiler) { bool sonuc = false; SqlConnection con = new SqlConnection(gnl.conString); SqlCommand cmd = new SqlCommand("Insert Into satislar(ADISYONID,URUNID,ADET,MASAID) values(@AdisyonNo,@UrunId,@Adet,@masaId)", con); try { if (con.State == ConnectionState.Closed) { con.Open(); } cmd.Parameters.Add("@AdisyonNo", SqlDbType.Int).Value = Bilgiler._adisyonID; cmd.Parameters.Add("@UrunId", SqlDbType.Int).Value = Bilgiler._urunId; cmd.Parameters.Add("@Adet", SqlDbType.Int).Value = Bilgiler._adet; cmd.Parameters.Add("@masaId", SqlDbType.Int).Value = Bilgiler._masaId; sonuc = Convert.ToBoolean(cmd.ExecuteNonQuery()); } catch (Exception ex) { string hata = ex.Message; } finally { con.Dispose(); con.Close(); } return(sonuc); }
private void frmSiparis_Load(object sender, EventArgs e) { lblMasaNo.Text = cGenel._ButtonValue; cMasalar ms = new cMasalar(); tableId = ms.TableGetbyNumber(cGenel._ButtonName); if (ms.TableGetbyState(tableId, 2) == true || ms.TableGetbyState(tableId, 4) == true) { cAdisyon Ad = new cAdisyon(); AdditionId = Ad.getByAddition(tableId); cSiparis orders = new cSiparis(); orders.getByOrder(lvSiparisler, AdditionId); } btn1.Click += new EventHandler(islem); btn2.Click += new EventHandler(islem); btn3.Click += new EventHandler(islem); btn4.Click += new EventHandler(islem); btn5.Click += new EventHandler(islem); btn6.Click += new EventHandler(islem); btn7.Click += new EventHandler(islem); btn8.Click += new EventHandler(islem); btn9.Click += new EventHandler(islem); btn0.Click += new EventHandler(islem); }
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(); } } }