public ActionResult ByDay() { List<JsonEModel> list = new TestBll().GetDataByDay() ?? new List<JsonEModel>(); string data = JsonConvert.SerializeObject(list); DataTable dt = new TestBll().GetBusiness(); string business = string.Empty; if (dt != null) { foreach (DataRow row in dt.Rows) { business += "\"" + row["BusinessName"].ToString() + "\","; } } if (business != null) business = business.Remove(business.Length - 1); DateTime dtTime = TypeParse.StrToDate("2016-5-2", DateTime.Now); int month = dtTime.Month; int days = DateTime.DaysInMonth(dtTime.Year, month); string dayList = string.Empty; for(int i=1;i<=days;i++) { dayList += "\""+month+"-"+ i+"\","; } if (dayList.Length > 0) dayList = dayList.Remove(dayList.Length - 1); ViewBag.data = data; ViewBag.business = "[" + business + "]"; ViewBag.day = "[" + dayList + "]"; return View(); }
public ActionResult ByMonthPie() { List<PieJsonModel> list = new TestBll().GetDataByMonthPie() ?? new List<PieJsonModel>(); string data = JsonConvert.SerializeObject(list); string monthList = string.Empty; foreach (PieJsonModel item in list) { monthList += "\"" + item.Name + "\","; } if (monthList.Length > 0) monthList = monthList.Remove(monthList.Length - 1); ViewBag.data = data; ViewBag.month = "[" + monthList + "]"; return View(); }
public ActionResult Index() { List<JsonEModel> list = new TestBll().GetData()??new List<JsonEModel>(); string data = JsonConvert.SerializeObject(list); DataTable dt = new TestBll().GetBusiness(); string business = string.Empty; if (dt != null) { foreach (DataRow row in dt.Rows) { business +="\""+ row["BusinessName"].ToString()+"\","; } } if (business != null) business = business.Remove(business.Length - 1); ViewBag.data = data; ViewBag.business = "["+business+"]"; return View(); }
public ActionResult ByMonth() { List<JsonEModel> list = new TestBll().GetDataByMonth() ?? new List<JsonEModel>(); string data = JsonConvert.SerializeObject(list); DateTime dtTime = TypeParse.StrToDate("2015-6-1", DateTime.Now); DateTime endTime = TypeParse.StrToDate("2016-8-1", DateTime.Now); string monthList = string.Empty; int year = dtTime.Year; for (int i = 1; dtTime < endTime; i++) { monthList += "\"" + dtTime.ToString("yyyy-MM") + "\","; dtTime = dtTime.AddMonths(1); } if (monthList.Length > 0) monthList = monthList.Remove(monthList.Length - 1); ViewBag.data = data; ViewBag.month = "[" + monthList + "]"; return View(); }
// // GET: /Default/ public ActionResult Index1() { ICar car; try { //string dllName = "", factoryType = ""; //IFactory factory = new SportFactory(); //car=factory.CreateCar(); //Console.WriteLine("下一场戏开跑车。"); //car.GetCar(); AbstractEquipment factoryEquipment=new SportEquipment(); CreateEquipment equipment=new CreateEquipment(factoryEquipment); equipment.ReadyEquipment(); //// ***具体app.config配置如下*** // ////<add key="assemblyName" value="CNBlogs.DesignPattern.Common"/> ////<add key="nameSpaceName" value="CNBlogs.DesignPattern.Common"/> ////<add key="typename" value="SportEquipment"/> //// 创建一个工厂类的实例 //string assemblyName = ConfigurationManager.AppSettings["assemblyName"]; //string fullTypeName = string.Concat(ConfigurationManager.AppSettings["nameSpaceName"], ".", ConfigurationManager.AppSettings["typename"]); //AbstractEquipment factory = (AbstractEquipment)Assembly.Load(assemblyName).CreateInstance(fullTypeName); //CreateEquipment equipment = new CreateEquipment(factory); //equipment.ReadyEquipment(); //Console.Read(); //// 工厂类的类名写在配置文件中可以方便以后修改 //string factoryType = ConfigurationManager.AppSettings["FactoryType"]; //// 这里把DLL配置在数据库是因为以后数据可能发生改变 //// 比如说现在的数据是从sql server取的,以后需要从oracle取的话只需要添加一个访问oracle数据库的工程就行了 //string dllName = ConfigurationManager.AppSettings["DllName"]; //// 利用.NET提供的反射可以根据类名来创建它的实例,非常方便 //var currentAssembly = System.Reflection.Assembly.GetExecutingAssembly(); //string codeBase = currentAssembly.CodeBase.ToLower().Replace(currentAssembly.ManifestModule.Name.ToLower(), string.Empty); //IFactory factory = Assembly.LoadFrom(Path.Combine(codeBase, dllName)).CreateInstance(factoryType) as IFactory; //ICar car = factory.CreateCar(); //car.GetCar(); } catch { } DataTable dt=new TestBll().GetModel(1)??new DataTable(); ViewBag.data = dt; return View(); }