/// <summary> /// 查询该月的消费信息 /// </summary> /// <param name="user"></param> /// <param name="month">如果为0,则表示当月的数据,</param> private void bindMonthXFinfo(Model.wx_ucard_users user, int month) { int year = DateTime.Now.Year; int todayMonth = DateTime.Now.Month; if (month == 0) { month = todayMonth; } IList <Model.wx_ucard_users_consumeinfo> clist = cBll.GetModelList("sId=" + sid + " and uid=" + user.id + " and moduleType!='签到' and year(addTime)=" + year + " and month(addTime)=" + month + " order by addTime desc"); StringBuilder xfSb = new StringBuilder(""); decimal ttMoney = 0; int ttScore = 0; if (clist != null && clist.Count > 0) { Model.wx_ucard_users_consumeinfo c = new Model.wx_ucard_users_consumeinfo(); for (int i = 0; i < clist.Count; i++) { c = clist[i]; xfSb.Append("<tr><td>" + c.addTime.Value.ToString("yyyy-MM-dd") + "</td> <td>" + MyCommFun.Obj2Decimal(c.consumeMoney, 0) + "</td> <td>" + MyCommFun.Obj2Int(c.score) + "</td> </tr>"); ttMoney += MyCommFun.Obj2Decimal(c.consumeMoney, 0); ttScore += MyCommFun.Obj2Int(c.score); } BindDaysDetailInfo(clist); } litXFStr.Text = xfSb.ToString(); litttMoney.Text = ttMoney.ToString(); litttScore.Text = ttScore.ToString(); }
/// <summary> /// 查询该月的签到信息 /// </summary> /// <param name="user"></param> /// <param name="month">如果为0,则表示当月的数据,</param> private void bindMonthQD(Model.wx_ucard_users user, int month) { int year = DateTime.Now.Year; int todayMonth = DateTime.Now.Month; if (month == 0) { month = todayMonth; } IList <Model.wx_ucard_users_consumeinfo> qdlist = cBll.GetModelList("sId=" + sid + " and uid=" + user.id + " and moduleType='签到' and year(addTime)=" + year + " and month(addTime)=" + month + " order by addTime desc"); DateTime thisBeginTimes = DateTime.Parse(year + "-" + month + "-1"); DateTime thisEndTimes; if (todayMonth == month) { //当前月 thisEndTimes = DateTime.Now; } else { //非当前月 thisEndTimes = thisBeginTimes.AddMonths(1).AddDays(-1); } int maxDays = thisEndTimes.Day; StringBuilder qdStr = new StringBuilder(""); DateTime tmpTimes = new DateTime(); Model.wx_ucard_users_consumeinfo tmpConsume = new Model.wx_ucard_users_consumeinfo(); int totqdjifen = 0; for (int i = maxDays; i > 0; i--) { //待完成 tmpTimes = DateTime.Parse(year + "-" + month + "-" + i); tmpConsume = getqdInfo(qdlist, tmpTimes); if (tmpConsume != null) { //已经签到 qdStr.Append(getqdStr(tmpTimes, tmpConsume.score.Value, true)); totqdjifen += tmpConsume.score.Value; } else { //未签到 qdStr.Append(getqdStr(tmpTimes, 0, false)); } } litQDStr.Text = qdStr.ToString(); litTTqdScore.Text = totqdjifen.ToString(); }