public void InitTopOrg() { string appId = MyConsole.GetAppString("ApplicationID"); var settingBLL = new SettingBLL(); //var topOrgName = BLL.MyConsole.GetAppString("TopOrgName"); var firstOrDefault = settingBLL.Filter(o => o.AppID.ToString() == appId).FirstOrDefault(); if (firstOrDefault != null) { var topOrgName = firstOrDefault.Title; var org = this.Filter(o => o.Enable && o.Type == 100001).OrderByDescending(o => o.Id).FirstOrDefault(); if (org == null) { //创建顶级机构和顶级建筑 org = new Organization(); org.Name = topOrgName; org.Type = 100001; org.Enable = true; org = this.Create(org); } else { if (org.Name != topOrgName) { org.Name = topOrgName; this.Update(org); } } } }
/// <summary> /// 删除过期的historybill /// </summary> public void DelOverTimeBill() { try { int days = Convert.ToInt32(MyConsole.GetAppString("HistoryBillMaxDays")); var beginday = DateTime.Now.Date.AddDays(-days); var yestoryday = DateTime.Now.Date.AddDays(-1); //string str = "delete from bill.historybill where PayMentTime<'" + String.Format("{0:0000}-{1:00}-{2:00}", beginday.Year, beginday.Month, beginday.Day) + "' and billtypeid=120001 and paytypeid=380001 and ispay=1 and issynchro=1"; //备份昨日前每日采集扣费数据 string str = "[backupHistoryBill] " + String.Format("'{0:0000}-{1:00}-{2:00}',120001", yestoryday.Year, yestoryday.Month, yestoryday.Day); this.db.Database.ExecuteSqlCommand(str); //备份设定日期,默认100天前每日统一账户扣费数据 str = "[backupHistoryBill] " + String.Format("'{0:0000}-{1:00}-{2:00}',120007", beginday.Year, beginday.Month, beginday.Day); this.db.Database.ExecuteSqlCommand(str); beginday = DateTime.Now.Date.AddDays(-30); str = "[backupAction] " + String.Format("'{0:0000}-{1:00}-{2:00}',120007", beginday.Year, beginday.Month, beginday.Day); this.db.Database.ExecuteSqlCommand(str); } catch { } }
public void InitSetting() { string appId = MyConsole.GetAppString("ApplicationID"); if (appId != null) { var setting = this.Filter(o => o.AppID.ToString() == appId).FirstOrDefault(); if (setting == null) { setting = new Setting(); //setting.AppID = Guid.NewGuid(); setting.AppID = new Guid(appId); //setting.Title = MyConsole.GetAppString("TopOrgName"); setting.Title = "初始院校"; setting.Data = ""; setting.Weather = ""; setting.ElectricityPrice = 0; setting.WaterPrice = 0; setting.ElectricityPrePay = 0; setting.WaterPrePay = 0; setting = this.Create(setting); } } }
public Setting GetSetting() { string appId = MyConsole.GetAppString("ApplicationID"); return(this.Filter(o => o.AppID.ToString() == appId).FirstOrDefault()); }