Example #1
0
        /// <summary>
        /// Function to get particular values from SalesReturnMaster Table based on the parameter
        /// </summary>
        /// <param name="salesReturnMasterId"></param>
        /// <returns></returns>
        public SalesReturnMasterInfo SalesReturnMasterView(decimal salesReturnMasterId)
        {
            SalesReturnMasterInfo salesreturnmasterinfo = new SalesReturnMasterInfo();
            SqlDataReader         sdrreader             = null;

            try
            {
                if (sqlcon.State == ConnectionState.Closed)
                {
                    sqlcon.Open();
                }
                SqlCommand sccmd = new SqlCommand("SalesReturnMasterView", sqlcon);
                sccmd.CommandType = CommandType.StoredProcedure;
                SqlParameter sprmparam = new SqlParameter();
                sprmparam       = sccmd.Parameters.Add("@salesReturnMasterId", SqlDbType.Decimal);
                sprmparam.Value = salesReturnMasterId;
                sdrreader       = sccmd.ExecuteReader();
                while (sdrreader.Read())
                {
                    salesreturnmasterinfo.SalesReturnMasterId = decimal.Parse(sdrreader["salesReturnMasterId"].ToString());
                    salesreturnmasterinfo.VoucherNo           = sdrreader["voucherNo"].ToString();
                    salesreturnmasterinfo.InvoiceNo           = sdrreader[2].ToString();
                    salesreturnmasterinfo.VoucherTypeId       = decimal.Parse(sdrreader["voucherTypeId"].ToString());
                    salesreturnmasterinfo.SuffixPrefixId      = decimal.Parse(sdrreader["suffixPrefixId"].ToString());
                    salesreturnmasterinfo.LedgerId            = decimal.Parse(sdrreader["ledgerId"].ToString());
                    salesreturnmasterinfo.SalesAccount        = decimal.Parse(sdrreader[6].ToString());
                    salesreturnmasterinfo.PricinglevelId      = decimal.Parse(sdrreader["pricinglevelId"].ToString());
                    salesreturnmasterinfo.EmployeeId          = decimal.Parse(sdrreader["employeeId"].ToString());
                    salesreturnmasterinfo.Narration           = sdrreader[9].ToString();
                    salesreturnmasterinfo.ExchangeRateId      = decimal.Parse(sdrreader["exchangeRateId"].ToString());
                    salesreturnmasterinfo.TaxAmount           = decimal.Parse(sdrreader["taxAmount"].ToString());
                    salesreturnmasterinfo.UserId = decimal.Parse(sdrreader["userId"].ToString());
                    salesreturnmasterinfo.LrNo   = sdrreader[13].ToString();
                    salesreturnmasterinfo.TransportationCompany = sdrreader[14].ToString();
                    salesreturnmasterinfo.Date            = DateTime.Parse(sdrreader["date"].ToString());
                    salesreturnmasterinfo.TotalAmount     = decimal.Parse(sdrreader["totalAmount"].ToString());
                    salesreturnmasterinfo.grandTotal      = decimal.Parse(sdrreader["grandTotal"].ToString());
                    salesreturnmasterinfo.FinancialYearId = decimal.Parse(sdrreader["financialYearId"].ToString());
                    salesreturnmasterinfo.ExtraDate       = DateTime.Parse(sdrreader["extraDate"].ToString());
                    salesreturnmasterinfo.Extra1          = sdrreader["extra1"].ToString();
                    salesreturnmasterinfo.Extra2          = sdrreader[20].ToString();
                    salesreturnmasterinfo.Discount        = decimal.Parse(sdrreader["discount"].ToString());
                    salesreturnmasterinfo.SalesMasterId   = decimal.Parse(sdrreader["salesMasterId"].ToString());
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                sdrreader.Close();
                sqlcon.Close();
            }
            return(salesreturnmasterinfo);
        }
Example #2
0
        /// <summary>
        /// Function to insert values to SalesReturnMaster Table
        /// </summary>
        /// <param name="salesreturnmasterinfo"></param>
        /// <returns></returns>
        public decimal SalesReturnMasterAdd(SalesReturnMasterInfo salesreturnmasterinfo)
        {
            decimal decIdentity = 0;

            try
            {
                if (sqlcon.State == ConnectionState.Closed)
                {
                    sqlcon.Open();
                }
                SqlCommand sccmd = new SqlCommand("SalesReturnMasterAdd", sqlcon);
                sccmd.CommandType = CommandType.StoredProcedure;
                SqlParameter sprmparam = new SqlParameter();
                sprmparam       = sccmd.Parameters.Add("@voucherNo", SqlDbType.VarChar);
                sprmparam.Value = salesreturnmasterinfo.VoucherNo;
                sprmparam       = sccmd.Parameters.Add("@invoiceNo", SqlDbType.VarChar);
                sprmparam.Value = salesreturnmasterinfo.InvoiceNo;
                sprmparam       = sccmd.Parameters.Add("@voucherTypeId", SqlDbType.Decimal);
                sprmparam.Value = salesreturnmasterinfo.VoucherTypeId;
                sprmparam       = sccmd.Parameters.Add("@suffixPrefixId", SqlDbType.Decimal);
                sprmparam.Value = salesreturnmasterinfo.SuffixPrefixId;
                sprmparam       = sccmd.Parameters.Add("@ledgerId", SqlDbType.Decimal);
                sprmparam.Value = salesreturnmasterinfo.LedgerId;
                sprmparam       = sccmd.Parameters.Add("@salesMasterId", SqlDbType.Decimal);
                sprmparam.Value = salesreturnmasterinfo.SalesMasterId;
                sprmparam       = sccmd.Parameters.Add("@salesAccount", SqlDbType.Decimal);
                sprmparam.Value = salesreturnmasterinfo.SalesAccount;
                sprmparam       = sccmd.Parameters.Add("@pricinglevelId", SqlDbType.Decimal);
                sprmparam.Value = salesreturnmasterinfo.PricinglevelId;
                sprmparam       = sccmd.Parameters.Add("@employeeId", SqlDbType.Decimal);
                sprmparam.Value = salesreturnmasterinfo.EmployeeId;
                sprmparam       = sccmd.Parameters.Add("@narration", SqlDbType.VarChar);
                sprmparam.Value = salesreturnmasterinfo.Narration;
                sprmparam       = sccmd.Parameters.Add("@exchangeRateId", SqlDbType.Decimal);
                sprmparam.Value = salesreturnmasterinfo.ExchangeRateId;
                sprmparam       = sccmd.Parameters.Add("@discount", SqlDbType.Decimal);
                sprmparam.Value = salesreturnmasterinfo.Discount;
                sprmparam       = sccmd.Parameters.Add("@taxAmount", SqlDbType.Decimal);
                sprmparam.Value = salesreturnmasterinfo.TaxAmount;
                sprmparam       = sccmd.Parameters.Add("@userId", SqlDbType.Decimal);
                sprmparam.Value = salesreturnmasterinfo.UserId;
                sprmparam       = sccmd.Parameters.Add("@lrNo", SqlDbType.VarChar);
                sprmparam.Value = salesreturnmasterinfo.LrNo;
                sprmparam       = sccmd.Parameters.Add("@transportationCompany", SqlDbType.VarChar);
                sprmparam.Value = salesreturnmasterinfo.TransportationCompany;
                sprmparam       = sccmd.Parameters.Add("@date", SqlDbType.DateTime);
                sprmparam.Value = salesreturnmasterinfo.Date;
                sprmparam       = sccmd.Parameters.Add("@totalAmount", SqlDbType.Decimal);
                sprmparam.Value = salesreturnmasterinfo.TotalAmount;
                sprmparam       = sccmd.Parameters.Add("@grandTotal", SqlDbType.Decimal);
                sprmparam.Value = salesreturnmasterinfo.grandTotal;
                sprmparam       = sccmd.Parameters.Add("@financialYearId", SqlDbType.Decimal);
                sprmparam.Value = salesreturnmasterinfo.FinancialYearId;
                sprmparam       = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
                sprmparam.Value = salesreturnmasterinfo.Extra1;
                sprmparam       = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
                sprmparam.Value = salesreturnmasterinfo.Extra2;
                decIdentity     = Convert.ToDecimal(sccmd.ExecuteScalar());
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                sqlcon.Close();
            }
            return(decIdentity);
        }
 /// <summary>
 /// Function to insert values to SalesReturnMaster Table
 /// </summary>
 /// <param name="salesreturnmasterinfo"></param>
 /// <returns></returns>
 public decimal SalesReturnMasterAdd(SalesReturnMasterInfo salesreturnmasterinfo)
 {
     decimal decIdentity = 0;
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("SalesReturnMasterAdd", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@voucherNo", SqlDbType.VarChar);
         sprmparam.Value = salesreturnmasterinfo.VoucherNo;
         sprmparam = sccmd.Parameters.Add("@invoiceNo", SqlDbType.VarChar);
         sprmparam.Value = salesreturnmasterinfo.InvoiceNo;
         sprmparam = sccmd.Parameters.Add("@voucherTypeId", SqlDbType.Decimal);
         sprmparam.Value = salesreturnmasterinfo.VoucherTypeId;
         sprmparam = sccmd.Parameters.Add("@suffixPrefixId", SqlDbType.Decimal);
         sprmparam.Value = salesreturnmasterinfo.SuffixPrefixId;
         sprmparam = sccmd.Parameters.Add("@ledgerId", SqlDbType.Decimal);
         sprmparam.Value = salesreturnmasterinfo.LedgerId;
         sprmparam = sccmd.Parameters.Add("@salesMasterId", SqlDbType.Decimal);
         sprmparam.Value = salesreturnmasterinfo.SalesMasterId;
         sprmparam = sccmd.Parameters.Add("@salesAccount", SqlDbType.Decimal);
         sprmparam.Value = salesreturnmasterinfo.SalesAccount;
         sprmparam = sccmd.Parameters.Add("@pricinglevelId", SqlDbType.Decimal);
         sprmparam.Value = salesreturnmasterinfo.PricinglevelId;
         sprmparam = sccmd.Parameters.Add("@employeeId", SqlDbType.Decimal);
         sprmparam.Value = salesreturnmasterinfo.EmployeeId;
         sprmparam = sccmd.Parameters.Add("@narration", SqlDbType.VarChar);
         sprmparam.Value = salesreturnmasterinfo.Narration;
         sprmparam = sccmd.Parameters.Add("@exchangeRateId", SqlDbType.Decimal);
         sprmparam.Value = salesreturnmasterinfo.ExchangeRateId;
         sprmparam = sccmd.Parameters.Add("@discount", SqlDbType.Decimal);
         sprmparam.Value = salesreturnmasterinfo.Discount;
         sprmparam = sccmd.Parameters.Add("@taxAmount", SqlDbType.Decimal);
         sprmparam.Value = salesreturnmasterinfo.TaxAmount;
         sprmparam = sccmd.Parameters.Add("@userId", SqlDbType.Decimal);
         sprmparam.Value = salesreturnmasterinfo.UserId;
         sprmparam = sccmd.Parameters.Add("@lrNo", SqlDbType.VarChar);
         sprmparam.Value = salesreturnmasterinfo.LrNo;
         sprmparam = sccmd.Parameters.Add("@transportationCompany", SqlDbType.VarChar);
         sprmparam.Value = salesreturnmasterinfo.TransportationCompany;
         sprmparam = sccmd.Parameters.Add("@date", SqlDbType.DateTime);
         sprmparam.Value = salesreturnmasterinfo.Date;
         sprmparam = sccmd.Parameters.Add("@totalAmount", SqlDbType.Decimal);
         sprmparam.Value = salesreturnmasterinfo.TotalAmount;
         sprmparam = sccmd.Parameters.Add("@grandTotal", SqlDbType.Decimal);
         sprmparam.Value = salesreturnmasterinfo.grandTotal;
         sprmparam = sccmd.Parameters.Add("@financialYearId", SqlDbType.Decimal);
         sprmparam.Value = salesreturnmasterinfo.FinancialYearId;
         sprmparam = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
         sprmparam.Value = salesreturnmasterinfo.Extra1;
         sprmparam = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam.Value = salesreturnmasterinfo.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 SalesReturnMaster Table based on the parameter
 /// </summary>
 /// <param name="salesReturnMasterId"></param>
 /// <returns></returns>
 public SalesReturnMasterInfo SalesReturnMasterView(decimal salesReturnMasterId)
 {
     SalesReturnMasterInfo salesreturnmasterinfo = new SalesReturnMasterInfo();
     SqlDataReader sdrreader = null;
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("SalesReturnMasterView", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@salesReturnMasterId", SqlDbType.Decimal);
         sprmparam.Value = salesReturnMasterId;
         sdrreader = sccmd.ExecuteReader();
         while (sdrreader.Read())
         {
             salesreturnmasterinfo.SalesReturnMasterId = decimal.Parse(sdrreader["salesReturnMasterId"].ToString());
             salesreturnmasterinfo.VoucherNo = sdrreader["voucherNo"].ToString();
             salesreturnmasterinfo.InvoiceNo = sdrreader[2].ToString();
             salesreturnmasterinfo.VoucherTypeId = decimal.Parse(sdrreader["voucherTypeId"].ToString());
             salesreturnmasterinfo.SuffixPrefixId = decimal.Parse(sdrreader["suffixPrefixId"].ToString());
             salesreturnmasterinfo.LedgerId = decimal.Parse(sdrreader["ledgerId"].ToString());
             salesreturnmasterinfo.SalesAccount = decimal.Parse(sdrreader[6].ToString());
             salesreturnmasterinfo.PricinglevelId = decimal.Parse(sdrreader["pricinglevelId"].ToString());
             salesreturnmasterinfo.EmployeeId = decimal.Parse(sdrreader["employeeId"].ToString());
             salesreturnmasterinfo.Narration = sdrreader[9].ToString();
             salesreturnmasterinfo.ExchangeRateId = decimal.Parse(sdrreader["exchangeRateId"].ToString());
             salesreturnmasterinfo.TaxAmount = decimal.Parse(sdrreader["taxAmount"].ToString());
             salesreturnmasterinfo.UserId = decimal.Parse(sdrreader["userId"].ToString());
             salesreturnmasterinfo.LrNo = sdrreader[13].ToString();
             salesreturnmasterinfo.TransportationCompany = sdrreader[14].ToString();
             salesreturnmasterinfo.Date = DateTime.Parse(sdrreader["date"].ToString());
             salesreturnmasterinfo.TotalAmount = decimal.Parse(sdrreader["totalAmount"].ToString());
             salesreturnmasterinfo.grandTotal = decimal.Parse(sdrreader["grandTotal"].ToString());
             salesreturnmasterinfo.FinancialYearId = decimal.Parse(sdrreader["financialYearId"].ToString());
             salesreturnmasterinfo.ExtraDate = DateTime.Parse(sdrreader["extraDate"].ToString());
             salesreturnmasterinfo.Extra1 = sdrreader["extra1"].ToString();
             salesreturnmasterinfo.Extra2 = sdrreader[20].ToString();
             salesreturnmasterinfo.Discount = decimal.Parse(sdrreader["discount"].ToString());
             salesreturnmasterinfo.SalesMasterId = decimal.Parse(sdrreader["salesMasterId"].ToString());
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sdrreader.Close();
         sqlcon.Close();
     }
     return salesreturnmasterinfo;
 }