Exemplo n.º 1
0
 /// <summary>
 /// 批量处理变更
 /// </summary>
 /// <param name="vipCardIds"></param>
 /// <param name="StatusIDNext"></param>
 /// <param name="strError"></param>
 /// <returns></returns>
 public bool SetVipCardStatusChangeBatch(string vipCardIds, int StatusIDNext, out string strError)
 {
     #region
     if (vipCardIds == null || vipCardIds.Trim().Equals(""))
     {
         strError = "会员卡号标识不能为空.";
         return(false);
     }
     if (StatusIDNext == 0 || StatusIDNext.ToString().Trim().Equals(""))
     {
         strError = "更改之后的状态标识不能为空.";
         return(false);
     }
     #endregion
     bool       bReturn       = true;
     string[]   vipCardIdArr  = vipCardIds.Split(',');
     VipCardBLL vipCardServer = new VipCardBLL(this.CurrentUserInfo);
     foreach (string id in vipCardIdArr)
     {
         VipCardEntity vipCardInfo = new VipCardEntity();
         vipCardInfo = vipCardServer.GetByID(id);
         bReturn     = SetVipCardStatusChange(id
                                              , Convert.ToInt32(vipCardInfo.VipCardStatusId)
                                              , StatusIDNext
                                              , this.CurrentUserInfo.CurrentUserRole.UnitId
                                              , out strError);
         if (!bReturn)
         {
             break;
         }
     }
     strError = "ok";
     return(bReturn);
 }
 /// <summary>
 /// 充值提交
 /// </summary>
 /// <param name="VipCardID">会员卡标识【必须】</param>
 /// <param name="RechargeAmount">充值金额【必须】</param>
 /// <param name="RechargeNo">小票号【必须】</param>
 /// <param name="PaymentTypeID">充值方式【必须】</param>
 /// <param name="UnitID">充值门店【必须】</param>
 /// <param name="strError">输出信息</param>
 /// <returns></returns>
 public bool SetVipCardRecjargeRpecord(string VipCardID
                                       , decimal RechargeAmount
                                       , string RechargeNo
                                       , string PaymentTypeID
                                       , string UnitID
                                       , out string strError)
 {
     try
     {
         #region 判断输入信息是否合法
         if (VipCardID == null || VipCardID.Trim().Equals(""))
         {
             strError = "会员卡号标识不能为空.";
             return(false);
         }
         if (RechargeAmount.ToString().Trim().Equals(""))
         {
             strError = "充值金额不能为空.";
             return(false);
         }
         if (RechargeNo == null || RechargeNo.ToString().Trim().Equals(""))
         {
             strError = "小票号不能为空.";
             return(false);
         }
         if (PaymentTypeID == null || PaymentTypeID.ToString().Trim().Equals(""))
         {
             strError = "支付方式不能为空.";
             return(false);
         }
         if (UnitID == null || UnitID.ToString().Trim().Equals(""))
         {
             strError = "充值门店不能为空.";
             return(false);
         }
         #endregion
         //1.获取会员卡信息
         #region 获取会员卡信息
         VipCardBLL    vipCardServer = new VipCardBLL(this.CurrentUserInfo);
         VipCardEntity vipCardInfo   = new VipCardEntity();
         vipCardInfo = vipCardServer.GetByID(VipCardID);
         if (vipCardInfo == null)
         {
             strError = "会员卡信息不存在.";
             return(false);
         }
         if (vipCardInfo.BalanceAmount == null || vipCardInfo.BalanceAmount.ToString().Equals(""))
         {
             vipCardInfo.BalanceAmount = 0;
         }
         if (vipCardInfo.TotalAmount == null || vipCardInfo.TotalAmount.ToString().Equals(""))
         {
             vipCardInfo.TotalAmount = 0;
         }
         #endregion
         //2.修改会员卡信息
         #region
         VipCardEntity vipCard = new VipCardEntity();
         vipCard.VipCardID     = vipCardInfo.VipCardID;
         vipCard.BalanceAmount = vipCardInfo.BalanceAmount + RechargeAmount;
         vipCard.TotalAmount   = vipCardInfo.TotalAmount + RechargeAmount;
         #endregion
         //3.插入充值记录
         #region
         VipCardRechargeRecordEntity vipCardRRInfo = new VipCardRechargeRecordEntity();
         vipCardRRInfo.RechargeRecordID    = JIT.CPOS.BS.BLL.BaseService.NewGuidPub();
         vipCardRRInfo.RechargeNo          = RechargeNo;
         vipCardRRInfo.PaymentTypeID       = PaymentTypeID;
         vipCardRRInfo.RechargeAmount      = RechargeAmount;
         vipCardRRInfo.RechargeTime        = System.DateTime.Now;
         vipCardRRInfo.VipCardID           = VipCardID;
         vipCardRRInfo.BalanceBeforeAmount = vipCardInfo.BalanceAmount;
         vipCardRRInfo.BalanceAfterAmount  = vipCardInfo.BalanceAmount + RechargeAmount;
         vipCardRRInfo.RechargeUserID      = this.CurrentUserInfo.UserID;
         vipCardRRInfo.UnitID     = UnitID;
         vipCardRRInfo.CustomerID = this.CurrentUserInfo.CurrentUser.customer_id;
         #endregion
         //strError = "充值成功.";
         //return true;
         return(_currentDAO.SetVipCardRecjargeRpecord(vipCard, vipCardRRInfo, out strError));
     }
     catch (Exception ex) {
         throw (ex);
     }
 }