public static void SyncCategory() { var categoryList = THSBiz.GetCategoryList(); var dbCategoryList = CategoryDAL.GetCategoryList(); if (dbCategoryList != null) { categoryList.RemoveAll(item => dbCategoryList.Exists(dbitem => { return(item.CategoryCode == dbitem.CategoryCode && item.StockCode == dbitem.StockCode); })); } var stockList = StockDAL.GetStockList(); if (categoryList != null && stockList != null) { foreach (var cat in categoryList) { var stock = stockList.Find(s => s.StockCode == cat.StockCode); if (stock != null) { cat.StockName = stock.StockName; } } } if (categoryList.Count > 0) { CategoryDAL.Insert(categoryList); } }
public static void DownloadFinanceFromTHS() { var stockList = FinanceDAL.GetNoFinanceStock(); foreach (var stock in stockList) { var list = THSBiz.DownloadFinance(stock); if (!list.IsNullOrEmpty()) { FinanceDAL.InsertFinance(list); } } }
public static void SyncFinanceFromTHS() { var reportDate = DateTime.Now; reportDate = DateTime.Parse(string.Format("{0}-{1}", reportDate.AddMonths(-6).Year - 2, "09-30")); while (reportDate < DateTime.Now) { var endDate = FinanceDAL.GetMaxIndate(reportDate).GetValueOrDefault(reportDate); var list = THSBiz.GetFinanceList(reportDate, endDate); if (!list.IsNullOrEmpty()) { FinanceDAL.InsertFinance(list); } reportDate = reportDate.AddDays(1).AddMonths(3).AddDays(-1); } }
public static void SyncNewsFromThs() { var list = THSBiz.LimitUpNews(); if (list.IsNullOrEmpty()) { return; } list.RemoveAll(item => { var dbItem = NewsDAL.GetStockNews(item.StockCode, item.Url); return(!dbItem.IsNullOrEmpty()); }); if (!list.IsNullOrEmpty()) { NewsDAL.Insert(list); } }