Exemplo n.º 1
0
        public Boolean addHeadquarter(Headquarter h)
        {
            String query = "INSERT INTO headquarter(building_name, rooms, rent, country, city, street, number, postal_code) VALUES('" + h.Building_name + "', '" + h.Rooms + "', '" + h.Rent + "', '" + h.Country + "', '" + h.City + "', '" + h.Street + "', '" + h.Number + "', '" + h.Postal_code + "')";

            try
            { headquarter.Insert(query); return(true); }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                return(false);
            }
        }
Exemplo n.º 2
0
        public void GetHeadquartersData()
        {
            Headquarter hq = new Headquarter();

            hqList = db1.getHeadquarterList();
            comboBox1.DataSource    = new BindingSource(hqList, null);
            comboBox1.DisplayMember = "Building_name";
            comboBox1.ValueMember   = "Id";
            if (this.projectId != 0)
            {
                comboBox1.SelectedValue = result.Headquarters_Id;
            }
        }
Exemplo n.º 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            Headquarter hqAdd = new Headquarter();

            hqAdd.Building_name = BuildingName.Text;
            hqAdd.Rooms         = Int32.Parse(Rooms.Text);
            hqAdd.Rent          = Int32.Parse(Rent.Text);
            hqAdd.Country       = Country.Text;
            hqAdd.City          = City.Text;
            hqAdd.Street        = Street.Text;
            hqAdd.Number        = Int32.Parse(Number.Text);
            hqAdd.Postal_code   = PostalCode.Text;

            if (db1.addHeadquarter(hqAdd))
            {
                this.Close();
            }
            else
            {
                MessageBox.Show("Headquarter couldn't be added!");
            }
        }
Exemplo n.º 4
0
        public AddEditEmployee(int employeeBsn)
        {
            this.employeeBsn = employeeBsn;
            InitializeComponent();
            if (employeeBsn != 0)
            {
                GetEmployeeData(employeeBsn);
            }
            Headquarter hq = new Headquarter();

            hq.Id            = 2;
            hq.Building_name = "Harvard";

            comboBox1.DataSource        = new BindingSource(db1.getHeadquarterList(), null);
            comboBox1.DisplayMember     = "Building_name";
            comboBox1.ValueMember       = "Id";
            degreeListBox.DataSource    = new BindingSource(db1.getSingleUserDegree(employee_id), null);
            degreeListBox.DisplayMember = "course";
            degreeListBox.ValueMember   = "id";


            //residenceListbox.DataSource = new BindingSource()
            //comboBox1.Items.Add(hq);
        }