/// <summary>
        /// Function to Update values in BudgetMaster Table
        /// </summary>
        /// <param name="budgetmasterinfo"></param>
        public void BudgetMasterEdit(BudgetMasterInfo budgetmasterinfo)
        {
            try
            {
                if (sqlcon.State == ConnectionState.Closed)
                {
                    sqlcon.Open();
                }
                SqlCommand sccmd = new SqlCommand("BudgetMasterEdit", sqlcon);
                sccmd.CommandType = CommandType.StoredProcedure;
                SqlParameter sprmparam = new SqlParameter();
                sprmparam       = sccmd.Parameters.Add("@budgetMasterId", SqlDbType.Decimal);
                sprmparam.Value = budgetmasterinfo.BudgetMasterId;
                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;

                sccmd.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                sqlcon.Close();
            }
        }
        /// <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);
        }
示例#3
0
 /// <summary>
 /// Function to Update values in BudgetMaster Table
 /// </summary>
 /// <param name="budgetmasterinfo"></param>
 public void BudgetMasterEdit(BudgetMasterInfo budgetmasterinfo)
 {
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("BudgetMasterEdit", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@budgetMasterId", SqlDbType.Decimal);
         sprmparam.Value = budgetmasterinfo.BudgetMasterId;
         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;
         
         sccmd.ExecuteNonQuery();        }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
 }
        /// <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);
        }
示例#5
0
 /// <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;
 }
示例#6
0
 /// <summary>
 /// function to fill controls for update
 /// </summary>
 public void FillControls()
 {
     try
     {
         dgvBudget.Rows.Clear();
         infoBudgetMaster = spBudgetMaster.BudgetMasterView(decBudgetMasterIdentity);
         txtBudgetName.Text = infoBudgetMaster.BudgetName;
         cmbType.Text = infoBudgetMaster.Type;
         txtTotalCr.Text = infoBudgetMaster.TotalCr.ToString();
         txtTotalDr.Text = infoBudgetMaster.TotalDr.ToString();
         txtFromDate.Text = infoBudgetMaster.FromDate.ToString("dd-MMM-yyyy");
         txtToDate.Text = infoBudgetMaster.ToDate.ToString("dd-MMM-yyyy");
         txtNarration.Text = infoBudgetMaster.Narration;
         decBudgetId = infoBudgetMaster.BudgetMasterId;
         DataTable dtbl = new DataTable();
         dtbl = spBudgetDetails.BudgetDetailsViewByMasterId(decBudgetMasterIdentity);
         for (int i = 0; i < dtbl.Rows.Count; i++)
         {
             dgvBudget.Rows.Add();
             dgvBudget.Rows[i].HeaderCell.Value = string.Empty;
             dgvBudget.Rows[i].Cells["budgetDetailsId"].Value = Convert.ToDecimal(dtbl.Rows[i]["budgetDetailsId"].ToString());
             if (dgvBudget.Rows[i].Cells["dgvcmbParticular"].Value == null)
             {
                 dgvBudget.Rows[i].Cells["dgvcmbParticular"].Value = Convert.ToDecimal(dtbl.Rows[i]["ledgerId"].ToString());
             }
             if (Convert.ToDecimal(dtbl.Rows[i]["debit"].ToString()) == 0)
             {
                 dgvBudget.Rows[i].Cells["dgvcmbDrOrCr"].Value = "Cr";
                 dgvBudget.Rows[i].Cells["dgvtxtAmount"].Value = Convert.ToDecimal(dtbl.Rows[i]["credit"].ToString());
             }
             else
             {
                 dgvBudget.Rows[i].Cells["dgvcmbDrOrCr"].Value = "Dr";
                 dgvBudget.Rows[i].Cells["dgvtxtAmount"].Value = Convert.ToDecimal(dtbl.Rows[i]["debit"].ToString());
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("BU9:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }