Esempio n. 1
0
 /// <summary>
 /// Function to fill additional cost
 /// </summary>
 public void AdditionalCostComboFill()
 {
     try
     {
         DataTable dtbl = new DataTable();
         AccountLedgerSP spAccountLedger = new AccountLedgerSP();
         dtbl = spAccountLedger.AdditionalCostGet();
         dgvcmbAdditionalCostLedger.DataSource = dtbl;
         dgvcmbAdditionalCostLedger.ValueMember = "ledgerId";
         dgvcmbAdditionalCostLedger.DisplayMember = "ledgerName";
     }
     catch (Exception ex)
     {
         MessageBox.Show("SJ:25" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Esempio n. 2
0
 /// <summary>
 /// dgvAdditionalCost grid cellbeginedit event
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void dgvAdditionalCost_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
 {
     try
     {
         DataTable dtbl = new DataTable();
         AccountLedgerSP SpAccountLedger = new AccountLedgerSP();
         if (dgvAdditionalCost.CurrentCell.ColumnIndex == dgvAdditionalCost.Columns["dgvcmbAdditionalCostLedger"].Index)
         {
             dtbl = SpAccountLedger.AdditionalCostGet();
             if (dtbl.Rows.Count > 0)
             {
                 if (dgvAdditionalCost.RowCount > 1)
                 {
                     int inGridRowCount = dgvAdditionalCost.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 (dgvAdditionalCost.Rows[inI].Cells["dgvcmbAdditionalCostLedger"].Value != null && dgvAdditionalCost.Rows[inI].Cells["dgvcmbAdditionalCostLedger"].Value.ToString() != string.Empty)
                                 {
                                     if (dtbl.Rows[inJ]["ledgerId"].ToString() == dgvAdditionalCost.Rows[inI].Cells["dgvcmbAdditionalCostLedger"].Value.ToString())
                                     {
                                         dtbl.Rows.RemoveAt(inJ);
                                         break;
                                     }
                                 }
                             }
                         }
                     }
                 }
                 DataGridViewComboBoxCell dgvcmbLedger = (DataGridViewComboBoxCell)dgvAdditionalCost[dgvAdditionalCost.Columns["dgvcmbAdditionalCostLedger"].Index, e.RowIndex];
                 dgvcmbLedger.DataSource = dtbl;
                 dgvcmbLedger.ValueMember = "ledgerId";
                 dgvcmbLedger.DisplayMember = "ledgerName";
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("SJ:77" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }