Пример #1
0
        public JsonResult RechargeCashSub()
        {
            ReturnedData data = new ReturnedData();

            try
            {
                string cardno = NullHelper.Convert<string>(Request["cno"], "");
                decimal rechargeAmount = NullHelper.Convert<decimal>(Request["rechargeAcc"], 0M);
                decimal rechargeDiscount = NullHelper.Convert<decimal>(Request["discount"], 0M);
                IClubCardMgm cardMgm = new ClubCardMgm();

                var card = cardMgm.GetClubCardByCardNo(cardno);
                RechargeVO recharge = new RechargeVO();
                recharge.ClubCardID = card.ClubCardID;
                recharge.ClubCardNo = card.ClubCardNo;
                recharge.ActualRechargeAmount = rechargeAmount;
                recharge.CustID = card.CustomerID;
                recharge.CustName = card.CustName;
                recharge.DiscountRate = rechargeDiscount;
                if (rechargeDiscount == 0)
                {
                    rechargeDiscount = 1;
                }
                recharge.PlatformRechargeAmount =Math.Round(rechargeAmount/ rechargeDiscount,2);
                recharge.RechargeDate = DateTime.Now;
                recharge.RechargeStore = Emp.StroeName;
                recharge.OriginalStore = card.OpenCardStore;
                recharge.PayType = (int)PayType.Cash;
                recharge.LastModifierID = Emp.UserName;
                recharge.LastModifiedDate = DateTime.Now;
                recharge.CreatedDate = DateTime.Now;
                recharge.CreatorID = Emp.UserName;
                recharge.DiscountInfo = "会员现金折扣";
                recharge.ClubCardPackageID = "";
                recharge.RechargeType = (int)RechargeType.ClubCash;
                recharge.RechargeSerialNo = SerialNoGenerator.GenRechargeSerialNo(Emp.StoreId);
                recharge.SalesMan = card.SalesMan;

                IRechargeMgm rechargeMgm = new RechargeMgm();
                rechargeMgm.RechargeCash(recharge);
                data.Success = true;
                Session.Add("recharge", recharge);
            }
            catch (Exception ex)
            {
                data.Success = false;
                data.Error = ex.ToString();
                data.Message = "充值失败";

            }

            return Json(data,JsonRequestBehavior.AllowGet);
        }
Пример #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);
        }
Пример #3
0
        public JsonResult RechargePkgSub()
        {
            ReturnedData data = new ReturnedData();
            try
            {
                string cardNo = NullHelper.Convert<string>(Request["cardNo"], null);
                int pkgId = NullHelper.Convert<int>(Request["pkgId"], -1);
                decimal disCount = NullHelper.Convert<decimal>(Request["disCount"], 0M);
                decimal rechAmount = NullHelper.Convert<decimal>(Request["rechAmount"], 0M);
                decimal pkgPrice = NullHelper.Convert<decimal>(Request["pkgPrice"], 0M);
                IClubCardMgm cardMgm = new ClubCardMgm();
                RechargeMgm rechMgm = new RechargeMgm();

                var card = cardMgm.GetClubCardByCardNo(cardNo);
                RechargeVO recharge = new RechargeVO();
                recharge.ClubCardID = card.ClubCardID;
                recharge.ClubCardNo = card.ClubCardNo;
                recharge.ActualRechargeAmount = rechAmount;
                recharge.CustID = card.CustomerID;
                recharge.CustName = card.CustName;
                recharge.DiscountRate = disCount;
                recharge.Reserved1 = card.ClubCardTypeName;

                recharge.PlatformRechargeAmount = pkgPrice;
                recharge.RechargeDate = DateTime.Now;
                recharge.RechargeStore = Emp.StroeName;
                recharge.OriginalStore = card.OpenCardStore;
                recharge.PayType = (int)PayType.Cash;
                recharge.LastModifierID = Emp.UserName;
                recharge.LastModifiedDate = DateTime.Now;
                recharge.CreatedDate = DateTime.Now;
                recharge.CreatorID = Emp.UserName;
                recharge.DiscountInfo = "会员套餐折扣";
                recharge.ClubCardPackageID =pkgId.ToString();
                recharge.RechargeType = (int)RechargeType.ClubPackage;
                recharge.RechargeSerialNo = SerialNoGenerator.GenRechargeSerialNo(Emp.StoreId);
                recharge.SalesMan = card.SalesMan;

                var reMes= rechMgm.RechargePkg(recharge);
                if (reMes == 1)
                {
                    Session.Add("rehPkg", recharge);
                    data.Success = true;
                    data.Message = "套餐购买成功";
                }
                else
                {
                    data.Success = false;
                    data.Message = "套餐购买失败";
                }

            }
            catch(Exception ex)
            {
                data.Success = false;
                data.Message = "系统错误,请联系维护人员";
                data.Error = ex.ToString();
                LogHandler.Error(ex.Message.ToString());
            }
            return Json(data,JsonRequestBehavior.AllowGet);
        }
