Пример #1
0
    protected void ImageButton2_Click(object sender, ImageClickEventArgs e)
    {
        try
        {
            if (TxtAmount.Text != "" && TxtAmount2.Text != "")
            {
                double t1 = double.Parse(TxtAmount.Text);

                double t2 = double.Parse(TxtAmount2.Text);



                if (t1 <= 500 && t2 <= 500)
                {
                    if (t1 == t2)
                    {
                        if (t1 <= 0.0)
                        {
                            LblError.Visible = true;
                            LblError.Text    = "Please enter positive amount of money";
                            TxtAmount.Focus();
                            return;
                        }
                        if (t2 <= 0.0)
                        {
                            LblError.Visible = true;
                            LblError.Text    = "Please enter positive amount of money";
                            TxtAmount2.Focus();
                            return;
                        }


                        else
                        {
                            LblError.Visible = false;
                            getaccountamount();
                        }
                    }
                    else
                    {
                        LblError.Visible = true;
                        LblError.Text    = "Please enter same amount";
                    }
                }
                else
                {
                    LblError.Visible = true;
                    LblError.Text    = "Please enter Amount less than or equal to 500$";
                }
            }

            else
            {
                LblError.Visible = true;
                LblError.Text    = "Please enter Amount";
            }
        }
        catch
        { }
    }
Пример #2
0
 private void TxtAmount2_TextChanged(object sender, TextChangedEventArgs e)
 {
     if (decimal.TryParse(TxtAmount2.Text.Replace(",", "").Replace(".", "").TrimStart('0'), out decimal result))
     {
         result /= 100;
         amount2 = result;
         TxtAmount2.TextChanged -= TxtAmount2_TextChanged;
         TxtAmount2.Text         = result.ToString("N2", nfi);
         TxtAmount2.TextChanged += TxtAmount2_TextChanged;
         TxtAmount2.Select(TxtAmount2.Text.Length, 0);
     }
 }