public void TestMethod3() { //add ClubCard ClubCardVO clubCardVO = new ClubCardVO(); clubCardVO.Balance = 0.0M; clubCardVO.Birthday = "19860909"; clubCardVO.CardStatus = 0; clubCardVO.ClubCardNo = "00001"; clubCardVO.ClubCardPwd = "11111"; clubCardVO.ClubCardTypeID = 1; clubCardVO.ClubCardTypeName = "金卡"; clubCardVO.CustName = "tianx"; clubCardVO.CustomerID = 1; clubCardVO.ExpireDate = DateTime.Parse("2025/09/09 12:00"); clubCardVO.SalesMan = "songge"; clubCardVO.SalesTime = DateTime.Parse("2015/09/09 12:00"); clubCardVO.OpenCardStore = "minhangqu"; clubCardVO.CreatedDate = DateTime.Now; clubCardVO.CreatorID = "001"; clubCardVO.LastModifiedDate = DateTime.Now; clubCardVO.LastModifierID = "002"; clubCardVO.LogicalStatus = 1; clubCardVO.PackageDiscount = 0.8M; clubCardVO.PayDiscount = 0.2M; //VO to PO Mapper.CreateMap<ClubCardVO, ClubCardPO>(); ClubCardMgm clubMgm = new ClubCardMgm(); clubMgm.AddClubCard(clubCardVO); }
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); }
private CustomerAndCard GetCusAndCardModel(ClubCardVO recard, CustomerVO recust) { if (recard != null && recust != null) { CustomerAndCard cuandcard = new CustomerAndCard() { CustID = recust.CustomerID, CustName = recust.Name, ICNo = recust.ICNo, MobileNo = recust.MobileNO, Birthday = recust.Birthday, CardID = recard.ClubCardID, CardNo = recard.ClubCardNo, CardType = recard.ClubCardTypeID, CardStatu = recard.CardStatus, OpenCardStore = recard.OpenCardStore, SaleMan = recard.SalesMan, SaleTime = recard.SalesTime, ExpireDate = recard.ExpireDate }; cuandcard.CardTypeName = recard.ClubCardTypeName; switch(recard.CardStatus) { case (int)ClubCardStatus.OpenCard: cuandcard.CardStatuName = "开卡"; break; case (int)ClubCardStatus.Expire: cuandcard.CardStatuName = "过期"; break; case (int)ClubCardStatus.Froze: cuandcard.CardStatuName = "冻结"; break; case (int)ClubCardStatus.LogOff: cuandcard.CardStatuName = "注销"; break; case (int)ClubCardStatus.ReportLoss: cuandcard.CardStatuName = "挂失"; break; } return cuandcard; } return new CustomerAndCard(); }
private List<ConsumeVO> GetConsumeList(List<ConsumePkgViewModel> list, ClubCardVO card, ConsumeType conType) { List<ConsumeVO> conList = new List<ConsumeVO>(); DateTime date = DateTime.Now; list.ForEach(item => { conList.Add(new ConsumeVO { ItemID = 0, ItemName = item.ItemName, ConsumeStore = Emp.StroeName, ConsumeCount = item.ItemConNum, OriginalPrice = 0, CreatedDate = date, CreatorID = Emp.UserName, LastModifiedDate = date, LastModifierID = Emp.UserName, ConsumeDate = date, ConsumeType = (int)conType, ClubCardPackageID = item.PkgId, PackageDetailID = item.ItemId, ClubCardNo = card.ClubCardNo, ClubCardID = card.ClubCardID, CustID = card.CustomerID, CustName = card.CustName, OriginalStore = card.OpenCardStore, RemainCount = 0, Reserved1 = Emp.StoreId.ToString() }); }); return conList; }
private CustomerAndCard GetCusAndCardModel(ClubCardVO recard, CustomerVO recust) { if(recard!=null&&recust!=null) { CustomerAndCard cuandcard = new CustomerAndCard() { CustID = recust.CustomerID, CustName = recust.Name, ICNo = recust.ICNo, MobileNo = recust.MobileNO, Birthday = recust.Birthday, CardID = recard.ClubCardID, CardNo = recard.ClubCardNo, CardType = recard.ClubCardTypeID, CardStatu = recard.CardStatus, OpenCardStore = recard.OpenCardStore, SaleMan = recard.SalesMan, SaleTime = recard.SalesTime, ExpireDate = recard.ExpireDate }; return cuandcard; } return new CustomerAndCard(); }
private ClubCardVO GetCardModel(CustomerAndCard cusandcard) { ClubCardVO clubcard = new ClubCardVO() { CustomerID = cusandcard.CustID, CustName = cusandcard.CustName, ClubCardID = cusandcard.CardID, ClubCardNo = cusandcard.CardNo, ClubCardTypeID=cusandcard.CardType, SalesMan = cusandcard.SaleMan, OpenCardStore = cusandcard.OpenCardStore, CardStatus = cusandcard.CardStatu }; return clubcard; }
/// <summary> /// 修改会员卡 /// </summary> /// <param name="customer"></param> /// <returns></returns> private ReturnedData CustomerCardEdiSub(ClubCardVO clubcard) { IClubCardMgm cusmgm = new ClubCardMgm(); ReturnedData data = new ReturnedData(); try { clubcard.LastModifiedDate = DateTime.Now; clubcard.ClubCardTypeName = new ClubCardTypeMgm().GetCardTypeByID(clubcard.ClubCardTypeID).CardTypeName; clubcard.LastModifierID = Emp.UserName; cusmgm.Update(clubcard); data.Message = "会员信息修改成功"; data.Success = true; } catch (Exception ex) { data.Success = false; data.Message = "会员信息修改失败"; data.Error = ex.ToString(); } return data; }
public JsonResult SearchCustomer(string carno) { ICustomerMgm custMgm = new CustomerMgm(); //改为车牌号查询 //CustomerVO cust = custMgm.GetCustomerByMobileNo(mobilno); //ClubCardVO card = new ClubCardMgm().GetClubCardByCustID(cust.CustomerID); var cust = custMgm.GetCustomerByCarNo(carno); ClubCardVO card = new ClubCardMgm().GetClubCardByCustID(cust.CustomerID); ReturnedData data = new ReturnedData(); if(cust.CustomerID==0) { data.Success = false; data.Message = "该车牌号没有客户"; } else { data.Success = true; } if(card==null) { card = new ClubCardVO(); } CustomerAndCard custandcard = GetCusAndCardModel(card, cust); data.Data = custandcard; return Json(data, JsonRequestBehavior.AllowGet); }
/// <summary> /// 添加会员卡 /// </summary> /// <param name="clubcard"></param> /// <returns></returns> public ReturnedData CustomerCardAddSub(ClubCardVO clubcard) { IClubCardMgm clubCardMgm = new ClubCardMgm(); clubcard.CreatedDate = DateTime.Now; clubcard.LastModifiedDate = DateTime.Now; clubcard.SalesTime = DateTime.Now; clubcard.ExpireDate = clubcard.SalesTime.AddYears(2); clubcard.CreatorID = Emp.UserName; clubcard.LastModifierID = Emp.UserName; clubcard.ClubCardTypeName = new ClubCardTypeMgm().GetCardTypeByID(clubcard.ClubCardTypeID).CardTypeName; clubcard.ClubCardPwd = "123456"; //clubcard.OpenCardStore = Emp.StroeName; //clubcard.SalesMan = Emp.Name;//存疑 ReturnedData data = new ReturnedData(); try { clubCardMgm.AddClubCard(clubcard); ICustomerMgm cusMgm = new CustomerMgm(); var cust = cusMgm.GetCustomerByID(clubcard.CustomerID); cust.CardFlag = 1; cusMgm.EditCustomer(cust); data.Message = "开卡成功"; data.Success = true; } catch (Exception ex) { data.Success = false; data.Message = "开卡失败"; data.Error = ex.ToString(); } return data; }
public Model.VO.ClubCardVO GetClubCardByID(int id) { ClubCardData clubCardData = new ClubCardData(); ClubCardVO clubCardVO = new ClubCardVO(); ClubCardPO clubCardPO = clubCardData.GetClubCardByID(id); clubCardVO = Mapper.Map<ClubCardPO, ClubCardVO>(clubCardPO); return clubCardVO; }
public void Update(ClubCardVO clubcard) { ClubCardData clubCarddal = new ClubCardData(); clubCarddal.EditCard(Mapper.Map<ClubCardVO, ClubCardPO>(clubcard)); }