/// <summary> /// 增加一条数据 /// </summary> public void Add(FirstMoney model) { using (DBHelper db = DBHelper.Create()) { db.Insert<FirstMoney>(model); } }
/// <summary> /// 新增期初欠费记录 /// </summary> /// <param name="fMoney"></param> /// <returns></returns> public ActionResult AddNewArrear(FirstMoney fMoney) { AjaxResult result = new AjaxResult(); fMoney.ID = Guid.NewGuid().ToString("N"); fMoney.Status = 0; try { new FirstMoneyRule().Add(fMoney); result.Success = true; result.Message = "期初欠费添加成功"; } catch (Exception ex) { result.Success = false; result.Message = ex.Message; } return Json(result, JsonRequestBehavior.AllowGet); }
/// <summary> /// 获取期初欠费一览数据 /// </summary> /// <param name="param"></param> /// <param name="customerID"></param> /// <returns></returns> public ActionResult NewArrearSearch(EasyUIGridParamModel param, FirstMoney fMoney) { int itemCount = 0; List<dynamic> newArrearList = new FirstMoneyRule().Search(param, fMoney, out itemCount); var showList = from newArrear in newArrearList select new { ID = newArrear.ID, Name = newArrear.NAME, Year = newArrear.YEAR, Money = newArrear.MONEY, Status = GetFirstMoneyStatus(newArrear.STATUS), ChargeDate = newArrear.CHARGEDATE }; return Json(new { total = itemCount, rows = showList, footer = new List<dynamic>() { new { Money = showList.Sum(t => Convert.ToInt32(Convert.ToDecimal(t.Money)).ToString("0.00")), Name = "合计" } } }, JsonRequestBehavior.AllowGet); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(FirstMoney model) { using (DBHelper db = DBHelper.Create()) { db.Update<FirstMoney>(model); return true; } }
/// <summary> /// 获取期初欠费一览 /// </summary> /// <param name="param"></param> /// <param name="fMoney"></param> /// <param name="itemCount"></param> /// <returns></returns> public List<dynamic> Search(EasyUIGridParamModel param, FirstMoney fMoney, out int itemCount) { Dictionary<string, object> DicParam = new Dictionary<string, object>(); string strSql = @"select fm.*,c.Name from T_FirstMoney fm left join T_Customer c on c.ID=fm.CustomerID where 1=1 "; if (!string.IsNullOrEmpty(fMoney.CustomerID)) { strSql+=" and fm.CustomerID=@customerID"; DicParam.Add("customerID", fMoney.CustomerID); } if (fMoney.Status!=-1) { strSql += " and fm.Status=@Status"; DicParam.Add("Status", fMoney.Status); } //分页信息 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="fMoney"></param> /// <param name="itemCount"></param> /// <returns></returns> public List<dynamic> Search(EasyUIGridParamModel param, FirstMoney fMoney, out int itemCount) { return dal.Search(param, fMoney, out itemCount); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Ajax.Model.FirstMoney model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public void Add(Ajax.Model.FirstMoney model) { dal.Add(model); }