コード例 #1
0
 protected override void PostReadIDOs(int index = 0)
 {
     base.PostReadIDOs(index);
     foreach (AdapterList ListTemp in AdapterListTemplate)
     {
         if (ListTemp.ObjIndex != index)
         {
             continue;
         }
         AdapterList colonList = new AdapterList
         {
             KeyName = ListTemp.KeyName
         };
         foreach (string key in ListTemp.ObjectList.Keys) //go through adapter items
         {
             AdapterListItem obj       = ListTemp.ObjectList[key];
             AdapterListItem colonItem = new AdapterListItem
             {
                 Name           = obj.Name,
                 Label          = obj.Label,
                 LayoutID       = obj.LayoutID,
                 Value          = obj.Value,
                 ValueType      = obj.ValueType,
                 DisplayedValue = obj.DisplayedValue,
                 Key            = obj.Key,
                 ActivityType   = obj.ActivityType
             };
             colonList.Add(colonItem);
         }
         AdapterLists.Add(colonList);
     }
 }
コード例 #2
0
        protected override void PostReadIDOs(int index = 0)
        {
            base.PostReadIDOs(index);

            //foreach (BaseBusinessObject o in
            for (int i = 0; i < BusinessObjects[index].GetRowCount(); i++) //go through IDO rows
            {
                foreach (AdapterList ListTemp in AdapterListTemplate)
                {
                    bool skip = false;
                    if (ListTemp.ObjIndex != index)
                    {
                        continue;
                    }
                    AdapterList colonList = new AdapterList
                    {
                        KeyName = ListTemp.KeyName
                    };
                    foreach (string key in ListTemp.ObjectList.Keys) //go through adapter items
                    {
                        AdapterListItem obj = ListTemp.ObjectList[key];

                        //check if the field need to be hide when repeat displaying
                        if (BusinessObjects[index].IsDuplicatedCol(key))
                        {
                            if (i > 0 && BusinessObjects[index].GetPropertyValue(obj.Name, i) == BusinessObjects[index].GetPropertyValue(obj.Name, i - 1))
                            {
                                skip = true;
                                continue;
                            }
                        }

                        AdapterListItem colonItem = new AdapterListItem
                        {
                            Name           = obj.Name,
                            Label          = obj.Label,
                            LayoutID       = obj.LayoutID,
                            ValueType      = obj.ValueType,
                            DisplayedValue = obj.DisplayedValue,
                            Key            = obj.Key,
                            ActivityType   = obj.ActivityType
                        };
                        if (!string.IsNullOrEmpty(obj.Name))
                        {
                            switch (obj.ValueType)
                            {
                            case AdapterListItem.ValueTypes.String:
                                colonItem.Value          = BusinessObjects[index].GetPropertyValue(obj.Name, i);
                                colonItem.DisplayedValue = GetPropertyDisplayedValue(BusinessObjects[index], index, obj.Name, i);
                                break;

                            case AdapterListItem.ValueTypes.Int:
                                colonItem.Value          = BusinessObjects[index].GetPropertyInt(obj.Name, i);
                                colonItem.DisplayedValue = GetPropertyDisplayedValue(BusinessObjects[index], index, obj.Name, i);
                                break;

                            case AdapterListItem.ValueTypes.Decimal:
                                colonItem.Value          = string.Format("{0:###,###,###,###,##0.00######}", BusinessObjects[index].GetPropertyDecimalValue(obj.Name, i));
                                colonItem.DisplayedValue = GetPropertyDisplayedValue(BusinessObjects[index], index, obj.Name, i);
                                break;

                            case AdapterListItem.ValueTypes.Date:
                                colonItem.Value          = BusinessObjects[index].GetPropertyValue(obj.Name, i);
                                colonItem.DisplayedValue = GetPropertyDisplayedValue(BusinessObjects[index], index, obj.Name, i);
                                break;

                            case AdapterListItem.ValueTypes.DateTime:
                                colonItem.Value          = BusinessObjects[index].GetPropertyValue(obj.Name, i);
                                colonItem.DisplayedValue = GetPropertyDisplayedValue(BusinessObjects[index], index, obj.Name, i);
                                break;

                            case AdapterListItem.ValueTypes.Bitmap:
                                colonItem.Value          = BusinessObjects[index].GetPropertyBitmap(obj.Name, i);
                                colonItem.DisplayedValue = GetPropertyDisplayedValue(BusinessObjects[index], index, obj.Name, i);
                                break;

                            case AdapterListItem.ValueTypes.Boolean:
                                colonItem.Value          = BusinessObjects[index].GetPropertyBoolean(obj.Name, i);
                                colonItem.DisplayedValue = GetPropertyDisplayedValue(BusinessObjects[index], index, obj.Name, i);
                                break;

                            default:
                                colonItem.Value = null;
                                break;
                            }
                        }
                        colonList.ObjectList.Add(key, colonItem);
                    }
                    if (!skip)
                    {
                        AdapterLists.Add(colonList);
                    }
                }
            }
        }