Пример #1
0
 /// <summary>
 /// Function to insert values to PurchaseReturnBilltax Table
 /// </summary>
 /// <param name="purchasereturnbilltaxinfo"></param>
 public void PurchaseReturnBilltaxAdd(PurchaseReturnBilltaxInfo purchasereturnbilltaxinfo)
 {
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("PurchaseReturnBilltaxAdd", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam       = sccmd.Parameters.Add("@purchaseReturnMasterId", SqlDbType.Decimal);
         sprmparam.Value = purchasereturnbilltaxinfo.PurchaseReturnMasterId;
         sprmparam       = sccmd.Parameters.Add("@taxId", SqlDbType.Decimal);
         sprmparam.Value = purchasereturnbilltaxinfo.TaxId;
         sprmparam       = sccmd.Parameters.Add("@taxAmount", SqlDbType.Decimal);
         sprmparam.Value = purchasereturnbilltaxinfo.TaxAmount;
         sprmparam       = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
         sprmparam.Value = purchasereturnbilltaxinfo.Extra1;
         sprmparam       = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam.Value = purchasereturnbilltaxinfo.Extra2;
         sccmd.ExecuteNonQuery();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
 }
Пример #2
0
        /// <summary>
        /// Function to get particular values from PurchaseReturnBilltax Table based on the parameter
        /// </summary>
        /// <param name="purchaseReturnBillTaxId"></param>
        /// <returns></returns>
        public PurchaseReturnBilltaxInfo PurchaseReturnBilltaxView(decimal purchaseReturnBillTaxId)
        {
            PurchaseReturnBilltaxInfo purchasereturnbilltaxinfo = new PurchaseReturnBilltaxInfo();
            SqlDataReader             sdrreader = null;

            try
            {
                if (sqlcon.State == ConnectionState.Closed)
                {
                    sqlcon.Open();
                }
                SqlCommand sccmd = new SqlCommand("PurchaseReturnBilltaxView", sqlcon);
                sccmd.CommandType = CommandType.StoredProcedure;
                SqlParameter sprmparam = new SqlParameter();
                sprmparam       = sccmd.Parameters.Add("@purchaseReturnBillTaxId", SqlDbType.Decimal);
                sprmparam.Value = purchaseReturnBillTaxId;
                sdrreader       = sccmd.ExecuteReader();
                while (sdrreader.Read())
                {
                    purchasereturnbilltaxinfo.PurchaseReturnBillTaxId = decimal.Parse(sdrreader[0].ToString());
                    purchasereturnbilltaxinfo.PurchaseReturnMasterId  = decimal.Parse(sdrreader[1].ToString());
                    purchasereturnbilltaxinfo.TaxId     = decimal.Parse(sdrreader[2].ToString());
                    purchasereturnbilltaxinfo.TaxAmount = decimal.Parse(sdrreader[3].ToString());
                    purchasereturnbilltaxinfo.Extra1    = sdrreader[4].ToString();
                    purchasereturnbilltaxinfo.Extra2    = sdrreader[5].ToString();
                    purchasereturnbilltaxinfo.ExtraDate = DateTime.Parse(sdrreader[6].ToString());
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            { sdrreader.Close();
              sqlcon.Close(); }
            return(purchasereturnbilltaxinfo);
        }