예제 #1
0
        /// <summary>
        /// Function to get particular values from accountgroup Table based on the parameter
        /// </summary>
        /// <param name="purchaseReturnDetailsId"></param>
        /// <returns></returns>
        public PurchaseReturnDetailsInfo PurchaseReturnDetailsView(decimal purchaseReturnDetailsId)
        {
            PurchaseReturnDetailsInfo purchasereturndetailsinfo = new PurchaseReturnDetailsInfo();
            SqlDataReader             sdrreader = null;

            try
            {
                if (sqlcon.State == ConnectionState.Closed)
                {
                    sqlcon.Open();
                }
                SqlCommand sccmd = new SqlCommand("PurchaseReturnDetailsView", sqlcon);
                sccmd.CommandType = CommandType.StoredProcedure;
                SqlParameter sprmparam = new SqlParameter();
                sprmparam       = sccmd.Parameters.Add("@purchaseReturnDetailsId", SqlDbType.Decimal);
                sprmparam.Value = purchaseReturnDetailsId;
                sdrreader       = sccmd.ExecuteReader();
                while (sdrreader.Read())
                {
                    purchasereturndetailsinfo.PurchaseReturnDetailsId = decimal.Parse(sdrreader[0].ToString());
                    purchasereturndetailsinfo.PurchaseReturnMasterId  = decimal.Parse(sdrreader[1].ToString());
                    purchasereturndetailsinfo.ProductId        = decimal.Parse(sdrreader[2].ToString());
                    purchasereturndetailsinfo.Qty              = decimal.Parse(sdrreader[3].ToString());
                    purchasereturndetailsinfo.Rate             = decimal.Parse(sdrreader[4].ToString());
                    purchasereturndetailsinfo.UnitId           = decimal.Parse(sdrreader[5].ToString());
                    purchasereturndetailsinfo.UnitConversionId = decimal.Parse(sdrreader[6].ToString());
                    purchasereturndetailsinfo.Discount         = decimal.Parse(sdrreader[7].ToString());
                    purchasereturndetailsinfo.TaxId            = decimal.Parse(sdrreader[8].ToString());
                    purchasereturndetailsinfo.BatchId          = decimal.Parse(sdrreader[9].ToString());
                    purchasereturndetailsinfo.GodownId         = decimal.Parse(sdrreader[10].ToString());
                    purchasereturndetailsinfo.RackId           = decimal.Parse(sdrreader[11].ToString());
                    purchasereturndetailsinfo.TaxAmount        = decimal.Parse(sdrreader[12].ToString());
                    purchasereturndetailsinfo.GrossAmount      = decimal.Parse(sdrreader[13].ToString());
                    purchasereturndetailsinfo.NetAmount        = decimal.Parse(sdrreader[14].ToString());
                    purchasereturndetailsinfo.Amount           = decimal.Parse(sdrreader[15].ToString());
                    purchasereturndetailsinfo.SlNo             = int.Parse(sdrreader[16].ToString());
                    purchasereturndetailsinfo.ExtraDate        = DateTime.Parse(sdrreader[17].ToString());
                    purchasereturndetailsinfo.Extra1           = sdrreader[18].ToString();
                    purchasereturndetailsinfo.Extra2           = sdrreader[19].ToString();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            { sdrreader.Close();
              sqlcon.Close(); }
            return(purchasereturndetailsinfo);
        }
예제 #2
0
 /// <summary>
 /// Function to Update values in accountgroup Table
 /// </summary>
 /// <param name="purchasereturndetailsinfo"></param>
 public void PurchaseReturnDetailsEdit(PurchaseReturnDetailsInfo purchasereturndetailsinfo)
 {
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("PurchaseReturnDetailsEdit", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam       = sccmd.Parameters.Add("@purchaseReturnDetailsId", SqlDbType.Decimal);
         sprmparam.Value = purchasereturndetailsinfo.PurchaseReturnDetailsId;
         sprmparam       = sccmd.Parameters.Add("@purchaseReturnMasterId", SqlDbType.Decimal);
         sprmparam.Value = purchasereturndetailsinfo.PurchaseReturnMasterId;
         sprmparam       = sccmd.Parameters.Add("@productId", SqlDbType.Decimal);
         sprmparam.Value = purchasereturndetailsinfo.ProductId;
         sprmparam       = sccmd.Parameters.Add("@qty", SqlDbType.Decimal);
         sprmparam.Value = purchasereturndetailsinfo.Qty;
         sprmparam       = sccmd.Parameters.Add("@rate", SqlDbType.Decimal);
         sprmparam.Value = purchasereturndetailsinfo.Rate;
         sprmparam       = sccmd.Parameters.Add("@unitId", SqlDbType.Decimal);
         sprmparam.Value = purchasereturndetailsinfo.UnitId;
         sprmparam       = sccmd.Parameters.Add("@unitConversionId", SqlDbType.Decimal);
         sprmparam.Value = purchasereturndetailsinfo.UnitConversionId;
         sprmparam       = sccmd.Parameters.Add("@discount", SqlDbType.Decimal);
         sprmparam.Value = purchasereturndetailsinfo.Discount;
         sprmparam       = sccmd.Parameters.Add("@taxId", SqlDbType.Decimal);
         sprmparam.Value = purchasereturndetailsinfo.TaxId;
         sprmparam       = sccmd.Parameters.Add("@batchId", SqlDbType.Decimal);
         sprmparam.Value = purchasereturndetailsinfo.BatchId;
         sprmparam       = sccmd.Parameters.Add("@godownId", SqlDbType.Decimal);
         sprmparam.Value = purchasereturndetailsinfo.GodownId;
         sprmparam       = sccmd.Parameters.Add("@rackId", SqlDbType.Decimal);
         sprmparam.Value = purchasereturndetailsinfo.RackId;
         sprmparam       = sccmd.Parameters.Add("@taxAmount", SqlDbType.Decimal);
         sprmparam.Value = purchasereturndetailsinfo.TaxAmount;
         sprmparam       = sccmd.Parameters.Add("@grossAmount", SqlDbType.Decimal);
         sprmparam.Value = purchasereturndetailsinfo.GrossAmount;
         sprmparam       = sccmd.Parameters.Add("@netAmount", SqlDbType.Decimal);
         sprmparam.Value = purchasereturndetailsinfo.NetAmount;
         sprmparam       = sccmd.Parameters.Add("@amount", SqlDbType.Decimal);
         sprmparam.Value = purchasereturndetailsinfo.Amount;
         sprmparam       = sccmd.Parameters.Add("@slNo", SqlDbType.Int);
         sprmparam.Value = purchasereturndetailsinfo.SlNo;
         sprmparam       = sccmd.Parameters.Add("@extraDate", SqlDbType.DateTime);
         sprmparam.Value = purchasereturndetailsinfo.ExtraDate;
         sprmparam       = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
         sprmparam.Value = purchasereturndetailsinfo.Extra1;
         sprmparam       = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam.Value = purchasereturndetailsinfo.Extra2;
         sccmd.ExecuteNonQuery();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
 }