public void RechargeCash(Model.VO.RechargeVO entity) { CustClubCardModule.ClubCardMgm clubCardMgm = new CustClubCardModule.ClubCardMgm(); int clubCardID = clubCardMgm.GetCardStatusByClubCardID(entity.ClubCardID); if (clubCardID != Convert.ToInt32(ClubCardStatus.OpenCard)) { throw new Exception("非有效会员卡,请联系后台管理员"); } RechargeLogData rechargeLogData = new RechargeLogData(); ClubCardData clubCardData = new ClubCardData(); ClubCardPO clubCardPO = clubCardData.GetClubCardByID(entity.ClubCardID); clubCardPO.Balance += entity.PlatformRechargeAmount; SqlConnection conn = new SqlConnection(PubConstant.ConnectionString); conn.Open(); SqlTransaction tx = conn.BeginTransaction(); try { //entity.RechargeSerialNo = SerialNoGenerator.GenRechargeSerialNo(entity.RechargeStore); rechargeLogData.AddRechargeLog(Mapper.Map <RechargeVO, RechargeLogPO>(entity)); clubCardData.UpdateClubCard(clubCardPO); tx.Commit(); } catch { tx.Rollback(); throw new Exception("现金充值失败"); } }
public string UpdatePwd(int clubCardID, string oldpwd, string newPwd) { IClubCardData carddal = new ClubCardData(); string restr; var result = Mapper.Map <ClubCardPO, ClubCardVO>(carddal.GetCardByID(clubCardID, 0)); if (result == null) { restr = "当前会员卡不存在"; } else { if (result.ClubCardPwd == StringHelper.MD5Encrypt(oldpwd)) { try { result.ClubCardPwd = StringHelper.MD5Encrypt(newPwd); carddal.UpdateClubCard(Mapper.Map <ClubCardVO, ClubCardPO>(result)); restr = null; } catch (Exception ex) { LogHandler.Error(ex.ToString()); restr = "出现错误,密码重置失败"; } } else { restr = "原始密码不正确"; } } return(restr); }
public void UpdatePwd(int clubCardID, string newPwd) { ClubCardData clubCardData = new ClubCardData(); ClubCardVO clubCardVO = GetClubCardByID(clubCardID); string encryptPwd = PwdHelper.MD5Encrypt(newPwd); clubCardVO.ClubCardPwd = encryptPwd; clubCardData.UpdateClubCard(Mapper.Map <ClubCardVO, ClubCardPO>(clubCardVO)); }
public void UpdateClubCardStatus(int clubCardID, int status) { ClubCardData clubCardData = new ClubCardData(); ClubCardVO clubCardVO = GetClubCardByID(clubCardID); if ((status != Convert.ToInt32(ClubCardStatus.OpenCard)) && (status != Convert.ToInt32(ClubCardStatus.ReportLoss)) && (status != Convert.ToInt32(ClubCardStatus.Froze)) && (status != Convert.ToInt32(ClubCardStatus.LogOff)) && (status != Convert.ToInt32(ClubCardStatus.Expire))) { throw new Exception("ClubCard Status invalid"); } clubCardVO.CardStatus = status; clubCardData.UpdateClubCard(Mapper.Map <ClubCardVO, ClubCardPO>(clubCardVO)); }
public void UpdateClubCardNo(int clubCardID, string newClubCardNo) { ClubCardData clubCardData = new ClubCardData(); ClubCardVO clubCardVO = GetClubCardByID(clubCardID); if (string.IsNullOrEmpty(newClubCardNo.Trim())) { throw new Exception("New ClubCardNo cannot empty "); } clubCardVO.ClubCardNo = newClubCardNo; clubCardVO.CardStatus = 0; clubCardData.UpdateClubCard(Mapper.Map <ClubCardVO, ClubCardPO>(clubCardVO)); }
public string ConsumeCash(List <Model.VO.ConsumeVO> list) { string strBatchNo = ""; CustClubCardModule.ClubCardMgm clubCardMgm = new CustClubCardModule.ClubCardMgm(); int clubCardStat = clubCardMgm.GetCardStatusByClubCardID(list[0].ClubCardID); if (clubCardStat != Convert.ToInt32(ClubCardStatus.OpenCard)) { throw new Exception("非有效会员卡,请联系后台管理员"); } ConsumeLogData consumeLogData = new ConsumeLogData(); ClubCardData clubCardData = new ClubCardData(); ClubCardPO clubCardPO = clubCardData.GetClubCardByID(list[0].ClubCardID); SqlConnection conn = new SqlConnection(PubConstant.ConnectionString); conn.Open(); SqlTransaction tx = conn.BeginTransaction(); int storeId = Convert.ToInt32(list.FirstOrDefault().Reserved1); list.ForEach(itm => itm.Reserved1 = null); try { decimal dConsumeAmount = 0.0M; strBatchNo = SerialNoGenerator.GenConsumeBatchNo(storeId); foreach (var item in list) { dConsumeAmount += item.OriginalPrice; item.ConsumeBatchNo = strBatchNo; consumeLogData.AddConsumeLog(Mapper.Map <ConsumeVO, ConsumeLogPO>(item)); } clubCardPO.Balance = clubCardPO.Balance - dConsumeAmount; clubCardData.UpdateClubCard(clubCardPO); tx.Commit(); } catch { tx.Rollback(); throw new Exception("会员现金消费失败"); } return(strBatchNo); }