Ejemplo n.º 1
0
        private void frmSiparis_Load(object sender, EventArgs e)
        {
            this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
            lblMasaNo.Text   = cGenel._ButtonValue;

            cMasalar ms = new cMasalar();

            TableId = ms.TableGetByNumber(cGenel._ButtonName);

            if (ms.TableGetByState(TableId, 2) == 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);



            // ms.MasalariDurumaGoreGetir(cbMasalar);
        }
Ejemplo n.º 2
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Masayı Silmek İstediğinizden Emin Misiniz?", "Dikkat!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
            {
                cAdisyon a = new cAdisyon();
                a.AdisyonuSil(Convert.ToInt32(lblAdisyonId.Text));

                cMasalar cms    = new cMasalar();
                int      masaid = masalar.TableGetByNumber(cGenel._ButtonName);
                cms.MasaDurumuDegistir(masaid);

                this.Close();
                frmMasalar frm = new frmMasalar();
                frm.Show();
            }
        }
Ejemplo n.º 3
0
        private void frmMasalar_Load(object sender, EventArgs e)
        {
            this.WindowState = System.Windows.Forms.FormWindowState.Maximized;

            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 (Convert.ToInt32(dr["ID"]) < 10)
                        {
                            if (item.Name == "btnMasa0" + dr["ID"].ToString() && dr["DURUM"].ToString() == "1")
                            {
                                item.BackgroundImage = (System.Drawing.Image)(Properties.Resources.yesil);
                            }
                            else if (item.Name == "btnMasa0" + dr["ID"].ToString() && dr["DURUM"].ToString() == "2")
                            {
                                cMasalar ms = new cMasalar();

                                //DateTime dt1 = Convert.ToDateTime(ms.SessionSum());
                                //DateTime dt2 = DateTime.Now;

                                //string st1 = Convert.ToDateTime(ms.SessionSum(1)).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.", fark.Days) : " ",
                                //    fark.Hours > 0 ? string.Format("{0}S.", fark.Hours) : " ",
                                //    fark.Minutes > 0 ? string.Format("{0}Dk.", fark.Minutes) : "").Trim() + "\nMasa" + dr["ID"].ToString();

                                item.BackgroundImage = (System.Drawing.Image)(Properties.Resources.kirmizi);
                            }
                        }



                        else if (Convert.ToInt32(dr["ID"]) >= 10)
                        {
                            if (item.Name == "btnMasa" + dr["ID"].ToString() && dr["DURUM"].ToString() == "1")
                            {
                                item.BackgroundImage = (System.Drawing.Image)(Properties.Resources.yesil);
                            }
                            else if (item.Name == "btnMasa" + dr["ID"].ToString() && dr["DURUM"].ToString() == "2")
                            {
                                cMasalar ms = new cMasalar();

                                //DateTime dt1 = Convert.ToDateTime(ms.SessionSum());
                                //DateTime dt2 = DateTime.Now;

                                //string st1 = Convert.ToDateTime(ms.SessionSum(1)).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.", fark.Days) : " ",
                                //    fark.Hours > 0 ? string.Format("{0}S.", fark.Hours) : " ",
                                //    fark.Minutes > 0 ? string.Format("{0}Dk.", fark.Minutes) : "").Trim() + "\nMasa" + dr["ID"].ToString();

                                item.BackgroundImage = (System.Drawing.Image)(Properties.Resources.kirmizi);
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 4
0
        private void btnSiparis_Click(object sender, EventArgs e)
        {
            /*
             * 1-masa boş
             * 2-masa dolu
             */

            cMasalar Masa        = new cMasalar();
            cAdisyon NewAddition = new cAdisyon();
            cSiparis SaveOrder   = new cSiparis();

            frmMasalar ms = new frmMasalar();

            bool sonuc = false;


            if (Masa.TableGetByState(TableId, 1) == true)
            {
                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)
            {
                if (lvYeniEklenenler.Items.Count > 0)
                {
                    for (int i = 0; i < lvYeniEklenenler.Items.Count; i++)
                    {
                        SaveOrder.MasaId    = TableId;
                        SaveOrder.Adet      = Convert.ToInt32(lvYeniEklenenler.Items[i].SubItems[2].Text);
                        SaveOrder.AdisyonId = NewAddition.GetByAddition(TableId);
                        SaveOrder.UrunId    = Convert.ToInt32(lvYeniEklenenler.Items[i].SubItems[1].Text);
                        SaveOrder.SetSaveOrder(SaveOrder);
                    }
                }

                if (silinenler.Count > 0)
                {
                    foreach (string item in silinenler)
                    {
                        SaveOrder.SetDeleteOrder(Convert.ToInt32(item));
                    }
                }

                this.Close();
                ms.Show();
            }
        }