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); }
public void MasaKapasitesiveDurumGetir(ComboBox cm) { cm.Items.Clear(); SqlConnection con = new SqlConnection(gnl.conString); SqlCommand cmd = new SqlCommand("select * from masalar", con); string durum = ""; if (con.State == ConnectionState.Closed) { con.Open(); } SqlDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { cMasalar c = new cMasalar(); if (c._DURUM == 2) { durum = "DOLU"; } else if (c._DURUM == 3) { durum = "REZERVE"; } c._KAPASITE = Convert.ToInt32(dr["KAPASITE"].ToString()); c._MasaBilgi = "Masa No:" + dr["ID"].ToString() + " Kapasitesi :" + dr["KAPASITE"].ToString(); c._ID = Convert.ToInt32(dr["ID"].ToString()); cm.Items.Add(c); } dr.Close(); con.Dispose(); con.Close(); }
private void frmMasalar_Load(object sender, EventArgs e) { SqlConnection con = new SqlConnection(gnl.conString); SqlCommand cmd = new SqlCommand("Select DURUM,ID from Masalar", con); SqlDataReader dr = null; if (con.State == ConnectionState.Closed) { con.Open(); } dr = cmd.ExecuteReader(); while (dr.Read()) { foreach (Control item in this.Controls) { if (item is Button) { if (item.Name == "btnMasa" + dr["ID"].ToString() && dr["DURUM"].ToString() == "1") { item.BackgroundImage = (Image)(Properties.Resources.bosmasa); } else if (item.Name == "btnMasa" + dr["ID"].ToString() && dr["DURUM"].ToString() == "2") { cMasalar ms = new cMasalar(); DateTime dt1 = Convert.ToDateTime(ms.SessionSum(2, dr["ID"].ToString())); DateTime dt2 = DateTime.Now; string st1 = Convert.ToDateTime(ms.SessionSum(2, dr["ID"].ToString())).ToShortTimeString(); string st2 = DateTime.Now.ToShortTimeString(); DateTime t1 = dt1.AddMinutes(DateTime.Parse(st1).TimeOfDay.TotalMinutes); DateTime t2 = dt2.AddMinutes(DateTime.Parse(st2).TimeOfDay.TotalMinutes); var fark = t2 - t1; item.Text = String.Format("{0} {1} {2}", fark.Days > 0 ? string.Format("{0} Gün", fark.Days):" ", fark.Hours > 0 ? string.Format("{0} Saat", fark.Hours) : " ", fark.Minutes > 0 ? string.Format("{0} Dakika", fark.Minutes) : " ").Trim() + "\n\n\nMasa" + dr["ID"].ToString(); item.BackgroundImage = (Image)(Properties.Resources.dolumasa); } else if (item.Name == "btnMasa" + dr["ID"].ToString() && dr["DURUM"].ToString() == "3") { item.BackgroundImage = (Image)(Properties.Resources.acikmasa); } else if (item.Name == "btnMasa" + dr["ID"].ToString() && dr["DURUM"].ToString() == "4") { item.BackgroundImage = (Image)(Properties.Resources.rezervasyon); } } } } }
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 (silinsinler.Count > 0) { foreach (string item in silinsinler) { 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(); } } }