private Boolean AddBOMDetailRow() { Boolean status = true; try { if (grdBOMDetail.Rows.Count > 0) { verifyAndReworkBOMDetailGridRows(); } grdBOMDetail.Rows.Add(); int kount = grdBOMDetail.RowCount; grdBOMDetail.Rows[kount - 1].Cells[0].Value = kount; DataGridViewComboBoxCell ComboColumn1 = (DataGridViewComboBoxCell)(grdBOMDetail.Rows[kount - 1].Cells[1]); StockItemDB.fillStockItemGridViewCombo(ComboColumn1, ""); ComboColumn1.DropDownWidth = 300; grdBOMDetail.Rows[kount - 1].Cells[2].Value = 0; grdBOMDetail.Rows[kount - 1].Cells[3].Value = 0; grdBOMDetail.Rows[kount - 1].Cells[4].Value = 0; grdBOMDetail.Rows[kount - 1].Cells[5].Value = 0; grdBOMDetail.Rows[kount - 1].Cells[7].Value = 0; var BtnCell = (DataGridViewButtonCell)grdBOMDetail.Rows[kount - 1].Cells[6]; BtnCell.Value = "Del"; grdBOMDetail.Rows[kount - 1].Cells[0].ReadOnly = true; grdBOMDetail.Rows[kount - 1].Cells[3].ReadOnly = true; grdBOMDetail.Rows[kount - 1].Cells[5].ReadOnly = true; } catch (Exception ex) { MessageBox.Show("AddBOMDetailRow() : Error"); } return(status); }
private void grdList_CellContentClick(object sender, DataGridViewCellEventArgs e) { try { if (e.RowIndex < 0) { return; } if (e.ColumnIndex == 5) { captureChange = false; int rowID = e.RowIndex; btnSave.Text = "Update"; cmbProduct.SelectedIndex = cmbProduct.FindStringExact(grdList.Rows[e.RowIndex].Cells[0].Value.ToString()); txtDetails.Text = grdList.Rows[e.RowIndex].Cells[2].Value.ToString(); txtCost.Text = grdList.Rows[e.RowIndex].Cells[3].Value.ToString(); cmbStatus.SelectedIndex = cmbStatus.FindStringExact(grdList.Rows[e.RowIndex].Cells[4].Value.ToString()); DataGridViewRow row = grdList.Rows[rowID]; //get customer bank details BOMDB bomdb = new BOMDB(); List <bomdetail> bomdetails = bomdb.getBOMDetail(grdList.Rows[e.RowIndex].Cells[0].Value.ToString()); grdBOMDetail.Rows.Clear(); int i = 0; foreach (bomdetail bd in bomdetails) { AddBOMDetailRow(); grdBOMDetail.Rows[i].Cells[0].Value = i + 1; //DataGridViewComboBoxCell ComboColumn1 = new DataGridViewComboBoxCell(); //StockItemDB.fillTaxItemGridViewCombo(ComboColumn1,""); //grdBOMDetail.Rows[i].Cells[1] = ComboColumn1; //grdBOMDetail.Rows[i].Cells[1].Value = bd.Name; DataGridViewComboBoxCell ComboColumn1 = new DataGridViewComboBoxCell(); StockItemDB.fillStockItemGridViewCombo(ComboColumn1, ""); grdBOMDetail.Rows[i].Cells[1].Value = bd.StockItemID + "-" + bd.Name; grdBOMDetail.Rows[i].Cells[2].Value = bd.Quantity; grdBOMDetail.Rows[i].Cells[3].Value = bd.PurchasePrice; grdBOMDetail.Rows[i].Cells[4].Value = bd.CustomPrice; i++; } cmbProduct.SelectedIndex = cmbProduct.FindString(grdList.Rows[e.RowIndex].Cells[0].Value.ToString()); cmbProduct.Enabled = false; verifyAndReworkBOMDetailGridRows(); btnSave.Text = "Update"; pnlBOMDetails.Visible = true; pnlBottomActions.Visible = false; captureChange = true; } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void ShowStockListView() { 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(550, 310); lv = StockItemDB.getStockItemListView(); lv.ShowItemToolTips = true; lv.ColumnClick += new ColumnClickEventHandler(LvColumnClick); //this.lv.ItemChecked += new System.Windows.Forms.ItemCheckedEventHandler(this.listView3_ItemChecked); lv.Bounds = new System.Drawing.Rectangle(new System.Drawing.Point(0, 25), new Size(550, 250)); frmPopup.Controls.Add(lv); System.Windows.Forms.Label pnlHeading = new System.Windows.Forms.Label(); pnlHeading.Size = new Size(300, 20); pnlHeading.Location = new System.Drawing.Point(5, 5); pnlHeading.Text = "Select StockItem"; pnlHeading.Font = new System.Drawing.Font("Arial", 10, FontStyle.Bold); pnlHeading.ForeColor = Color.Black; frmPopup.Controls.Add(pnlHeading); System.Windows.Forms.Button lvOK = new System.Windows.Forms.Button(); lvOK.BackColor = Color.Tan; lvOK.Text = "OK"; lvOK.Location = new Point(40, 280); lvOK.Click += new System.EventHandler(this.lvOK_Click2); frmPopup.Controls.Add(lvOK); System.Windows.Forms.Button lvCancel = new System.Windows.Forms.Button(); lvCancel.Text = "CANCEL"; lvCancel.BackColor = Color.Tan; lvCancel.Location = new Point(130, 280); lvCancel.Click += new System.EventHandler(this.lvCancel_Click2); frmPopup.Controls.Add(lvCancel); System.Windows.Forms.Label lblSearch = new System.Windows.Forms.Label(); lblSearch.Text = "Search"; lblSearch.Location = new Point(260, 282); lblSearch.Size = new Size(45, 15); frmPopup.Controls.Add(lblSearch); txtSearch = new System.Windows.Forms.TextBox(); txtSearch.Location = new Point(310, 280); txtSearch.TextChanged += new EventHandler(txtSearch_TextChanged); frmPopup.Controls.Add(txtSearch); frmPopup.ShowDialog(); }
private void ShowStockListView() { //removeControlsFromPnlLvPanel(); //pnllv = new Panel(); //pnllv.BorderStyle = BorderStyle.FixedSingle; //pnllv.Bounds = new System.Drawing.Rectangle(new System.Drawing.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 = StockItemDB.getStockItemListView(); lv.ColumnClick += new ColumnClickEventHandler(LvColumnClick); //this.lv.ItemChecked += new System.Windows.Forms.ItemCheckedEventHandler(this.listView3_ItemChecked); lv.Bounds = new System.Drawing.Rectangle(new System.Drawing.Point(0, 0), new Size(450, 250)); frmPopup.Controls.Add(lv); System.Windows.Forms.Button lvOK = new System.Windows.Forms.Button(); lvOK.BackColor = Color.Tan; lvOK.Text = "OK"; lvOK.Location = new Point(44, 265); lvOK.Click += new System.EventHandler(this.lvOK_Click2); frmPopup.Controls.Add(lvOK); System.Windows.Forms.Button lvCancel = new System.Windows.Forms.Button(); lvCancel.Text = "CANCEL"; lvCancel.BackColor = Color.Tan; lvCancel.Location = new Point(141, 265); lvCancel.Click += new System.EventHandler(this.lvCancel_Click2); frmPopup.Controls.Add(lvCancel); System.Windows.Forms.Label lblSearch = new System.Windows.Forms.Label(); lblSearch.Text = "Search"; lblSearch.Location = new Point(250, 267); lblSearch.Size = new Size(45, 15); frmPopup.Controls.Add(lblSearch); txtSearch = new System.Windows.Forms.TextBox(); txtSearch.Location = new Point(300, 265); txtSearch.TextChanged += new EventHandler(txtSearch_TextChanged); frmPopup.Controls.Add(txtSearch); frmPopup.ShowDialog(); //pnlAddEdit.Controls.Add(pnllv); //pnllv.BringToFront(); //pnllv.Visible = true; }
private void btnSelectSMRNHeaderNo_Click(object sender, EventArgs e) { if (grdProductTestDetail.Rows.Count != 0) { DialogResult dialog = MessageBox.Show("Grid Detail will be removed", "Yes", MessageBoxButtons.YesNo); if (dialog == DialogResult.Yes) { grdProductTestDetail.Rows.Clear(); } else { return; } } removeControlsFromForwarderPanelTV(); tv = new TreeView(); tv.CheckBoxes = true; tv.Nodes.Clear(); tv.CheckBoxes = true; pnlForwarder.BorderStyle = BorderStyle.FixedSingle; pnlForwarder.Bounds = new Rectangle(new Point(100, 10), new Size(700, 300)); tv = StockItemDB.getStockItemTreeView(); tv.Bounds = new Rectangle(new Point(50, 50), new Size(600, 200)); pnlForwarder.Controls.Remove(tv); pnlForwarder.Controls.Add(tv); //tv.cl tv.AfterCheck += new System.Windows.Forms.TreeViewEventHandler(this.tv_AfterCheck); Button lvForwrdOK = new Button(); lvForwrdOK.Text = "OK"; lvForwrdOK.Size = new Size(150, 20); lvForwrdOK.Location = new Point(50, 270); lvForwrdOK.Click += new System.EventHandler(this.tvOK_Click); pnlForwarder.Controls.Add(lvForwrdOK); Button lvForwardCancel = new Button(); lvForwardCancel.Text = "Cancel"; lvForwardCancel.Size = new Size(150, 20); lvForwardCancel.Location = new Point(250, 270); lvForwardCancel.Click += new System.EventHandler(this.tvCancel_Click); pnlForwarder.Controls.Add(lvForwardCancel); ////lvForwardCancel.Visible = false; //tv.CheckBoxes = true; pnlForwarder.Visible = true; pnlAddEdit.Controls.Add(pnlForwarder); pnlAddEdit.BringToFront(); pnlForwarder.BringToFront(); pnlForwarder.Focus(); }
private void showStockItemTreeView() { removeControlsFromForwarderPanelTV(); tv = new TreeView(); tv.CheckBoxes = true; tv.Nodes.Clear(); tv.CheckBoxes = true; pnlForwarder.BorderStyle = BorderStyle.FixedSingle; pnlForwarder.Bounds = new Rectangle(new Point(100, 10), new Size(700, 300)); tv = StockItemDB.getStockItemTreeView(); tv.Bounds = new Rectangle(new Point(50, 50), new Size(600, 200)); pnlForwarder.Controls.Remove(tv); pnlForwarder.Controls.Add(tv); //tv.cl tv.AfterCheck += new System.Windows.Forms.TreeViewEventHandler(this.tv_AfterCheck); Button lvForwrdOK = new Button(); lvForwrdOK.Text = "OK"; lvForwrdOK.Size = new Size(150, 20); lvForwrdOK.Location = new Point(50, 270); lvForwrdOK.Click += new System.EventHandler(this.tvOK_Click); pnlForwarder.Controls.Add(lvForwrdOK); Button lvForwardCancel = new Button(); lvForwardCancel.Text = "Cancel"; lvForwardCancel.Size = new Size(150, 20); lvForwardCancel.Location = new Point(250, 270); lvForwardCancel.Click += new System.EventHandler(this.tvCancel_Click); pnlForwarder.Controls.Add(lvForwardCancel); ////lvForwardCancel.Visible = false; //tv.CheckBoxes = true; pnlForwarder.Visible = true; pnlList.Controls.Add(pnlForwarder); pnlList.BringToFront(); pnlForwarder.BringToFront(); pnlForwarder.Focus(); }
private void initVariables() { fillStatusCombo(cmbStatus); StockItemDB.fillStockItemCombo(cmbProduct, "Products"); }