Beispiel #1
0
        public Room(RoomDAO room)
        {
            InitializeComponent();

            this.room = room;

            // set the start position
            this.StartPosition = FormStartPosition.Manual;
            this.Location      = new Point(400, 100);
        }
Beispiel #2
0
        public AddRoom(RoomDAO roomDAO)
        {
            InitializeComponent();

            this.roomDAO  = roomDAO;
            this.isUpdate = true;

            // set the start position
            this.StartPosition = FormStartPosition.Manual;
            this.Location      = new Point(600, 250);
        }
Beispiel #3
0
        private void RenderDataQLPT()
        {
            // get phong tro
            StringBuilder query = new StringBuilder();

            query.Append("SELECT * FROM PHONGTRO ");

            SqlConnection conn = new SqlConnection(Program.getConnectionString());

            conn.Open();
            SqlDataAdapter da = new SqlDataAdapter(query.ToString(), conn);
            DataSet        ds = new DataSet();

            da.Fill(ds, "PHONGTRO");
            conn.Close();

            int spaceCol = -50;

            foreach (DataRow row in ds.Tables["PHONGTRO"].Rows)
            {
                // pass data to roomDAO
                RoomDAO room = new RoomDAO();
                room.Id             = row["MAPT"].ToString();
                room.Price          = Convert.ToDecimal(row["GIATHUE"]);
                room.NumberOfPeople = Convert.ToInt32(row["SONGUOI"]);
                room.Description    = row["MOTA"].ToString();
                rooms.Add(room);

                // get X of button
                spaceCol = getSpaceCol(buttons.Count, spaceCol, numPerRow);

                MaterialRaisedButton newButton = new MaterialRaisedButton();
                newButton.AutoSize = false;
                //newButton.AutoSizeMode = AutoSizeMode.GrowAndShrink;
                newButton.Depth      = 0;
                newButton.Icon       = null;
                newButton.Location   = new Point(spaceCol, getSpaceRow(buttons.Count, numPerRow));
                newButton.MouseState = MouseState.HOVER;
                newButton.Name       = row["MAPT"].ToString();
                newButton.Primary    = true;
                newButton.Size       = new Size(80, 80);
                newButton.TabIndex   = 0;
                newButton.Text       = row["MAPT"].ToString();
                newButton.UseVisualStyleBackColor = true;

                // Add a Button Click Event handler
                newButton.Click += new EventHandler(newButton_Click);

                buttons.Add(newButton);
                this.tabPageQLPT.Controls.Add(newButton);
            }

            // add button to add a new room

            // get X of button
            spaceCol = getSpaceCol(buttons.Count, spaceCol, numPerRow);

            MaterialRaisedButton addButton = new MaterialRaisedButton();

            addButton.AutoSize = false;
            //newButton.AutoSizeMode = AutoSizeMode.GrowAndShrink;
            addButton.Depth      = 0;
            addButton.Icon       = null;
            addButton.Location   = new Point(spaceCol, getSpaceRow(buttons.Count, numPerRow));
            addButton.MouseState = MouseState.HOVER;
            addButton.Name       = "addRoom";
            addButton.Primary    = true;
            addButton.Size       = new Size(80, 80);
            addButton.TabIndex   = 0;
            addButton.Text       = "+";
            addButton.UseVisualStyleBackColor = true;

            addButton.Click += new EventHandler(addButton_Click);
            buttons.Add(addButton);

            this.tabPageQLPT.Controls.Add(addButton);
        }