예제 #1
0
        public JsonResult CheckCardPassword()
        {
            ReturnedData data = new ReturnedData();
            try
            {
                string cardNo = NullHelper.Convert<string>(Request["cardNo"], "");
                string pwd = NullHelper.Convert<string>(Request["pwd"], "");

                ClubCardMgm cardMgm = new ClubCardMgm();
                var card = cardMgm.GetClubCardByCardNo(cardNo);
                int erroNum = 0;
                if (!string.IsNullOrEmpty(card.Reserved1))
                {
                    erroNum = NullHelper.Convert<int>(card.Reserved1, 0);
                }

                if (erroNum < 3 && card.CardStatus == (int)ClubCardStatus.OpenCard)
                {
                    var result = cardMgm.CheckPwd(card.ClubCardID, pwd);
                    if (!result)
                    {
                        card.Reserved1 = (erroNum + 1).ToString();
                        if (erroNum == 2)
                        {
                            card.CardStatus = (int)ClubCardStatus.Froze;
                            card.Reserved1 = "0";
                            data.Message = "密码输入错误三次,会员卡被冻结";
                        }
                        else
                        {
                            data.Message = "密码输入错误,还剩" + (2 - erroNum) + "次机会";
                        }
                        cardMgm.Update(card);
                        data.Success = false;

                    }
                    else
                    {
                        if (erroNum > 0)
                        {
                            card.Reserved1 = "0";
                            cardMgm.Update(card);
                        }
                        data.Success = true;
                        data.Message = "密码验证成功";

                    }
                }
                else
                {
                    data.Success = false;
                    data.Message = "当前会员卡不能正常使用,请联系管理员";
                }

            }
            catch (Exception ex)
            {
                data.Success = false;
                data.Message = "出现错误,请联系维护人员";
                LogHandler.Error(ex.Message.ToString());
                data.Error = ex.ToString();
            }
            return Json(data, JsonRequestBehavior.AllowGet);
        }
예제 #2
0
        /// <summary>
        /// 修改会员卡
        /// </summary>
        /// <param name="customer"></param>
        /// <returns></returns>
        private ReturnedData CustomerCardEdiSub(ClubCardVO clubcard)
        {
            IClubCardMgm cusmgm = new ClubCardMgm();
            ReturnedData data = new ReturnedData();
            try
            {
                clubcard.LastModifiedDate = DateTime.Now;
                clubcard.ClubCardTypeName = new ClubCardTypeMgm().GetCardTypeByID(clubcard.ClubCardTypeID).CardTypeName;
                clubcard.LastModifierID = Emp.UserName;
                cusmgm.Update(clubcard);
                data.Message = "会员信息修改成功";
                data.Success = true;
            }
            catch (Exception ex)
            {
                data.Success = false;
                data.Message = "会员信息修改失败";
                data.Error = ex.ToString();

            }

            return data;
        }