コード例 #1
0
ファイル: CalculationMain.cs プロジェクト: ivladokk/myorders
        private void OpenItem_Click(object sender, EventArgs e)
        {
            var id = grid.GetSelectedID();

            if (id < 0)
            {
                return;
            }
            using (UserContext db = new UserContext(Settings.constr))
            {
                var             instance = db.CalculationInsctInstances.FirstOrDefault(x => x.ID == id);
                CalculationForm f        = new CalculationForm(instance);
                f.MdiParent = this.MdiParent;
                f.Show();
            }
        }
コード例 #2
0
            public CalculationResult(CalculationForm form)
            {
                if (form.Weight * form.Height != 0)
                {
                    this.IndicationList = new List <Indication>()
                    {
                        new Indication(0, 13, "やせ", form.Age, form.Height, form.Weight),
                        new Indication(13, 15, "やせ気味", form.Age, form.Height, form.Weight),
                        new Indication(15, 18, "標準", form.Age, form.Height, form.Weight),
                        new Indication(18, 20, "肥満気味", form.Age, form.Height, form.Weight),
                        new Indication(20, 0, "肥満", form.Age, form.Height, form.Weight),
                    };

                    double kaup = 0;
                    switch (form.Age)
                    {
                    case int n when n < 6:
                        kaup = form.Weight / Math.Pow(form.Height, 2.0) * Math.Pow(10, 4.0);
                        break;

                    case int n when 6 <= n && n < 16:
                        kaup = form.Weight / Math.Pow(form.Height, 3.0) * Math.Pow(10, 7.0);
                        break;

                    case int n:
                    default:
                        break;
                    }
                    this.Kaup = kaup;

                    this.Subject = this.IndicationList
                                   .Where(m => m.LowerIndex <= kaup)
                                   .Where(m => m.UpperIndex == 0 || m.UpperIndex > kaup)
                                   .Single().Subject;
                }
            }
コード例 #3
0
 public KaupCalculation(CalculationForm form)
 {
     this.Form   = form;
     this.Result = new CalculationResult(form);
 }
コード例 #4
0
        public void ShowFormOnClick(Office.IRibbonControl control)
        {
            CalculationForm calculationForm = new CalculationForm(ThisAdd);

            calculationForm.Show();
        }
コード例 #5
0
        public void ShowMultiplicationLog()
        {
            CalculationForm calculationForm = new CalculationForm(ellipticCurve.MultiplicationLog);

            calculationForm.ShowDialog();
        }
コード例 #6
0
        public void ShowAdditionLog()
        {
            CalculationForm calculationForm = new CalculationForm(ellipticCurve.AdditionLog);

            calculationForm.ShowDialog();
        }