Beispiel #1
0
        private void gridViewInfo_RowCellStyle(object sender, DevExpress.XtraGrid.Views.Grid.RowCellStyleEventArgs e)
        {
            if (WorldInfo == null)
            {
                return;
            }

            if ((e.Column.Tag != null) && (ColorManager != null))
            {
                DayOfWeek dw = (DayOfWeek)e.Column.Tag;

                WorldPlanningStatisticItem item = (WorldPlanningStatisticItem)gridViewInfo.GetRow(e.RowHandle);

                if ((item != null) && (item.ItemType == WorldStaticticItemType.DifferenceInPercent))
                {
                    double value = WorldInfo.GetDayPercent(dw);

                    Color color = ColorManager.GetColorByDifferenceInPercentPlannedAndEstimatedHours(value);
                    e.Appearance.ForeColor = color;
                }
            }
        }
Beispiel #2
0
        private void gridViewInfo_CustomUnboundColumnData(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDataEventArgs e)
        {
            if (WorldInfo == null)
            {
                e.Value = "0";
                return;
            }
            if (e.IsGetData)
            {
                if (e.Column == gcInfoSummAndDifferences)
                {
                    WorldPlanningStatisticItem item = (WorldPlanningStatisticItem)gridViewInfo.GetRow(e.RowHandle);

                    if (item.ItemType == WorldStaticticItemType.DifferenceInPercent)
                    {
                        StringBuilder sb = new StringBuilder();

                        sb.AppendLine(String.Format("{0}%", Math.Round(WorldInfo.SumDifferencePercent)) + " " + __SummDifferenceInPercent);
                        sb.AppendLine(TextParser.BuildDifferenceAbsoluteSumInPercent
                                      (
                                          WorldInfo.AbsSumDifferencePercent,
                                          WorldInfo.AbsSumDifferencePosPercent,
                                          WorldInfo.AbsSumDifferenceNegPercent
                                      ) + " " + __AbsoluteSummDifferenceInPercent);
                        e.Value = sb.ToString();
                    }
                    if (item.ItemType == WorldStaticticItemType.SummPlannedWorkingHours)
                    {
                        e.Value = TextParser.TimeToString(WorldInfo.SumPlannedHours);
                    }
                    if (item.ItemType == WorldStaticticItemType.TargetedHours)
                    {
                        StringBuilder sb = new StringBuilder();
                        sb.AppendLine(TextParser.TimeToString(WorldInfo.SumTargetedHours) + " " + __SummTargetedHours);

                        e.Value = sb.ToString();
                    }
                    return;
                }

                if (e.Column.Tag != null)
                {
                    DayOfWeek dw = (DayOfWeek )e.Column.Tag;

                    WorldPlanningStatisticItem item = (WorldPlanningStatisticItem)gridViewInfo.GetRow(e.RowHandle);
                    if (item != null)
                    {
                        if (item.ItemType == WorldStaticticItemType.DifferenceInPercent)
                        {
                            e.Value = TextParser.ToRoundSignPercent(WorldInfo.GetDayPercent(dw));
                        }
                        if (item.ItemType == WorldStaticticItemType.SummPlannedWorkingHours)
                        {
                            e.Value = TextParser.TimeToString(WorldInfo.GetPlannedValue(dw));
                        }
                        if (item.ItemType == WorldStaticticItemType.TargetedHours)
                        {
                            e.Value = TextParser.TimeToString(WorldInfo.GetTargetValue(dw));
                        }
                    }
                }
            }
        }