private void txt_price_TextChanged(object sender, EventArgs e) { if (txt_num.Text == "") { return; } decimal price = decimal.Parse(txt_price.Text); int num = int.Parse(txt_num.Text); lab_total.Text = GetTotal(price, num, 1) + " + " + MyIni.ReadIniData("maimai", "mairu", "0.0") + " = " + GetTotal(price, num, 2); }
/// <summary> /// /// </summary> /// <param name="price"></param> /// <param name="num"></param> /// <returns></returns> private decimal GetTotal(decimal price, int num, int type) { decimal total = price * num * 100; //decimal maichu = decimal.Parse(MyIni.ReadIniData("maimai", "maichu", "0.0")); if (type == 1) { return(total); } else { decimal mairu = decimal.Parse(MyIni.ReadIniData("maimai", "mairu", "0.0")); return(total + mairu); } }