Exemplo n.º 1
0
 /// <summary>
 /// Function to get particular values from PurchaseReturnMaster table based on the parameter
 /// </summary>
 /// <param name="purchaseReturnMasterId"></param>
 /// <returns></returns>
 public PurchaseReturnMasterInfo PurchaseReturnMasterView(decimal purchaseReturnMasterId)
 {
     PurchaseReturnMasterInfo purchasereturnmasterinfo = new PurchaseReturnMasterInfo();
     SqlDataReader sdrreader = null;
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("PurchaseReturnMasterView", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@purchaseReturnMasterId", SqlDbType.Decimal);
         sprmparam.Value = purchaseReturnMasterId;
         sdrreader = sccmd.ExecuteReader();
         while (sdrreader.Read())
         {
             purchasereturnmasterinfo.PurchaseReturnMasterId = Convert.ToDecimal(sdrreader["purchaseReturnMasterId"].ToString());
             purchasereturnmasterinfo.VoucherNo = sdrreader["voucherNo"].ToString();
             purchasereturnmasterinfo.InvoiceNo = sdrreader["invoiceNo"].ToString();
             purchasereturnmasterinfo.SuffixPrefixId = Convert.ToDecimal(sdrreader["suffixPrefixId"].ToString());
             purchasereturnmasterinfo.VoucherTypeId = Convert.ToDecimal(sdrreader["voucherTypeId"].ToString());
             purchasereturnmasterinfo.Date = Convert.ToDateTime(sdrreader["date"].ToString());
             purchasereturnmasterinfo.LedgerId = Convert.ToDecimal(sdrreader["ledgerId"].ToString());
             purchasereturnmasterinfo.Discount = Convert.ToDecimal(sdrreader["discount"].ToString());
             purchasereturnmasterinfo.Narration = sdrreader["narration"].ToString();
             purchasereturnmasterinfo.PurchaseAccount = Convert.ToDecimal(sdrreader["purchaseAccount"].ToString());
             purchasereturnmasterinfo.TotalTax = Convert.ToDecimal(sdrreader["totalTax"].ToString());
             purchasereturnmasterinfo.TotalAmount = Convert.ToDecimal(sdrreader["totalAmount"].ToString());
             purchasereturnmasterinfo.GrandTotal = Convert.ToDecimal(sdrreader["grandTotal"].ToString());
             purchasereturnmasterinfo.UserId = Convert.ToDecimal(sdrreader["userId"].ToString());
             purchasereturnmasterinfo.LrNo = sdrreader["lrNo"].ToString();
             purchasereturnmasterinfo.TransportationCompany = sdrreader["transportationCompany"].ToString();
             purchasereturnmasterinfo.FinancialYearId = Convert.ToDecimal(sdrreader["financialYearId"].ToString());
             purchasereturnmasterinfo.PurchaseMasterId = Convert.ToDecimal(sdrreader["purchaseMasterId"].ToString());
             purchasereturnmasterinfo.ExchangeRateId = Convert.ToDecimal(sdrreader["exchangeRateId"].ToString());
             purchasereturnmasterinfo.ExtraDate = Convert.ToDateTime(sdrreader["extraDate"].ToString());
             purchasereturnmasterinfo.Extra1 = sdrreader["extra1"].ToString();
             purchasereturnmasterinfo.Extra2 = sdrreader["extra2"].ToString();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sdrreader.Close();
         sqlcon.Close();
     }
     return purchasereturnmasterinfo;
 }
Exemplo n.º 2
0
 /// <summary>
 /// Function to insert values to PurchaseReturnMaster Table
 /// </summary>
 /// <param name="purchasereturnmasterinfo"></param>
 /// <returns></returns>
 public decimal PurchaseReturnMasterAddWithReturnIdentity(PurchaseReturnMasterInfo purchasereturnmasterinfo)
 {
     decimal decIdentity = 0;
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("PurchaseReturnMasterAddWithReturnIdentity", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@voucherNo", SqlDbType.VarChar);
         sprmparam.Value = purchasereturnmasterinfo.VoucherNo;
         sprmparam = sccmd.Parameters.Add("@invoiceNo", SqlDbType.VarChar);
         sprmparam.Value = purchasereturnmasterinfo.InvoiceNo;
         sprmparam = sccmd.Parameters.Add("@suffixPrefixId", SqlDbType.Decimal);
         sprmparam.Value = purchasereturnmasterinfo.SuffixPrefixId;
         sprmparam = sccmd.Parameters.Add("@voucherTypeId", SqlDbType.Decimal);
         sprmparam.Value = purchasereturnmasterinfo.VoucherTypeId;
         sprmparam = sccmd.Parameters.Add("@date", SqlDbType.DateTime);
         sprmparam.Value = purchasereturnmasterinfo.Date;
         sprmparam = sccmd.Parameters.Add("@purchaseMasterId", SqlDbType.Decimal);
         sprmparam.Value = purchasereturnmasterinfo.PurchaseMasterId;
         sprmparam = sccmd.Parameters.Add("@ledgerId", SqlDbType.Decimal);
         sprmparam.Value = purchasereturnmasterinfo.LedgerId;
         sprmparam = sccmd.Parameters.Add("@discount", SqlDbType.Decimal);
         sprmparam.Value = purchasereturnmasterinfo.Discount;
         sprmparam = sccmd.Parameters.Add("@ExchangeRateId", SqlDbType.Decimal);
         sprmparam.Value = purchasereturnmasterinfo.ExchangeRateId;
         sprmparam = sccmd.Parameters.Add("@narration", SqlDbType.VarChar);
         sprmparam.Value = purchasereturnmasterinfo.Narration;
         sprmparam = sccmd.Parameters.Add("@purchaseAccount", SqlDbType.Decimal);
         sprmparam.Value = purchasereturnmasterinfo.PurchaseAccount;
         sprmparam = sccmd.Parameters.Add("@totalTax", SqlDbType.Decimal);
         sprmparam.Value = purchasereturnmasterinfo.TotalTax;
         sprmparam = sccmd.Parameters.Add("@grandTotal", SqlDbType.Decimal);
         sprmparam.Value = purchasereturnmasterinfo.GrandTotal;
         sprmparam = sccmd.Parameters.Add("@totalAmount", SqlDbType.Decimal);
         sprmparam.Value = purchasereturnmasterinfo.TotalAmount;
         sprmparam = sccmd.Parameters.Add("@userId", SqlDbType.Decimal);
         sprmparam.Value = purchasereturnmasterinfo.UserId;
         sprmparam = sccmd.Parameters.Add("@lrNo", SqlDbType.VarChar);
         sprmparam.Value = purchasereturnmasterinfo.LrNo;
         sprmparam = sccmd.Parameters.Add("@transportationCompany", SqlDbType.VarChar);
         sprmparam.Value = purchasereturnmasterinfo.TransportationCompany;
         sprmparam = sccmd.Parameters.Add("@financialYearId", SqlDbType.Decimal);
         sprmparam.Value = purchasereturnmasterinfo.FinancialYearId;
         sprmparam = sccmd.Parameters.Add("@extraDate", SqlDbType.DateTime);
         sprmparam.Value = purchasereturnmasterinfo.ExtraDate;
         sprmparam = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
         sprmparam.Value = purchasereturnmasterinfo.Extra1;
         sprmparam = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam.Value = purchasereturnmasterinfo.Extra2;
         decIdentity = Convert.ToDecimal(sccmd.ExecuteScalar().ToString());
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
     return decIdentity;
 }