示例#1
0
        /// <summary>
        /// Function to insert values to SalesQuotationMaster Table
        /// </summary>
        /// <param name="salesquotationmasterinfo"></param>
        /// <returns></returns>
        public decimal SalesQuotationMasterAdd(SalesQuotationMasterInfo salesquotationmasterinfo)
        {
            decimal decSalesQuotationmasterIdentity = 0;

            try
            {
                if (sqlcon.State == ConnectionState.Closed)
                {
                    sqlcon.Open();
                }
                SqlCommand sccmd = new SqlCommand("SalesQuotationMasterAdd", sqlcon);
                sccmd.CommandType = CommandType.StoredProcedure;
                SqlParameter sprmparam = new SqlParameter();
                sprmparam       = sccmd.Parameters.Add("@voucherNo", SqlDbType.VarChar);
                sprmparam.Value = salesquotationmasterinfo.VoucherNo;
                sprmparam       = sccmd.Parameters.Add("@invoiceNo", SqlDbType.VarChar);
                sprmparam.Value = salesquotationmasterinfo.InvoiceNo;
                sprmparam       = sccmd.Parameters.Add("@voucherTypeId", SqlDbType.Decimal);
                sprmparam.Value = salesquotationmasterinfo.VoucherTypeId;
                sprmparam       = sccmd.Parameters.Add("@suffixPrefixId", SqlDbType.Decimal);
                sprmparam.Value = salesquotationmasterinfo.SuffixPrefixId;
                sprmparam       = sccmd.Parameters.Add("@date", SqlDbType.DateTime);
                sprmparam.Value = salesquotationmasterinfo.Date;
                sprmparam       = sccmd.Parameters.Add("@pricinglevelId", SqlDbType.Decimal);
                sprmparam.Value = salesquotationmasterinfo.PricinglevelId;
                sprmparam       = sccmd.Parameters.Add("@ledgerId", SqlDbType.Decimal);
                sprmparam.Value = salesquotationmasterinfo.LedgerId;
                sprmparam       = sccmd.Parameters.Add("@employeeId", SqlDbType.Decimal);
                sprmparam.Value = salesquotationmasterinfo.EmployeeId;
                sprmparam       = sccmd.Parameters.Add("@userId", SqlDbType.Decimal);
                sprmparam.Value = salesquotationmasterinfo.userId;
                sprmparam       = sccmd.Parameters.Add("@approved", SqlDbType.Bit);
                sprmparam.Value = salesquotationmasterinfo.Approved;
                sprmparam       = sccmd.Parameters.Add("@totalAmount", SqlDbType.Decimal);
                sprmparam.Value = salesquotationmasterinfo.TotalAmount;
                sprmparam       = sccmd.Parameters.Add("@narration", SqlDbType.VarChar);
                sprmparam.Value = salesquotationmasterinfo.Narration;
                sprmparam       = sccmd.Parameters.Add("@financialYearId", SqlDbType.Decimal);
                sprmparam.Value = salesquotationmasterinfo.FinancialYearId;
                sprmparam       = sccmd.Parameters.Add("@exchangeRateId", SqlDbType.Decimal);
                sprmparam.Value = salesquotationmasterinfo.ExchangeRateId;
                sprmparam       = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
                sprmparam.Value = salesquotationmasterinfo.Extra1;
                sprmparam       = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
                sprmparam.Value = salesquotationmasterinfo.Extra2;
                decSalesQuotationmasterIdentity = Convert.ToDecimal(sccmd.ExecuteScalar());
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                sqlcon.Close();
            }
            return(decSalesQuotationmasterIdentity);
        }
示例#2
0
        /// <summary>
        /// Function to get particular values from SalesQuotationMaster table based on the parameter
        /// </summary>
        /// <param name="quotationMasterId"></param>
        /// <returns></returns>
        public SalesQuotationMasterInfo SalesQuotationMasterView(decimal quotationMasterId)
        {
            SalesQuotationMasterInfo salesquotationmasterinfo = new SalesQuotationMasterInfo();
            SqlDataReader            sdrreader = null;

            try
            {
                if (sqlcon.State == ConnectionState.Closed)
                {
                    sqlcon.Open();
                }
                SqlCommand sccmd = new SqlCommand("SalesQuotationMasterView", sqlcon);
                sccmd.CommandType = CommandType.StoredProcedure;
                SqlParameter sprmparam = new SqlParameter();
                sprmparam       = sccmd.Parameters.Add("@quotationMasterId", SqlDbType.Decimal);
                sprmparam.Value = quotationMasterId;
                sdrreader       = sccmd.ExecuteReader();
                while (sdrreader.Read())
                {
                    salesquotationmasterinfo.QuotationMasterId = Convert.ToDecimal(sdrreader[0].ToString());
                    salesquotationmasterinfo.VoucherNo         = sdrreader[1].ToString();
                    salesquotationmasterinfo.InvoiceNo         = sdrreader[2].ToString();
                    salesquotationmasterinfo.VoucherTypeId     = Convert.ToDecimal(sdrreader[3].ToString());
                    salesquotationmasterinfo.SuffixPrefixId    = Convert.ToDecimal(sdrreader[4].ToString());
                    salesquotationmasterinfo.Date            = DateTime.Parse(sdrreader[5].ToString());
                    salesquotationmasterinfo.PricinglevelId  = Convert.ToDecimal(sdrreader[6].ToString());
                    salesquotationmasterinfo.LedgerId        = Convert.ToDecimal(sdrreader[7].ToString());
                    salesquotationmasterinfo.EmployeeId      = Convert.ToDecimal(sdrreader[8].ToString());
                    salesquotationmasterinfo.Approved        = bool.Parse(sdrreader[9].ToString());
                    salesquotationmasterinfo.TotalAmount     = Convert.ToDecimal(sdrreader[10].ToString());
                    salesquotationmasterinfo.Narration       = sdrreader[11].ToString();
                    salesquotationmasterinfo.FinancialYearId = Convert.ToDecimal(sdrreader[12].ToString());
                    salesquotationmasterinfo.ExchangeRateId  = Convert.ToDecimal(sdrreader[13].ToString());
                    salesquotationmasterinfo.Extra1          = sdrreader[14].ToString();
                    salesquotationmasterinfo.Extra2          = sdrreader[15].ToString();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                sdrreader.Close();
                sqlcon.Close();
            }
            return(salesquotationmasterinfo);
        }