Пример #1
0
        public Offer(TableSystem TS)
        {
            InitializeComponent();
            this.TS = TS;

            PeopleCount.Maximum = TS.ChairCount;
        }
Пример #2
0
        private void TBL_Click(object sender, EventArgs e)
        {
            TableSystem TS = null;

            if (Reserve != null)
            {
                TS = Reserve(this);
            }

            Offer OF = new Offer(TS);

            OF.ShowDialog();
        }
Пример #3
0
        private void UpdateLocations()
        {
            foreach (TableView TW in TableViews)
            {
                this.Controls.Remove(TW.TBL);
                this.Controls.Remove(TW.P);
                this.Controls.Remove(TW.M);
            }
            TableViews.Clear();

            Tables = Server.Deserialize <Table>(Server.PostQuery(Constants.QueryURL, "query=SELECT * FROM TBL WHERE hall_id=" + H.id + "&pas=Delishes228"));

            DateTime N = DateTime.Now;

            List <Table> Reserved = Server.Deserialize <Table>(Server.PostQuery(Constants.QueryURL,
                                                                                "query=SELECT T.id FROM " +
                                                                                "offer O, TBL T, tbl_offer TOF " +
                                                                                "WHERE T.id = TOF.tbl_id AND TOF.offer_id = O.id AND '" +
                                                                                N.Year + "-" + N.Month + "-" + N.Day + " " + N.Hour + ":" + N.Minute + ":" + N.Second + "' BETWEEN " +
                                                                                "O.time_start AND O.time_end;&pas=Delishes228"));


            foreach (Table T in Tables)
            {
                TableView TW = new TableView(T, edit_mode);

                this.Controls.Add(TW.TBL);
                this.Controls.Add(TW.P);
                this.Controls.Add(TW.M);
                TableViews.Add(TW);

                if (edit_mode)
                {
                    TW.TableMove  += Validate;
                    TW.TableMoved += TW_TableMoved;
                    TW.Destroyed  += TW_Destroyed;
                    this.KeyDown  += TW.KeyDown;
                }
                else
                {
                    TW.Reserve += TW_Reserve;

                    foreach (Table R in Reserved)
                    {
                        if (R.id == T.id)
                        {
                            TW.TBL.BackColor = Color.Red;
                            TW.T.moveable    = 0;
                        }
                    }
                }
                TableSystem TS = new TableSystem();
                TS.Tables.Add(TW);
                TableSystems.Add(TS);

                foreach (TableView TWW in TableViews)
                {
                    if (TW.T.id != TWW.T.id && Table.Intersects(TW.T, TWW.T) && Table.Intersects(TWW.T, TW.T))
                    {
                        int T2Side = Table.GetIntersectionSide(TW.T, TWW.T);
                        int OP     = Table.GetIntersectionSide(TWW.T, TW.T);

                        if (TW.Connected[T2Side / 2 - 1] != null || TWW.Connected[OP / 2 - 1] != null)
                        {
                            continue;
                        }

                        ReMergeTables(TW, TWW, T2Side, OP);
                    }
                }
            }
        }