예제 #1
0
        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 = (System.Drawing.Image)(Properties.Resources.masaa);
                        }
                        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())).ToShortDateString();
                            //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 = (System.Drawing.Image)(Properties.Resources.kırmızımasa);
                        }
                        else if (item.Name == "btnMasa" + dr["ID"].ToString() && dr["DURUM"].ToString() == "3")
                        {
                            item.BackgroundImage = (System.Drawing.Image)(Properties.Resources.mavimasa);
                        }
                        else if (item.Name == "btnMasa" + dr["ID"].ToString() && dr["DURUM"].ToString() == "4")
                        {
                            item.BackgroundImage = (System.Drawing.Image)(Properties.Resources.mormasa);
                        }
                    }
                }
            }
        }
예제 #2
0
        private void frmSiparis_Load(object sender, EventArgs e)
        {
            lblMasaNo.Text = cGenel._ButtonValue;
            cMasalar ms = new cMasalar();

            tableId = ms.MasaNosu(cGenel._ButtonName);
            if (ms.MasaDurumu(tableId, 2) == true || ms.MasaDurumu(tableId, 4) == true)
            {
                cAdisyon Ad = new cAdisyon();
                AdditionId = Ad.AdisyonBilgisiGetir(tableId);
                cSiparis siparisler = new cSiparis();
                siparisler.SiparisleriGetir(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);
        }
예제 #3
0
        private void btnsiparis_Click_1(object sender, EventArgs e)
        {
            //1.Masaboş2.masaDolu3.masarezerve4.masarezerveoturanvar
            cMasalar   masa          = new cMasalar();
            cAdisyon   yeniAdisyon   = new cAdisyon();
            cSiparis   siparisKaydet = new cSiparis();
            frmMasalar m             = new frmMasalar();
            bool       sonuc         = false;

            if (masa.MasaDurumu(tableId, 1) == true)
            {
                yeniAdisyon.ServisTurNo = 1;
                yeniAdisyon.PersonelId  = 1;
                yeniAdisyon.MasaId      = tableId;
                yeniAdisyon.Tarih       = DateTime.Now;
                sonuc = yeniAdisyon.YeniAdisyonuGetir(yeniAdisyon);
                masa.MasaDurumuDegistir(cGenel._ButtonName, 2);
                if (lvSiparisler.Items.Count > 0)
                {
                    for (int i = 0; i < lvSiparisler.Items.Count; i++)
                    {
                        siparisKaydet.MasaId    = tableId;
                        siparisKaydet.UrunId    = Convert.ToInt32(lvSiparisler.Items[i].SubItems[2].Text);
                        siparisKaydet.AdisyonID = yeniAdisyon.AdisyonBilgisiGetir(tableId);
                        siparisKaydet.Adet      = Convert.ToInt32(lvSiparisler.Items[i].SubItems[1].Text);
                        siparisKaydet.SiparisleriVeriTabaninaKaydet(siparisKaydet);
                    }
                    this.Close();
                    m.Show();
                }
            }
            else if (masa.MasaDurumu(tableId, 2) == true || masa.MasaDurumu(tableId, 4) == true)
            {
                if (lvYeniEklenen.Items.Count > 0)
                {
                    for (int i = 0; i < lvYeniEklenen.Items.Count; i++)
                    {
                        siparisKaydet.MasaId    = tableId;
                        siparisKaydet.UrunId    = Convert.ToInt32(lvYeniEklenen.Items[i].SubItems[1].Text);
                        siparisKaydet.AdisyonID = yeniAdisyon.AdisyonBilgisiGetir(tableId);
                        siparisKaydet.Adet      = Convert.ToInt32(lvYeniEklenen.Items[i].SubItems[2].Text);
                        siparisKaydet.SiparisleriVeriTabaninaKaydet(siparisKaydet);
                    }
                    cGenel._AdisyonId = Convert.ToString(yeniAdisyon.AdisyonBilgisiGetir(tableId));
                }
                if (silinenler.Count > 0)
                {
                    foreach (string item in silinenler)
                    {
                        siparisKaydet.SiparisSil(Convert.ToInt32(item));
                    }
                }
                this.Close();
                m.Show();
            }
            else if (masa.MasaDurumu(tableId, 3) == true)
            {
                yeniAdisyon.ServisTurNo = 1;
                yeniAdisyon.PersonelId  = 1;
                yeniAdisyon.MasaId      = tableId;
                yeniAdisyon.Tarih       = DateTime.Now;
                sonuc = yeniAdisyon.YeniAdisyonuGetir(yeniAdisyon);
                masa.MasaDurumuDegistir(cGenel._ButtonName, 4);
                if (lvSiparisler.Items.Count > 0)
                {
                    for (int i = 0; i < lvSiparisler.Items.Count; i++)
                    {
                        siparisKaydet.MasaId    = tableId;
                        siparisKaydet.UrunId    = Convert.ToInt32(lvSiparisler.Items[i].SubItems[2].Text);
                        siparisKaydet.AdisyonID = yeniAdisyon.AdisyonBilgisiGetir(tableId);
                        siparisKaydet.Adet      = Convert.ToInt32(lvSiparisler.Items[i].SubItems[1].Text);
                        siparisKaydet.SiparisleriVeriTabaninaKaydet(siparisKaydet);
                    }
                    this.Close();
                    m.Show();
                }
            }
        }