public void populate() { OfficerDataBase officerDB = new OfficerDataBase(); list_Officer = officerDB.Select_All(); officerGridView.DataSource = list_Officer; }
private void btnDelete_Click(object sender, EventArgs e) { o = new Officer(); o.officerID = Convert.ToInt32(officerGridView.CurrentRow.Cells[0].Value.ToString()); OfficerDataBase officerDB = new OfficerDataBase(); officerDB.delete(o); populate(); }
private void btnSave_Click(object sender, EventArgs e) { OfficerDataBase officerDB = new OfficerDataBase(); o = new Officer(); o.officerName = txtName.Text; o.officerSalary = Convert.ToInt32(txtSalary.Text); o.officerRank = txtRank.Text; o.officerAddress = txtAddress.Text; o.officerPhoneNo = Convert.ToInt64(txtPhoneNumber.Text); o.officerAge = Convert.ToInt32(txtAge.Text); o.officerJoiningDate = txtJoiningDate.Text; o.officerCNIC = Convert.ToInt64(txtCNIC.Text); officerDB.insert(o); populate(); }
private void btnUpdate_Click(object sender, EventArgs e) { OfficerDataBase officerDB = new OfficerDataBase(); o = new Officer(); o.officerID = Convert.ToInt32(officerGridView.CurrentRow.Cells[0].Value.ToString()); o.officerName = txtName.Text; o.officerSalary = Convert.ToInt32(txtSalary.Text); o.officerRank = txtRank.Text; o.officerAddress = txtAddress.Text; o.officerPhoneNo = Convert.ToInt32(txtPhoneNumber.Text); o.officerAge = Convert.ToInt32(txtAge.Text); o.officerJoiningDate = txtJoiningDate.Text; o.officerCNIC = Convert.ToInt32(txtCNIC.Text); officerDB.update(o); populate(); }