示例#1
0
        public JsonResult SearchCustomerAndCard()
        {
            string       mobileno = NullHelper.Convert <string>(Request["MobileNo"], "");
            string       cardNo   = NullHelper.Convert <string>(Request["CardNo"], "");
            ReturnedData data     = new ReturnedData();

            if (!string.IsNullOrEmpty(mobileno) || !string.IsNullOrEmpty(cardNo))
            {
                ICustomerMgm custMgm = new CustomerMgm();
                IClubCardMgm cardMgm = new ClubCardMgm();
                //有缺陷
                if (!string.IsNullOrEmpty(mobileno))
                {
                    CustomerVO cust = custMgm.GetCustomerByMobileNo(mobileno);
                    if (cust != null)
                    {
                        ClubCardVO card = cardMgm.GetClubCardByCustID(cust.CustomerID);
                        data.Data    = GetCusAndCardModel(card, cust);
                        data.Success = true;
                    }
                    else
                    {
                        data.Success = false;
                        data.Message = "当前手机号无用户";
                    }
                }
                else if (!string.IsNullOrEmpty(cardNo))
                {
                    ClubCardVO card = cardMgm.GetClubCardByCardNo(cardNo);
                    if (card != null)
                    {
                        CustomerVO cust = custMgm.GetCustomerByID(card.CustomerID);
                        data.Data    = GetCusAndCardModel(card, cust);
                        data.Success = true;
                    }
                    else
                    {
                        data.Success = false;
                        data.Message = "当前会员卡号无用户";
                    }
                }
            }
            else
            {
                data.Success = false;
                data.Message = "请输入会员卡号或用户手机号码";
            }
            return(Json(data, JsonRequestBehavior.AllowGet));
        }
示例#2
0
        public JsonResult GetCustomerModel(string phoneNo)
        {
            ReturnedData data    = new ReturnedData();
            CustomerMgm  custMgm = new CustomerMgm();

            try
            {
                var cust = custMgm.GetCustomerByMobileNo(phoneNo);
                if (cust != null && cust.CustomerID > 0)
                {
                    data.Success = true;
                    data.Data    = cust;
                    //    if(cust.CardFlag==(int)CardFlag.OpenCard)
                    //    {

                    //    }
                    //    else
                    //    {
                    //        data.Success = false;
                    //        data.Message = "该客户为会员,请使用会员消费功能";
                    //    }
                }
                else
                {
                    data.Success = false;
                    data.Message = "没有相关客户信息";
                }
            }
            catch (Exception ex)
            {
                data.Success = true;
                data.Message = "出现错误,请联系维护人员";
                data.Error   = ex.ToString();
                LogHandler.Error(ex.Message.ToString());
            }

            return(Json(data, JsonRequestBehavior.AllowGet));
        }