Exemplo n.º 1
0
        private void EntryTableControl_viewClick(object sender, EventArgs e)
        {
            EntryTableControl entry = (EntryTableControl)sender;

            entry.table.ShowDialog();
            if (dBConnection.IsConnect())
            {
                dataGridView1.DataSource = dBConnection.currentOrderTable();
            }
        }
Exemplo n.º 2
0
        private void removeEntryAt(int pos)
        {
            int tableNum = entries[pos].Num;

            long id = Int64.Parse(entries[pos].Table_id.ToString());

            string filePath = "datas/" + tableNum + "_" + +id + ".bin";

            //Console.WriteLine("DELETING FILE: " + filePath);
            System.IO.File.Delete(filePath);

            tableListNum.RemoveAt(pos);

            EntryTableControl entry = entries[pos];

            entries.RemoveAt(pos);
            flowLayoutPanel1.Controls.Remove(entry);
        }
Exemplo n.º 3
0
        private void EntryTableControl_mergeClick(object sender, EventArgs e)
        {
            EntryTableControl entry = (EntryTableControl)sender;
            int pos = entries.IndexOf(entry);

            if (entries.Count > 1)
            {
                int srcNum = entries[pos].Num;

                FrmMerge frmMerge = new FrmMerge(srcNum, tableListNum);
                frmMerge.ShowDialog();
                int desNum = frmMerge.DesNum;

                int srcPos = tableListNum.IndexOf(srcNum);
                int desPos = tableListNum.IndexOf(desNum);
                mergeTables(srcPos, desPos);
            }
        }
Exemplo n.º 4
0
        private void createNewEntryTable(int num, bool isNew, long id)
        {
            tableListNum.Add(num);
            Console.WriteLine("Creating new Entry:  Num = {0} ID={1}", num, id);
            EntryTableControl entryTableControl;

            if (id != -1)
            {
                entryTableControl             = new EntryTableControl(num, id);
                entryTableControl.table.isNew = isNew;
            }
            else
            {
                entryTableControl             = new EntryTableControl(num, -1);
                entryTableControl.table.isNew = isNew;
            }


            if (!System.IO.Directory.Exists("datas"))
            {
                System.IO.Directory.CreateDirectory("datas/");
            }

            //entries.Add(entryTableControl);
            entries.Insert(0, entryTableControl);
            flowLayoutPanel1.Controls.Add(entryTableControl);
            flowLayoutPanel1.Controls.SetChildIndex(entryTableControl, 0);
            flowLayoutPanel1.ResumeLayout();
            entryTableControl.deleteClick += EntryTableControl_delete;
            entryTableControl.mergeClick  += EntryTableControl_mergeClick;
            entryTableControl.viewClick   += EntryTableControl_viewClick;
            entryTableControl.payedEvent  += EntryTableControl_payedEvent;

            // int tableNum = entryTableControl.Num;
            int    tableNum = num;
            string filePath = "datas/" + tableNum + "_" + id + ".bin";

            if (!System.IO.File.Exists(filePath))
            {
                var myFile = System.IO.File.Create(filePath);
                myFile.Close();
            }
        }
Exemplo n.º 5
0
        private void EntryTableControl_delete(object sender, EventArgs e)
        {
            DialogResult dialogResult = MessageBox.Show("Xóa Bàn Này?", "Chú Ý", MessageBoxButtons.YesNo);

            if (dialogResult == DialogResult.No)
            {
                return;
            }
            else
            {
                EntryTableControl entry = (EntryTableControl)sender;
                int pos = entries.IndexOf(entry);

                if (dBConnection.IsConnect())
                {
                    long table_id = entries[pos].Table_id;
                    dBConnection.deleteFromCurrentTable(table_id);
                }
                removeEntryAt(pos);
                dataGridView1.DataSource = dBConnection.currentOrderTable();
            }
        }
Exemplo n.º 6
0
        private void EntryTableControl_payedEvent(object sender, EventArgs e)
        {
            EntryTableControl entry = (EntryTableControl)sender;

            entry.BackColor = Color.Empty;
        }