public void BudgetMasterEdit(BudgetMasterInfo InfoBudgetMaster)
 {
     try
     {
         SpBudgetMaster.BudgetMasterEdit(InfoBudgetMaster);
     }
     catch (Exception ex)
     {
         MessageBox.Show("SB3:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 public BudgetMasterInfo BudgetMasterView(decimal DecMasterId)
 {
     BudgetMasterInfo InfoBudgetMaster = new BudgetMasterInfo();
     try
     {
         InfoBudgetMaster = SpBudgetMaster.BudgetMasterView(DecMasterId);
     }
     catch (Exception ex)
     {
         MessageBox.Show("SB6:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     return InfoBudgetMaster;
 }
        public decimal BudgetMasterAdd(BudgetMasterInfo InfoBudgetMaster)
        {
            decimal decId = 0;
            try
            {
                decId = SpBudgetMaster.BudgetMasterAdd(InfoBudgetMaster);
            }

            catch (Exception ex)
            {
                MessageBox.Show("SB1:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            return decId;
        }
 /// <summary>
 /// Function to insert values to budgetMaster Table
 /// </summary>
 /// <param name="budgetmasterinfo"></param>
 /// <returns></returns>
 public decimal BudgetMasterAdd(BudgetMasterInfo budgetmasterinfo)
 {
     decimal decIdentity = 0;
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("BudgetMasterAdd", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@budgetName", SqlDbType.VarChar);
         sprmparam.Value = budgetmasterinfo.BudgetName;
         sprmparam = sccmd.Parameters.Add("@type", SqlDbType.VarChar);
         sprmparam.Value = budgetmasterinfo.Type;
         sprmparam = sccmd.Parameters.Add("@totalDr", SqlDbType.Decimal);
         sprmparam.Value = budgetmasterinfo.TotalDr;
         sprmparam = sccmd.Parameters.Add("@totalCr", SqlDbType.Decimal);
         sprmparam.Value = budgetmasterinfo.TotalCr;
         sprmparam = sccmd.Parameters.Add("@fromDate", SqlDbType.DateTime);
         sprmparam.Value = budgetmasterinfo.FromDate;
         sprmparam = sccmd.Parameters.Add("@toDate", SqlDbType.DateTime);
         sprmparam.Value = budgetmasterinfo.ToDate;
         sprmparam = sccmd.Parameters.Add("@narration", SqlDbType.VarChar);
         sprmparam.Value = budgetmasterinfo.Narration;
         sprmparam = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
         sprmparam.Value = budgetmasterinfo.Extra1;
         sprmparam = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam.Value = budgetmasterinfo.Extra2;
         decIdentity = Convert.ToDecimal(sccmd.ExecuteScalar());
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
     return decIdentity;
 }
        /// <summary>
        /// Function to get particular values from BudgetMaster table based on the parameter
        /// </summary>
        /// <param name="budgetMasterId"></param>
        /// <returns></returns>
        public BudgetMasterInfo BudgetMasterView(decimal budgetMasterId)
        {
            BudgetMasterInfo budgetmasterinfo = new BudgetMasterInfo();
            try
            {
                budgetmasterinfo = SPBudgetMaster.BudgetMasterView(budgetMasterId);
            }
            catch (Exception ex)
            {

                MessageBox.Show("BGBll11:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            return budgetmasterinfo;
        }
        /// <summary>
        /// Function to Update values in BudgetMaster Table
        /// </summary>
        /// <param name="budgetmasterinfo"></param>
        public void BudgetMasterEdit(BudgetMasterInfo budgetmasterinfo)
        {
            try
            {

                SPBudgetMaster.BudgetMasterEdit(budgetmasterinfo);
            }
            catch (Exception ex)
            {

                MessageBox.Show("BGBll9:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
        public decimal BudgetMasterAdd(BudgetMasterInfo budgetmasterinfo)
        {
            decimal decIdentity = 0;
            try
            {

               decIdentity= SPBudgetMaster.BudgetMasterAdd(budgetmasterinfo);
            }
            catch (Exception ex)
            {

                MessageBox.Show("BGBll8:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            return decIdentity;
        }
 /// <summary>
 /// Function to get particular values from BudgetMaster table based on the parameter
 /// </summary>
 /// <param name="budgetMasterId"></param>
 /// <returns></returns>
 public BudgetMasterInfo BudgetMasterView(decimal budgetMasterId)
 {
     BudgetMasterInfo budgetmasterinfo = new BudgetMasterInfo();
     SqlDataReader sdrreader = null;
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("BudgetMasterView", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@budgetMasterId", SqlDbType.Decimal);
         sprmparam.Value = budgetMasterId;
         sdrreader = sccmd.ExecuteReader();
         while (sdrreader.Read())
         {
             budgetmasterinfo.BudgetMasterId = Convert.ToDecimal(sdrreader["budgetMasterId"].ToString());
             budgetmasterinfo.BudgetName = sdrreader["budgetName"].ToString();
             budgetmasterinfo.Type = sdrreader["type"].ToString();
             budgetmasterinfo.TotalDr = Convert.ToDecimal(sdrreader["totalDr"].ToString());
             budgetmasterinfo.TotalCr = Convert.ToDecimal(sdrreader["totalCr"].ToString());
             budgetmasterinfo.FromDate = DateTime.Parse(sdrreader["fromDate"].ToString());
             budgetmasterinfo.ToDate = DateTime.Parse(sdrreader["toDate"].ToString());
             budgetmasterinfo.Narration = sdrreader["narration"].ToString();
             budgetmasterinfo.Extra1 = sdrreader["extra1"].ToString();
             budgetmasterinfo.Extra2 = sdrreader["extra2"].ToString();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sdrreader.Close();
         sqlcon.Close();
     }
     return budgetmasterinfo;
 }