예제 #1
0
 /// <summary>
 /// Function to Update values in SalesOrderMaster Table
 /// </summary>
 /// <param name="salesordermasterinfo"></param>
 public void SalesOrderMasterEdit(SalesOrderMasterInfo salesordermasterinfo)
 {
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("SalesOrderMasterEdit", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam       = sccmd.Parameters.Add("@salesOrderMasterId", SqlDbType.Decimal);
         sprmparam.Value = salesordermasterinfo.SalesOrderMasterId;
         sprmparam       = sccmd.Parameters.Add("@voucherNo", SqlDbType.VarChar);
         sprmparam.Value = salesordermasterinfo.VoucherNo;
         sprmparam       = sccmd.Parameters.Add("@invoiceNo", SqlDbType.VarChar);
         sprmparam.Value = salesordermasterinfo.InvoiceNo;
         sprmparam       = sccmd.Parameters.Add("@voucherTypeId", SqlDbType.Decimal);
         sprmparam.Value = salesordermasterinfo.VoucherTypeId;
         sprmparam       = sccmd.Parameters.Add("@suffixPrefixId", SqlDbType.Decimal);
         sprmparam.Value = salesordermasterinfo.SuffixPrefixId;
         sprmparam       = sccmd.Parameters.Add("@date", SqlDbType.DateTime);
         sprmparam.Value = salesordermasterinfo.Date;
         sprmparam       = sccmd.Parameters.Add("@dueDate", SqlDbType.DateTime);
         sprmparam.Value = salesordermasterinfo.DueDate;
         sprmparam       = sccmd.Parameters.Add("@cancelled", SqlDbType.Bit);
         sprmparam.Value = salesordermasterinfo.Cancelled;
         sprmparam       = sccmd.Parameters.Add("@ledgerId", SqlDbType.Decimal);
         sprmparam.Value = salesordermasterinfo.LedgerId;
         sprmparam       = sccmd.Parameters.Add("@pricinglevelId", SqlDbType.Decimal);
         sprmparam.Value = salesordermasterinfo.PricinglevelId;
         sprmparam       = sccmd.Parameters.Add("@employeeId", SqlDbType.Decimal);
         sprmparam.Value = salesordermasterinfo.EmployeeId;
         sprmparam       = sccmd.Parameters.Add("@narration", SqlDbType.VarChar);
         sprmparam.Value = salesordermasterinfo.Narration;
         sprmparam       = sccmd.Parameters.Add("@totalAmount", SqlDbType.Decimal);
         sprmparam.Value = salesordermasterinfo.TotalAmount;
         sprmparam       = sccmd.Parameters.Add("@userId", SqlDbType.Decimal);
         sprmparam.Value = salesordermasterinfo.UserId;
         sprmparam       = sccmd.Parameters.Add("@quotationMasterId", SqlDbType.Decimal);
         sprmparam.Value = salesordermasterinfo.QuotationMasterId;
         sprmparam       = sccmd.Parameters.Add("@financialYearId", SqlDbType.Decimal);
         sprmparam.Value = salesordermasterinfo.FinancialYearId;
         sprmparam       = sccmd.Parameters.Add("@exchangeRateId", SqlDbType.Decimal);
         sprmparam.Value = salesordermasterinfo.ExchangeRateId;
         sprmparam       = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
         sprmparam.Value = salesordermasterinfo.Extra1;
         sprmparam       = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam.Value = salesordermasterinfo.Extra2;
         sccmd.ExecuteNonQuery();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
 }
예제 #2
0
        /// <summary>
        /// Function to get particular values from SalesOrderMaster Table based on the parameter
        /// </summary>
        /// <param name="salesOrderMasterId"></param>
        /// <returns></returns>
        public SalesOrderMasterInfo SalesOrderMasterView(decimal salesOrderMasterId)
        {
            SalesOrderMasterInfo salesordermasterinfo = new SalesOrderMasterInfo();
            SqlDataReader        sdrreader            = null;

            try
            {
                if (sqlcon.State == ConnectionState.Closed)
                {
                    sqlcon.Open();
                }
                SqlCommand sccmd = new SqlCommand("SalesOrderMasterView", sqlcon);
                sccmd.CommandType = CommandType.StoredProcedure;
                SqlParameter sprmparam = new SqlParameter();
                sprmparam       = sccmd.Parameters.Add("@salesOrderMasterId", SqlDbType.Decimal);
                sprmparam.Value = salesOrderMasterId;
                sdrreader       = sccmd.ExecuteReader();
                while (sdrreader.Read())
                {
                    salesordermasterinfo.SalesOrderMasterId = Convert.ToDecimal(sdrreader["salesOrderMasterId"].ToString());
                    salesordermasterinfo.VoucherNo          = sdrreader["voucherNo"].ToString();
                    salesordermasterinfo.InvoiceNo          = sdrreader["invoiceNo"].ToString();
                    salesordermasterinfo.VoucherTypeId      = Convert.ToDecimal(sdrreader["voucherTypeId"].ToString());
                    salesordermasterinfo.SuffixPrefixId     = Convert.ToDecimal(sdrreader["suffixPrefixId"].ToString());
                    salesordermasterinfo.Date              = DateTime.Parse(sdrreader["date"].ToString());
                    salesordermasterinfo.DueDate           = DateTime.Parse(sdrreader["dueDate"].ToString());
                    salesordermasterinfo.Cancelled         = Convert.ToBoolean(sdrreader["cancelled"].ToString());
                    salesordermasterinfo.LedgerId          = Convert.ToDecimal(sdrreader["ledgerId"].ToString());
                    salesordermasterinfo.PricinglevelId    = Convert.ToDecimal(sdrreader["pricinglevelId"].ToString());
                    salesordermasterinfo.EmployeeId        = Convert.ToDecimal(sdrreader["employeeId"].ToString());
                    salesordermasterinfo.Narration         = sdrreader["narration"].ToString();
                    salesordermasterinfo.TotalAmount       = Convert.ToDecimal(sdrreader["totalAmount"].ToString());
                    salesordermasterinfo.ExchangeRateId    = Convert.ToDecimal(sdrreader["exchangeRateId"].ToString());
                    salesordermasterinfo.QuotationMasterId = Convert.ToDecimal(sdrreader["quotationMasterId"].ToString());
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                sdrreader.Close();
                sqlcon.Close();
            }
            return(salesordermasterinfo);
        }