Example #1
0
        /// <summary>
        /// 注册
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        public async void UserRegisterd(User user)
        {
            user.Role = Role.Client;
            Statistical statistical1 = new Statistical();

            user.RunTeamId = 0;
            statistical1.SportFreeModel = SportFreeModel.Running;
            statistical1.User           = user;
            Statistical statistical2 = new Statistical
            {
                SportFreeModel = SportFreeModel.Riding,
                User           = user
            };
            LatitudeAndLongitude latitudeAndLongitude = new LatitudeAndLongitude
            {
                Name  = user.Name,
                Phone = user.Account,
                User  = user
            };

            await _myContext.Statisticals.AddAsync(statistical1);

            await _myContext.Statisticals.AddAsync(statistical2);

            await _myContext.Users.AddAsync(user);

            await _myContext.LatitudeAndLongitudes.AddAsync(latitudeAndLongitude);
        }
Example #2
0
        public void StandardMovingAverageIntTest()
        {
            IEnumerable <int>    source;
            IEnumerable <double> expected;
            IEnumerable <double> actual;
            int blockSize;

            source    = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 };
            expected  = new double[] { 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 };
            blockSize = 3;

            actual = Statistical.StandardMovingAverage(source, blockSize);
            Assert.IsTrue(expected.SequenceEqual(actual));

            //------------------------------//

            source    = new int[] { 1, 2, 3, 4, 5 };
            expected  = new double[] { 3 };
            blockSize = 8;

            actual = Statistical.StandardMovingAverage(source, blockSize);
            Assert.IsTrue(expected.SequenceEqual(actual));

            //------------------------------//

            try
            {
                source    = new int[] { 1, 2, 3, 4, 5 };
                blockSize = 1;
                int x = Statistical.StandardMovingAverage(source, blockSize).Count();
                Assert.Fail();
            }
            catch (ArgumentException e) { Assert.IsTrue(e.ParamName == "blockSize"); }
            catch (Exception) { Assert.Fail(); }
        }
Example #3
0
        void TimerTick(object sender, EventArgs e)
        {
            if (FormBorderStyle.Equals(FormBorderStyle.Sizable) && WindowState.Equals(FormWindowState.Minimized) == false && Result.Equals(DialogResult.Yes))
            {
                FormBorderStyle = FormBorderStyle.FixedSingle;
                WindowState     = FormWindowState.Minimized;
            }
            else if (DateTime.Now.Hour < 3 && backgroundWorker.IsBusy == false &&
                     DateTime.Now.DayOfWeek.Equals(DayOfWeek.Sunday) &&
                     (cookie as string).Equals(admin) == false)
            {
                timer.Stop();
                strip.ItemClicked -= OnItemClick;
                GetSettleTheFare();
                Dispose();
            }
            else if (Visible == false && ShowIcon == false && notifyIcon.Visible && WindowState.Equals(FormWindowState.Minimized))
            {
                notifyIcon.Icon = (Icon)resources.GetObject(Change ? upload : download);
                Change          = !Change;

                if (IsApplicationAlreadyRunning(Privacy.Security) == false && backgroundWorker.IsBusy == false &&
                    string.IsNullOrEmpty(Privacy.Account) && string.IsNullOrEmpty(Privacy.SecuritiesAPI) && string.IsNullOrEmpty(Privacy.SecurityAPI))
                {
                    strip.Items.Find(st, false).First(o => o.Name.Equals(st)).PerformClick();
                }
            }
            else
            {
                Statistical.CheckForSurvival(colors[DateTime.Now.Second % 3]);
            }
        }
Example #4
0
 public void should_test_all_classes_functionality_calculations()
 {
     MathTrig.Test(new CalcEngine());
     Logical.Test(new CalcEngine());
     Statistical.Test(new CalcEngine());
     Text.Test(new CalcEngine());
 }
Example #5
0
        public void WriteStatistical(double[] dataAr, string rowName)
        {
            if (DataConvertationClass.IsUndefinedElement(dataAr))
            {
                return;
            }

            double mid   = Statistical.Middle(dataAr);
            double disp  = Statistical.Dispersion(dataAr);
            double skewn = Statistical.Skewness(dataAr);
            double kurt  = Statistical.Kurtosis(dataAr);
            double jb    = Statistical.JB(dataAr, 0);

            richTextBox.SelectionFont      = new Font("Arial", 12, FontStyle.Bold);
            richTextBox.SelectedText       = "\nСтатистичні характеристики.";
            richTextBox.SelectionAlignment = HorizontalAlignment.Center;
            richTextBox.SelectionFont      = new Font("Arial", 12, FontStyle.Bold);
            richTextBox.SelectedText       = "\nРяд \"" + rowName + "\".";
            richTextBox.SelectionAlignment = HorizontalAlignment.Center;
            richTextBox.SelectedText       = "\n";
            richTextBox.SelectionFont      = new Font("Arial", 10);
            richTextBox.SelectionAlignment = HorizontalAlignment.Left;
            richTextBox.SelectionIndent    = 15;
            richTextBox.SelectedText       = "\nСереднє\t\t\t" + mid.ToString("F4") + "\v";
            richTextBox.SelectedText       = "\nДисперсія\t\t\t" + disp.ToString("F4") + "\v";
            richTextBox.SelectedText       = "\nКоофіцієнт асиметрії\t\t" + skewn.ToString("F4") + "\v";
            richTextBox.SelectedText       = "\nЕксцес\t\t\t" + kurt.ToString("F4") + "\v";
            richTextBox.SelectedText       = "\nЖака-Бера\t\t\t" + jb.ToString("F4") + "\v";
        }
        public void MovingSumNullableIntTest()
        {
            IEnumerable <int?> source;
            IEnumerable <int?> expected;
            IEnumerable <int?> actual;
            int blockSize;

            source    = new int?[] { 1, null, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 };
            expected  = new int?[] { 4, 7, 12, 15, 18, 21, 24, 27, 30, 33, 36 };
            blockSize = 3;

            actual = Statistical.MovingSum(source, blockSize);
            Assert.IsTrue(expected.SequenceEqual(actual));

            //------------------------------//

            source    = new int?[] { 1, 2, null, 4 };
            expected  = new int?[] { 7 };
            blockSize = 8;

            actual = Statistical.MovingSum(source, blockSize);
            Assert.IsTrue(expected.SequenceEqual(actual));

            //------------------------------//

            try
            {
                source    = new int?[] { 1, 2, null, 4 };
                blockSize = 1;
                int x = Statistical.MovingSum(source, blockSize).Count();
                Assert.Fail();
            }
            catch (ArgumentException e) { Assert.IsTrue(e.ParamName == "blockSize"); }
            catch (Exception) { Assert.Fail(); }
        }
Example #7
0
    void Start()
    {
        //groupMod = MatGroupMod.Instance;

        groupMod = GroupMod.Instance;

        statistical = Statistical.Instance;
    }
        public IEnumerable <Statistical> RevenueStatistical(string option, int monthSearch, int yearSearch)
        {
            //DateTime date = DateTime.UtcNow.Date;
            if (option == null || option == "dayinmonth")
            {
                /*var report = _ctx.orders
                 * .GroupBy(x => new { x.createDate.Date })
                 * .Select(x => new { Date = x.Key.Date.ToShortDateString(), Count = x.Count(), Total = x.Sum(y=> y.total) });*/
                var report = from o in _ctx.orders
                             group o by o.createDate.Date into g

                             //where g.Key.Month == date.Month && g.Key.Year == date.Year
                             where g.Key.Month == monthSearch && g.Key.Year == yearSearch
                             select new
                {
                    Day   = g.Key.ToString("dd/MM/yyyy"),
                    Count = g.Count(),
                    Total = g.Sum(x => x.total)
                };
                List <Statistical> lst = new List <Statistical>();
                foreach (var value in report)
                {
                    var temp = new Statistical();
                    temp.Day   = value.Day;
                    temp.Count = value.Count;
                    temp.Total = value.Total;
                    lst.Add(temp);
                }
                return(lst);
            }
            else
            {
                //string test = date.Month.ToString();
                var rp = from i in _ctx.orders
                         where i.createDate.Year == yearSearch
                         group i by i.createDate.Month into h
                         //where g.Key > date && g.Key < DateTime.Parse("2019-12-22")
                         //where g.Key.Month == date.Month

                         select new
                {
                    Day   = h.Key,
                    Count = h.Count(),
                    Total = h.Sum(x => x.total)
                };
                List <Statistical> list = new List <Statistical>();
                foreach (var valu in rp)
                {
                    var tem = new Statistical();
                    tem.Day   = "Tháng " + valu.Day.ToString();
                    tem.Count = valu.Count;
                    tem.Total = valu.Total;
                    list.Add(tem);
                }
                return(list);
            }
        }
Example #9
0
        public void CumulativeMovingAverageLongTest1()
        {
            IEnumerable <long>   source   = new long[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 };
            IEnumerable <double> expected = new double[] { 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5, 5.5, 6, 6.5, 7 };
            IEnumerable <double> actual;

            actual = Statistical.CumulativeMovingAverage(source);
            Assert.IsTrue(expected.SequenceEqual(actual));
        }
Example #10
0
        public void CumulativeMovingAverageNullableDecimalTest()
        {
            IEnumerable <decimal?> source   = new decimal?[] { 1, 2, 3, 4, null, null, 5, 6, 7, 8, 9, 10, 11, 12, 13 };
            IEnumerable <decimal?> expected = new decimal?[] { 1, 1.5m, 2, 2.5m, 3, 3.5m, 4, 4.5m, 5, 5.5m, 6, 6.5m, 7 };
            IEnumerable <decimal?> actual;

            actual = Statistical.CumulativeMovingAverage(source);
            Assert.IsTrue(expected.SequenceEqual(actual));
        }
Example #11
0
        public void CumulativeMovingAverageNullableFloatTest()
        {
            IEnumerable <float?> source   = new float?[] { 1, 2, null, null, 3, 4, 5, 6, 7, 8, 9, float.NaN, 11, 12, 13 };
            IEnumerable <float?> expected = new float?[] { 1, 1.5f, 2, 2.5f, 3, 3.5f, 4, 4.5f, 5, float.NaN, float.NaN, float.NaN, float.NaN };
            IEnumerable <float?> actual;

            actual = Statistical.CumulativeMovingAverage(source);
            Assert.IsTrue(expected.SequenceEqual(actual));
        }
Example #12
0
        public void CumulativeMovingAverageNullableDoubleTest()
        {
            IEnumerable <double?> source   = new double?[] { 1, 2, null, null, 3, 4, 5, 6, 7, 8, 9, double.NaN, 11, 12, 13 };
            IEnumerable <double?> expected = new double?[] { 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5, double.NaN, double.NaN, double.NaN, double.NaN };
            IEnumerable <double?> actual;

            actual = Statistical.CumulativeMovingAverage(source);
            Assert.IsTrue(expected.SequenceEqual(actual));
        }
Example #13
0
        public void StandardMovingAverageLongTest1()
        {
            IEnumerable <Tuple <string, long> > source = Enumerator.Generate <Tuple <string, long> >(13, X => Generator.GenerateLong(X));
            int blockSize = 3;
            IEnumerable <double> expected = new double[] { 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 };
            IEnumerable <double> actual;

            actual = Statistical.StandardMovingAverage(source, blockSize, S => S.Item2);
            Assert.IsTrue(expected.SequenceEqual(actual));
        }
Example #14
0
        public void StandardMovingAverageFloatTest1()
        {
            IEnumerable <Tuple <string, float> > source = Enumerator.Generate <Tuple <string, float> >(13, X => Generator.GenerateFloat(X, 10));
            int blockSize = 3;
            IEnumerable <float> expected = new float[] { 2, 3, 4, 5, 6, 7, 8, float.NaN, float.NaN, float.NaN, 12 };
            IEnumerable <float> actual;

            actual = Statistical.StandardMovingAverage(source, blockSize, S => S.Item2);
            Assert.IsTrue(expected.SequenceEqual(actual));
        }
Example #15
0
        public void StandardMovingAverageNullableIntTest1()
        {
            IEnumerable <Tuple <string, int?> > source = Enumerator.Generate <Tuple <string, int?> >(13, X => Generator.GenerateNullableInt(X, 2));
            int blockSize = 3;
            IEnumerable <double?> expected = new double?[] { 2, 3.5, 4, 5, 6, 7, 8, 9, 10, 11, 12 };
            IEnumerable <double?> actual;

            actual = Statistical.StandardMovingAverage(source, blockSize, S => S.Item2);
            Assert.IsTrue(expected.SequenceEqual(actual));
        }
        public void MovingSumIntTest3()
        {
            IEnumerable <Tuple <string, int?> > source = Enumerator.Generate <Tuple <string, int?> >(13, X => Generator.GenerateNullableInt(X, 2));
            int blockSize = 3;
            IEnumerable <int?> expected = new int?[] { 4, 7, 12, 15, 18, 21, 24, 27, 30, 33, 36 };
            IEnumerable <int?> actual;

            actual = Statistical.MovingSum(source, blockSize, S => S.Item2);
            Assert.IsTrue(expected.SequenceEqual(actual));
        }
        public void MovingSumFloatTest2()
        {
            IEnumerable <Tuple <string, float> > source = Enumerator.Generate <Tuple <string, float> >(13, X => Generator.GenerateFloat(X, 10));
            int blockSize = 3;
            IEnumerable <float> expected = new float[] { 6, 9, 12, 15, 18, 21, 24, float.NaN, float.NaN, float.NaN, 36 };
            IEnumerable <float> actual;

            actual = Statistical.MovingSum(source, blockSize, S => S.Item2);
            Assert.IsTrue(expected.SequenceEqual(actual));
        }
        public void MovingSumLongTest2()
        {
            IEnumerable <Tuple <string, long> > source = Enumerator.Generate <Tuple <string, long> >(13, X => Generator.GenerateLong(X));
            int blockSize = 3;
            IEnumerable <long> expected = new long[] { 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36 };
            IEnumerable <long> actual;

            actual = Statistical.MovingSum(source, blockSize, S => S.Item2);
            Assert.IsTrue(expected.SequenceEqual(actual));
        }
        public void MovingSumDoubleTest3()
        {
            IEnumerable <Tuple <string, double?> > source = Enumerator.Generate <Tuple <string, double?> >(13, X => Generator.GenerateNullableDouble(X, 10, 2));
            IEnumerable <double?> expected = new double?[] { 4, 7, 12, 15, 18, 21, 24, double.NaN, double.NaN, double.NaN, 36 };
            IEnumerable <double?> actual;
            int blockSize = 3;

            actual = Statistical.MovingSum(source, blockSize, S => S.Item2);
            Assert.IsTrue(expected.SequenceEqual(actual));
        }
Example #20
0
        private static async Task UpdateDataAsync()
        {
            var html = await Helper.GetHTMLAsync("https://ncov.moh.gov.vn/");

            var(vietNam, global) = await Statistical.GetVietNamGlobalAsync(html);

            var provinces = await Statistical.GetProvincesAsync(html);

            var patients = await Patient.GetPatientsAsync(html);

            if (File.Exists(Env.StatisticalGlobalPath))
            {
                if (!global.Equals(Helper.DeserializeObjectFromFile <Statistical>(Env.StatisticalGlobalPath)))
                {
                    Helper.SerializeObjectToFile(Env.StatisticalGlobalPath, global);
                }
            }
            else
            {
                Helper.SerializeObjectToFile(Env.StatisticalGlobalPath, global);
            }
            if (File.Exists(Env.StatisticalVietNamPath))
            {
                if (!vietNam.Equals(Helper.DeserializeObjectFromFile <Statistical>(Env.StatisticalVietNamPath)))
                {
                    Helper.SerializeObjectToFile(Env.StatisticalVietNamPath, vietNam);
                }
            }
            else
            {
                Helper.SerializeObjectToFile(Env.StatisticalVietNamPath, vietNam);
            }
            if (File.Exists(Env.StatisticalProvincesPath))
            {
                if (!provinces.Equals(Helper.DeserializeObjectFromFile <List <Statistical> >(Env.StatisticalProvincesPath)))
                {
                    Helper.SerializeObjectToFile(Env.StatisticalProvincesPath, provinces);
                }
            }
            else
            {
                Helper.SerializeObjectToFile(Env.StatisticalProvincesPath, provinces);
            }
            if (File.Exists(Env.StatisticalPatientsPath))
            {
                if (!patients.Equals(Helper.DeserializeObjectFromFile <List <Statistical> >(Env.StatisticalPatientsPath)))
                {
                    Helper.SerializeObjectToFile(Env.StatisticalPatientsPath, patients);
                }
            }
            else
            {
                Helper.SerializeObjectToFile(Env.StatisticalPatientsPath, patients);
            }
        }
Example #21
0
        public void StandardMovingAverageNullableLongTest()
        {
            IEnumerable <long?>   source;
            IEnumerable <double?> expected;
            IEnumerable <double?> actual;
            int blockSize;

            source    = new long?[] { 1, null, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 };
            expected  = new double?[] { 2, 3.5, 4, 5, 6, 7, 8, 9, 10, 11, 12 };
            blockSize = 3;

            actual = Statistical.StandardMovingAverage(source, blockSize);
            Assert.IsTrue(expected.SequenceEqual(actual));

            //------------------------------//

            source    = new long?[] { 1, 2, null, 9 };
            expected  = new double?[] { 4 };
            blockSize = 8;

            actual = Statistical.StandardMovingAverage(source, blockSize);
            Assert.IsTrue(expected.SequenceEqual(actual));

            //------------------------------//

            try
            {
                source    = new long?[] { 1, 2, 3, 4, 5 };
                blockSize = 1;
                int x = Statistical.StandardMovingAverage(source, blockSize).Count();
                Assert.Fail();
            }
            catch (ArgumentException e) { Assert.IsTrue(e.ParamName == "blockSize"); }
            catch (Exception) { Assert.Fail(); }

            //------------------------------//

            source    = new long?[] { null, null, null, null };
            expected  = new double?[] { null };
            blockSize = 8;

            actual = Statistical.StandardMovingAverage(source, blockSize);
            Assert.IsTrue(expected.SequenceEqual(actual));

            //------------------------------//

            source    = new long?[] { 1, null, null, null };
            expected  = new double?[] { 1, null, null };
            blockSize = 2;

            actual = Statistical.StandardMovingAverage(source, blockSize);
            Assert.IsTrue(expected.SequenceEqual(actual));
        }
Example #22
0
        public List <Statistical> GetStatisticalListByDate(String start, String end)
        {
            List <Statistical> statisList = new List <Statistical>();
            string             query      = "EXEC GetStatisByDate '" + start + "' , '" + end + "'";
            DataTable          data       = DataProvider.Instance.ExecuteQuery(query);

            foreach (DataRow item in data.Rows)
            {
                Statistical statis = new Statistical(item);
                statisList.Add(statis);
            }
            return(statisList);
        }
Example #23
0
        void OnReceiveStrategy(object sender, EventHandler.BackTesting.Statistics e)
        {
            if (string.IsNullOrEmpty(e.Setting.Code) == false && string.IsNullOrEmpty(e.Setting.Strategy) == false && retrieve.SetIdentify(e.Setting) >= 0)
            {
                Cursor = Cursors.Default;
                retrieve.SetStatistics(e.Setting, new List <string>(secret.strategy), secret.rate[0]);

                return;
            }
            if (Chart == null)
            {
                Chart = new ChartControl();
                panel.Controls.Add(Chart);
                Chart.Dock = DockStyle.Fill;
            }
            if (retrieve.OnReceiveRepositoryID(e.Game) == false)
            {
                var message = string.Empty;
                Task = new Task(() => message = new BackTesting((char)86, retrieve.GetImitationModel(e.Game), key).Message);
                Task.Start();

                if (TimerBox.Show(secret.BackTesting, e.Game.Strategy, MessageBoxButtons.OK, MessageBoxIcon.Warning, (uint)15E+3).Equals(DialogResult.OK))
                {
                    Cursor = Cursors.AppStarting;
                    Task.Wait();

                    if (string.IsNullOrEmpty(message) == false && TimerBox.Show(message, e.Game.Strategy, MessageBoxButtons.OK, MessageBoxIcon.Warning, 3251).Equals(DialogResult.OK))
                    {
                        Cursor = Cursors.Default;

                        return;
                    }
                }
            }
            var task = new Task <Dictionary <DateTime, string> >(() => retrieve.OnReceiveInformation(e.Game));

            task.Start();
            Cursor           = Cursors.WaitCursor;
            SendInformation += Chart.OnReceiveChartValue;
            task.Wait();
            SuspendLayout();
            SendInformation?.Invoke(this, new EventHandler.BackTesting.Statistics(task.Result));
            Size = Chart.SetChartValue();
            Statistical.Hide();
            Chart.Show();
            ResumeLayout();
            CenterToScreen();
            Cursor           = Cursors.Default;
            SendInformation -= Chart.OnReceiveChartValue;
        }
Example #24
0
        public void FrequencyTest3()
        {
            IEnumerable <int>    input   = new int[] { 1, 2, 3, 4, 3, 2, 3, 3, 3, 3, 2, 2, 2, 3, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 3, 2, 2, 3, 3, 2, 2, 2, 2, 2, 2, 3, 3, 1, 1, 2, 2, 1, 2, 1, 1, 2, 1, 2 };
            IEnumerable <string> buckets = new string[] { "a", "b", "c", "Z1", "Z2" };
            Func <int, IEnumerable <string>, string>  bucketSelector = BucketSelector;
            IEnumerable <KeyValuePair <string, int> > expected       = new KeyValuePair <string, int>[] { new KeyValuePair <string, int>("a", 13),
                                                                                                          new KeyValuePair <string, int>("b", 23),
                                                                                                          new KeyValuePair <string, int>("c", 12),
                                                                                                          new KeyValuePair <string, int>("Z1", 1),
                                                                                                          new KeyValuePair <string, int>("Z2", 0) };
            IEnumerable <KeyValuePair <string, int> > actual;

            actual = Statistical.Frequency(input, buckets, bucketSelector);
            Assert.IsTrue(expected.SequenceEqual(actual));
        }
Example #25
0
        public void WeightedMovingAverageNullableDoubleTest()
        {
            IEnumerable <double?> source;
            IEnumerable <double?> expected;
            IEnumerable <double?> actual;
            int blockSize;

            source    = new double?[] { 1, 2, 3, 6, 7, 9, 11, double.NaN, 10, 11, null, 15, 25 };
            expected  = new double?[] { 4.4, 6, 7.8, 9.7, double.NaN, double.NaN, double.NaN, double.NaN, 14, 21 };
            blockSize = 4;

            actual = Statistical.WeightedMovingAverage(source, blockSize, DoubleWeightGen);
            Assert.IsTrue(expected.SequenceEqual(actual));

            //------------------------------//

            try
            {
                source    = new double?[] { 1, 2, 3, 4, 5 };
                blockSize = 1;
                int x = Statistical.WeightedMovingAverage(source, blockSize).Count();
                Assert.Fail();
            }
            catch (ArgumentException e) { Assert.IsTrue(e.ParamName == "blockSize"); }
            catch (Exception) { Assert.Fail(); }

            //------------------------------//

            try
            {
                source    = new double?[] { 1, 2, 3, 4, 5 };
                blockSize = 15;
                int x = Statistical.WeightedMovingAverage(source, blockSize).Count();
                Assert.Fail();
            }
            catch (ArgumentException e) { Assert.IsTrue(e.ParamName == "source"); }
            catch (Exception) { Assert.Fail(); }

            //------------------------------//

            source    = new double?[] { null, null, null, null, null };
            expected  = new double?[] { null, null };
            blockSize = 4;

            actual = Statistical.WeightedMovingAverage(source, blockSize, DoubleWeightGen);
            Assert.IsTrue(expected.SequenceEqual(actual));
        }
Example #26
0
        /// <summary>
        /// 显示窗体
        /// </summary>
        /// <param name="title"></param>
        /// <param name="xtraForm"></param>
        private void ShowForm(string title)
        {
            splashScreenManager.ShowWaitForm();
            Cursor currentCursor = Cursor.Current;

            Cursor.Current = Cursors.WaitCursor;

            XtraFormBase xtraForm = null;

            switch (title)
            {
            case "搜索":
                Cursor.Current = currentCursor;
                splashScreenManager.CloseWaitForm();
                searchForm.StartPosition = FormStartPosition.CenterParent;
                searchForm.ShowDialog();
                return;

            case "整板结果":
                xtraForm = new ShowDetailNew();
                break;

            case "整板统计":
                xtraForm = new Statistical();
                break;
                //case "我是测试2":
                //    xtraForm = new ShowDetail2();
                //    break;
            }
            try
            {
                XtraMdiTabPage tabPage = GetTabPage(title);
                if (tabPage != null)
                {
                    xtraTabbedMdiManager1.SelectedPage = tabPage;
                }
                else if (xtraForm != null)
                {
                    xForms.Add(title, xtraForm);
                    xtraForm.Text      = title;
                    xtraForm.MdiParent = this;
                    xtraForm.Show();
                }
            }
            finally { Cursor.Current = currentCursor; splashScreenManager.CloseWaitForm(); }
        }
Example #27
0
        void GoblinBatResize(object sender, EventArgs e)
        {
            if (WindowState.Equals(FormWindowState.Minimized))
            {
                if (string.IsNullOrEmpty(OnClickMinimized) == false && OnClickMinimized.Equals(st))
                {
                    Statistical.Hide();
                }

                Opacity            = 0.8135;
                BackColor          = Color.FromArgb(0x79, 0x85, 0x82);
                Visible            = false;
                ShowIcon           = false;
                ClosingForm        = false;
                notifyIcon.Visible = true;
            }
        }
Example #28
0
 void BackgroundWorkerRunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
 {
     if (e.Error != null)
     {
         Statistical.SetProgressRate(Color.Maroon);
         SendMessage(e.Error.StackTrace);
     }
     else if (e.Cancelled)
     {
         Statistical.SetProgressRate(e.Cancelled);
         Statistical.SetProgressRate(Color.Ivory);
     }
     else
     {
         Statistical.SetProgressRate((bool)e.Result);
         Statistical.SetProgressRate(Color.Ivory);
     }
 }
        public void MovingSumDoubleTest()
        {
            IEnumerable <double> source;
            IEnumerable <double> expected;
            IEnumerable <double> actual;
            int blockSize;

            source    = new double[] { 1, double.NaN, 3, 4, 5, 6, 7, 8, 9, double.NaN, 11, 12, 13 };
            expected  = new double[] { double.NaN, double.NaN, 12, 15, 18, 21, 24, double.NaN, double.NaN, double.NaN, 36 };
            blockSize = 3;

            actual = Statistical.MovingSum(source, blockSize);
            Assert.IsTrue(expected.SequenceEqual(actual));

            //------------------------------//

            source    = new double[] { 1, 2, 3, 4 };
            expected  = new double[] { 10 };
            blockSize = 8;

            actual = Statistical.MovingSum(source, blockSize);
            Assert.IsTrue(expected.SequenceEqual(actual));

            //------------------------------//

            source    = new double[] { 1, double.NaN, 3, 4 };
            expected  = new double[] { double.NaN, };
            blockSize = 8;

            actual = Statistical.MovingSum(source, blockSize);
            Assert.IsTrue(expected.SequenceEqual(actual));

            //------------------------------//

            try
            {
                source    = new double[] { 1, 2, 3, 4 };
                blockSize = 1;
                int x = Statistical.MovingSum(source, blockSize).Count();
                Assert.Fail();
            }
            catch (ArgumentException e) { Assert.IsTrue(e.ParamName == "blockSize"); }
            catch (Exception) { Assert.Fail(); }
        }
Example #30
0
        // GET: Statistical
        public ActionResult Index()
        {
            ViewBag.IDLoaiCongVan = new SelectList(_data.LoaiCongVans.ToList().OrderBy(n => n.IDLoaiCongVan), "IDLoaiCongVan", "TenLoaiCongVan");
            ViewBag.IDPhongBan    = new SelectList(_data.PhongBans.ToList().OrderBy(n => n.IDPhongBan), "IDPhongBan", "TenPhongBan");
            ViewBag.idDonViGui    = new SelectList(_data.DonVis.ToList().OrderBy(n => n.IDDonVi), "IDDonVi", "TenDonVi");

            int countTextTo = 0, countTextGo = 0;

            countTextTo = _data.CongVanDens.Count();
            countTextGo = _data.CongVanDis.Count();
            var statistical = new Statistical()
            {
                CountTextTo = countTextTo,
                CountTextGo = countTextGo,
                SUM         = countTextTo + countTextGo
            };

            return(View(statistical));
        }