예제 #1
0
 public JsonResult SubNocardConsume()
 {
     ReturnedData data = new ReturnedData();
     try
     {
         int payType = NullHelper.Convert<int>(Request["payType"], -1);
         int custID = NullHelper.Convert<int>(Request["custID"], -1);
         string consItem = NullHelper.Convert<string>(Request["data"], "");
         var comlist= JsonSerializer(consItem);
         var cust = new CustomerMgm().GetCustomerByID(custID);
         var conlist= GetConsumeList(comlist, cust, ConsumeType.NoCard,(PayType)payType);
         ConsumeMgm conMgm = new ConsumeMgm();
         string serNo = conMgm.ConsumeForNoCard(conlist);
         data.Success = true;
         data.Message = serNo + "|" + conlist.FirstOrDefault().CreatedDate.ToString("yyyy/MM/dd HH:mm:ss");
     }
     catch(Exception ex)
     {
         data.Success = false;
         data.Message = "出现错误,请联系维护人员";
         LogHandler.Error(ex.Message.ToString());
         data.Error = ex.ToString();
     }
     return Json(data,JsonRequestBehavior.AllowGet);
 }
예제 #2
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);
 }
예제 #3
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);
        }