public decimal GetAvgPrice(string stockCode, string date, int type) { decimal result = 0; using (DaStock da = new DaStock()) { if (type == 5) { result = da.GetFiveAvgPrice(stockCode, date); } else if (type == 10) { result = da.GetTenAvgPrice(stockCode, date); } else if (type == 20) { result = da.GetTwentyAvgPrice(stockCode, date); } else if (type == 30) { result = da.GetThirtyAvgPrice(stockCode, date); } else if (type == 60) { result = da.GetSixtyAvgPrice(stockCode, date); } } return(result); }