public static FetchDataBase GetInstance(string type) { FetchDataBase instance = null; switch (type) { case "chuchang": instance = new FetchPriceEntity <ChuChangPrice>(type, "LongZhong_LeaveFactoryPrice"); break; case "guoji": instance = new FetchPriceEntity <GuoJiPrice>(type, "LongZhong_InternationalPrice"); break; case "guonei": instance = new FetchPriceEntity <GuoNeiPrice>(type, "LongZhong_NationalPrice"); break; case "oil": instance = new FetchPriceEntity <OilPrice>(type, "LongZhong_OilPrice"); break; default: break; } return(instance); }
public void Execute() { FetchDataBase chuChangPrice = PriceFactory.GetInstance("chuchang"); FetchDataBase guojiPrice = PriceFactory.GetInstance("guoji"); FetchDataBase guoNeiPrice = PriceFactory.GetInstance("guonei"); FetchDataBase oilPrice = PriceFactory.GetInstance("oil"); oilPrice.FetchAndFill(LogMsg); chuChangPrice.FetchAndFill(LogMsg); guojiPrice.FetchAndFill(LogMsg); guoNeiPrice.FetchAndFill(LogMsg); }