private void btCreate_Click(object sender, EventArgs e) { try { FormCreateCardboardProfile dlg = new FormCreateCardboardProfile(); if (DialogResult.OK == dlg.ShowDialog()) { // get client PLMPackServiceClient client = WCFClientSingleton.Instance.Client; client.CreateNewCardboardProfile(dlg.ProfileName, dlg.Description, dlg.Code, dlg.Thickness); // fill list view again FillListView(); } } catch (Exception ex) { _log.Debug(ex.ToString()); } }
private void bnModify_Click(object sender, System.EventArgs e) { try { // get client PLMPackServiceClient client = WCFClientSingleton.Instance.Client; if (listViewProfile.SelectedIndices.Count > 0) { // get selected item int iSel = this.listViewProfile.SelectedIndices[0]; ListViewItem item = listViewProfile.Items[iSel]; DCCardboardProfile currentCardboardProfile = client.GetCardboardProfileByID((int)item.Tag); FormCreateCardboardProfile dlg = new FormCreateCardboardProfile(); dlg.ProfileName = currentCardboardProfile.Name; dlg.Code = currentCardboardProfile.Code; dlg.Thickness = currentCardboardProfile.Thickness; if (DialogResult.OK == dlg.ShowDialog()) { // set new values currentCardboardProfile.Name = dlg.ProfileName; currentCardboardProfile.Code = dlg.Code; currentCardboardProfile.Thickness = dlg.Thickness; // update database client.UpdateCardboardProfile(currentCardboardProfile); // refill list view FillListView(); // select current item listViewProfile.Items[iSel].Selected = true; } } } catch (Exception ex) { _log.Error(ex.ToString()); } }