コード例 #1
0
        private void pivotGridControl1_CustomFieldSort(object sender, PivotGridCustomFieldSortEventArgs e)
        {
            if (this.pivotData == null || sortInfo == null)
            {
                e.Handled = false;
                return;
            }
            int sortByColumnIndex = GetSortByColumnIndex(e);
            int value1RowIndex    = GetValueIndex(false, e.Value1, e.Field, null);
            int value2RowIndex    = GetValueIndex(false, e.Value2, e.Field, null);

            if (value1RowIndex < 0 || value2RowIndex < 0 || sortByColumnIndex < 0)
            {
                return;
            }
            object cellValue1 = pivotData.GetCellValue(sortByColumnIndex, value1RowIndex);
            object cellValue2 = pivotData.GetCellValue(sortByColumnIndex, value2RowIndex);

            e.Handled = true;
            if (object.Equals(cellValue1, cellValue2))
            {
                e.Result = Comparer.Default.Compare(e.Value1, e.Value2);
            }
            else
            {
                e.Result = Comparer.Default.Compare(cellValue1, cellValue2);
            }
            return;
        }
コード例 #2
0
 int GetSortByColumnIndex(PivotGridCustomFieldSortEventArgs e)
 {
     if (sortInfo.Conditions.Count == 0)
     {
         for (int i = pivotData.ColumnCount - 1; i >= 0; i--)
         {
             FieldValue value = pivotData.GetFieldValue(true, i);
             if (value.ValueType == PivotGridValueType.GrandTotal && value.DataField == sortInfo.DataField)
             {
                 return(i);
             }
         }
     }
     else
     {
         for (int i = 0; i < pivotData.ColumnCount; i++)
         {
             FieldValue value = pivotData.GetFieldValue(true, i);
             if (IsValueFit(value, sortInfo.Conditions, sortInfo.DataField))
             {
                 return(i);
             }
         }
     }
     return(-1);
 }
コード例 #3
0
ファイル: PivotGridController.cs プロジェクト: scsi110/eXpand
        void PivotGridControlOnCustomFieldSort(object sender, PivotGridCustomFieldSortEventArgs e)
        {
            var pivotFieldSortRules = _ruleCollector.FieldSortRules(e.Field, Frame);

            foreach (var pivotFieldSort in pivotFieldSortRules)
            {
                pivotFieldSort.Calculate(e);
            }
        }
コード例 #4
0
        void IPivotFieldSortEvent.Calculate(PivotGridCustomFieldSortEventArgs e)
        {
            int value1 = ReferenceEquals(e.Value1, _topObject) ? 1 : 0,
                value2 = ReferenceEquals(e.Value2, _topObject) ? 1 : 0;
            int res    = Comparer <int> .Default.Compare(value1, value2);

            if (res != 0)
            {
                e.Result  = res;
                e.Handled = true;
            }
        }
コード例 #5
0
        private void pivotGridControl1_CustomFieldSort(object sender, PivotGridCustomFieldSortEventArgs e)
        {
            if (e.Field.FieldName != DataConst.BALANCE_STEP)
                return;

            int s1 = ConvertLayerIndex(e.Value1 as string);
            int s2 = ConvertLayerIndex(e.Value2 as string);

            e.Result = s1.CompareTo(s2);

            e.Handled = true;
        }
コード例 #6
0
        private void pivotGridControl_CustomFieldSort(object sender, PivotGridCustomFieldSortEventArgs e)
        {
            if (e.Field.FieldName != TargetPlanCompareData.STEP_ID)
            {
                return;
            }

            int s1 = ConvertLayerIndex(e.Value1 as string);
            int s2 = ConvertLayerIndex(e.Value2 as string);

            e.Result = s1.CompareTo(s2);

            e.Handled = true;
        }
コード例 #7
0
ファイル: BalanceTableView.cs プロジェクト: yichunbong/CSOT
        private void pivotGridControl1_CustomFieldSort(object sender, PivotGridCustomFieldSortEventArgs e)
        {
            if (e.Field.FieldName == BalanceTableViewData.CATEGORY)
            {
                if (e.Value1 == null || e.Value2 == null)
                {
                    return;
                }
                e.Handled = true;
                string s1 = e.Value1.ToString();
                string s2 = e.Value2.ToString();

                int ind1 = _categories.IndexOf(s1);
                int ind2 = _categories.IndexOf(s2);

                e.Result = ind1.CompareTo(ind2);
            }

            else if (e.Field.FieldName == BalanceTableViewData.TARGET_DATE)
            {
                if (e.Value1 == null || e.Value2 == null)
                {
                    return;
                }
                e.Handled = true;
                string s1 = e.Value1.ToString();
                string s2 = e.Value2.ToString();

                if (s1 == BalanceTableViewData.INITIAL_SHIFT && s2 == BalanceTableViewData.INITIAL_SHIFT)
                {
                    e.Result = 0;
                }
                else if (s1 == BalanceTableViewData.INITIAL_SHIFT)
                {
                    e.Result = -1;
                }
                else if (s2 == BalanceTableViewData.INITIAL_SHIFT)
                {
                    e.Result = 1;
                }
                else
                {
                    e.Result = s1.CompareTo(s2);
                }
            }
        }
 void pivotGridControl1_CustomFieldSort(object sender, PivotGridCustomFieldSortEventArgs e)
 {
     if (e.Field.FieldName == "Sales Person")
     {
         if (e.SortLocation == PivotSortLocation.Pivot)
         {
             object orderValue1 = e.GetListSourceColumnValue(e.ListSourceRowIndex1, "Last Name"),
                    orderValue2 = e.GetListSourceColumnValue(e.ListSourceRowIndex2, "Last Name");
             e.Result = Comparer.Default.Compare(orderValue1, orderValue2);
         }
         else
         {
             e.Result = Comparer.Default.Compare(e.Value1.ToString().Split(' ')[1], e.Value2.ToString().Split(' ')[1]);
         }
         e.Handled = true;
     }
 }
コード例 #9
0
        private void pivotGridControl1_CustomFieldSort(object sender, PivotGridCustomFieldSortEventArgs e)
        {
            if (e.Field.FieldName == JobChangePlanData.LAYER)
            {
                if (e.Value1 == null || e.Value2 == null)
                {
                    return;
                }
                e.Handled = true;
                string d1 = "" + e.Value1.ToString();
                string d2 = "" + e.Value2.ToString();

                int c1 = _layerOrder.IndexOf(d1);
                int c2 = _layerOrder.IndexOf(d2);

                e.Result = c1.CompareTo(c2);
            }
        }
        private void pivotGridControl1_CustomFieldSort(object sender, PivotGridCustomFieldSortEventArgs e)
        {
            if (!rowField.Equals(e.Field))
            {
                return;
            }
            string value1  = e.Value1.ToString();
            string value2  = e.Value2.ToString();
            int    length1 = value1.Length;
            int    length2 = value2.Length;

            e.Result = Comparer <int> .Default.Compare(length1, length2);

            if (e.Result == 0)
            {
                e.Result = Comparer <string> .Default.Compare(value1, value2);
            }
            e.Handled = true;
        }
コード例 #11
0
 void IPivotFieldSortEvent.Calculate(PivotGridCustomFieldSortEventArgs e) {
     int value1 = ReferenceEquals(e.Value1, _topObject) ? 1 : 0,
         value2 = ReferenceEquals(e.Value2, _topObject) ? 1 : 0;
     int res = Comparer<int>.Default.Compare(value1, value2);
     if (res != 0) {
         e.Result = res;
         e.Handled = true;
     }
 }
コード例 #12
0
        public void Calculate(PivotGridCustomFieldSortEventArgs e)
        {
            e.Result = Comparer <int> .Default.Compare(CorrectMonth((int)e.Value1), CorrectMonth((int)e.Value2));

            e.Handled = true;
        }