Ejemplo n.º 1
0
        private void gridViewInfo_CalcRowHeight(object sender, DevExpress.XtraGrid.Views.Grid.RowHeightEventArgs e)
        {
            WorldPlanningStatisticItem item = (WorldPlanningStatisticItem)gridViewInfo.GetRow(e.RowHandle);

            if (item == null)
            {
                return;
            }

            Graphics graphics = gridControlInfo.CreateGraphics();

            try
            {
                Size sf           = graphics.MeasureString("222", gridViewInfo.Appearance.Row.Font).ToSize();
                int  stringHeight = sf.Height;


                if (item.ItemType == WorldStaticticItemType.TargetedHours)
                {
                    e.RowHeight = stringHeight;
                }
                else if (item.ItemType == WorldStaticticItemType.SummPlannedWorkingHours)
                {
                    e.RowHeight = stringHeight;
                }
                else if (item.ItemType == WorldStaticticItemType.DifferenceInPercent)
                {
                    e.RowHeight = stringHeight * 2;
                }
            }
            finally
            {
                graphics.Dispose();
            }
        }
Ejemplo n.º 2
0
        public UCStoreWorldPlanningInfo()
        {
            InitializeComponent();
            if (!IsDesignMode)
            {
                _statisticItems[0] = new WorldPlanningStatisticItem(
                    GetLocalized(WorldStaticticItemType.SummPlannedWorkingHours.ToString()),
                    WorldStaticticItemType.SummPlannedWorkingHours);
                _statisticItems[1] = new WorldPlanningStatisticItem(
                    GetLocalized(WorldStaticticItemType.TargetedHours.ToString()),
                    WorldStaticticItemType.TargetedHours);
                /*_statisticItems[2] = new WorldPlanningStatisticItem(
                    GetLocalized(WorldStaticticItemType.Difference.ToString()),
                    WorldStaticticItemType.Difference);*/
                _statisticItems[2] = new WorldPlanningStatisticItem(
                    GetLocalized(WorldStaticticItemType.DifferenceInPercent.ToString()),
                    WorldStaticticItemType.DifferenceInPercent);

                gridControlInfo.DataSource = _statisticItems;
                gridViewInfo.CustomUnboundColumnData += new DevExpress.XtraGrid.Views.Base.CustomColumnDataEventHandler(gridViewInfo_CustomUnboundColumnData);
            }
        }
Ejemplo n.º 3
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;
                }
            }
        }
Ejemplo n.º 4
0
        public UCStoreWorldPlanningInfo()
        {
            InitializeComponent();
            if (!IsDesignMode)
            {
                _statisticItems[0] = new WorldPlanningStatisticItem(
                    GetLocalized(WorldStaticticItemType.SummPlannedWorkingHours.ToString()),
                    WorldStaticticItemType.SummPlannedWorkingHours);
                _statisticItems[1] = new WorldPlanningStatisticItem(
                    GetLocalized(WorldStaticticItemType.TargetedHours.ToString()),
                    WorldStaticticItemType.TargetedHours);

                /*_statisticItems[2] = new WorldPlanningStatisticItem(
                 *  GetLocalized(WorldStaticticItemType.Difference.ToString()),
                 *  WorldStaticticItemType.Difference);*/
                _statisticItems[2] = new WorldPlanningStatisticItem(
                    GetLocalized(WorldStaticticItemType.DifferenceInPercent.ToString()),
                    WorldStaticticItemType.DifferenceInPercent);

                gridControlInfo.DataSource            = _statisticItems;
                gridViewInfo.CustomUnboundColumnData += new DevExpress.XtraGrid.Views.Base.CustomColumnDataEventHandler(gridViewInfo_CustomUnboundColumnData);
            }
        }
Ejemplo n.º 5
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));
                        }
                    }
                }
            }
        }