public JsonResult GetCardPkgItemDetail() { ReturnedData data = new ReturnedData(); try { int id = NullHelper.Convert <int>(Request["itemId"], -1); ClubCardMgm cardMgm = new ClubCardMgm(); var item = cardMgm.GetClubCardPkgDetailByID(id); if (item != null && item.ItemID > 0) { data.Success = true; data.Data = item; } 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)); }
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)); }
public ActionResult RechargeCash() { int cardid = NullHelper.Convert <int>(Request["id"], 0); if (cardid > 0) { IClubCardMgm cardMgm = new ClubCardMgm(); var card = cardMgm.GetClubCardByID(cardid); IClubCardTypeMgm ctypeMgm = new ClubCardTypeMgm(); var ctype = ctypeMgm.GetCardTypeByID(card.ClubCardTypeID); ViewData["name"] = card.CustName; ViewData["cno"] = card.ClubCardNo; ViewData["ctype"] = card.ClubCardTypeName; ViewData["discount"] = ctype.PayDiscount; } else { ViewData["name"] = ""; ViewData["cno"] = ""; ViewData["ctype"] = ""; ViewData["discount"] = ""; } //recharge. return(View()); }
public JsonResult GetPkgItems() { ReturnedData data = new ReturnedData(); try { int pkgId = NullHelper.Convert <int>(Request["id"], -1); PkgItemsMgm pkgMgm = new PkgItemsMgm(); PackageMgm pkMgm = new PackageMgm(); var pkg = pkMgm.GetPackageByID(pkgId); var pkgitem = pkgMgm.GetItemsByPkgID(pkgId); data.Success = true; data.Message = pkg.TotalPrice.ToString(); data.Data = pkgitem; } catch (Exception ex) { data.Success = false; data.Message = "系统错误,请联系维护人员"; data.Error = ex.ToString(); LogHandler.Error(ex.Message.ToString()); } return(Json(data, JsonRequestBehavior.AllowGet)); }
public JsonResult AddConsumeItem() { string itemName = NullHelper.Convert <string>(Request["citemName"], ""); decimal itemPrice = NullHelper.Convert <decimal>(Request["citemPrice"], 0M); ConsumeItemVO conItem = new ConsumeItemVO(); conItem.ItemName = itemName; conItem.ItemPrice = itemPrice; conItem.LastModifiedDate = DateTime.Now; conItem.LastModifierID = Emp.UserName; conItem.CreatedDate = DateTime.Now; conItem.CreatorID = Emp.UserName; ReturnedData data = new ReturnedData(); IConsumeItemMgm conMgm = new ConsumeItemMgm(); try { conMgm.AddConsumeItem(conItem); data.Success = true; data.Message = "消费项目添加成功"; LogHandler.Info("员工" + Emp.UserName + "添加一条消费项目,项目名:" + itemName); } catch (Exception ex) { data.Success = false; data.Message = "消费项目添加失败"; LogHandler.Error("添加消费项目出现错误:" + (ex.Message.ToString())); data.Error = ex.ToString(); } return(Json(data, JsonRequestBehavior.AllowGet)); }
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)); }
//套餐基本信息页 public ActionResult DetailPkg() { try { int pkgId = NullHelper.Convert <int>(Request["id"], -1); if (pkgId > 0) { PackageMgm pkgMgm = new PackageMgm(); var pkg = pkgMgm.GetPackageByID(pkgId); ViewBag.pkgName = pkg.PackageName; ViewBag.pkgPrice = pkg.TotalPrice; ViewBag.pkgId = pkg.PackageID; } else { ViewBag.pkgName = ""; ViewBag.pkgPrice = ""; ViewBag.pkgId = -1; } } catch (Exception ex) { LogHandler.Error(ex.Message.ToString()); } return(View()); }
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)); }
//添加/修改 套餐基本信息 public JsonResult SubPkg() { ReturnedData data = new ReturnedData(); try { int id = NullHelper.Convert <int>(Request["id"], -1); string pkgName = NullHelper.Convert <string>(Request["pkgName"], ""); decimal pkgPrice = NullHelper.Convert <decimal>(Request["pkgPrice"], 0M); if (id == -1) { data = AddPkg(pkgName, pkgPrice); } else { data = EditePkg(id, pkgName, pkgPrice); } } catch (Exception ex) { data.Success = false; data.Message = "出现错误,请联系维护人员"; data.Error = ex.ToString(); LogHandler.Error(ex.Message.ToString()); } return(Json(data, JsonRequestBehavior.AllowGet)); }
public ActionResult RechargePkg() { int cardid = NullHelper.Convert <int>(Request["id"], 0); ClubCardMgm cardMgm = new ClubCardMgm(); var card = cardMgm.GetClubCardByID(cardid); ViewData["PkgBag"] = GetddlList(DDLlist.Pkg, false, null, null); ViewBag.Data = card; return(View()); }
public ActionResult PkgItemDetail() { string pkgName = NullHelper.Convert <string>(Request["pkgName"], ""); int pkgID = NullHelper.Convert <int>(Request["id"], 0); ViewBag.PkgName = pkgName; ViewBag.PkgID = pkgID; ViewData["ConItem"] = GetddlList(DDLlist.PkgItem, false, null, null, pkgID); return(View()); }
public JsonResult EditeClubCardTypeModel() { IClubCardTypeMgm ctmgm = new ClubCardTypeMgm(); int ctid = NullHelper.Convert <int>(Request["id"], 0); string ctypename = NullHelper.Convert <string>(Request["ctype"], null); decimal cdis = NullHelper.Convert <decimal>(Request["cdiscount"], 0M); decimal pdis = NullHelper.Convert <decimal>(Request["pkgdiscount"], 0M); var cardtype = new ClubCardTypeMgm().GetCardTypeByID(ctid); if (cardtype == null) { cardtype = new ClubCardTypeVO(); } cardtype.CardTypeName = ctypename; cardtype.PackageDiscount = pdis; cardtype.PayDiscount = cdis; var data = GetValidata(cardtype); if (data.Success) { if (ctid > 0) { try { cardtype.LastModifiedDate = DateTime.Now; cardtype.LastModifierID = Emp.UserName; data.Success = ctmgm.EditCardType(cardtype); if (data.Success) { data.Message = "会员卡类型更新成功"; } else { data.Message = "会员卡类型更新失败"; } } catch (Exception ex) { data.Success = false; data.Message = "会员卡类型更新失败"; data.Error = ex.ToString(); } } else { data.Success = false; data.Message = "当前会员卡类型不能修改"; } } return(Json(data, JsonRequestBehavior.AllowGet)); }
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)); }
/// <summary> /// 获取会员卡套餐消费项目 /// </summary> /// <returns></returns> public JsonResult GetCardPkgItemList() { ReturnedData data = new ReturnedData(); try { string cardPkgId = NullHelper.Convert <string>(Request["cardPkgId"], "-1"); ClubCardMgm cardMgm = new ClubCardMgm(); var result = cardMgm.GetDetailByClubCardPkgID(cardPkgId); List <SelectListItem> itemList = new List <SelectListItem>(); result = result.SkipWhile(i => i.RemainCount == 0).ToList(); if (result != null && result.Count > 0) { result.ForEach(item => { if (item.RemainCount > 0) { if (itemList.Count <= 0) { itemList.Add(new SelectListItem() { Text = item.ItemName, Value = item.PackageDetailID.ToString(), Selected = true }); } else { itemList.Add(new SelectListItem() { Text = item.ItemName, Value = item.PackageDetailID.ToString() }); } } }); } else { itemList.Add(new SelectListItem() { Text = "套餐无可用项目", Value = "-1", Selected = true }); } data.Success = true; data.Data = itemList; } catch (Exception ex) { LogHandler.Error(ex.Message.ToString()); data.Success = false; data.Message = "出现错误,请联系维护人员"; data.Error = ex.ToString(); } return(Json(data, JsonRequestBehavior.AllowGet)); }
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)); }
// // GET: /ClubcardRecharge/ public ActionResult Index() { int id = NullHelper.Convert <int>(Request["id"], 0); CustomerAndCard cuscard = new CustomerAndCard(); if (id > 0) { IClubCardMgm cardMgm = new ClubCardMgm(); ClubCardVO card = cardMgm.GetClubCardByID(id); ICustomerMgm custMgm = new CustomerMgm(); CustomerVO cust = custMgm.GetCustomerByID(card.CustomerID); cuscard = GetCusAndCardModel(card, cust); } return(View(cuscard)); }
public ActionResult DetailItems() { try { string pkgName = NullHelper.Convert <string>(Request["pkgName"], ""); int pkgID = NullHelper.Convert <int>(Request["id"], 0); string v = HttpUtility.UrlDecode(pkgName); ViewBag.PkgName = v; ViewBag.PkgID = pkgID; } catch (Exception ex) { LogHandler.Error(ex.Message.ToString()); } return(View()); }
// // GET: /ClubcardConsume/ public ActionResult Index() { ViewData["ConItem"] = GetddlList(DDLlist.PkgItem, false, null, null, null); //ViewData["CardPkgItem"]=GetddlList(DDLlist.CardPkg,null,null,null,) int id = NullHelper.Convert <int>(Request["id"], 0); ViewBag.StoreName = Emp.StroeName; ViewBag.Recivor = Emp.UserName; CustomerAndCard cuscard = new CustomerAndCard(); if (id > 0) { IClubCardMgm cardMgm = new ClubCardMgm(); ClubCardVO card = cardMgm.GetClubCardByID(id); ICustomerMgm custMgm = new CustomerMgm(); CustomerVO cust = custMgm.GetCustomerByID(card.CustomerID); cuscard = GetCusAndCardModel(card, cust); } return(View(cuscard)); }
public JsonResult GetConsumeItem() { ReturnedData data = new ReturnedData(); try { int itemId = NullHelper.Convert <int>(Request["itemId"], 0); ConsumeItemMgm conMgm = new ConsumeItemMgm(); var conItem = conMgm.GetConsumeItemByID(itemId); data.Data = conItem; data.Success = true; } catch (Exception ex) { data.Success = false; data.Message = "出现错误,请联系维护人员"; data.Error = ex.ToString(); LogHandler.Error(ex.Message.ToString()); } return(Json(data, JsonRequestBehavior.AllowGet)); }
/// <summary> /// 获取会员卡所有套餐 /// </summary> /// <returns></returns> public JsonResult GetCardPkgList() { ReturnedData data = new ReturnedData(); try { int cardId = NullHelper.Convert <int>(Request["cardId"], 0); var list = GetddlList(DDLlist.CardPkg, false, null, null, cardId); data.Success = true; data.Data = list; } catch (Exception ex) { LogHandler.Error(ex.Message.ToString()); data.Success = false; data.Message = "出现错误,请联系维护人员"; data.Error = ex.ToString(); } return(Json(data, JsonRequestBehavior.AllowGet)); }
public JsonResult EditConsumeItem() { ReturnedData data = new ReturnedData(); IConsumeItemMgm conMgm = new ConsumeItemMgm(); try { int id = NullHelper.Convert <int>(Request["id"], 0); string itemName = NullHelper.Convert <string>(Request["citemName"], ""); decimal itemPrice = NullHelper.Convert <decimal>(Request["citemPrice"], 0M); var result = conMgm.GetConsumeItemByID(id); if (result != null) { result.ItemName = itemName; result.ItemPrice = itemPrice; result.LastModifierID = Emp.UserName; result.LastModifiedDate = DateTime.Now; conMgm.EditConsumeItem(result); data.Success = true; data.Message = "消费项目修改成功"; LogHandler.Info("员工" + Emp.UserName + "修改一条消费项目,项目id:" + id); } else { data.Success = false; data.Message = "该消费项目不存在"; } } catch (Exception ex) { data.Success = false; data.Message = "消费项目修改失败"; data.Error = ex.ToString(); LogHandler.Error("修改消费项目出现错误:" + (ex.Message.ToString())); throw; } return(Json(data, JsonRequestBehavior.AllowGet)); }
private List <ConsumePkgViewModel> JsonSerializerPkg(string data, ConsumeType conType) { List <ConsumePkgViewModel> list = new List <ConsumePkgViewModel>(); string dataitems = data.Replace("},", "}|"); Regex re = new Regex("\"|\\[|\\]|{|}"); dataitems = re.Replace(dataitems, ""); string[] items = dataitems.Split('|'); foreach (var item in items) { string[] itemAttr = item.Split(','); ConsumePkgViewModel comModel = new ConsumePkgViewModel(); comModel.PkgId = NullHelper.Convert <string>(itemAttr[0].Split(':')[1], ""); comModel.ItemId = NullHelper.Convert <int>(itemAttr[1].Split(':')[1], 0); comModel.ItemName = NullHelper.Convert <string>(itemAttr[2].Split(':')[1], ""); comModel.ItemConNum = NullHelper.Convert <int>(itemAttr[3].Split(':')[1], 0); list.Add(comModel); } return(list); }
public JsonResult AddClubCardTypeModel() { IClubCardTypeMgm ctmgm = new ClubCardTypeMgm(); string ctypename = NullHelper.Convert <string>(Request["ctype"], null); decimal cdis = NullHelper.Convert <decimal>(Request["cdiscount"], 0M); decimal pdis = NullHelper.Convert <decimal>(Request["pkgdiscount"], 0M); ClubCardTypeVO cardtype = new ClubCardTypeVO() { CardTypeName = ctypename, PackageDiscount = pdis, PayDiscount = cdis, CreatedDate = DateTime.Now, CreatorID = Emp.UserName, LastModifierID = Emp.UserName, LastModifiedDate = DateTime.Now }; var data = GetValidata(cardtype); if (data.Success) { try { ctmgm.AddCardType(cardtype); data.Success = true; data.Message = "会员卡类型添加成功"; } catch (Exception ex) { data.Success = false; data.Message = "会员卡类型添加失败"; data.Error = ex.ToString(); } } return(Json(data, JsonRequestBehavior.AllowGet)); }
public JsonResult GetRechargeLogList() { ReturnedData data = new ReturnedData(); try { string custName = NullHelper.Convert <string>(Request["Name"], ""); string cardNo = NullHelper.Convert <string>(Request["CardNo"], ""); string reStroe = NullHelper.Convert <string>(Request["Dore"], ""); string beginDate = NullHelper.Convert <string>(Request["from"], null); string endDate = NullHelper.Convert <string>(Request["to"], null); string creator = NullHelper.Convert <string>(Request["Operator"], ""); RechargeMgm recMgm = new RechargeMgm(); RechargeLogQueryEntity entity = new RechargeLogQueryEntity() { CustName = custName, Creator = creator, ClubCardNO = cardNo, StoreID = reStroe, StartDate = string.IsNullOrEmpty(beginDate)?null:(DateTime?)Convert.ToDateTime(beginDate), EndDate = string.IsNullOrEmpty(endDate)? null : (DateTime?)Convert.ToDateTime(endDate) }; var list = recMgm.GetRechargeCashLog(entity); data.Success = true; data.Data = list; } catch (Exception ex) { data.Success = false; data.Message = "出现错误,请联系维护人员"; LogHandler.Error(ex.Message.ToString()); data.Error = ex.ToString(); } return(Json(data, JsonRequestBehavior.AllowGet)); }
public JsonResult AddPkgItem() { ReturnedData data = new ReturnedData(); try { int pkItemId = NullHelper.Convert <int>(Request["pkItemId"], 0); int pkgid = NullHelper.Convert <int>(Request["pkgId"], 0); int conNum = NullHelper.Convert <int>(Request["conNum"], 0); string pkgName = NullHelper.Convert <string>(Request["pkgName"], ""); string itemName = NullHelper.Convert <string>(Request["itemName"], ""); PkgItemsMgm pkgItMgm = new PkgItemsMgm(); PkgItemVO pkgItem = new PkgItemVO(); pkgItem.ItemID = pkItemId; pkgItem.PackageID = pkgid; pkgItem.ConsumeCount = conNum; pkgItem.CreatedDate = DateTime.Now; pkgItem.CreatorID = Emp.UserName; pkgItem.LastModifiedDate = DateTime.Now; pkgItem.LastModifierID = Emp.UserName; pkgItem.ItemName = itemName; pkgItMgm.AddPkgItem(pkgItem); data.Success = true; data.Message = "套餐消费项目添加成功"; LogHandler.Info("用户:" + Emp.UserName + "于 " + DateTime.Now.ToString() + " 为套餐:" + pkgName + " 添加消费项目:" + itemName); } catch (Exception ex) { data.Success = false; data.Message = "套餐消费项目添加失败"; data.Error = ex.ToString(); LogHandler.Error(ex.Message.ToString()); } return(Json(data, JsonRequestBehavior.AllowGet)); }
public JsonResult GetItemsByPkgId() { List <PkgItemVO> result = new List <PkgItemVO>(); try { int id = NullHelper.Convert <int>(Request["id"], -1); //var mocker = new BizMocker(); PkgItemsMgm pkgItemMgm = new PkgItemsMgm(); result = pkgItemMgm.GetItemsByPkgID(id); foreach (var item in result) { item.DT_RowId = item.PackageItemID.ToString(); item.Operation = "<a href='javascript:void(0)' onclick=\"PackageItems.Del(" + item.DT_RowId + ",'" + PageValidateHelper.FilterParams(item.ItemName) + "')\"><i class='fa fa-times'></i> 删除</a>"; } } catch (Exception ex) { LogHandler.Error(ex.Message.ToString()); } return(Json(result, JsonRequestBehavior.AllowGet)); }
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)); }
public JsonResult GetCludCardList() { DatatablesResult <ClubCardVO> result = new DatatablesResult <ClubCardVO>(); try{ int start = NullHelper.Convert <int>(Request[Constants.PAGE_START], 0); int length = NullHelper.Convert <int>(Request[Constants.PAGE_LENGTH], 10); int draw = NullHelper.Convert <int>(Request[Constants.REQ_DRAW], 1); string sortOrder = NullHelper.Convert <string>(Request[Constants.SORT_ORDER], "asc"); int sortIdx = NullHelper.Convert <int>(Request[Constants.SORT_IDX], 0); string columnKey = string.Format(Constants.SORT_NAME, sortIdx); string sortName = NullHelper.Convert <string>(Request[columnKey], "ClubcardNO"); string cardno = NullHelper.Convert <string>(Request["ClubcardNO"], ""); int cardtype = NullHelper.Convert <int>(Request["ClubcardType"], -1); string custName = NullHelper.Convert <string>(Request["CustomerName"], ""); string mobileNo = NullHelper.Convert <string>(Request["MobileNo"], ""); int cardstatus = NullHelper.Convert <int>(Request["CardStatus"], -1); string storename = NullHelper.Convert <string>(Request["SaleCardStore"], ""); if (sortName == "MobileNo" || sortName == "CardStatusDesc") { sortName = "ClubcardNO"; } ClubCardTypeMgm clucardbMgm = new ClubCardTypeMgm(); ClubCardTypeVO clubcardtype = clucardbMgm.GetCardTypeByID(cardtype); IClubCardMgm clubcardMgm = new ClubCardMgm(); ClubCardQueryEntity filter = new ClubCardQueryEntity() { Start = start, Length = length, SortOrder = sortOrder, SortName = sortName, ClubCardNo = cardno, ClubCardTypeID = cardtype, ClubCardTypeName = "", MobileNo = mobileNo, Name = custName, StoreName = storename, CardStatus = cardstatus }; var list = clubcardMgm.GetClubCards(filter); int recordsTotal = clubcardMgm.GetClubCardRecordCount(filter); list.ForEach(i => i.MobileNo = new CustomerMgm().GetCustomerByID(i.CustomerID).MobileNO); foreach (var item in list) { item.DT_RowId = item.ClubCardID.ToString(); switch (item.CardStatus) { case (int)ClubCardStatus.OpenCard: item.CardStatusDesc = "已开卡"; break; case (int)ClubCardStatus.Froze: item.CardStatusDesc = "已冻结"; break; case (int)ClubCardStatus.ReportLoss: item.CardStatusDesc = "已挂失"; break; case (int)ClubCardStatus.LogOff: item.CardStatusDesc = "已注销"; break; case (int)ClubCardStatus.Expire: item.CardStatusDesc = "已过期"; break; } item.Operation = " <div class='btn-group'><button onclick='ClubCard.Operation(" + item.DT_RowId + ")' class='btn blue dropdown-toggle' type='button' data-toggle='dropdown'>操作 <i class='fa fa-angle-down'></i></button> <ul class='dropdown-menu pull-right' role='menu'><li><a href='" + @Url.Action("ClubCardDetails", "ClubCard") + "?type=card&id=" + item.DT_RowId + "'>查看</a></li><li><a href='#'>套餐余额</a></li><li><a href='" + @Url.Action("ResetPassword", "ClubCard") + "?id=" + item.DT_RowId + "'>修改密码</a></li><li class='divider'></li><li><a href='" + @Url.Action("SetCardStatus", "ClubCard") + "?id=" + item.DT_RowId + "'>挂失/冻结</a></li>{0}<li><a href='" + @Url.Action("Index", "Recharge") + "?id=" + item.DT_RowId + "'>会员充值</a></li> <li><a href=''>会员消费</a></li><li><a href=''>已完结套餐查询</a></li></ul></div>"; string strChangeno = "<li><a href='javascript:;' onclick='alert(\"该会员卡不处于挂失状态,不能补办会员卡\")' >补办会员卡</a></li>"; if (item.CardStatus == 1) { strChangeno = "<li><a href='" + @Url.Action("ChangeCardNo", "ClubCard") + "?id=" + item.DT_RowId + "'>补办会员卡</a></li>"; } item.Operation = string.Format(item.Operation, strChangeno); } result.draw = draw; result.recordsTotal = recordsTotal; result.recordsFiltered = recordsTotal; result.data = list; } catch (Exception ex) { result.data = new List <ClubCardVO>(); LogHandler.Error(ex.Message.ToString()); result.error = ex.ToString(); } return(Json(result, JsonRequestBehavior.AllowGet)); }
public JsonResult GetCustomers() { DatatablesResult <CustomerVO> result = new DatatablesResult <CustomerVO>(); try { int start = NullHelper.Convert <int>(Request[Constants.PAGE_START], 0); int length = NullHelper.Convert <int>(Request[Constants.PAGE_LENGTH], 10); int draw = NullHelper.Convert <int>(Request[Constants.REQ_DRAW], 1); string sortOrder = NullHelper.Convert <string>(Request[Constants.SORT_ORDER], "desc"); int sortIdx = NullHelper.Convert <int>(Request[Constants.SORT_IDX], 0); string columnKey = string.Format(Constants.SORT_NAME, sortIdx); string sortName = NullHelper.Convert <string>(Request[columnKey], "CustomerID"); if (sortName == "CardFlagDesc" || sortName == "ClubCardDesc" || sortName == "CarDesc" || sortName == "Operation") { sortName = "CustomerID"; } string name = NullHelper.Convert <string>(Request["Name"], ""); string icNo = NullHelper.Convert <string>(Request["ICNo"], ""); string mobileNo = NullHelper.Convert <string>(Request["MobileNo"], ""); int cardFlag = NullHelper.Convert <int>(Request["CardFlag"], -1); CustomerQueryEntity filter = new CustomerQueryEntity() { Start = start, Length = length, SortOrder = sortOrder, SortName = sortName, Name = name, ICNo = icNo, MobileNo = mobileNo, CardFlag = cardFlag }; ICustomerMgm coustomer = new CustomerMgm(); var list = coustomer.GetCustomers(filter); if (list == null) { list = new List <CustomerVO>(); } int recordsTotal = coustomer.GetRecordCount(filter); foreach (var item in list) { item.DT_RowId = item.CustomerID.ToString(); if (item.CardFlag == 1) { item.CardFlagDesc = "<i class='fa fa-check fa-lg' style='color:green;'></i>"; item.ClubCardDesc = "<a href='javascript:void(0)' onclick='Customer.EditClubcard(" + item.DT_RowId + ")'><i class='fa fa-search'></i> 查看</a>"; } else { item.CardFlagDesc = "<i class='fa fa-times fa-lg red' style='color:red;'></i>"; item.ClubCardDesc = "<a href='javascript:void(0)' onclick='Customer.AddCludcard(" + item.DT_RowId + ")'> <i class='fa fa-credit-card'></i> 开卡</a>"; } item.CarDesc = "<a href='javascript:void(0)' onclick='Customer.EditCar(" + item.DT_RowId + ")'><i class='fa fa-search'></i> 查看</a>"; item.Operation = "<a href='javascript:void(0)' onclick='Customer.Edit(" + item.DT_RowId + ")'><i class='fa fa-pencil'></i> 编辑</a> | <a href='javascript:void(0)' onclick='Customer.Del(" + item.DT_RowId + ")'><i class='fa fa-times'></i> 删除</a>"; } result.draw = draw; result.recordsTotal = recordsTotal; result.recordsFiltered = recordsTotal; result.data = list; } catch (Exception ex) { result.data = new List <CustomerVO>(); LogHandler.Error(ex.Message.ToString()); result.error = ex.ToString(); } return(Json(result, JsonRequestBehavior.AllowGet)); }
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)); }