Ejemplo n.º 1
0
        private void textBox9_TextChanged(object sender, EventArgs e)
        {
            try
            {
                double mz = 0; //Convert.ToDouble(textBox7.Text);
                double pz = 0; //Convert.ToDouble(textBox8.Text);
                double jz = 0;
                double.TryParse(textBox7.Text, out mz);
                double.TryParse(textBox8.Text, out pz);
                double.TryParse(textBox9.Text, out jz);
                GaussianRNG g = new GaussianRNG();

                double d = g.Next();
                if (jz > 0)
                {
                    pz = 18 + 2 * d;
                }
                mz            = pz + jz;
                textBox7.Text = mz.ToString("f2");
                textBox8.Text = pz.ToString("f2");
            }
            catch
            {
            }
            UpdateHtml();
        }
Ejemplo n.º 2
0
        private void dateTimePicker1_ValueChanged(object sender, EventArgs e)
        {
            GaussianRNG g  = new GaussianRNG();
            double      d  = Math.Abs(g.Next());
            Random      ra = new Random(DateTime.Now.Second);
            DateTime    pt = dateTimePicker1.Value.AddSeconds(ra.Next(3, 25));

            label18.Text = pt.ToString("yyyy-MM-dd HH:mm:ss");
            if (checkBox1.Checked)
            {
                if (LastID > 0)
                {
                    int add = (int)(d * 3 + 1);
                    textBox1.Text = "A" + pt.ToString("yyyyMMdd") + (ID + LastID + add).ToString().Substring(1);
                }
                else
                {
                    int add = (int)(d * 75 + 1);
                    textBox1.Text = "A" + pt.ToString("yyyyMMdd") + (ID + add).ToString().Substring(1);
                }
            }



            if (checkBox4.Checked)
            {
                if (LastCarIndex == -1)
                {
                    LastCarIndex = 0;
                }
                else
                {
                    if (LastCarIndex == listOnit.Count - 1)
                    {
                        LastCarIndex = 0;
                    }
                    else
                    {
                        LastCarIndex++;
                    }
                }
                comboBox1.SelectedIndex = LastCarIndex;
            }
            d = Math.Abs(g.Next());
            int      i  = (int)(d * 14400 + 3600);
            DateTime mt = dateTimePicker1.Value.AddSeconds(-i);

            label19.Text   = i.ToString();
            textBox12.Text = mt.ToString("yyyy/MM/dd HH:mm:ss");
            UpdateHtml();
        }