/// <summary> /// 增加一条数据 /// </summary> public void Add(YearEndArrear model) { using (DBHelper db = DBHelper.Create()) { db.Insert<YearEndArrear>(model); } }
/// <summary> /// 执行年终结算 /// </summary> /// <param name="strYear">结算年份</param> /// <returns></returns> public void CaculateYearFee(string strYear) { decimal totalFee = 0; //获取欠费用户列表 string strWhere = @" and PID is null and status=1 and beginChargeDate between '{0}-1-1 0:00:00' and '{0}-12-31 23:59:59'"; List<Customer> arrearsCustomerList = new CustomerRule().GetList(string.Format(strWhere, strYear)); foreach (Customer c in arrearsCustomerList) { totalFee = new ChargeRule().CaculateCustomerFee(c.ID); YearEndArrear yeaInfo = new YearEndArrear() { ID = Guid.NewGuid().ToString("N"), CustomerID = c.ID, Money = totalFee, Status = 0, Year = Convert.ToInt32(strYear) }; new YearEndArrearRule().Add(yeaInfo); //更新起始缴费时间 c.BeginChargeDate = Convert.ToDateTime(string.Format("{0}-1-1", DateTime.Now.Year - 1)); new CustomerRule().Update(c); } }
/// <summary> /// 获取年终总结一览数据 /// </summary> /// <param name="param"></param> /// <param name="yeArrear"></param> /// <returns></returns> public ActionResult YearBalanceSearch(EasyUIGridParamModel param, YearEndArrear yeArrear) { int itemCount = 0; var YeArrearList = new YearEndArrearRule().Search(param, yeArrear, out itemCount); var showList = from ya in YeArrearList select new { ID = ya.ID, Name = ya.NAME, Money = ya.MONEY, Status = GetYearEndArrearStatus(ya.STATUS), Year = ya.YEAR, ChargeDate = ya.CHARGEDATE }; return Json(new { total = itemCount, rows = showList }, JsonRequestBehavior.AllowGet); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(YearEndArrear model) { using (DBHelper db = DBHelper.Create()) { db.Update<YearEndArrear>(model); return true; } }
/// <summary> /// 获取年度欠费一览 /// </summary> /// <param name="param"></param> /// <param name="yeArrear"></param> /// <param name="itemCount"></param> /// <returns></returns> public List<dynamic> Search(EasyUIGridParamModel param, YearEndArrear yeArrear, out int itemCount) { Dictionary<string, object> DicParam = new Dictionary<string, object>(); string strSql = @"select yea.*,c.Name from T_YearEndArrear yea left join T_Customer c on c.ID=yea.CustomerID where 1=1 "; if (!string.IsNullOrEmpty(yeArrear.CustomerID)) { strSql += " and yea.CustomerID=@customerID"; DicParam.Add("customerID", yeArrear.CustomerID); } if (yeArrear.Status != -1) { strSql += " and yea.Year=@Year"; DicParam.Add("Year", yeArrear.Year); } //分页信息 int pageIndex = Convert.ToInt32(param.page) - 1; int pageSize = Convert.ToInt32(param.rows); using (DBHelper db = DBHelper.Create()) { itemCount = db.GetCount(string.Format(DBHelper.StrGetCountSql, strSql), DicParam); return db.GetDynaminObjectList(strSql, pageIndex, pageSize, "ID", DicParam); } }
/// <summary> /// 获取年度欠费一览 /// </summary> /// <param name="param"></param> /// <param name="yeArrear"></param> /// <param name="itemCount"></param> /// <returns></returns> public List<dynamic> Search(EasyUIGridParamModel param, YearEndArrear yeArrear, out int itemCount) { return dal.Search(param, yeArrear, out itemCount); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Ajax.Model.YearEndArrear model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public void Add(Ajax.Model.YearEndArrear model) { dal.Add(model); }