/// <summary> /// 加载首页数据,抽取出来供首页加载方法和首页登录方法调用 /// author:hbqian in 2013/02/21 /// </summary> private void loadIndexData() { //取得最新加入的电站 IList <Plant> newPlants = PlantService.GetInstance().GetNewPlantInfoList(4); User userinfo = UserService.GetInstance().GetUserByName(UserUtil.demousername); if (userinfo != null) { IList <PlantUser> plant = PlantUserService.GetInstance().GetAllPlantUserByUserID(new PlantUser { userID = userinfo.id }); ViewData["examplePlant"] = plant; } ViewData["newPlants"] = newPlants; float co2Rate = ItemConfigService.GetInstance().getCO2Config(); ViewData["AllPlant"] = PlantService.GetInstance().GetPlantNum(); double alltotalenergy = DeviceRunDataService.GetInstance().GetAllTotalEnergy(); //modify by hbqian at 2013-08-02 for 同一时刻 2个值结果不一致 ,首页和内部所有电站日发电量统计值不一致 //double dayEnergy = CollectorRunDataService.GetInstance().GetAllDayEnergy(); double dayEnergy = getAllPlantTodayEnergy(); //modify by hbqian at 2013-08-02 for 同一时刻 2个值结果不一致 ,首页和内部所有电站日发电量统计值不一致 end double co2Value = alltotalenergy * co2Rate; ViewData["co2Unit"] = Util.upCo2Unit(co2Value); ViewData["energyUnit"] = Util.upEnergyUnit(alltotalenergy); ViewData["dayenergyUnit"] = Util.upEnergyUnit(dayEnergy); ViewData["AllTotalEnergy"] = StringUtil.formatDouble(Util.upDigtal(alltotalenergy)); ViewData["AlldayTotalEnergy"] = StringUtil.formatDouble(Util.upDigtal(dayEnergy)); ViewData["AllCO2"] = StringUtil.formatDouble(Util.upDigtal(co2Value)); getPPics(); getAdPics(); }
protected void Application_Start() { //默认模板 Application[ComConst.Templete] = TemplateService.GetInstance().getDefault(); AreaRegistration.RegisterAllAreas(); RegisterRoutes(RouteTable.Routes); ViewEngines.Engines.Clear(); ViewEngines.Engines.Add(new MvcViewEngine()); //初始化用户实体的减排系数 float c2 = ItemConfigService.GetInstance().getCO2Config(); float tree = ItemConfigService.GetInstance().getTreeConfig(); ItemConfig.treeConvert = tree; ItemConfig.reductionRate = c2; if (syndata != null && syndata.Equals("true")) { SynDataService.GetInstance().startupforWeb(); } //从后台维护数据表中设置错误码静态数据 ErrorcodeService.GetInstance().setErrorStaticData(); //add by hbqian in 20130504 for 启动生成电站发电量告警表数据线程 if (energywarn != null && energywarn.Equals("true")) { EnergywarnProcesser dataProcess = new EnergywarnProcesser(); Thread m_thread = new Thread(new ThreadStart(dataProcess.Processing)); m_thread.Start(); } }
/// <summary> /// 取得CO2减排换算率 /// </summary> /// <returns></returns> protected float getCO2Rate() { ItemConfig modcon = ItemConfigService.GetInstance().GetItemConfigByName(ItemConfig.CO2); if (modcon == null) { return(1F); } else { return(modcon.value); } }
// // GET: /Wap/ public ActionResult Index() { float co2Rate = ItemConfigService.GetInstance().getCO2Config(); double alltotalenergy = DeviceRunDataService.GetInstance().GetAllTotalEnergy(); double dayEnergy = CollectorRunDataService.GetInstance().GetAllDayEnergy(); double co2Value = alltotalenergy * co2Rate; ViewData["co2Unit"] = Util.upCo2Unit(co2Value); ViewData["energyUnit"] = Util.upEnergyUnit(alltotalenergy); ViewData["dayenergyUnit"] = Util.upEnergyUnit(dayEnergy); ViewData["AllTotalEnergy"] = StringUtil.formatDouble(Util.upDigtal(alltotalenergy)); ViewData["AlldayTotalEnergy"] = StringUtil.formatDouble(Util.upDigtal(dayEnergy)); ViewData["AllCO2"] = StringUtil.formatDouble(Util.upDigtal(co2Value)); return(View()); }
public ActionResult Warningpayment() { #region 获取配置电站付费提醒天数 int limitDays = 30; ItemConfig config = ItemConfigService.GetInstance().GetItemConfigByName(ItemConfig.Payment); if (config != null && config.value > 0) { limitDays = (int)config.value; } #endregion //过滤相同的用户ID Userid IList <Plant> plants = PlantService.GetInstance().GetPaymentExpiredList(); plants = plants.Distinct(new PlantUserIdComparer()).ToList <Plant>(); User user = null; foreach (Plant plant in plants) { if (plant.userID.Equals(0)) { continue; } user = UserService.GetInstance().Get(plant.userID); //根据电站取用户 if (string.IsNullOrEmpty(user.email)) //邮箱不对跳过 { continue; } IList <Plant> expiredPlants = user.ExpiredPlants; string msg = string.Empty; foreach (Plant vo in expiredPlants) { msg += string.Format(Resources.SunResource.FEE_EMAILTIPS_DONE_FOMART, vo.name, vo.PaymentLimitDate.ToString("yyyy-MM-dd")); } MailServerPoolObject obj = EmailConnectionPool.getMailServerPoolObject(); Message message = null; try { message = new Message(); message.BodyHtml = string.Format(Resources.SunResource.FEE_EMAILTIPS_DONE, user.username, msg); message.From.Email = obj.accountName; message.To.Add(user.email); message.Subject = "SolarInfoBank"; if (expiredPlants.Count > 0) { obj.SendMail(message); //更新电站邮件最后发送时间 foreach (Plant vo in expiredPlants) { vo.LastEmailRemindDate = DateTime.Now; PlantService.GetInstance().UpdateLastEmailRemindDate(vo); } } obj.close(); expiredPlants = user.ExpireSoonPlants(limitDays); if (expiredPlants.Count.Equals(0)) { continue; } msg = string.Empty; foreach (Plant vo in expiredPlants) { msg += string.Format(Resources.SunResource.FEE_EMAILTIPS_WILL_FOMART, vo.name, vo.PaymentLimitDate.ToString("yyyy-MM-dd")); } //下面发送即将到期电站邮件 obj = EmailConnectionPool.getMailServerPoolObject(); message.BodyHtml = string.Format(Resources.SunResource.FEE_EMAILTIPS_WILL, user.username, msg); obj.SendMail(message); obj.close(); //更新电站邮件最后发送时间 foreach (Plant vo in expiredPlants) { vo.LastEmailRemindDate = DateTime.Now; PlantService.GetInstance().UpdateLastEmailRemindDate(vo); } } catch { obj.close(); } } return(Content("")); }
public ActionResult SavePaymentconfig(ItemConfig itemConfig) { ItemConfigService.GetInstance().UpdateValue(itemConfig); return(Redirect("/saler/paymentconfig/")); }
public ActionResult PaymentConfig() { ItemConfig config = ItemConfigService.GetInstance().GetItemConfigByName(ItemConfig.Payment); return(View(config)); }