private bool UpdateMemberFee(List<string> memberCodeList, int activityId, List<double> serviceFeeList) { bool result = false; try { for (int i = 0; i < memberCodeList.Count; i++) { ICriteria criteria = this.IActivityManage.NativeHibernateSession.CreateCriteria(typeof(MemberBaseInfo)); MemberBaseInfo member = new MemberBaseInfo(); member = criteria.Add(Restrictions.Eq("MemberCode", memberCodeList[i])).List<MemberBaseInfo>().ToList<MemberBaseInfo>()[0]; string feeMemberCode = member.MemberCode; ICriteria criteriaFee = this.IActivityManage.NativeHibernateSession.CreateCriteria(typeof(MemberActivityInfo)); if (member.AddtionalCode != null && member.AddtionalCode.Trim() != "") { member = this.IActivityManage.NativeHibernateSession.CreateCriteria(typeof(MemberBaseInfo)).Add(Restrictions.Eq("MemberCode", member.AddtionalCode)).List<MemberBaseInfo>().ToList<MemberBaseInfo>()[0]; } criteriaFee.Add(Restrictions.Eq("ActivityId", activityId)); criteriaFee.Add(Restrictions.Eq("MemberCode", feeMemberCode)); MemberActivityInfo memberActivity = new MemberActivityInfo(); List<MemberActivityInfo> memAcList = new List<MemberActivityInfo>(); memAcList = criteriaFee.List<MemberActivityInfo>().ToList<MemberActivityInfo>(); if ((memAcList != null) && (memAcList.Count > 0)) { memberActivity = memAcList[0]; } member.FeeBalance = (member.FeeBalance + memberActivity.ServiceFee) - serviceFeeList[i]; result = this.IActivityManage.UpdateTableInfo<MemberBaseInfo>(member); MemberFee memberFeeRecord = new MemberFee { MemberId = member.MemberId, ActivityCode = memberActivity.ActivityCode, FeeStatus = 3, FeeId = 0, ClubCount = memberActivity.ServiceFee, FeeDate = DateTime.Now, LastUpdateBy = (HttpContext.Current.Session["ADMIN"] as AdminInfo).AdminName, LastUpdateDate = DateTime.Now, Remark = "取消参加" + memberActivity.ActivityCode + ",系统退费" }; this.IActivityManage.UpdateTableInfo<MemberFee>(memberFeeRecord); } } catch (Exception) { result = false; } return result; }
public object SaveMemberFee(MemberFee newFee) { MemberManageBLL memberFeeBLL = new MemberManageBLL(); newFee.FeeStatus = 0; return memberFeeBLL.SaveMemberFee(newFee); }
public void UpdateFeeRecord(List<string> memberCodelist, int activityId) { try { for (int i = 0; i < memberCodelist.Count; i++) { ICriteria criteria = this.IActivityManage.NativeHibernateSession.CreateCriteria(typeof(MemberBaseInfo)); MemberBaseInfo member = new MemberBaseInfo(); member = criteria.Add(Restrictions.Eq("MemberCode", memberCodelist[i])).List<MemberBaseInfo>().ToList<MemberBaseInfo>()[0]; string feeMemberCode = member.MemberCode; int feeMemberId = member.MemberId; if (member.AddtionalCode != null && member.AddtionalCode.Trim() != "") { member = this.IActivityManage.NativeHibernateSession.CreateCriteria(typeof(MemberBaseInfo)).Add(Restrictions.Eq("MemberCode", member.AddtionalCode)).List<MemberBaseInfo>().ToList<MemberBaseInfo>()[0]; } ICriteria criteriaFee = this.IActivityManage.NativeHibernateSession.CreateCriteria(typeof(MemberActivityInfo)); criteriaFee.Add(Restrictions.Eq("ActivityId", activityId)); criteriaFee.Add(Restrictions.Eq("MemberCode", feeMemberCode)); MemberActivityInfo memberActivity = new MemberActivityInfo(); List<MemberActivityInfo> memAcList = new List<MemberActivityInfo>(); memAcList = criteriaFee.List<MemberActivityInfo>().ToList<MemberActivityInfo>(); if ((memAcList != null) && (memAcList.Count > 0)) { memberActivity = memAcList[0]; } this.IActivityManage.NativeHibernateSession.Delete(string.Concat(new object[] { "from MemberFee t where t.MemberId=", feeMemberId, " and t.ActivityCode='", memberActivity.ActivityCode, "'" })); this.IActivityManage.NativeHibernateSession.Flush(); MemberFee newfeeRecord = new MemberFee { MemberId =feeMemberId, ActivityCode = memberActivity.ActivityCode, ClubCount = memberActivity.ServiceFee, FeeDate = DateTime.Now, LastUpdateBy = (HttpContext.Current.Session["ADMIN"] as AdminInfo).AdminName, LastUpdateDate = DateTime.Now, FeeStatus = 1, Remark = "参加" + memberActivity.ActivityCode + "扣费" }; this.IActivityManage.NativeHibernateSession.Save(newfeeRecord); } } catch (Exception) { } }