Пример #4
0
 public JsonResult SumCardPkgConsumeItems()
 {
     ReturnedData data = new ReturnedData();
     try
     {
         string cardNo = NullHelper.Convert<string>(Request["cardNo"], "");
         string itemData = NullHelper.Convert<string>(Request["itemData"], "");
         if (!string.IsNullOrEmpty(itemData))
         {
             List<ConsumePkgViewModel> list = JsonSerializerPkg(itemData, ConsumeType.ClubPackage);
             ClubCardMgm cardMgm = new ClubCardMgm();
             var card = cardMgm.GetClubCardByCardNo(cardNo);
             var conlist = GetConsumeList(list, card, ConsumeType.ClubPackage);
             ConsumeMgm conMgm = new ConsumeMgm();
             var consSerNo = conMgm.ConsumePkg(conlist);
             data.Success = true;
             LogHandler.Info(Emp.UserName + "添加会员套餐消费,时间:" + DateTime.Now);
             data.Message = consSerNo + "|" + conlist.FirstOrDefault().CreatedDate.ToString("yyyy/MM/dd HH:mm:ss");
             data.Data = cardMgm.GetDetailByClubCardPkgID(list[0].PkgId);
         }
     }
     catch (Exception ex)
     {
         data.Success = false;
         data.Message = "出现错误,请联系维护人员";
         data.Error = ex.ToString();
         LogHandler.Error(ex.Message.ToString());
     }
     return Json(data, JsonRequestBehavior.AllowGet);
 }
Пример #5
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);
        }
Пример #6
0
        public JsonResult SumCardCarshConsumeItems()
        {
            ReturnedData data = new ReturnedData();
            try
            {
                string cardNo = NullHelper.Convert<string>(Request["cardNo"], "");
                string itemData = NullHelper.Convert<string>(Request["itemData"], "");
                //[{\"itemid\":\"12\",\"itemName\":\"喷漆\",\"itemSum\":\"1\",\"itemSubPrice\":\"150\"}]
                //JavaScriptSerializer jsonSerializer = new JavaScriptSerializer();
                //List<ComsumeItemViewModel> list = (List<ComsumeItemViewModel>)jsonSerializer.Deserialize(itemData,typeof(ComsumeItemViewModel));

                if (!string.IsNullOrEmpty(itemData))
                {
                    List<ComsumeItemViewModel> list = JsonSerializer(itemData,ConsumeType.ClubCash);
                    ClubCardMgm cardMgm = new ClubCardMgm();
                    var card = cardMgm.GetClubCardByCardNo(cardNo);
                    var conlist = GetConsumeList(list, card, ConsumeType.ClubCash);
                    ConsumeMgm conMgm = new ConsumeMgm();
                    var consSerNo = conMgm.ConsumeCash(conlist);
                    data.Success = true;
                    LogHandler.Info(Emp.UserName + "添加会员现金消费,时间:" + DateTime.Now);
                    data.Message = consSerNo + "|" + conlist.FirstOrDefault().CreatedDate.ToString("yyyy/MM/dd HH:mm:ss");
                    data.Data = cardMgm.GetBalanceByClubCardID(card.ClubCardID);
                }

            }
            catch (Exception ex)
            {
                data.Success = false;
                data.Message = "会员现金消费过程出现异常,请联系维护人员";
                data.Error = ex.ToString();
                LogHandler.Error(ex.Message.ToString());
            }
            return Json(data, JsonRequestBehavior.AllowGet);
        }