public void getDatagridDetails() { List <ServiceModeModel> lstServiceMode = new List <ServiceModeModel>(); ServiceModeModel service = new ServiceModeModel(); try { queryString = "SELECT ID, serviceType AS 'SERVICE TYPE' FROM dbspa.tblservicemode WHERE isDeleted = 0"; MySqlDataReader reader = conDB.getSelectConnection(queryString, null); while (reader.Read()) { service.ID1 = reader["ID"].ToString(); service.ServiceType = reader["SERVICE TYPE"].ToString(); lstServiceMode.Add(service); service = new ServiceModeModel(); } dgvServiceMode.ItemsSource = lstServiceMode; conDB.closeConnection(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void fillComboBoxServiceMode(ComboBox combo) { try { queryString = "SELECT ID, serviceType FROM dbspa.tblservicemode WHERE (isDeleted = 0)"; MySqlDataReader reader = conDB.getSelectConnection(queryString, null); while (reader.Read()) { ServiceModeModel smm = new ServiceModeModel(); smm.ID1 = reader["ID"].ToString(); smm.ServiceType = reader["serviceType"].ToString(); combo.Items.Add(smm); if (clientModel != null) { if (smm.ID1.Equals(clientModel.ServiceMode)) { combo.SelectedItem = smm; } } } conDB.closeConnection(); } catch (Exception ex) { System.Windows.MessageBox.Show(ex.Message); } }
private void btnEdit_Click(object sender, RoutedEventArgs e) { ServiceModeModel smm = dgvServiceMode.SelectedItem as ServiceModeModel; if (smm != null) { int id = Convert.ToInt32(smm.ID1); smm.IfEditDetails = true; ServiceModeDetails cd = new ServiceModeDetails(this, smm); cd.ShowDialog(); } else { MessageBox.Show("No record selected!"); } }
private void loadDataGridDetails() { List <ServiceModeModel> lstServiceMode = new List <ServiceModeModel>(); ServiceModeModel serviceMode = new ServiceModeModel(); queryString = "SELECT ID, serviceType AS 'SERVICE TYPE' FROM dbspa.tblservicemode WHERE isDeleted = 0"; MySqlDataReader reader = conDB.getSelectConnection(queryString, null); while (reader.Read()) { serviceMode.ID1 = reader["ID"].ToString(); serviceMode.ServiceType = reader["SERVICE TYPE"].ToString(); lstServiceMode.Add(serviceMode); serviceMode = new ServiceModeModel(); } conDB.closeConnection(); serviceModeWindow.dgvServiceMode.ItemsSource = lstServiceMode; }
private void btnDelete_Click(object sender, RoutedEventArgs e) { System.Windows.Forms.DialogResult dialogResult = System.Windows.Forms.MessageBox.Show("Are you sure you want to Delete record?", "Delete Record", System.Windows.Forms.MessageBoxButtons.YesNo); if (dialogResult == System.Windows.Forms.DialogResult.Yes) { ServiceModeModel sm = dgvServiceMode.SelectedItem as ServiceModeModel; if (sm != null) { int id = Convert.ToInt32(sm.ID1); if (id != 0) { deleteClientRecord(id); MessageBox.Show("Record deleted successfuly!"); } } else { MessageBox.Show("No record selected!"); } } }
public ServiceModeDetails(ServiceModeWindow sm, ServiceModeModel smm) { serviceModel = smm; serviceModeWindow = sm; InitializeComponent(); }