public void SalePrice() { double originalPrice, discountPercentage, discountAmount, salePrice; con.Open(); SqlCommand sqlcom = new SqlCommand("USP_SalePriceCalculation", con); sqlcom.CommandType = CommandType.StoredProcedure; SqlDataAdapter da = new SqlDataAdapter(sqlcom); DataTable dt = new DataTable(); da.Fill(dt); if (dt.Rows.Count > 0) { // Get item's original price. originalPrice = double.Parse(dt.Rows[0]["actprice"].ToString()); // Get discount percentage. discountPercentage = double.Parse(dt.Rows[0]["Discount"].ToString()); // Create decimal representation of % (move point left two places) discountPercentage = discountPercentage / 100; // Calculate amount of the discount. discountAmount = originalPrice * discountPercentage; // Calculate sale price. salePrice = originalPrice - discountAmount; // Display sale price as Currency ("c") lblPrice.Text = salePrice.ToString("c", Cultures.INDIA); } con.Close(); } public static class Cultures { public static readonly CultureInfo INDIA = CultureInfo.GetCultureInfo("en-IN"); }
SalePrice(); var unitPrice = long.Parse(lblPrice.Text); var qty = int.Parse(txbQty.Text); var subTotal = unitPrice * qty;
select sum(col) as SubTotal from tablename Group by Quantity, Price
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)