private void btnSave_Click(object sender, EventArgs e) { try { productTestDesc ptdesc = new productTestDesc(); ProductTestDescriptionDB ptdescDB = new ProductTestDescriptionDB(); ptdesc.TestDescriptionID = txtTestDescID.Text; ptdesc.TestDescription = txtTestDesc.Text; ptdesc.Status = ComboFIll.getStatusCode(cmbStatus.SelectedItem.ToString()); System.Windows.Forms.Button btn = sender as System.Windows.Forms.Button; string btnText = btn.Text; { if (btnText.Equals("Update")) { if (ptdescDB.updateProductTestDescription(ptdesc)) { MessageBox.Show("Document Status updated"); closeAllPanels(); ListProductTestDesc(); } else { MessageBox.Show("Failed to update Document Status"); } } else if (btnText.Equals("Save")) { if (ptdescDB.validateProductTestDescription(ptdesc)) { if (ptdescDB.insertProductTestDescription(ptdesc)) { MessageBox.Show("Document data Added"); closeAllPanels(); ListProductTestDesc(); } else { MessageBox.Show("Failed to Insert Document"); } } else { MessageBox.Show("Document Data Validation failed"); } } } } catch (Exception) { MessageBox.Show("Failed Adding / Editing User Data"); } }
private void ShowTestDescriptionIDListView() { //removeControlsFromPnlLvPanel(); //pnllv = new Panel(); //pnllv.BorderStyle = BorderStyle.FixedSingle; //pnllv.Bounds = new Rectangle(new Point(100, 100), new Size(600, 300)); frmPopup = new Form(); frmPopup.StartPosition = FormStartPosition.CenterScreen; frmPopup.BackColor = Color.CadetBlue; frmPopup.MaximizeBox = false; frmPopup.MinimizeBox = false; frmPopup.ControlBox = false; frmPopup.FormBorderStyle = FormBorderStyle.FixedSingle; frmPopup.Size = new Size(450, 300); lv = ProductTestDescriptionDB.getTestDescriptionListView(); //this.lv.ItemChecked += new System.Windows.Forms.ItemCheckedEventHandler(this.listView3_ItemChecked); lv.Bounds = new Rectangle(new Point(0, 0), new Size(450, 250)); frmPopup.Controls.Add(lv); Button lvOK = new Button(); lvOK.BackColor = Color.Tan; lvOK.Text = "OK"; lvOK.Location = new Point(40, 265); lvOK.Click += new System.EventHandler(this.lvOK_Click2); frmPopup.Controls.Add(lvOK); Button lvCancel = new Button(); lvCancel.BackColor = Color.Tan; lvCancel.Text = "CANCEL"; lvCancel.Location = new Point(130, 265); lvCancel.Click += new System.EventHandler(this.lvCancel_Click2); frmPopup.Controls.Add(lvCancel); frmPopup.ShowDialog(); //pnlAddEdit.Controls.Add(pnllv); //pnllv.BringToFront(); //pnllv.Visible = true; }
private void ListProductTestDesc() { try { grdList.Rows.Clear(); ProductTestDescriptionDB ptDescDB = new ProductTestDescriptionDB(); List <productTestDesc> PTDescList = ptDescDB.getProductTestDescriptionList(); foreach (productTestDesc ptdesc in PTDescList) { grdList.Rows.Add(ptdesc.TestDescriptionID, ptdesc.TestDescription, ComboFIll.getStatusString(ptdesc.Status), ptdesc.CreateUser, ptdesc.CreateTime); //dbrecord.getEmpStatusString(emp.empStatus), emp.empPhoto); } } catch (Exception ex) { } enableBottomButtons(); pnlDocumentList.Visible = true; }