Пример #1
0
        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);
        }
Пример #2
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.Resource.bos);
                        }
                        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();
                            //denee
                            //item.BackgroundImage = (System.Drawing.Image)(Properties.Resource.dolu);
                        }
                        else if (item.Name == "btnMasa" + dr["ID"].ToString() && dr["DURUM"].ToString() == "3")
                        {
                            //item.BackgroundImage = (System.Drawing.Image)(Properties.Resources.acikmasa);
                        }
                        else if (item.Name == "btnMasa" + dr["ID"].ToString() && dr["DURUM"].ToString() == "4")
                        {
                            //item.BackgroundImage = (System.Drawing.Image)(Properties.Resources.rezervasyon);
                        }
                    }
                }
            }
        }
Пример #3
0
        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();
                }
            }
        }