예제 #1
0
 public static void removeItem(AppStockList targetList, string item)
 {
     if (targetList != null && targetList.stocks != null)
     {
         targetList.stocks.Remove(item);
     }
 }
예제 #2
0
 public static void addItem(AppStockList targetList, string item)
 {
     if (targetList != null && targetList.stocks != null)
     {
         targetList.stocks.Add(item);
     }
 }
예제 #3
0
 public void setTargetList(AppStockList target)
 {
     m_targetList = target;
 }
예제 #4
0
        private void runSort()
        {
            AppStockList  targetList = AppGlobalCache.getInstance().getTargetList();
            List <string> src        = new List <string>();

            src.AddRange(targetList.stocks);

            List <StockSortableMetadata> target = new List <StockSortableMetadata>();
            bool reverse = true;

            foreach (string stockID in src)
            {
                StockSortableMetadata sd = null;
                switch (m_sortType)
                {
                case AppStockSortType.SST_AnnualCost:
                    sd = new SSMDAnnualCostPerf(stockID);
                    break;

                case AppStockSortType.SST_DynamicCost:
                    sd = new SSMDCostPerf(stockID);
                    break;

                case AppStockSortType.SST_PriceScale:
                    string refDate = textBox_pricescale_refdate.Text;
                    if (!DateUtil.isDateValid(refDate))
                    {
                        refDate = m_defaultRefDate;
                    }
                    sd = new SSDMPriceScale(stockID, refDate);
                    break;

                case AppStockSortType.SST_QuarterCost:
                    sd = new SSMDQuarterCostPerf(stockID);
                    break;

                case AppStockSortType.SST_SpecCost:
                    string y = textBox_spec_year.Text;
                    string q = textBox_spec_quarter.Text;
                    sd = new SSMDSpecCostPerf(stockID, y, q);
                    break;

                case AppStockSortType.SST_YoyCost:
                    sd = new SSMDYoyCostPerf(stockID);
                    break;

                default:
                    break;
                }

                if (sd != null)
                {
                    target.Add(sd);
                }
            }

            target.Sort();
            if (reverse)
            {
                target.Reverse();
            }

            List <string> result = new List <string>();

            for (int i = 0; i < target.Count; i++)
            {
                result.Add(target[i].stockID);
            }

            targetList.copy(result);
        }