コード例 #1
0
ファイル: Form1.cs プロジェクト: moqiguishou/GuShen
        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);
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: moqiguishou/GuShen
        /// <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);
            }
        }