Exemple #1
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));
                        }
                    }
                }
            }
        }