/// <summary> /// Function to insert values to BudgetDetails Table /// </summary> /// <param name="budgetdetailsinfo"></param> public void BudgetDetailsAdd(BudgetDetailsInfo budgetdetailsinfo) { try { if (sqlcon.State == ConnectionState.Closed) { sqlcon.Open(); } SqlCommand sccmd = new SqlCommand("BudgetDetailsAdd", sqlcon); sccmd.CommandType = CommandType.StoredProcedure; SqlParameter sprmparam = new SqlParameter(); sprmparam = sccmd.Parameters.Add("@budgetMasterId", SqlDbType.Decimal); sprmparam.Value = budgetdetailsinfo.BudgetMasterId; sprmparam = sccmd.Parameters.Add("@particular", SqlDbType.VarChar); sprmparam.Value = budgetdetailsinfo.Particular; sprmparam = sccmd.Parameters.Add("@credit", SqlDbType.Decimal); sprmparam.Value = budgetdetailsinfo.Credit; sprmparam = sccmd.Parameters.Add("@debit", SqlDbType.Decimal); sprmparam.Value = budgetdetailsinfo.Debit; sprmparam = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar); sprmparam.Value = budgetdetailsinfo.Extra1; sprmparam = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar); sprmparam.Value = budgetdetailsinfo.Extra2; sccmd.ExecuteNonQuery(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { sqlcon.Close(); } }
/// <summary> /// Function to Update values in BudgetDetails Table /// </summary> /// <param name="budgetdetailsinfo"></param> public void BudgetDetailsEdit(BudgetDetailsInfo budgetdetailsinfo) { try { SPBudgetDetails.BudgetDetailsEdit(budgetdetailsinfo); } catch (Exception ex) { MessageBox.Show("BGBll2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to get particular values from BudgetDetails table based on the parameter /// </summary> /// <param name="budgetDetailsId"></param> /// <returns></returns> public BudgetDetailsInfo BudgetDetailsView(decimal budgetDetailsId) { BudgetDetailsInfo budgetdetailsinfo = new BudgetDetailsInfo(); try { budgetdetailsinfo = SPBudgetDetails.BudgetDetailsView(budgetDetailsId); } catch (Exception ex) { MessageBox.Show("BGBll5:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } return budgetdetailsinfo; }
/// <summary> /// Function to get particular values from BudgetDetails table based on the parameter /// </summary> /// <param name="budgetDetailsId"></param> /// <returns></returns> public BudgetDetailsInfo BudgetDetailsView(decimal budgetDetailsId) { BudgetDetailsInfo budgetdetailsinfo = new BudgetDetailsInfo(); SqlDataReader sdrreader = null; try { if (sqlcon.State == ConnectionState.Closed) { sqlcon.Open(); } SqlCommand sccmd = new SqlCommand("BudgetDetailsView", sqlcon); sccmd.CommandType = CommandType.StoredProcedure; SqlParameter sprmparam = new SqlParameter(); sprmparam = sccmd.Parameters.Add("@budgetDetailsId", SqlDbType.Decimal); sprmparam.Value = budgetDetailsId; sdrreader = sccmd.ExecuteReader(); while (sdrreader.Read()) { budgetdetailsinfo.BudgetDetailsId = decimal.Parse(sdrreader[0].ToString()); budgetdetailsinfo.BudgetMasterId = decimal.Parse(sdrreader[1].ToString()); budgetdetailsinfo.Particular = sdrreader[2].ToString(); budgetdetailsinfo.Credit = decimal.Parse(sdrreader[3].ToString()); budgetdetailsinfo.Debit = decimal.Parse(sdrreader[4].ToString()); budgetdetailsinfo.Extra1 = sdrreader[5].ToString(); budgetdetailsinfo.Extra2 = sdrreader[6].ToString(); budgetdetailsinfo.ExtraDate = DateTime.Parse(sdrreader[7].ToString()); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { sdrreader.Close(); sqlcon.Close(); } return budgetdetailsinfo; }