private void btnUpdate_Click(object sender, EventArgs e) { Studentsc us = new Studentsc(); { us.Fname = txtFname.Text; us.Lname = txtLname.Text; us.Adone = txtAdone.Text; us.Adtwo = txtAddtwo.Text; us.City = txtCity.Text; us.Number = txtNum.Text; us.Nic = txtNic.Text; us.Jdate = cmbBatch.Text; us.Username = txtUsername.Text; us.Password = txtPassword.Text; }; Service1Client service = new Service1Client(); if (service.UpdateStudents(us) == 1) { MessageBox.Show("Successfully Updated"); TableLoad(); } else { MessageBox.Show("Error.. Please Try Again"); } }
private void btnSearch_Click(object sender, EventArgs e) { Studentsc u = new Studentsc(); Service1Client service = new Service1Client(); u = service.SearchStuForm(txtUsername.Text); if (u != null) { txtFname.Text = u.Fname; txtLname.Text = u.Lname; txtAdone.Text = u.Adone; txtAddtwo.Text = u.Adtwo; txtCity.Text = u.City; txtNum.Text = u.Number; dateTimePicker2.Text = u.Byear; txtNic.Text = u.Nic; cmbFac.Text = u.Faculty; cmbBatch.Text = u.Jdate; txtUsername.Text = u.Username; txtPassword.Text = u.Password; } else { MessageBox.Show("Invalid Username !! Try Again !!"); } }
private void btnSave_Click(object sender, EventArgs e) { Studentsc sdc = new Studentsc(); sdc.Fname = txtFname.Text; sdc.Lname = txtLname.Text; sdc.Adone = txtAdone.Text; sdc.Adtwo = txtAddtwo.Text; sdc.City = txtCity.Text; sdc.Number = txtNum.Text; sdc.Byear = dateTimePicker2.Text; sdc.Nic = txtNic.Text; sdc.Faculty = cmbFac.SelectedItem.ToString(); sdc.Jdate = cmbBatch.Text; sdc.Username = txtUsername.Text; sdc.Password = txtPassword.Text; Service1Client service = new Service1Client(); if (service.SaveStudents(sdc) == 1) { MessageBox.Show("Successfully Saved"); TableLoad(); } else { MessageBox.Show("Error.. Please Try Again"); } }
private void btnStusearch_Click(object sender, EventArgs e) { List <Studentsc> stus = new List <Studentsc>(); Studentsc ts = new Studentsc(); { ts.Username = txtUsername.Text; }; Service2Client service = new Service2Client(); stus.Add(service.SearchStudents(ts)); dataGridView2.DataSource = stus; }
private void btnDelete_Click(object sender, EventArgs e) { Studentsc dstu = new Studentsc(); { dstu.Username = txtUsername.Text; }; Service1Client service = new Service1Client(); if (service.DeleteStudents(dstu) == 1) { MessageBox.Show("Successfully Deleted"); TableLoad(); } else { MessageBox.Show("Error.. Please Try Again"); } }