Esempio n. 1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            string blockId     = txtBlockId.Text;
            string blockName   = txtBlockName.Text;
            string gender      = txtGender.Text;
            string description = txtDescription.Text;
            string status      = txtStatus.Text;

            BlockBuilding block = new BlockBuilding();

            block.setBlockId(blockId);
            block.setBlockName(blockName);
            block.setGender(gender);
            block.setDescription(description);
            block.setStatus(status);

            BlockController blockController = new BlockController();
            bool            i = blockController.UpdateBlock(block);

            if (i == true)
            {
                MessageBox.Show("Block Information updated successfully!");
            }
            else
            {
                MessageBox.Show("Block Information is not updated successfully!");
            }
        }
Esempio n. 2
0
        public BlockBuilding SearchBlock(string search)
        {
            BlockBuilding block = new BlockBuilding();
            string        query = "select * from tblblock where blockId='" + search + "';";

            try
            {
                databaseConnection.Open();
                commandDatabase = new MySqlCommand(query, databaseConnection);
                MySqlDataReader reader = commandDatabase.ExecuteReader();

                while (reader.Read())
                {
                    block.setBlockId(reader["blockId"].ToString());
                    block.setBlockName(reader["name"].ToString());
                    block.setGender(reader["gender"].ToString());
                    block.setDescription(reader["description"].ToString());
                    block.setStatus(reader["status"].ToString());
                }
                databaseConnection.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Query Error : " + ex.Message);
            }
            return(block);
        }
Esempio n. 3
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            string block       = txtBlockName.Text;
            string gender      = txtGender.Text;
            string description = txtDescription.Text;
            string status      = txtStatus.Text;

            BlockBuilding blockBuilding = new BlockBuilding();

            blockBuilding.setBlockName(block);
            blockBuilding.setGender(gender);
            blockBuilding.setDescription(description);
            blockBuilding.setStatus(status);

            BlockController blockController = new BlockController();
            bool            i = blockController.AddBlock(blockBuilding);

            if (i == true)
            {
                MessageBox.Show("Block has been added Successfully");
                txtBlockName.Text   = "";
                txtGender.Text      = "";
                txtDescription.Text = "";
                txtStatus.Text      = "";
            }
            else
            {
                MessageBox.Show("Block has not been added");
            }
        }