private void materialRaisedButton1_Click(object sender, EventArgs e) { string fname = sFirstName.Text; string lname = sLastName.Text; string CNIC = txtCNIC.Text; string add = txtAddress.Text; string city = cmdCity.Text; string gender = cmbGender.Text; string dateofbirth = dateOfBirth.Value.ToString(); string religion = cmbReligion.Text; string martial = cmbMarritalStatus.Text; string education = cmbEducation.Text; string email = txtEmail.Text; DataAccessTier.Person dp = new DataAccessTier.Person(); dp.UpdatePerson(Convert.ToInt32(metroComboBox1.Text), fname, lname, CNIC, add, city, gender, dateofbirth, religion, education, martial, email); if (cmbIncomeType.Text != "") { DataTable dt = new DataTable(); dt = dp.SelectRecords(); int id = Convert.ToInt32(dt.Rows[dt.Rows.Count - 1][0]); string income = cmbIncomeType.Text; string occupation = txtOccupation.Text; string org = txtOrganization.Text; string design = txtDesignation.Text; DataAccessTier.Customer cp = new DataAccessTier.Customer(); cp.UpdateCustomer(Convert.ToInt32(metroComboBox1.Text), income, occupation, org, design); } MessageBox.Show("Update Successful"); }
private void EditClient_Load(object sender, EventArgs e) { DataAccessTier.Person dp = new DataAccessTier.Person(); DataTable dt = new DataTable(); dt = dp.SelectRecords(); for (int i = 0; i < dt.Rows.Count; i++) { metroComboBox1.Items.Add(dt.Rows[i][0]); } }
private void btnDelte_Click(object sender, EventArgs e) { int id = Convert.ToInt32(dataGridView1.Rows[dataGridView1.CurrentRow.Index].Cells[0].Value); DataAccessTier.Person dp = new DataAccessTier.Person(); dp.DeletePerson(id); DataAccessTier.Customer cp = new DataAccessTier.Customer(); cp.DeleteCustomer(id); MessageBox.Show("Delete Sucessful"); DataTable dt = new DataTable(); dt = dp.SelectRecords(); dataGridView1.DataSource = dt; }
private void DeleteClient_Load(object sender, EventArgs e) { dataGridView1.BorderStyle = BorderStyle.None; dataGridView1.AlternatingRowsDefaultCellStyle.BackColor = Color.FromArgb(238, 239, 249); dataGridView1.CellBorderStyle = DataGridViewCellBorderStyle.SingleHorizontal; dataGridView1.DefaultCellStyle.SelectionBackColor = Color.Green; dataGridView1.DefaultCellStyle.SelectionForeColor = Color.WhiteSmoke; dataGridView1.BackgroundColor = Color.White; dataGridView1.EnableHeadersVisualStyles = false; dataGridView1.ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle.None; dataGridView1.ColumnHeadersDefaultCellStyle.BackColor = Color.FromArgb(50, 205, 50); dataGridView1.ColumnHeadersDefaultCellStyle.ForeColor = Color.White; DataAccessTier.Person dp = new DataAccessTier.Person(); DataTable dt = new DataTable(); dt = dp.SelectRecords(); dataGridView1.DataSource = dt; }