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 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)); }
public void TestMethod4() { //add customer CustomerVO customerVO = new CustomerVO(); customerVO.Birthday = "19860907"; customerVO.CardFlag = 1; customerVO.Company = "phillip"; customerVO.CreatedDate = DateTime.Now; customerVO.CreatorID = "001"; customerVO.LastModifiedDate = DateTime.Now; customerVO.LastModifierID = "002"; customerVO.LogicalStatus = 1; customerVO.ICNo = "32092319860907331x"; customerVO.MobileNO = "18516251396"; customerVO.Name = "zhuqingsong"; customerVO.Sex = "M"; customerVO.Weixin = "chadzhu"; //VO to PO Mapper.CreateMap <CustomerVO, CustomerPO>(); CustomerMgm customerMgm = new CustomerMgm(); customerMgm.AddCustomer(customerVO); }
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="cusandcar"></param> /// <returns></returns> public JsonResult AddCustomerSub(CustomerAndCar cusandcar) { ICustomerMgm customerMgm = new CustomerMgm(); ICarMgm carMgm = new CarMgm(); CustomerVO customer = new CustomerVO() { Name = cusandcar.Name, Sex = cusandcar.Sex, ICNo = cusandcar.ICNo, Birthday = cusandcar.Birthday, MobileNO = cusandcar.MobileNo, CreatorID = Emp.UserName, LastModifierID = Emp.UserName, CreatedDate = DateTime.Now, LastModifiedDate = DateTime.Now, }; CarVO car = new CarVO() { CarNo = cusandcar.Carno, Brand = cusandcar.Brand, CarModel = cusandcar.Carmodel, Capacity = cusandcar.Capacity, Color = cusandcar.Color, FrameNo = cusandcar.FrameNo, EngineNo = cusandcar.EngineNo, MaintainKM = cusandcar.Maintainkm, InsureDate = cusandcar.Insuredate, ASDate = cusandcar.Asdate, CreatorID = Emp.UserName, LastModifierID = Emp.UserName, CreatedDate = DateTime.Now, LastModifiedDate = DateTime.Now, }; ReturnedData data = new ReturnedData(); try { car.CustomerID = customerMgm.AddAllCustomer(customer, car); //carMgm.AddCar(car); data.Message = "客户添加成功"; data.Success = true; } catch (Exception ex) { 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)); }
// // 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)); }
/// <summary> /// 客户详细信息 /// </summary> /// <param name="id"></param> /// <returns></returns> public ActionResult CustomerDetails(int id) { var result = new CustomerAndCar(); if (id != -1) { ICustomerMgm couMgm = new CustomerMgm(); ICarMgm carMgm = new CarMgm(); CustomerVO customer = couMgm.GetCustomerByID(id); List <CarVO> car = new List <CarVO>(); if (customer != null) { car = carMgm.GetCarsByCustID(customer.CustomerID); result = GetcusAndcarObj(customer, car.FirstOrDefault()); } } return(View(result)); }
public JsonResult ReceveFiles() { ReturnedData data = new ReturnedData(); var cusMgm = new CustomerMgm(); //excel. try { cusMgm.ImprotDataTosql(Request.Files["file"].InputStream, Emp.UserName); data.Success = true; data.Message = "客户数据导入成功"; } catch (Exception ex) { data.Success = false; data.Message = ex.ToString(); } return(Json(data, JsonRequestBehavior.AllowGet)); }
/// <summary> /// 删除客户 /// </summary> /// <param name="id"></param> /// <returns></returns> public JsonResult DeleteCustomer(int id) { ICustomerMgm cusmgm = new CustomerMgm(); ICarMgm carmgm = new CarMgm(); ReturnedData data = new ReturnedData(); try { cusmgm.DelCustomer(id); data.Message = "客户删除成功"; data.Success = true; } catch (Exception ex) { data.Success = false; data.Message = "客户删除失败"; data.Error = ex.ToString(); } return(Json(data, JsonRequestBehavior.AllowGet)); }
public JsonResult GetCustomerModel(string phoneNo) { ReturnedData data = new ReturnedData(); CustomerMgm custMgm = new CustomerMgm(); try { var cust = custMgm.GetCustomerByMobileNo(phoneNo); if (cust != null && cust.CustomerID > 0) { data.Success = true; data.Data = cust; // if(cust.CardFlag==(int)CardFlag.OpenCard) // { // } // else // { // data.Success = false; // data.Message = "该客户为会员,请使用会员消费功能"; // } } else { data.Success = false; data.Message = "没有相关客户信息"; } } catch (Exception ex) { data.Success = true; data.Message = "出现错误,请联系维护人员"; data.Error = ex.ToString(); LogHandler.Error(ex.Message.ToString()); } 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 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)); }