private async void Qty_LostFocus(object sender, RoutedEventArgs e) { if (!string.IsNullOrEmpty(Price.Text) && !string.IsNullOrEmpty(Qty.Text)) { Log.Info("Before: Process to calculate total amount in Qty_LostFocus Add Purchase"); float price, Quantity; price = float.Parse(Price.Text); Quantity = float.Parse(Qty.Text); TotalAmount.Text = Convert.ToString(price * Quantity); Log.Info("Before: Process to calculate total amount in Qty_LostFocus Add Purchase"); } else { MainWindow mainWindow = (MainWindow)Application.Current.MainWindow; if (!string.IsNullOrEmpty(Price.Text)) { await mainWindow.ShowMessageAsync("Please Enter Qunatity", ""); Qty.Focus(); } else { await mainWindow.ShowMessageAsync("Please Enter Unitprice", ""); Price.Focus(); } // MessageBox.Show("Please enter Unitprice and Qunatity"); } }
protected void ProductName_TextChanged(object sender, EventArgs e) { SqlConnection con = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["conn"].ToString()); SqlCommand cmd = new SqlCommand("", con); cmd.CommandText = "select *,dbo.GETAVLQTY(productId,@FrenchiseID)as AQTY from ProductRepurchase where ProductName = @ProductName and Status != 1 "; cmd.Parameters.AddWithValue("@productName", ProductName.Text); cmd.Parameters.AddWithValue("@FrenchiseID", ConfigurationManager.AppSettings["FrenchiseID"].ToString()); con.Open(); cmd.CommandTimeout = 0; SqlDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { PID.Value = dr["ProductID"].ToString(); ProductCode.Text = dr["ProductCode"].ToString(); MRP.Text = dr["MRP"].ToString().Replace(".0000", ".00"); SpecialDiscount = Convert.ToDecimal(dr["DiscountAmount"].ToString().Replace(".0000", ".00")); SPDiscount.Text = SpecialDiscount.ToString(); DP.Text = dr["SalesAmount"].ToString().Replace(".0000", ".00"); BV.Text = dr["BV"].ToString(); Tax.Text = dr["vat"].ToString(); CashBack.Text = dr["CashBack"].ToString(); txtselcashback.Text = dr["SelfCashBack"].ToString(); CGST.Text = string.Format("{0:f2}", decimal.Parse(dr["CGST"].ToString())); SGST.Text = string.Format("{0:f2}", decimal.Parse(dr["SGST"].ToString())); IGST.Text = string.Format("{0:f2}", decimal.Parse(dr["IGST"].ToString())); Cess.Text = string.Format("{0:f2}", decimal.Parse(dr["Cess"].ToString())); Qty.Text = "1"; // Amount.Text = string.Format("{0:f2}", (decimal.Parse(Qty.Text) * decimal.Parse(DP.Text))); //Amount.Text = string.Format("{0:f2}", (decimal.Parse(DP.Text) - decimal.Parse(SPDiscount.Text))); Amount.Text = string.Format("{0:f2}", (decimal.Parse(DP.Text) * (decimal.Parse(Qty.Text)) - decimal.Parse(SPDiscount.Text))); // txtAVLQTY.Text = dr["AQTY"].ToString(); //imageload.HRef = dr["ImageUrl"].ToString(); } dr.Close(); con.Close(); Qty.Focus(); }
private async void discounttxt_LostFocus(object sender, RoutedEventArgs e) { MainWindow mainWindow = (MainWindow)Application.Current.MainWindow; if (!string.IsNullOrEmpty(Price.Text) && !string.IsNullOrEmpty(Qty.Text)) { calculateTotal(); } else { if (string.IsNullOrEmpty(Qty.Text)) { await mainWindow.ShowMessageAsync("Please Enter Qunatity", ""); Qty.Focus(); } else if (string.IsNullOrEmpty(Price.Text)) { await mainWindow.ShowMessageAsync("Please Enter Unitprice", ""); Price.Focus(); } } }