Example #1
0
        public ActionResult ClubcardDetails(int id,string type)
        {
            CustomerAndCard cusAndCard = new CustomerAndCard();
            CustomerMgm custMgm = new CustomerMgm();
            ClubCardMgm cardMgm = new ClubCardMgm();
            var ddllist =GetddlList(DDLlist.CardType, false, null, null);
            ViewData["CardType"] =ddllist;
            if(type=="cust")
            {

                var recust = custMgm.GetCustomerByID(id);
                ClubCardVO recard = new ClubCardVO();
                if(recust.CardFlag==1)
                {
                    recard = cardMgm.GetClubCardByCustID(recust.CustomerID);
                }

                cusAndCard = GetCusAndCardModel(recard, recust);
            }
            else if(type == "card")
            {
                var recard = cardMgm.GetClubCardByID(id);
                var recust = custMgm.GetCustomerByID(recard.CustomerID);
                cusAndCard = GetCusAndCardModel(recard, recust);
            }

            return View(cusAndCard);
        }
Example #2
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);
        }