private void OpenProductsSelectedDialogForm(DataGridViewCellEventArgs e) { DataGridViewRow row = grvProductList.Rows[e.RowIndex]; int productId = int.Parse(row.Cells[Constant.ProductSearch.ProductGridColumnName.PRODUCT_ID].Value.ToString()); JSManagementDataSet.ProductDataTable prod = productTableAdapter.GetDataByProductId(productId); ProductsSelectedDialogForm proSelectedDialogForm = new ProductsSelectedDialogForm(); Label lbProductCode = proSelectedDialogForm.Controls.Find(Constant.ProductsSelectedDialog.PRODUCT_CODE_LABEL_CONTROL_NAME, true)[0] as Label; Label lbProductType = proSelectedDialogForm.Controls.Find(Constant.ProductsSelectedDialog.PRODUCT_TYPE_LABEL_CONTROL_NAME, true)[0] as Label; Label lbProductBrand = proSelectedDialogForm.Controls.Find(Constant.ProductsSelectedDialog.PRODUCT_BRAND_LABEL_CONTROL_NAME, true)[0] as Label; Label lbProdId = proSelectedDialogForm.Controls.Find(Constant.ProductsSelectedDialog.PROD_ID_LABEL_CONTROL_NAME, true)[0] as Label; lbProductCode.Text = prod[0].ProductCode; lbProductType.Text = prod[0].ProductType; lbProductBrand.Text = prod[0].Brand; lbProdId.Text = prod[0].ProdId.ToString(); proSelectedDialogForm.isWorkingOnOutputOrder = true; proSelectedDialogForm.OutputTypeCode = this.OutputTypeCode; proSelectedDialogForm.StartPosition = FormStartPosition.CenterScreen; proSelectedDialogForm.ShowDialog(); this.Close(); }
private void PassProductInforToProductInputForm(DataGridViewCellEventArgs e) { DataGridViewRow row = grvProductList.Rows[e.RowIndex]; string prodId = row.Cells[Constant.ProductSearch.ProductGridColumnName.ProdId].Value.ToString(); string productId = row.Cells[Constant.ProductSearch.ProductGridColumnName.PRODUCT_ID].Value.ToString(); string productCode = row.Cells[Constant.ProductSearch.ProductGridColumnName.PRODUCT_CODE].Value.ToString(); string brand = row.Cells[Constant.ProductSearch.ProductGridColumnName.BRAND].Value.ToString(); string productType = row.Cells[Constant.ProductSearch.ProductGridColumnName.PRODUCT_TYPE].Value.ToString(); string productCost = row.Cells[Constant.ProductSearch.ProductGridColumnName.PRODUCT_COST].Value.ToString(); string price = row.Cells[Constant.ProductSearch.ProductGridColumnName.PRICE].Value.ToString(); string size = row.Cells[Constant.ProductSearch.ProductGridColumnName.SIZE].Value.ToString(); string openingBalance = row.Cells[Constant.ProductSearch.ProductGridColumnName.OPENING_BALANCE].Value.ToString(); string input = row.Cells[Constant.ProductSearch.ProductGridColumnName.INPUT].Value.ToString(); string output = row.Cells[Constant.ProductSearch.ProductGridColumnName.OUTPUT].Value.ToString(); string closingBalance = row.Cells[Constant.ProductSearch.ProductGridColumnName.CLOSING_BALANCE].Value.ToString(); if (Setting.GetBoolSetting(Constant.Setting.Select_Multi_Product_On_Input)) { ProductsSelectedDialogForm proSelectedDialogForm = new ProductsSelectedDialogForm(); Label lbProductCode = proSelectedDialogForm.Controls.Find(Constant.ProductsSelectedDialog.PRODUCT_CODE_LABEL_CONTROL_NAME, true)[0] as Label; Label lbProductType = proSelectedDialogForm.Controls.Find(Constant.ProductsSelectedDialog.PRODUCT_TYPE_LABEL_CONTROL_NAME, true)[0] as Label; Label lbProductBrand = proSelectedDialogForm.Controls.Find(Constant.ProductsSelectedDialog.PRODUCT_BRAND_LABEL_CONTROL_NAME, true)[0] as Label; Label lbProdId = proSelectedDialogForm.Controls.Find(Constant.ProductsSelectedDialog.PROD_ID_LABEL_CONTROL_NAME, true)[0] as Label; lbProductCode.Text = productCode; lbProductType.Text = productType; lbProductBrand.Text = brand; lbProdId.Text = prodId; proSelectedDialogForm.isWorkingOnInputOrder = true; proSelectedDialogForm.StartPosition = FormStartPosition.CenterScreen; proSelectedDialogForm.ShowDialog(); return; } FormCollection fc = Application.OpenForms; Form productInputForm = new Form(); foreach (Form f in fc) { if (f.Name == "productInputForm") { productInputForm = f; } } DataGridView grvProducts = productInputForm.Controls.Find("grvProducts", true)[0] as DataGridView; grvProducts.Rows[grvProducts.CurrentCell.RowIndex].Cells[0].Value = productCode; grvProducts.Rows[grvProducts.CurrentCell.RowIndex].Cells[1].Value = productType; grvProducts.Rows[grvProducts.CurrentCell.RowIndex].Cells[1].ReadOnly = true; grvProducts.Rows[grvProducts.CurrentCell.RowIndex].Cells[2].Value = brand; grvProducts.Rows[grvProducts.CurrentCell.RowIndex].Cells[2].ReadOnly = true; grvProducts.Rows[grvProducts.CurrentCell.RowIndex].Cells[3].Value = size; grvProducts.Rows[grvProducts.CurrentCell.RowIndex].Cells[3].ReadOnly = true; grvProducts.Rows[grvProducts.CurrentCell.RowIndex].Cells[4].Value = Setting.GetIntergerSetting("ProductInputQuantity") == 0 ? 1 : Setting.GetIntergerSetting("ProductInputQuantity"); grvProducts.Rows[grvProducts.CurrentCell.RowIndex].Cells[7].Value = productId; grvProducts.Rows[grvProducts.CurrentCell.RowIndex].Cells[7].ReadOnly = true; //grvProducts.Rows[purchaseReceiptOrderProductGridRowIndex].Cells[10].Value = 0; //grvProducts.Rows[purchaseReceiptOrderProductGridRowIndex].Cells[11].Value = 0; this.Close(); }