コード例 #1
0
 /// <summary>
 /// Function for auto completion of products
 /// </summary>
 public void AutoCompleteProducts()
 {
     ProductSP spProduct = new ProductSP();
     try
     {
         DataTable dtblProducts = new DataTable();
         dtblProducts = spProduct.ProductViewAll();
         ProductNames = new AutoCompleteStringCollection();
         ProductCodes = new AutoCompleteStringCollection();
         foreach (DataRow dr in dtblProducts.Rows)
         {
             ProductNames.Add(dr["productName"].ToString());
             ProductCodes.Add(dr["productCode"].ToString());
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("SJ:44" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
コード例 #2
0
 /// <summary>
 /// AutoCompletion of Product name and Product code
 /// </summary>
 /// <param name="isProductName"></param>
 /// <param name="editControl"></param>
 public void FillProducts(bool isProductName, DataGridViewTextBoxEditingControl editControl)
 {
     ProductSP SpProduct = new ProductSP();
     try
     {
         DataTable dtblProducts = new DataTable();
         dtblProducts = SpProduct.ProductViewAll();
         ProductName = new AutoCompleteStringCollection();
         ProductCode = new AutoCompleteStringCollection();
         foreach (DataRow dr in dtblProducts.Rows)
         {
             ProductName.Add(dr["productName"].ToString());
             ProductCode.Add(dr["productCode"].ToString());
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("SQ:12" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
コード例 #3
0
ファイル: frmProductBom.cs プロジェクト: jsoques/openmiracle
 /// <summary>
 /// To remove the selected product from the list in combo box
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void dgvProductBOM_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
 {
     try
     {
         DataTable dtbl = new DataTable();
         ProductSP spProduct = new ProductSP();
         if (dgvProductBOM.CurrentCell.ColumnIndex == dgvProductBOM.Columns["dgvcmbRawMaterial"].Index)
         {
             if (isCallFromProductCreation)
             {
                 dtbl = spProduct.ProductViewAllWithoutOneProduct(decProductIdForEdit);
             }
             else
             {
                 dtbl = spProduct.ProductViewAll();
             }
             if (dtbl.Rows.Count > 0)
             {
                 if (dgvProductBOM.RowCount > 1)
                 {
                     int inGridRowCount = dgvProductBOM.RowCount;
                     for (int inI = 0; inI < inGridRowCount - 1; inI++)
                     {
                         if (inI != e.RowIndex)
                         {
                             int inTableRowcount = dtbl.Rows.Count;
                             for (int inJ = 0; inJ < inTableRowcount; inJ++)
                             {
                                 if (dgvProductBOM.Rows[inI].Cells["dgvcmbRawMaterial"].Value != null && dgvProductBOM.Rows[inI].Cells["dgvcmbRawMaterial"].Value.ToString() != "")
                                 {
                                     if (dtbl.Rows[inJ]["productId"].ToString() == dgvProductBOM.Rows[inI].Cells["dgvcmbRawMaterial"].Value.ToString())
                                     {
                                         dtbl.Rows.RemoveAt(inJ);
                                         break;
                                     }
                                 }
                             }
                         }
                     }
                 }
                 DataGridViewComboBoxCell dgvccProductBom = (DataGridViewComboBoxCell)dgvProductBOM[dgvProductBOM.Columns["dgvcmbRawMaterial"].Index, e.RowIndex];
                 dgvccProductBom.DataSource = dtbl;
                 DataRow drow = dtbl.NewRow();
                 drow["productName"] = string.Empty;
                 drow["productId"] = 0;
                 dtbl.Rows.InsertAt(drow, 0);
                 dgvccProductBom.ValueMember = "productId";
                 dgvccProductBom.DisplayMember = "productName";
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("PB:28" + ex.Message, "Open Miracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
コード例 #4
0
ファイル: frmProductBom.cs プロジェクト: jsoques/openmiracle
 /// <summary>
 /// RawMaterialComboFill function
 /// </summary>
 public void RawMaterialComboFill()
 {
     try
     {
         DataTable dtbl = new DataTable();
         ProductSP spProduct = new ProductSP();
         if (isCallFromProductCreation)
         {
             dtbl = spProduct.ProductViewAllWithoutOneProduct(decProductIdForEdit);
             dgvcmbRawMaterial.DataSource = dtbl;
             DataRow drow = dtbl.NewRow();
             drow["productName"] = string.Empty;
             drow["productId"] = 0;
             dtbl.Rows.InsertAt(drow, 0);
             dgvcmbRawMaterial.DisplayMember = "productName";
             dgvcmbRawMaterial.ValueMember = "productId";
         }
         else
         {
             dtbl = spProduct.ProductViewAll();
             DataRow drow = dtbl.NewRow();
             drow["productName"] = string.Empty;
             drow["productId"] = 0;
             dtbl.Rows.InsertAt(drow, 0);
             dgvcmbRawMaterial.DataSource = dtbl;
             dgvcmbRawMaterial.DisplayMember = "productName";
             dgvcmbRawMaterial.ValueMember = "productId";
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("PB:3" + ex.Message, "Open Miracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
コード例 #5
0
ファイル: frmPOS.cs プロジェクト: jsoques/openmiracle
 /// <summary>
 /// Function to use the Items Combo Fill 
 /// </summary>
 public void ItemComboFill()
 {
     try
     {
         ProductSP spProduct = new ProductSP();
         DataTable dtbl = new DataTable();
         dtbl = spProduct.ProductViewAll();
         cmbItem.DataSource = dtbl;
         cmbItem.ValueMember = "productId";
         cmbItem.DisplayMember = "productName";
     }
     catch (Exception ex)
     {
         MessageBox.Show("POS:17" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }