private void btnAddService_Click(object sender, EventArgs e) { try { Service_DTO service = new Service_DTO(); service.ServiceID = txtServiceID.Text; service.ServiceName = txtServiceName.Text; service.ServicePrice = float.Parse(txtServicePrice.Text); if (txtServiceID.Text == "" || txtServiceName.Text == "" || txtServicePrice.Text == "") { XtraMessageBox.Show("You have to fullfill service information!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); ClearDisplay(); return; } if (Service_BUS.InsertService(service)) { XtraMessageBox.Show("Service Info has been inserted sucessfully!", "Notification", MessageBoxButtons.OK, MessageBoxIcon.Information); LoadServiceList(); ClearDisplay(); return; } } catch { XtraMessageBox.Show("Insert Info Failed!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } }
public void btnDeleteService_Click(object sender, EventArgs e) { try { Service_DTO service = new Service_DTO(); service.ServiceID = dtgvServiceInfoList.CurrentRow.Cells["ServiceID"].Value.ToString(); service.ServiceName = txtServiceName.Text; if (txtServiceID.Text == "" || txtServiceName.Text == "" || txtServicePrice.Text == "") { XtraMessageBox.Show("You have to choose at least one service to delete!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); ClearDisplay(); return; } if (Service_BUS.DeleteService(service)) { LoadServiceList(); XtraMessageBox.Show("Service Info has been deleted sucessfully!", "Notification", MessageBoxButtons.OK, MessageBoxIcon.Information); ClearDisplay(); return; } } catch { XtraMessageBox.Show("Delete Info Failed!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } }
private void LoadService() { List <Service_DTO> loadService = Service_BUS.LoadService(); cmbServiceName.DataSource = loadService; cmbServiceName.ValueMember = "ServiceID"; cmbServiceName.DisplayMember = "ServiceName"; txtServiceID.Text = cmbServiceName.SelectedValue.ToString(); txtServicePrice.DataBindings.Add("Text", loadService, "ServicePrice"); }
public void LoadServiceList() { List <Service_DTO> service = Service_BUS.LoadService(); dtgvServiceInfoList.DataSource = service; }