/// <summary> /// function to fill datagridview /// </summary> public void GridFill() { try { DataTable dtbl = new DataTable(); BudgetMasterSP spbudgetmaster = new BudgetMasterSP(); dgvBudgetVariance.Rows.Clear(); decimal decId = Convert.ToDecimal(cmbBudget.SelectedValue.ToString()); dtbl = spbudgetmaster.BudgetVariance(decId); decimal decrindx = dgvBudgetVariance.Rows.Count; int index = 0; foreach (DataRow rw in dtbl.Rows) { dgvBudgetVariance.Rows.Add(); dgvBudgetVariance.Rows[index].Cells["dgvtxtSlNo"].Value = rw["Sl NO"].ToString(); dgvBudgetVariance.Rows[index].Cells["dgvtxtParticulars"].Value = rw["Particular"].ToString(); dgvBudgetVariance.Rows[index].Cells["dgvtxtBudgetDr"].Value = rw["BudgetDr"].ToString(); dgvBudgetVariance.Rows[index].Cells["dgvtxtActualDr"].Value = rw["ActualDr"].ToString(); dgvBudgetVariance.Rows[index].Cells["dgvtxtVarianceDr"].Value = rw["VarianceDr"].ToString(); dgvBudgetVariance.Rows[index].Cells["dgvtxtBudgetCr"].Value = rw["BudgetCr"].ToString(); dgvBudgetVariance.Rows[index].Cells["dgvtxtActualCr"].Value = rw["ActualCr"].ToString(); dgvBudgetVariance.Rows[index].Cells["dgvtxtVarianceCr"].Value = rw["VarianceCr"].ToString(); index++; } } catch (Exception ex) { MessageBox.Show("BV:01" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// function to fill budget combo /// </summary> public void BudgetComboFill() { try { BudgetMasterSP spBudgetMaster = new BudgetMasterSP(); DataTable dtbl = new DataTable(); dtbl = spBudgetMaster.BudgetViewAll(); DataRow drow = dtbl.NewRow(); drow[0] = 0; drow[1] = "Select"; drow[2] = 0; drow[3] = 0; dtbl.Rows.InsertAt(drow, 0); cmbBudget.ValueMember = "budgetMasterId"; cmbBudget.DisplayMember = "budgetName"; cmbBudget.DataSource = dtbl; } catch (Exception ex) { MessageBox.Show("BV:02" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }