コード例 #1
0
        private void DoBatchParse(object parameter)
        {
            var fileDialog = new OpenFileDialog();

            fileDialog.DefaultExt = ".csv";
            fileDialog.Filter     = "csv file|*.csv";
            if (fileDialog.ShowDialog() == true)
            {
                CountControl         = UIHelper.FindChild <CaseCountControl>(Application.Current.MainWindow, "CaseCountControl");
                DefactPercentControl = UIHelper.FindChild <DefactPercentControl>(Application.Current.MainWindow,
                                                                                 "DefactPercentControl");

                var dataList = FileUtils <DateMapper> .ReadDateList(fileDialog.FileName);

                if (null != dataList)
                {
                    CountControl.SetTotal(dataList.Count);
                    int trueCnt = 0, falseCnt = 0;

                    foreach (var csvMapper in dataList)
                    {
                        var parseResult = GeneralParser.ParseDate(csvMapper.DateStr);
                        if (parseResult[0].Equals(true))
                        {
                            csvMapper.Result = parseResult[1] as string;
                        }
                        else
                        {
                            csvMapper.Result    = "Parse Error";
                            csvMapper.Exception = parseResult[1] as string;
                        }

                        if (csvMapper.Result.Equals(csvMapper.Expected))
                        {
                            trueCnt++;
                        }
                        else
                        {
                            falseCnt++;
                        }
                    }
                    CountControl.SetPassed(trueCnt);
                    CountControl.SetFailed(falseCnt);
                    //WriteResult(dataList);
                    FileUtils <DateMapper> .WriteResult(dataList, "rNextDate.csv");

                    DefactPercentControl.SetValues(trueCnt, falseCnt);
                }
            }
        }
コード例 #2
0
        public void BatchDeterTriFun(object sender)
        {
            var fileDialog = new OpenFileDialog();

            fileDialog.DefaultExt = ".csv";
            fileDialog.Filter     = "csv file|*.csv";
            if (fileDialog.ShowDialog() == true)
            {
                CountControl         = UIHelper.FindChild <CaseCountControl>(Application.Current.MainWindow, "CaseCountControl");
                DefactPercentControl = UIHelper.FindChild <DefactPercentControl>(Application.Current.MainWindow,
                                                                                 "DefactPercentControl");

                var dataList = FileUtils <TriangleMapper> .ReadDateList(fileDialog.FileName);

                if (null != dataList)
                {
                    CountControl.SetTotal(dataList.Count);
                    int trueCnt = 0, falseCnt = 0;

                    foreach (var csvMapper in dataList)
                    {
                        var parseResult = GeneralParser.ParseTriangle(csvMapper.A, csvMapper.B, csvMapper.C,
                                                                      GetParseTriangleStr);
                        csvMapper.Result = parseResult;

                        if (parseResult.Equals("不能构成三角形."))
                        {
                            csvMapper.Exception = "不能构成三角形.";
                        }

                        if (parseResult.Equals(csvMapper.Expected))
                        {
                            csvMapper.IsCorrect = "true";
                            trueCnt++;
                        }
                        else
                        {
                            csvMapper.IsCorrect = "false";
                            falseCnt++;
                        }
                    }
                    CountControl.SetPassed(trueCnt);
                    CountControl.SetFailed(falseCnt);
                    //WriteResult(dataList);
                    FileUtils <TriangleMapper> .WriteResult(dataList, "rTriangle.csv");

                    DefactPercentControl.SetValues(trueCnt, falseCnt);
                }
            }
        }
コード例 #3
0
        private void BatchCalculateBabyBreak(object sender)
        {
            var filePath = GetInputCurWindowFilePath();

            if (null == filePath)
            {
                return;
            }
            InitReportVisuals();
            var dataList = FileUtils <BabyBreakCSV> .ReadDateList(filePath);

            if (null != dataList)
            {
                CountControl.SetTotal(dataList.Count);
                int trueCnt = 0, falseCnt = 0;

                foreach (var babyBreakCsv in dataList)
                {
                    var cnt = GetBabyBreakCount(
                        babyBreakCsv.is_woman,
                        babyBreakCsv.late_marriage,
                        babyBreakCsv.late_birth,
                        babyBreakCsv.less_7_month,
                        babyBreakCsv.dystocia,
                        babyBreakCsv.less_30_day
                        );

                    babyBreakCsv.Result = cnt.ToString();

                    if (cnt == babyBreakCsv.result_day)
                    {
                        trueCnt++;
                        babyBreakCsv.IsCorrect = "True";
                    }
                    else
                    {
                        falseCnt++;
                        babyBreakCsv.IsCorrect = "False";
                    }
                }
                CountControl.SetPassed(trueCnt);
                CountControl.SetFailed(falseCnt);
                //WriteResult(dataList);
                FileUtils <BabyBreakCSV> .WriteResult(dataList, "rBabyBreaks.csv");

                DefactPercentControl.SetValues(trueCnt, falseCnt);
            }
        }
コード例 #4
0
        private void BatchCalculate(object sender)
        {
            var fileDialog = new OpenFileDialog();

            fileDialog.DefaultExt = ".csv";
            fileDialog.Filter     = "csv file|*.csv";
            if (fileDialog.ShowDialog() == true)
            {
                sellComputerBatchFlag = true;
                var dataList = FileUtils <ComputerMapper> .ReadDateList(fileDialog.FileName);

                if (null != dataList)
                {
                    int passed, failed;
                    passed       = failed = 0;
                    CountControl = UIHelper.FindChild <CaseCountControl>(Application.Current.MainWindow,
                                                                         "CaseCountControl");
                    DefactPercentControl = UIHelper.FindChild <DefactPercentControl>(Application.Current.MainWindow,
                                                                                     "DefactPercentControl");

                    foreach (var csvMapper in dataList)
                    {
                        var strRes = GetSumStr(csvMapper.OutLet, csvMapper.MainFrame, csvMapper.Monitor);
                        if (strRes[0].Equals(csvMapper.Expected))
                        {
                            csvMapper.IsCorrect = "true";
                            passed++;
                        }
                        else
                        {
                            csvMapper.IsCorrect = "false";
                            failed++;
                        }

                        csvMapper.Result    = strRes[0];
                        csvMapper.Exception = strRes[1];
                    }

                    FileUtils <ComputerMapper> .WriteResult(dataList, "rComputerAccessories.csv");

                    CountControl.SetPassed(passed);
                    CountControl.SetFailed(failed);
                    CountControl.SetTotal(passed + failed);
                    DefactPercentControl.SetValues(passed, failed);
                }
            }
        }
コード例 #5
0
        public void BatchTelecomCalFun(object sender)
        {
            var fileDialog = new OpenFileDialog();

            fileDialog.DefaultExt = ".csv";
            fileDialog.Filter     = "csv file|*.csv";
            if (fileDialog.ShowDialog() == true)
            {
                CountControl         = UIHelper.FindChild <CaseCountControl>(Application.Current.MainWindow, "CaseCountControl");
                DefactPercentControl = UIHelper.FindChild <DefactPercentControl>(Application.Current.MainWindow,
                                                                                 "DefactPercentControl");
                var dataList = FileUtils <TelecomMapper> .ReadDateList(fileDialog.FileName);

                if (null != dataList)
                {
                    CountControl.SetTotal(dataList.Count);
                    int trueCnt = 0, falseCnt = 0;

                    foreach (var csvMapper in dataList)
                    {
                        var parseResult = CalculateTelecomFee(csvMapper.minutes, csvMapper.times);
                        csvMapper.ResultDiscount = parseResult[0].ToString();
                        csvMapper.ResultFee      = parseResult[1].ToString();
                        if (Math.Abs(double.Parse(csvMapper.ExpectedDiscount) - parseResult[0]) < 1e10 - 3 &&
                            Math.Abs(double.Parse(csvMapper.ExpectedFee) - parseResult[1]) < 1e10 - 3)
                        {
                            csvMapper.IsCorrect = "True";
                            trueCnt++;
                        }
                        else
                        {
                            csvMapper.IsCorrect = "False";
                            falseCnt++;
                        }
                    }
                    CountControl.SetPassed(trueCnt);
                    CountControl.SetFailed(falseCnt);
                    //WriteResult(dataList);
                    FileUtils <TelecomMapper> .WriteResult(dataList, "rTelecom.csv");

                    DefactPercentControl.SetValues(trueCnt, falseCnt);
                }
            }
        }
コード例 #6
0
        private void BatchCalculateProduct(object e)
        {
            var filePath = GetInputCurWindowFilePath();

            if (null == filePath)
            {
                return;
            }
            InitReportVisuals();
            var dataList = FileUtils <ProductionProductCSV> .ReadDateList(filePath);

            if (null != dataList)
            {
                CountControl.SetTotal(dataList.Count);
                int trueCnt = 0, falseCnt = 0;

                foreach (var productCSV in dataList)
                {
                    productCSV.实际结果 = GetProductProductionResult(
                        productCSV.销售合同订单量,
                        productCSV.库存量,
                        productCSV.生产库存量,
                        productCSV.生产质检合格,
                        productCSV.废品,
                        productCSV.采购质检合格,
                        productCSV.货已发完
                        );
                    if (productCSV.实际结果.Equals(productCSV.预期结果))
                    {
                        trueCnt++;
                    }
                    else
                    {
                        falseCnt++;
                    }
                }
                CountControl.SetPassed(trueCnt);
                CountControl.SetFailed(falseCnt);

                FileUtils <ProductionProductCSV> .WriteResult(dataList, "rProductProduction.csv");

                DefactPercentControl.SetValues(trueCnt, falseCnt);
            }
        }