Exemple #1
0
        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());
            }
        }
Exemple #2
0
        private void addGridListRows()
        {
            try
            {
                BOMDB    bomdb         = new BOMDB();
                string[] ProductStrArr = prod.Split('-');
                string   ProdID        = ProductStrArr[0];
                string   ProdName      = ProductStrArr[1];
                lblProductCode.Text  = ProdID;
                lblProductname.Text  = ProdName;
                bomList              = bomdb.getBOMDetail(ProdID);
                txtProdQuantity.Text = prodQuant.ToString();
                int QuantTOPrepare = Convert.ToInt32(txtProdQuantity.Text);
                lblModelNo.Text = ModelNo;
                foreach (bomdetail bom in bomList)
                {
                    string stockID    = bom.StockItemID;
                    double totalStock = StockDB.getTotalItemWiseStock(stockID, lblModelNo.Text);

                    grdList.Rows.Add();
                    grdList.Rows[grdList.Rows.Count - 1].Cells["SINO"].Value             = grdList.Rows.Count;
                    grdList.Rows[grdList.Rows.Count - 1].Cells["StockItemID"].Value      = bom.StockItemID;
                    grdList.Rows[grdList.Rows.Count - 1].Cells["StockItemName"].Value    = bom.Name;
                    grdList.Rows[grdList.Rows.Count - 1].Cells["gModelNo"].Value         = "NA";
                    grdList.Rows[grdList.Rows.Count - 1].Cells["RequiredQuantity"].Value = bom.Quantity * QuantTOPrepare;
                    grdList.Rows[grdList.Rows.Count - 1].Cells["StockQunatity"].Value    = totalStock;
                    if ((bom.Quantity * QuantTOPrepare) > totalStock)
                    {
                        grdList.Rows[grdList.Rows.Count - 1].Cells["IssueQuantity"].Value = totalStock;
                    }
                    else
                    {
                        grdList.Rows[grdList.Rows.Count - 1].Cells["IssueQuantity"].Value = bom.Quantity * QuantTOPrepare;
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }