Example #1
0
 public void CreateNewData(CreateNewProject createNewProjDialog)
 {
     if (createNewProjDialog.Frequency != SeriesData.SeriesFrequency.Undated)
         data = new SeriesData(createNewProjDialog.DataName, createNewProjDialog.Frequency, createNewProjDialog.StartDate, createNewProjDialog.EndDate);
     else
         data = new SeriesData(createNewProjDialog.DataName, createNewProjDialog.NumberObservations);
        this.Text = createNewProjDialog.DataName + " : \"Unsaved\"";
 }
		public void TestPrototypes()
		{
			Initialize();

			StudyData studyPrototype = new StudyData();
			studyPrototype.PatientId = "123";
			studyPrototype.PatientsBirthDateRaw = "19760810";
			studyPrototype.PatientsNameRaw = "Patient^Anonymous";
			studyPrototype.PatientsSex = "M";
			studyPrototype.StudyDateRaw = "20080220";
			studyPrototype.StudyDescription= "Test";
			studyPrototype.StudyId = "Test";

			SeriesData seriesPrototype = new SeriesData();
			seriesPrototype.SeriesDescription = "Series";
			seriesPrototype.ProtocolName = "Protocol";
			seriesPrototype.SeriesNumber = "1";

			DicomAnonymizer anonymizer = new DicomAnonymizer();
			anonymizer.StudyDataPrototype = studyPrototype;
			anonymizer.SeriesDataPrototype = seriesPrototype;
			anonymizer.Anonymize(_file);

			AfterAnonymize(studyPrototype, seriesPrototype);

			//validate the adjusted dates.
			Assert.AreEqual("20080220", _anonymizedDateData.InstanceCreationDate, "Anonymized InstanceCreationDate doesn't match StudyDate");
			Assert.AreEqual("20080220", _anonymizedDateData.SeriesDate, "Anonymized SeriesDate doesn't match StudyDate");
			Assert.AreEqual("20080220", _anonymizedDateData.ContentDate, "Anonymized ContentDate doesn't match StudyDate");
			Assert.AreEqual("20080220100406", _anonymizedDateData.AcquisitionDatetime, "Anonymized AcquisitionDatetime doesn't match StudyDate/Time");
		}
Example #3
0
        private string[] getForecastedTime()
        {
            string[] result = new string[this.forecasted.Length];

            DateTime currentDate = new DateTime();

            switch (this.data.Frequency)
            {
            case zaitun.Data.SeriesData.SeriesFrequency.Annual:
                for (int i = 0; i < this.forecasted.Length; i++)
                {
                    currentDate = this.data.EndDate.AddYears(i + 1);
                    result[i]   = currentDate.Year.ToString();
                }
                break;

            case zaitun.Data.SeriesData.SeriesFrequency.SemiAnnual:
                for (int i = 0; i < this.forecasted.Length; i++)
                {
                    currentDate = this.data.EndDate.AddMonths(6 * (i + 1));
                    result[i]   = "Pertengahan " + (currentDate.Month / 2) + " " +
                                  currentDate.Year.ToString();
                }
                break;

            case zaitun.Data.SeriesData.SeriesFrequency.Quarterly:
                for (int i = 0; i < this.forecasted.Length; i++)
                {
                    currentDate = this.data.EndDate.AddMonths(3 * (i + 1));
                    result[i]   = "Triwulan " + (currentDate.Month / 3) + " " +
                                  currentDate.Year.ToString();
                }
                break;

            case zaitun.Data.SeriesData.SeriesFrequency.Monthly:
                for (int i = 0; i < this.forecasted.Length; i++)
                {
                    currentDate = this.data.EndDate.AddMonths(i + 1);
                    result[i]   = SeriesData.ConvertIntToMonth(currentDate.Month)
                                  + " " + currentDate.Year.ToString();
                }
                break;

            case zaitun.Data.SeriesData.SeriesFrequency.Weekly:
                for (int i = 0; i < this.forecasted.Length; i++)
                {
                    currentDate = this.data.EndDate.AddDays(7 * (i + 1));
                    result[i]   = currentDate.ToString("dd/MM/yy");
                }
                break;

            case zaitun.Data.SeriesData.SeriesFrequency.Daily:
                for (int i = 0; i < this.forecasted.Length; i++)
                {
                    currentDate = this.data.EndDate.AddDays(i + 1);
                    result[i]   = currentDate.ToString("dd/MM/yy");
                }
                break;

            case zaitun.Data.SeriesData.SeriesFrequency.Daily6:
            {
                int i = 0;
                currentDate = this.data.EndDate;
                while (i < this.forecasted.Length)
                {
                    currentDate = currentDate.AddDays(1);
                    if (currentDate.DayOfWeek != DayOfWeek.Sunday)
                    {
                        result[i] = currentDate.ToString("dd/MM/yy");
                        i++;
                    }
                }
            }
            break;

            case zaitun.Data.SeriesData.SeriesFrequency.Daily5:
            {
                int i = 0;
                currentDate = this.data.EndDate;
                while (i < this.forecasted.Length)
                {
                    currentDate = currentDate.AddDays(1);
                    if (currentDate.DayOfWeek != DayOfWeek.Sunday &&
                        currentDate.DayOfWeek != DayOfWeek.Saturday)
                    {
                        result[i] = currentDate.ToString("dd/MM/yy");
                        i++;
                    }
                }
            }
            break;

            case zaitun.Data.SeriesData.SeriesFrequency.Undated:
            {
                for (int i = 0; i < this.forecasted.Length; i++)
                {
                    int current = this.data.NumberObservations + i + 1;
                    result[i] = current.ToString();
                }
            }
            break;
            }

            return(result);
        }
Example #4
0
 public List <Serie> ListarSeries()
 {
     return(SeriesData.GetSeries());
 }
        public static List <Series> GetDivisionSeriesData()
        {
            var seriesData = new SeriesData();

            return(seriesData.DivisionSeries.ToList());
        }
        private void viewSpecificationPane(SeriesData.SeriesFrequency frequency)
        {
            labelObservation.Show();
            labelJumlahObs.Show();
            switch (frequency) {
                case SeriesData.SeriesFrequency.Annual:
                    groupDate.Visible = false;
                    groupYear.Visible = true;
                    groupUndated.Visible = false;

                    labelQuarter.Text = "Month: ";
                    numMonthStart.Enabled = false;
                    numMonthEnd.Enabled = false;

                    this.calculateStartDate();
                    this.calculateEndDate();

                    break;
                case SeriesData.SeriesFrequency.SemiAnnual:
                    groupDate.Visible = false;
                    groupYear.Visible = true;
                    groupUndated.Visible = false;

                    labelQuarter.Text = "Half: ";
                    numMonthStart.Enabled = true;
                    numMonthEnd.Enabled = true;
                    numMonthStart.Maximum = 2;
                    numMonthEnd.Maximum = 2;

                    this.calculateStartDate();
                    this.calculateEndDate();

                    break;
                case SeriesData.SeriesFrequency.Quarterly:
                    groupDate.Visible = false;
                    groupYear.Visible = true;
                    groupUndated.Visible = false;

                    labelQuarter.Text = "Quarter: ";
                    numMonthStart.Enabled = true;
                    numMonthEnd.Enabled = true;
                    numMonthStart.Maximum = 4;
                    numMonthEnd.Maximum = 4;

                    this.calculateStartDate();
                    this.calculateEndDate();

                    break;
                case SeriesData.SeriesFrequency.Monthly:
                    groupDate.Visible = false;
                    groupYear.Visible = true;
                    groupUndated.Visible = false;

                    labelQuarter.Text = "Month: ";
                    numMonthStart.Enabled = true;
                    numMonthEnd.Enabled = true;
                    numMonthStart.Maximum = 12;
                    numMonthEnd.Maximum = 12;

                    this.calculateStartDate();
                    this.calculateEndDate();

                    break;
                case SeriesData.SeriesFrequency.Weekly:
                    groupDate.Visible = true;
                    groupYear.Visible = false;
                    groupUndated.Visible = false;

                    this.startDate = this.timePickerStart.Value;
                    this.endDate = this.timePickerEnd.Value;
                    this.displayNumberObservations();

                    break;
                case SeriesData.SeriesFrequency.Daily:
                    groupDate.Visible = true;
                    groupYear.Visible = false;
                    groupUndated.Visible = false;

                    this.startDate = this.timePickerStart.Value;
                    this.endDate = this.timePickerEnd.Value;
                    this.displayNumberObservations();

                    break;
                case SeriesData.SeriesFrequency.Daily6:
                    groupDate.Visible = true;
                    groupYear.Visible = false;
                    groupUndated.Visible = false;

                    this.startDate = this.timePickerStart.Value;
                    this.endDate = this.timePickerEnd.Value;
                    this.displayNumberObservations();

                    break;
                case SeriesData.SeriesFrequency.Daily5:
                    groupDate.Visible = true;
                    groupYear.Visible = false;
                    groupUndated.Visible = false;

                    this.startDate = this.timePickerStart.Value;
                    this.endDate = this.timePickerEnd.Value;
                    this.displayNumberObservations();

                    break;
                case SeriesData.SeriesFrequency.Undated:
                    groupDate.Visible = false;
                    groupYear.Visible = false;
                    groupUndated.Visible = true;
                    labelObservation.Hide();
                    labelJumlahObs.Hide();

                    try {
                        this.setNumberObservations(int.Parse(labelJumlahObs.Text));
                    } catch {
                        this.setNumberObservations(0);
                    }

                    break;
            }
        }
        /// <summary>
        /// If no area with this name exists, a new one will be created.
        /// Keep in mind that all data series must have equal sizes, otherwise problems occur on having zoom.
        /// </summary>
        bool AddDataSeries(string areaName, string seriesName, SeriesDataLineType lineType, 
            double[][] valuesArrays, bool graphicalSeries)
        {
            if (GetSeriesDataByName(seriesName) != null)
            {
                System.Diagnostics.Debug.Fail("Data series already exists.");
                return false;
            }

            // We need to make sure all the sizes are equal.
            foreach (double[] doubleArray in valuesArrays)
            {
                int longestDataSize = this.LongestDataSize;
                if (doubleArray.Length != longestDataSize && longestDataSize != 0)
                {// We have a problem, deny adding this series.
                    System.Diagnostics.Debug.Fail("Data series size is wrong.");
                    return false;
                }
            }

            ChartArea chartArea = GetChartAreaByName(areaName);
            if (chartArea == null)
            {
                CreateNewChartArea(areaName);
                chartArea = GetChartAreaByName(areaName);
            }

            chartArea.AxisX.Margin = false;

            //chartArea.AxisX.Minimum = 50;

            SeriesData seriesData = new SeriesData();
            seriesData.IsGraphical = graphicalSeries;
            seriesData.ValuesArrays = valuesArrays;
            seriesData.SeriesName = seriesName;
            seriesData.ChartAreaName = areaName;
            _seriesDatas.Add(seriesData);

            {
                Series series = this.chartMain.Series.Add(seriesName);
                series.ChartArea = areaName;

                if (lineType == SeriesDataLineType.Custom_FatLine)
                {
                    series.BorderWidth = 3;
                    series.ChartType = "Line";
                }
                else
                {
                    series.ChartType = lineType.ToString();
                }

                series.Name = seriesName;
                series.ShowInLegend = false;
                series.ShadowOffset = 0;

                // We need to call this in order to have the colors properly applied to this new series.
                this.chartMain.ApplyPaletteColors();

                CreateSeriesLegendItem(series);
            }

            UpdateCharts();

            return true;
        }
 public void SetData(SeriesData data)
 {
     this.data = data;
 }
Example #9
0
 public LineSeries(string name)
     : base(name)
 {
     _data = new SeriesData();
 }
Example #10
0
        private ChartData GetIssuMaturesTopChart(string rate, string chartType, string columnType, DateTime start, DateTime end, string category, string itemList, string unit, int isUseSubCategory = 0, string subCategory = "Bond_Class", string subCategoryValue = "", bool isTotal = false)
        {
            if (start > end)
            {
                return(new ChartData());
            }
            var chartData = new ChartData
            {
                ChartType = chartType,
                YText     = Resources.Global.Unit + "(" + HtmlUtil.GetUnitOptionByKey(unit) + ")"
            };

            switch (columnType)
            {
            case "InitialBalance":
                chartData.Decimal = 2;
                break;

            case "Issues":
                chartData.YText   = string.Empty;
                chartData.Decimal = 0;
                break;

            case "IssuesPercent":
                chartData.YText   = string.Empty;
                chartData.Decimal = 2;
                break;

            case "IssuesAmount":
                chartData.Decimal = 2;
                break;

            case "IssuesAmountPercent":
                chartData.YText   = string.Empty;
                chartData.Decimal = 2;
                break;

            case "MaturityBonds":
                chartData.YText   = string.Empty;
                chartData.Decimal = 0;
                break;

            case "MaturityAmount":
                chartData.Decimal = 2;
                break;

            case "EndBalance":
                chartData.Decimal = 2;
                break;

            case "EndIssuesPercent":
                chartData.YText   = string.Empty;
                chartData.Decimal = 2;
                break;
            }
            var typeName    = "TypeCn";
            var subTypeName = "SubTypeCn";

            if (CultureHelper.IsEnglishCulture())
            {
                typeName    = "TypeEn";
                subTypeName = "SubTypeEn";
            }
            if (chartType == "bar" || chartType == "line")
            {
                var yearsDic = new Dictionary <string, DataTable>();
                var dates    = PopulateRateTimes(start, end, rate);
                for (var i = 0; i < dates.Count; i += 2)
                {
                    var currentStart = dates[i];
                    var currentEnd   = dates[i + 1];
                    var summaryData  = BondReportRepository.GetBondDepositoryBalanceChart(columnType, currentStart, currentEnd, category, itemList, unit, isUseSubCategory, subCategory, subCategoryValue);
                    yearsDic.Add(rate == "y" ? currentEnd.ToString("yyyy") : currentEnd.ToString("yyyy-M"), summaryData);
                }
                chartData.ColumnCategories = yearsDic.Keys.Select(x => x.ToString()).ToArray();
                var groupDic = new Dictionary <string, List <double> >();
                if (isTotal)
                {
                    groupDic.Add(Resources.Global.Total, new List <double>());
                    foreach (var keyValue in yearsDic)
                    {
                        double total = 0;
                        for (var j = 0; j < keyValue.Value.Rows.Count; j++)
                        {
                            total += Convert.ToDouble(keyValue.Value.Rows[j][columnType]);
                        }
                        groupDic[Resources.Global.Total].Add(total);
                    }
                }
                else
                {
                    foreach (var keyValue in yearsDic)
                    {
                        for (var j = 0; j < keyValue.Value.Rows.Count; j++)
                        {
                            var name = keyValue.Value.Rows[j][typeName].ToString();
                            if (string.IsNullOrEmpty(subCategoryValue))
                            {
                                if (!groupDic.ContainsKey(name))
                                {
                                    groupDic.Add(name, new List <double>());
                                }
                            }
                            else
                            {
                                name = string.Format("{0}({1})", keyValue.Value.Rows[j][typeName], keyValue.Value.Rows[j][subTypeName]);
                                if (!groupDic.ContainsKey(name))
                                {
                                    groupDic.Add(name, new List <double>());
                                }
                            }
                            groupDic[name].Add(Convert.ToDouble(keyValue.Value.Rows[j][columnType]));
                        }
                    }
                }
                var seriesDataList = new List <SeriesData>();
                foreach (var keyValue in groupDic)
                {
                    var sData = new SeriesData {
                        name = keyValue.Key
                    };
                    if (keyValue.Value != null)
                    {
                        sData.data = keyValue.Value.ToArray();
                        seriesDataList.Add(sData);
                    }
                }
                chartData.ColumnSeriesData = seriesDataList.ToArray();
            }
            else
            {
                var groupData = BondReportRepository.GetBondDepositoryBalanceChart(columnType, start, end, category, itemList, unit, isUseSubCategory, subCategory, subCategoryValue);
                var pieData   = new List <PieSectionData>();
                for (int j = 0; j < groupData.Rows.Count; j++)
                {
                    var currentSection = new PieSectionData {
                        name = groupData.Rows[j][typeName].ToString(), y = Convert.ToDouble(groupData.Rows[j][columnType])
                    };
                    pieData.Add(currentSection);
                }
                chartData.PieSeriesData = pieData.ToArray();
            }


            return(chartData);
        }
Example #11
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public ResultFeeapportion GetFeeApportionData(Queryfeeapportion query)
        {
            try
            {
                ExecuteProcess process = new ExecuteProcess();
                process.ActionName   = "";
                process.ActionTime   = System.DateTime.Now;
                process.Success      = true;
                process.ExceptionMsg = "";

                ResultFeeapportion feeApption = new ResultFeeapportion();
                feeApption.FeeApportionType = "按比例分摊";


                List <TB_Alloction_Config> config = GetAlloctionConfig(query);
                if (config.Count == 0)
                {
                    process.Success      = false;
                    process.ExceptionMsg = "此区域费用分摊没有配置";

                    ResultFeeapportion feeApptionReturn = new ResultFeeapportion();
                    feeApption.ActionInfo = process;
                    return(feeApption);
                }

                Queryfeeapportion queryLastMonth = new Queryfeeapportion();
                queryLastMonth.ItemCode  = query.ItemCode;
                queryLastMonth.ObjType   = query.ObjType;
                queryLastMonth.ObjectId  = query.ObjectId;
                queryLastMonth.StartTime = query.StartTime.AddMonths(-1);

                List <TB_Alloction_Config> configLast = GetAlloctionConfig(queryLastMonth);

                FeeApportionValClass feeappVal = new FeeApportionValClass();

                FeeApportionChartsClass chartClass = new FeeApportionChartsClass();


                // 数据。
                List <SeriesClass> serialClass = new List <SeriesClass>();

                if (config.Count > 0)
                {
                    DateTime dtBegin = config[0].ALLoction_StartDate;
                    DateTime dtEnd   = config[0].ALLoction_EndDate;

                    double feeDai = config[0].ALLoction_Fee;
                    feeappVal.ApportionVal = config[0].ALLoction_Fee;

                    //List<CostQueryModel> refModel = _feeApportion.GetCostQuery(query, dtBegin, dtEnd);

                    EnergyContrast energy = new EnergyContrast();
                    BasicQuery     query2 = new BasicQuery();
                    query2.AreaType  = query.ObjType;
                    query2.StartTime = config[0].ALLoction_StartDate;
                    query2.EndTime   = config[0].ALLoction_EndDate;
                    query2.ObjectNum = query.ObjectId;
                    query2.QueryType = EnergyAnalyseQueryType.Default;
                    query2.Unit      = 1;
                    var    lineChart = energy.GetSingleItemCodeByObject(query2, query.ItemCode);
                    double befVal    = 0;
                    befVal = (double)lineChart.Values.Sum();
                    AccessCommon acess   = new AccessCommon();
                    decimal      flPrice = acess.GetFeePrice(query.ItemCode);
                    befVal = befVal * (double)flPrice;
                    //foreach (var costQueryModel in refModel)
                    //{
                    //    befVal += costQueryModel.TOTAL_COST;
                    //}
                    feeappVal.BeforeVal = Math.Round(befVal, 2);
                    feeappVal.TotalVal  = Math.Round((befVal + feeappVal.ApportionVal), 2);
                }

                List <SeriesData> sidatas = new List <SeriesData>();
                SeriesData        seri    = new SeriesData();
                // 统计明细数据

                SeriesData         data1     = new SeriesData();
                SeriesData         data2     = new SeriesData();
                List <SeriesClass> serClass1 = new List <SeriesClass>();
                List <SeriesClass> serClass2 = new List <SeriesClass>();

                int iCout = 0;
                // 列表
                List <FeeApportionListClass> appList = new List <FeeApportionListClass>();
                foreach (TB_Alloction_Config conf in config)
                {
                    FeeApportionListClass listClass = new FeeApportionListClass();

                    SeriesClass serial1  = new SeriesClass();
                    SeriesClass serial2  = new SeriesClass();
                    int         objectId = conf.AreaID;
                    List <Model.BaseLayerObject> objectList;
                    string      objectName = "";
                    TB_AreaInfo info       = _accssCommon.GetAreaInfo(conf.AreaID);
                    if (info != null)
                    {
                        objectName = info.CName;
                    }

                    //Queryfeeapportion queryItem = new Queryfeeapportion();
                    //queryItem = query;
                    //queryItem.ObjectId = conf.AreaID;
                    //List<CostQueryModel> refModel = _feeApportion.GetCostQuery(queryItem, conf.ALLoction_StartDate, conf.ALLoction_EndDate);
                    double BefFee = 0;
                    //if (refModel.Count > 0)
                    //{
                    //    for (int jCount = 0; jCount < refModel.Count; jCount++)
                    //    {
                    //        BefFee += refModel[jCount].TOTAL_COST;
                    //    }
                    //}
                    EnergyContrast energy = new EnergyContrast();
                    BasicQuery     query2 = new BasicQuery();
                    query2.AreaType  = query.ObjType;
                    query2.StartTime = config[0].ALLoction_StartDate;
                    query2.EndTime   = config[0].ALLoction_EndDate;
                    query2.ObjectNum = conf.AreaID;
                    query2.QueryType = EnergyAnalyseQueryType.Default;
                    query2.Unit      = 1;
                    var lineChart2 = energy.GetSingleItemCodeByObject(query2, query.ItemCode);
                    BefFee = (double)lineChart2.Values.Sum();
                    AccessCommon acess   = new AccessCommon();
                    decimal      flPrice = acess.GetFeePrice(query.ItemCode);
                    BefFee = BefFee * (double)flPrice;

                    serial1.name = objectName;
                    serial2.name = objectName;
                    serial1.y    = Math.Round(BefFee);
                    serial2.y    = Math.Round((conf.ALLoction_Fee * conf.CfgPercent), 2);

                    serClass1.Add(serial1);
                    serClass2.Add(serial2);

                    FeeApportionListClass list1 = new FeeApportionListClass();
                    list1.Id           = iCout + 1;
                    list1.Obj          = objectName;
                    list1.Tm           = query.StartTime.ToString("yyyy-MM");
                    list1.BeforeVal    = Math.Round(BefFee, 2);
                    list1.ApportionVal = Math.Round((conf.ALLoction_Fee * conf.CfgPercent), 2);
                    list1.TotalVal     = list1.BeforeVal + list1.ApportionVal;
                    appList.Add(list1);
                    iCout++;
                }
                data1.name = "分摊前费用";
                data1.data = serClass1;

                data2.name = "分摊费用";
                data2.data = serClass2;
                sidatas.Add(data1);
                sidatas.Add(data2);
                chartClass.series             = sidatas;
                feeApption.FeeApportionCharts = chartClass;


                if (configLast.Count > 0)
                {
                    DateTime dtBegin2 = configLast[0].ALLoction_StartDate;
                    DateTime dtEnd2   = configLast[0].ALLoction_EndDate;

                    double feeDai = configLast[0].ALLoction_Fee;
                    feeappVal.ApportionValLastMonth = configLast[0].ALLoction_Fee;

                    //List<CostQueryModel> refModel = _feeApportion.GetCostQuery(query, dtBegin2, dtEnd2);
                    double beforeApportionVal = 0;
                    //foreach (var costQueryModel in refModel)
                    //{
                    //    beforeApportionVal += costQueryModel.TOTAL_COST;
                    //}
                    EnergyContrast energy = new EnergyContrast();
                    BasicQuery     query2 = new BasicQuery();
                    query2.AreaType  = query.ObjType;
                    query2.StartTime = configLast[0].ALLoction_StartDate;
                    query2.EndTime   = configLast[0].ALLoction_EndDate;
                    query2.ObjectNum = query.ObjectId;
                    query2.QueryType = EnergyAnalyseQueryType.Default;
                    query2.Unit      = 1;
                    var lineChart2 = energy.GetSingleItemCodeByObject(query2, query.ItemCode);
                    beforeApportionVal = (double)lineChart2.Values.Sum();
                    AccessCommon acess   = new AccessCommon();
                    decimal      flPrice = acess.GetFeePrice(query.ItemCode);
                    beforeApportionVal = Math.Round(beforeApportionVal * (double)flPrice, 2);

                    feeappVal.BeforeValLastMonth = beforeApportionVal;
                    feeappVal.TotalValLastMonth  = beforeApportionVal + feeappVal.ApportionValLastMonth;
                }
                if (feeappVal.ApportionValLastMonth > 0)
                {
                    double compare = (feeappVal.ApportionVal - feeappVal.ApportionValLastMonth) * 100 /
                                     feeappVal.ApportionValLastMonth;
                    feeappVal.ApportionValCompare = Math.Round(compare, 2).ToString();
                }
                else
                {
                    feeappVal.ApportionValCompare = "-";
                }

                if (feeappVal.BeforeValLastMonth > 0)
                {
                    double compare = (feeappVal.BeforeVal - feeappVal.BeforeValLastMonth) * 100 / feeappVal.BeforeValLastMonth;
                    feeappVal.BeforeValCompare = Math.Round(compare, 2).ToString();
                }
                else
                {
                    feeappVal.BeforeValCompare = "-";
                }

                if (feeappVal.TotalValLastMonth > 0)
                {
                    double compare = (feeappVal.TotalVal - feeappVal.TotalValLastMonth) * 100 / feeappVal.TotalValLastMonth;
                    feeappVal.TotalValCompare = Math.Round(compare, 2).ToString();
                }
                else
                {
                    feeappVal.TotalValCompare = "-";
                }
                FeeApportionTblClass tblClass = new FeeApportionTblClass();

                tblClass.FeeApportionList  = appList;
                feeApption.FeeApportionTbl = tblClass;
                feeApption.FeeApportionVal = feeappVal;
                feeApption.ActionInfo      = process;

                return(feeApption);
            }
            catch (Exception ex)
            {
                ExecuteProcess process = new ExecuteProcess();
                process.ActionName   = "";
                process.ActionTime   = System.DateTime.Now;
                process.Success      = false;
                process.ExceptionMsg = ex.Message;
                ResultFeeapportion feeApption = new ResultFeeapportion();
                feeApption.ActionInfo = process;
                return(feeApption);
            }
        }
 public string BasicColumnBarChart()
 {
     using (var context = new PaperContext())
     {
         List <SeriesData> seriesDatas = new List <SeriesData>();
         var entities = context.Papers.GroupBy(p => p.CustomerID).Select(g => new
         {
             Key   = g.Key,
             Count = g.Count(),
         });
         foreach (var entity in entities)
         {
             var item = new SeriesData
             {
                 Y    = entity.Count,
                 Name = GetCustomerName(entity.Key)
             };
             if (!string.IsNullOrEmpty(item.Name))
             {
                 seriesDatas.Add(item);
             }
         }
         Data       data  = new Data(seriesDatas.ToArray());
         Highcharts chart = new Highcharts("chart1");
         chart.InitChart(new Chart
         {
             Type = ChartTypes.Column
         });
         chart.SetTitle(new Title
         {
             Text = "客户文章数量柱状图"
         });
         chart.SetSubtitle(new Subtitle
         {
             Text = "查看文章数量"
         });
         chart.SetXAxis(new XAxis
         {
             Type   = AxisTypes.Category,
             Labels = new XAxisLabels
             {
                 Rotation = -30,
                 Align    = HorizontalAligns.Right,
                 Style    = "fontSize: '13px',fontFamily: 'Verdana, sans-serif'"
             }
         });
         chart.SetYAxis(new YAxis
         {
             Title = new YAxisTitle {
                 Text = "总数量份额"
             }
         });
         chart.SetLegend(new DotNet.Highcharts.Options.Legend {
             Enabled = false
         });
         chart.SetTooltip(new Tooltip
         {
             HeaderFormat = "<span style=\"font-size:11px\">{series.name}</span><br/>",
             PointFormat  = "<span style=\"color:{point.color}\">{point.name}:<b>{point.y}条</b></span><br/>"
         });
         chart.SetPlotOptions(new PlotOptions
         {
             Column = new PlotOptionsColumn
             {
                 BorderWidth = 0,
                 DataLabels  = new PlotOptionsColumnDataLabels
                 {
                     Enabled = true,
                     Format  = "{point.y}条"
                 }
             }
         });
         chart.SetSeries(new Series
         {
             Name           = "文章数量",
             Data           = data,
             PlotOptionsBar = new PlotOptionsBar
             {
                 ColorByPoint = true
             }
         });
         return(chart.ToHtmlString());
     }
 }
        public static List <Serie> GetSeries(string query)
        {
            string responseData = null;

            using (var httpClient = new HttpClient {
                BaseAddress = new Uri(Settings.Default.API_UrlTheTVDB)
            })
            {
                using (
                    HttpResponseMessage response = httpClient.GetAsync("/api/GetSeries.php?seriesname=" + query).Result)
                {
                    responseData = response.Content.ReadAsStringAsync().Result;
                }
            }

            // Valida quando o xml possui a tag <Language> em com o 'L' minúsculo.
            responseData = Regex.Replace(responseData, @"(?:<language>)([\w\W]{0,2})(?:<\/language>)",
                                         "<Language>$1</Language>");

            var data       = new SeriesData();
            var serializer = new XmlSerializer(typeof(SeriesData));

            using (var reader = new StringReader(responseData))
            {
                data = (SeriesData)serializer.Deserialize(reader);
            }

            var series = new List <Serie>();

            if (data.Series != null)
            {
                foreach (Serie itemData in data.Series)
                {
                    foreach (Serie item in data.Series)
                    {
                        var isExistente = false;
                        item.nIdEstado = Enums.Estado.Simples;
                        foreach (Serie itemListaSeries in series)
                        {
                            if (item.nCdApi == itemListaSeries.nCdApi)
                            {
                                isExistente = true;
                                break;
                            }
                        }

                        if (!isExistente)
                        {
                            series.Add(item);
                        }
                    }
                    //foreach (var item in series)
                    //{
                    //    if (item.IDApi == itemData.IDApi)
                    //    {
                    //        isExistente = true;
                    //        break;
                    //    }
                    //}
                    //if (!isExistente)
                    //    series.Add(itemData);
                    //break;
                }
            }

            return(series);
        }
        public static async Task <Serie> GetSerieInfoAsync(int IDTvdb, string lang)
        {
            string xmlString = null;
            var    rnd       = new Random();
            int    randomNum = rnd.Next(1, 55555);
            // Para evitar erros de arquivos sendo utilizados ao excluir.
            string path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
                                       Settings.Default.AppName, "Metadata", "temp" + randomNum, "temp.zip");

            try
            {
                if (File.Exists(path))
                {
                    File.Delete(path);
                }
                if (!Directory.Exists(Path.GetDirectoryName(path)))
                {
                    Directory.CreateDirectory(Path.GetDirectoryName(path));
                }
                using (var wc = new WebClient())
                {
                    await
                    wc.DownloadFileTaskAsync(
                        new Uri(Settings.Default.API_UrlTheTVDB + "/api/" +
                                Settings.Default.API_KeyTheTVDB +
                                "/series/" + IDTvdb + "/all/" + lang + ".zip"), path);
                }

                using (ZipFile zip = ZipFile.Read(path))
                {
                    ZipEntry xmlFileEntry = zip[lang + ".xml"];
                    using (var ms = new MemoryStream())
                    {
                        xmlFileEntry.Extract(ms);
                        var sr = new StreamReader(ms);
                        ms.Position = 0;
                        xmlString   = sr.ReadToEnd();
                    }
                }
            }
            finally
            {
                if (File.Exists(path))
                {
                    File.Delete(path);
                }
                if (Directory.Exists(Path.GetDirectoryName(path)))
                {
                    Directory.Delete(Path.GetDirectoryName(path));
                }
            }

            var data       = new SeriesData();
            var serializer = new XmlSerializer(typeof(SeriesData));

            using (var reader = new StringReader(xmlString))
            {
                data = (SeriesData)serializer.Deserialize(reader);
            }

            foreach (Serie item in data.Series)
            {
                item.nIdEstado    = Enums.Estado.Completo;
                item.lstEpisodios = data.Episodios != null
                                        ? new List <Episodio>(data.Episodios)
                                        : new List <Episodio>();
            }

            return(data.Series.FirstOrDefault());
        }
		private void Initialize()
		{
			_file = CreateTestFile();
			
			_originalUidData = new UidData();
			_originaStudyData = new StudyData();
			_originaSeriesData = new SeriesData();
			_originalDateData = new DateData();

			_file.DataSet.LoadDicomFields(_originalUidData);
			_file.DataSet.LoadDicomFields(_originaStudyData);
			_file.DataSet.LoadDicomFields(_originaSeriesData);
			_file.DataSet.LoadDicomFields(_originalDateData);
		}
Example #16
0
        private void displayNumberObservations()
        {
            int count = SeriesData.NumberObservation(this.startDate, this.endDate, this.frequency);

            this.setNumberObservations(count);
        }
		private void AfterAnonymize(StudyData studyPrototype, SeriesData seriesPrototype)
		{
			_anonymizedUidData = new UidData();
			_anonymizedStudyData = new StudyData();
			_anonymizedSeriesData = new SeriesData();
			_anonymizedDateData = new DateData();

			_file.DataSet.LoadDicomFields(_anonymizedUidData);
			_file.DataSet.LoadDicomFields(_anonymizedStudyData);
			_file.DataSet.LoadDicomFields(_anonymizedSeriesData);
			_file.DataSet.LoadDicomFields(_anonymizedDateData);

			ValidateRemovedTags(_file.DataSet);
			ValidateNulledAttributes(_file.DataSet);
			ValidateRemappedUids(_originalUidData, _anonymizedUidData);

			Assert.AreEqual(_anonymizedStudyData.PatientId, studyPrototype.PatientId);
			Assert.AreEqual(_anonymizedStudyData.PatientsNameRaw, studyPrototype.PatientsNameRaw);
			Assert.AreEqual(_anonymizedStudyData.PatientsBirthDateRaw, studyPrototype.PatientsBirthDateRaw);
			Assert.AreEqual(_anonymizedStudyData.PatientsSex, studyPrototype.PatientsSex);
			Assert.AreEqual(_anonymizedStudyData.AccessionNumber, studyPrototype.AccessionNumber);
			Assert.AreEqual(_anonymizedStudyData.StudyDateRaw, studyPrototype.StudyDateRaw);
			Assert.AreEqual(_anonymizedStudyData.StudyDescription, studyPrototype.StudyDescription);
			Assert.AreEqual(_anonymizedStudyData.StudyId, studyPrototype.StudyId);

			Assert.AreEqual(_anonymizedSeriesData.SeriesDescription, seriesPrototype.SeriesDescription);
			Assert.AreEqual(_anonymizedSeriesData.ProtocolName, seriesPrototype.ProtocolName);
			Assert.AreEqual(_anonymizedSeriesData.SeriesNumber, seriesPrototype.SeriesNumber);
		}
Example #18
0
        /// <summary>
        /// Method to populate form elements with activity statistics
        /// </summary>
        private void PopulateActivityStats()
        {
            int playerID = Convert.ToInt16(playerCombo.SelectedValue.ToString());
            int gameID   = Convert.ToInt16(dateCombo.SelectedValue.ToString());

            List <TimeLine> matchedTimeLineRecords = Search.Instance.FindMatchingTimeLines(gameID, playerID);

            if (matchedTimeLineRecords.Count() != 0)
            {
                using (DataClassesDataContext dbContext = new DataClassesDataContext())
                {
                    Option options = dbContext.Options.Where(o => o.Id.Equals(4)).SingleOrDefault();

                    //calculate total distance and display
                    double totalDistance = Calculations.Instance.CalcTotalDistance(matchedTimeLineRecords);
                    distanceLbl.Text = string.Format("{0} m", Math.Round(totalDistance, 2));

                    //calculate velocity and display
                    Speed  speed = new Speed(totalDistance, matchedTimeLineRecords[0].ReadingTime, matchedTimeLineRecords[matchedTimeLineRecords.Count - 1].ReadingTime);
                    double v     = speed.AvgMtrPerSecondRnd();
                    paceLbl.Text = string.Format("{0} m/s", v);

                    //calculate sprints and display
                    double minSpeed = options.EffortZone6Min; //the minimum threshold for classifying movement in m/s
                    double maxSpeed = options.EffortZone6Max; //the maximum threshold for classifying movement in m/s
                    double sprints  = Calculations.Instance.CalcSprints(matchedTimeLineRecords, minSpeed, maxSpeed);
                    sprintsLbl.Text = string.Format("{0}", sprints);

                    SeriesData seriesData     = new SeriesData();
                    double     seriesInterval = options.BreakdownInterval; //interval for series, set here, could be dynamically set in future
                    PopulateChartWithDistance(seriesData.GenerateSeriesData(matchedTimeLineRecords, seriesInterval));

                    //Create list of xy coordinates from timeline events for the graphical display
                    xy = Calculations.Instance.CalcXYFromGeolocationCoords(matchedTimeLineRecords, Width, Height);
                    List <XY> minMax = Calculations.Instance.CalcMinMaxCoords(xy);

                    XYCount     = xy.Count();
                    XYCountdown = xy.Count();

                    //populate effortzone chart
                    List <EffortZones> effortZones = new List <EffortZones>();
                    effortZones.Add(new EffortZones("Zone 1", options.EffortZone1Min, options.EffortZone1Max));
                    effortZones.Add(new EffortZones("Zone 2", options.EffortZone2Min, options.EffortZone2Max));
                    effortZones.Add(new EffortZones("Zone 3", options.EffortZone3Min, options.EffortZone3Max));
                    effortZones.Add(new EffortZones("Zone 4", options.EffortZone4Min, options.EffortZone4Max));
                    effortZones.Add(new EffortZones("Zone 5", options.EffortZone5Min, options.EffortZone5Max));
                    effortZones.Add(new EffortZones("Zone 6", options.EffortZone6Min, options.EffortZone6Max));
                    List <double> effortResults = new List <double>();
                    foreach (var zone in effortZones)
                    {
                        double s = Calculations.Instance.CalcSprints(matchedTimeLineRecords, zone.Min, zone.Max);
                        effortResults.Add(s);
                    }
                    effortZonesChart.DataSource = effortResults;
                    effortZonesChart.DataBind();
                }
            }
            else
            {
                ClearData();
            }
        }
        /// <summary>
        /// 
        /// </summary>
        protected void AddValuesToSeriesData(SeriesData currentSeriesData, double[][] valuesArrays)
        {
            // Copy over the data.
            for (int i = 0; i < valuesArrays.Length; i++)
            {
                double[] existingArray = currentSeriesData.ValuesArrays[i];
                double[] newArray = new double[existingArray.Length + valuesArrays[i].Length];

                existingArray.CopyTo(newArray, 0);
                valuesArrays[i].CopyTo(newArray, existingArray.Length);

                currentSeriesData.ValuesArrays[i] = newArray;
            }
        }
Example #20
0
 public void CalculateYEntriesCount()
 {
     YEntriesCount = SeriesData.Aggregate(0, (current, graphSeries) => graphSeries.Xvalue.Count > current ? graphSeries.Xvalue.Count : current);
 }
        /// <summary>
        /// This is a little special. As there is a problem with having 0 as interval in the Dundas control,
        /// this will make sure the interval is proper and it is not zero.
        /// </summary>
        private void SetSafeChartAreaYAxisRangeIntervalForSeries(SeriesData seriesData, int startIndex, int endIndex)
        {
            double[][] valuesArrays = seriesData.ValuesArrays;

            double min = double.MaxValue;
            double max = double.MinValue;

            for (int k = 0; k < valuesArrays.Length; k++)
            {
                for (int i = startIndex; (i < endIndex || endIndex == 0) && i < valuesArrays[k].Length; i++)
                {// Cycle for the given range, as long as it is valid, and if the endIndex is zero, disregard it.
                    min = Math.Min(min, valuesArrays[k][i]);
                    max = Math.Max(max, valuesArrays[k][i]);
                }
            }

            // Set the chart area limits.
            ChartArea chartArea = GetChartAreaByName(seriesData.ChartAreaName);
            chartArea.AxisY.Minimum = Math.Min(chartArea.AxisY.Minimum, min);
            chartArea.AxisY.Maximum = Math.Max(chartArea.AxisY.Maximum, max);

            if (chartArea.AxisY.Minimum == chartArea.AxisY.Maximum)
            {// We need this otherwise the control goes crash if the interval is zero.
                chartArea.AxisY.Maximum = chartArea.AxisY.Minimum + 1;
            }
        }
Example #22
0
 public Serie ObterSerie(string nome)
 {
     return(SeriesData.GetSeries().FirstOrDefault(x => x.Nome == nome));
 }
Example #23
0
    private SeriesData GetSeriesInfo(DI_MapDataColumns mapDataColumns, DataTable SeriesDataTable, bool isMyData, string dbNid, string LanguageCode)
    {
        SeriesData RetVal = null;
        Hashtable Indicators = new Hashtable();
        DataTable dtDistinctIUSs = null;
        DataTable dtDistinctIndicatorNIds = null;
        Hashtable IUSs = null;
        SeriesInfo seriesInfo;
        List<string> distinctIUSNIds = new List<string>();
        List<string> columnsToSkipFilter = new List<string>();
        List<string> distinctColumns = new List<string>();
        string SeriesName = string.Empty;

        try
        {
            if (SeriesDataTable.Rows.Count > 0)
            {
                seriesInfo = new SeriesInfo();
                RetVal = new SeriesData();
                if (!isMyData)
                {
                    //get theme name IndicatorUnitSubgroup from Database

                    _DBCon = Global.GetDbConnection(int.Parse(dbNid));
                    dtDistinctIndicatorNIds = SeriesDataTable.DefaultView.ToTable(true, mapDataColumns.SeriesNid);
                    dtDistinctIUSs = SeriesDataTable.DefaultView.ToTable(true, mapDataColumns.SeriesNid);
                    this.SetTimeLogIntoFile("Start getting IUSs Nmaes from Procedure sp_getIUSNames_-> " + DateTime.Now.ToLongTimeString());
                    IUSs = getIUSNames(dtDistinctIUSs, LanguageCode);
                    this.SetTimeLogIntoFile("Ends getting IUSs Nmaes from Procedure sp_getIUSNames_-> " + DateTime.Now.ToLongTimeString());
                    foreach (object key in IUSs.Keys)
                    {
                        seriesInfo = new SeriesInfo();
                        seriesInfo.SeriesID = key.ToString();
                        seriesInfo.SeriesName = IUSs[key].ToString();
                        RetVal.Add(seriesInfo);
                    }
                }
                else
                {
                    columnsToSkipFilter.Add(mapDataColumns.AreaID);
                    columnsToSkipFilter.Add(mapDataColumns.AreaName);
                    columnsToSkipFilter.Add(mapDataColumns.DataValue);
                    columnsToSkipFilter.Add(mapDataColumns.NumericData);
                    columnsToSkipFilter.Add(mapDataColumns.TimePeriod);
                    columnsToSkipFilter.Add(mapDataColumns.isMRD);

                    //set row filter
                    foreach (DataColumn column in SeriesDataTable.Columns)
                    {
                        if (!columnsToSkipFilter.Contains(column.ColumnName))
                        {
                            distinctColumns.Add(column.ColumnName);
                        }
                    }

                    dtDistinctIndicatorNIds = SeriesDataTable.DefaultView.ToTable(true, distinctColumns.ToArray());
                    foreach (DataRow row in dtDistinctIndicatorNIds.Rows)
                    {
                        seriesInfo = new SeriesInfo();
                        SeriesName = string.Empty;
                        seriesInfo.SeriesID = Convert.ToString(row[mapDataColumns.SeriesNid]);
                        foreach (string columnName in distinctColumns)
                        {
                            if (columnName != mapDataColumns.SeriesNid)
                            {
                                SeriesName += Convert.ToString(row[columnName]) + ", ";
                            }
                        }

                        seriesInfo.SeriesName = SeriesName.TrimEnd(", ".ToCharArray());
                        RetVal.Add(seriesInfo);
                    }
                }
            }
        }
        catch (Exception ex)
        {
            Global.CreateExceptionString(ex, null);

            throw;
        }

        return RetVal;
    }
 public void SetData(SeriesData data, SeriesVariables independentVariables)
 {
     this.data = data;
     this.independentVariables = independentVariables;
 }