/// <summary> /// 会员详细信息 /// </summary> /// <returns></returns> public string GetVipDetail() { var loggingSessionInfo = Default.GetLjLoggingSession(); //根据客户标识获取连接字符串 qianzhi 2013-07-30 if (!string.IsNullOrEmpty(Request["customerId"])) { loggingSessionInfo = Default.GetBSLoggingSession(Request["customerId"].Trim(), ""); } string content = string.Empty; GetResponseParams <VipEntity> response = new GetResponseParams <VipEntity>(); response.Code = "200"; response.Description = "操作成功"; try { string Weixin = Request["Weixin"].ToString().Trim(); VipBLL vipBll = new VipBLL(loggingSessionInfo); response.Params = vipBll.GetVipDetail(Weixin); } catch (Exception ex) { response.Code = "201"; response.Description = "失败" + ex.ToString(); } content = string.Format("{{\"Description\":\"{2}\",\"Code\":\"{1}\",\"Vip\":{0}}}", response.Params.ToJSON(), response.Code, response.Description); return(content); }
/// <summary> /// 市场活动签到 /// </summary> /// <returns></returns> public string MarketEventSignIn() { var loggingSesssionInfo = Default.GetLoggingSession(); string content = string.Empty; GetResponseParams <bool> response = new GetResponseParams <bool>(); response.Code = "200"; response.Description = "操作成功"; try { string openID = Request["openID"].ToString().Trim(); string eventID = Request["eventID"].ToString().Trim(); if (!string.IsNullOrEmpty(openID) && !string.IsNullOrEmpty(eventID)) { //添加签到信息 MarketSignInBLL signInServer = new MarketSignInBLL(loggingSesssionInfo); signInServer.SignIn(openID, eventID); } } catch (Exception ex) { response.Code = "201"; response.Description = "操作失败:" + ex.ToString(); } content = string.Format("{{\"description\":\"{0}\",\"code\":\"{1}\"}}", response.Description, response.Code); return(content); }
public string getEventTotalInfo() { var loggingSessionInfo = Default.GetLjLoggingSession(); //根据客户标识获取连接字符串 qianzhi 2013-07-30 if (!string.IsNullOrEmpty(Request["customerId"])) { loggingSessionInfo = Default.GetBSLoggingSession(Request["customerId"].Trim(), ""); } string content = string.Empty; GetResponseParams <EventTotalInfo> response = new GetResponseParams <EventTotalInfo>(); response.Code = "200"; response.Description = "操作成功"; try { string WeiXinId = Request["WeiXinId"].ToString().Trim(); string EventId = Request["EventId"].ToString().Trim(); LEventsEntity eventInfo = new LEventsEntity(); LEventsBLL inoutServer = new LEventsBLL(loggingSessionInfo); string strError = string.Empty; eventInfo = inoutServer.GetEventTotalInfo(WeiXinId, EventId, loggingSessionInfo, out strError); if (eventInfo == null) { response.Code = "201"; response.Description = strError; } else { EventTotalInfo eventTotalInfo = new EventTotalInfo(); eventTotalInfo.hasOrderCount = eventInfo.hasOrderCount; eventTotalInfo.hasPayCount = eventInfo.hasPayCount; eventTotalInfo.hasSalesAmount = eventInfo.hasSalesAmount; eventTotalInfo.hasVipCount = eventInfo.hasVipCount; eventTotalInfo.newVipCount = eventInfo.newVipCount; response.Params = eventTotalInfo; } } catch (Exception ex) { response.Code = "201"; response.Description = "失败" + ex.ToString(); } content = string.Format("{{\"Description\":\"{2}\",\"Code\":\"{1}\",\"Vip\":{0}}}", response.Params.ToJSON(), response.Code, response.Description); return(content); }
/// <summary> /// 市场活动购买 /// </summary> /// <returns></returns> public string MarketEventPurchase() { var loggingSesssionInfo = Default.GetLoggingSession(); string content = string.Empty; GetResponseParams <bool> response = new GetResponseParams <bool>(); response.Code = "200"; response.Description = "操作成功"; try { string openID = Request["openID"].ToString().Trim(); string eventID = Request["eventID"].ToString().Trim(); string productName = Request["productName"].ToString().Trim(); string purchaseAmount = Request["purchaseAmount"].ToString().Trim(); if (!string.IsNullOrEmpty(openID) && !string.IsNullOrEmpty(eventID) && !string.IsNullOrEmpty(productName) && !string.IsNullOrEmpty(purchaseAmount)) { //添加商品购买信息 MarketEventResponseBLL responseServer = new MarketEventResponseBLL(loggingSesssionInfo); responseServer.MarketEventPurchase(openID, eventID, productName, purchaseAmount); } } catch (Exception ex) { response.Code = "201"; response.Description = "操作失败:" + ex.ToString(); } content = string.Format("{{\"description\":\"{0}\",\"code\":\"{1}\"}}", response.Description, response.Code); return(content); }
/// <summary> /// 获取订单 /// </summary> /// <returns></returns> public string GetOrderInfo() { string content = string.Empty; GetResponseParams <GetOrderInfoEntity> response = new GetResponseParams <GetOrderInfoEntity>(); response.Code = "200"; response.Description = "操作成功"; response.Params = new GetOrderInfoEntity(); if (string.IsNullOrEmpty(Request["UnitId"]) || string.IsNullOrEmpty(Request["CustomerId"]) || string.IsNullOrEmpty(Request["OrderNo"])) { response.Code = "201"; response.Description = "请求的参数不能为空"; return(string.Format("{{\"Description\":\"{2}\",\"Code\":\"{1}\"}}", "", response.Code, response.Description)); } var loggingSessionInfo = Default.GetLjLoggingSession(); //根据客户标识获取连接字符串 qianzhi 2013-07-30 if (!string.IsNullOrEmpty(Request["CustomerId"])) { loggingSessionInfo = Default.GetBSLoggingSession(Request["CustomerId"].Trim(), ""); } try { string unitId = Request["UnitId"].ToString().Trim(); //门店标识 string customerId = Request["CustomerId"].ToString().Trim(); //客户标识 string orderNo = Request["OrderNo"].ToString().Trim(); //订单号 InoutService inoutService = new InoutService(loggingSessionInfo); //TUnitExpandBLL service = new TUnitExpandBLL(loggingSessionInfo); //var unitExpandEntity = new TUnitExpandEntity() { UnitId = unitId }; //var unitExpandEntitys = service.QueryByEntity(unitExpandEntity, null).ToList(); //if (unitExpandEntitys != null && unitExpandEntitys.Count > 0) //{ var orderId = inoutService.GetInoutId(new InoutInfo() { sales_unit_id = unitId, //customer_id = customerId, order_type_id = "1F0A100C42484454BAEA211D4C14B80F", order_reason_id = "2F6891A2194A4BBAB6F17B4C99A6C6F5", red_flag = "1", Field16 = orderNo }); if (orderId != null && orderId.Trim().Length > 0) { response.Params.order = inoutService.GetInoutInfoById(orderId); } //} } catch (Exception ex) { response.Code = "201"; response.Description = "操作失败:" + ex.ToString(); } content = string.Format("{{\"Description\":\"{2}\",\"Code\":\"{1}\",\"content\":{0}}}", response.Params.order.ToJSON(), response.Code, response.Description); return(content); }
/// <summary> /// 获取订单号码(每次返回10个订单号) /// </summary> /// <returns></returns> public string GetOrderNo() { var loggingSessionInfo = Default.GetLjLoggingSession(); //根据客户标识获取连接字符串 qianzhi 2013-07-30 if (!string.IsNullOrEmpty(Request["CustomerId"])) { loggingSessionInfo = Default.GetBSLoggingSession(Request["CustomerId"].Trim(), ""); } string content = string.Empty; GetResponseParams <GetOrderNoEntity> response = new GetResponseParams <GetOrderNoEntity>(); response.Code = "200"; response.Description = "操作成功"; response.Params = new GetOrderNoEntity(); response.Params.orderNos = new List <OrderNoEntity>(); if (string.IsNullOrEmpty(Request["UnitId"]) || string.IsNullOrEmpty(Request["CustomerId"])) { response.Code = "201"; response.Description = "请求的参数不能为空"; return(string.Format("{{\"Description\":\"{2}\",\"Code\":\"{1}\",\"orderNos\":{0}}}", response.Params.ToJSON(), response.Code, response.Description)); } try { string unitId = Request["UnitId"].ToString().Trim(); //门店标识 string customerId = Request["CustomerId"].ToString().Trim(); //客户标识 TUnitExpandBLL service = new TUnitExpandBLL(loggingSessionInfo); int orderNo = service.GetOrderNo(loggingSessionInfo, unitId, 10); OrderNoEntity orderEntity = null; for (int i = 0; i < 10; i++) { orderEntity = new OrderNoEntity(); var len = orderNo.ToString().Length; switch (len) { case 1: orderEntity.orderNo = "000" + orderNo; break; case 2: orderEntity.orderNo = "00" + orderNo; break; case 3: orderEntity.orderNo = "0" + orderNo; break; case 4: orderEntity.orderNo = orderNo.ToString(); break; } response.Params.orderNos.Add(orderEntity); orderNo++; } } catch (Exception ex) { response.Code = "201"; response.Description = "操作失败:" + ex.ToString(); } content = string.Format("{{\"Description\":\"{2}\",\"Code\":\"{1}\",\"orderNos\":{0}}}", response.Params.orderNos.ToJSON(), response.Code, response.Description); return(content); }
/// <summary> /// 活动报名表数据获取 /// </summary> public string getEventApplyQues() { string ReqContent = string.Empty; string content = string.Empty; var respObj = new getEventApplyQuesRespData(); string respStr = string.Empty; try { ReqContent = Request["ReqContent"]; ReqContent = HttpUtility.HtmlDecode(ReqContent); var reqContentObj = ReqContent.DeserializeJSONTo <getEventApplyQuesReqData>(); Loggers.Debug(new DebugLogInfo() { Message = string.Format( "getEventApplyQues ReqContent:{0}", ReqContent) }); var service = new QuestionnaireBLL(Default.GetLoggingSession()); GetResponseParams <QuestionnaireEntity> returnDataObj = service.getEventApplyQues(reqContentObj.special.eventId); // GetResponseParams<QuestionnaireEntity> returnDataObj = service.getEventApplyQues("1"); var contentObj = new getEventApplyQuesRespContentData(); respObj.Code = returnDataObj.Code; respObj.Description = returnDataObj.Description; if (returnDataObj.Flag == "1" && returnDataObj.Params != null) { contentObj.questionCount = Default.ToStr(returnDataObj.Params.QuestionCount); // questions if (returnDataObj.Params.QuesQuestionEntityList != null) { contentObj.questions = new List <getEventApplyQuesRespQuestionData>(); foreach (var tmpQuestion in returnDataObj.Params.QuesQuestionEntityList) { if (tmpQuestion == null) { continue; } var tmpQues = new getEventApplyQuesRespQuestionData(); tmpQues.questionId = Default.ToStr(tmpQuestion.QuestionID); tmpQues.isSaveOutEvent = Default.ToStr(tmpQuestion.IsSaveOutEvent); tmpQues.cookieName = Default.ToStr(tmpQuestion.CookieName); tmpQues.questionText = Default.ToStr(tmpQuestion.QuestionDesc); tmpQues.questionType = Default.ToStr(tmpQuestion.QuestionType); tmpQues.minSelected = Default.ToStr(tmpQuestion.MinSelected); tmpQues.maxSelected = Default.ToStr(tmpQuestion.MaxSelected); tmpQues.isRequired = Default.ToStr(tmpQuestion.IsRequired); tmpQues.isFinished = Default.ToStr(tmpQuestion.IsFinished); // options if (tmpQuestion.QuesOptionEntityList != null) { tmpQues.options = new List <getEventApplyQuesRespOptionData>(); foreach (var tmpOption in tmpQuestion.QuesOptionEntityList) { if (tmpOption == null) { continue; } var tmpOp = new getEventApplyQuesRespOptionData(); tmpOp.optionId = Default.ToStr(tmpOption.OptionsID); tmpOp.optionText = Default.ToStr(tmpOption.OptionsText); tmpOp.isSelected = Default.ToStr(tmpOption.IsSelect); tmpQues.options.Add(tmpOp); } } contentObj.questions.Add(tmpQues); } } } respObj.content = contentObj; Loggers.Debug(new DebugLogInfo() { Message = string.Format( "getEventApplyQues RespContent:{0}", respObj.ToJSON()) }); } catch (Exception ex) { respObj.Code = "103"; respObj.Description = "数据库操作错误"; respObj.Exception = ex.ToString(); } content = respObj.ToJSON(); return(content); }
/// <summary> /// 活动报名表数据提交 /// </summary> public string submitEventApply() { string ReqContent = string.Empty; string content = string.Empty; var respObj = new submitEventApplyRespData(); string respStr = string.Empty; try { ReqContent = Request["Form"]; //ReqContent = HttpUtility.HtmlDecode(ReqContent); var reqContentObj = ReqContent.DeserializeJSONTo <submitEventApplyReqData>(); Loggers.Debug(new DebugLogInfo() { Message = string.Format( "submitEventApply ReqContent:{0}", ReqContent) }); var service = new QuestionnaireBLL(Default.GetLoggingSession()); // WEventUserMappingEntity //WEventUserMappingEntity userMappingEntity = new WEventUserMappingEntity(); //userMappingEntity.UserName = reqContentObj.special.userName; //userMappingEntity.Mobile = reqContentObj.special.mobile; //userMappingEntity.Email = reqContentObj.special.email; // quesAnswerList IList <QuesAnswerEntity> quesAnswerList = new List <QuesAnswerEntity>(); if (reqContentObj.special.questions != null) { foreach (var question in reqContentObj.special.questions) { QuesAnswerEntity quesAnswerEntity = new QuesAnswerEntity(); quesAnswerEntity.QuestionID = question.questionId; quesAnswerEntity.QuestionValue = question.questionValue; quesAnswerList.Add(quesAnswerEntity); } } string userId = reqContentObj.common.userId; if (userId == null || userId.Trim().Length == 0) { userId = "1"; } //Jermyn20130621 判断特殊的openId=123456,作为公众平台编辑模式进来的判断逻辑 if (reqContentObj.common.openId.Equals("123456") || reqContentObj.common.openId.Equals("111")) { reqContentObj.common.openId = System.Guid.NewGuid().ToString().Replace("-", ""); } if (reqContentObj.special.userName == null || reqContentObj.special.userName.Trim().Length == 0) { reqContentObj.special.userName = System.Guid.NewGuid().ToString().Replace("-", ""); } GetResponseParams <bool> returnDataObj = service.WEventSubmitEventApply( reqContentObj.common.openId, reqContentObj.special.eventId, userId, //userMappingEntity, quesAnswerList, reqContentObj.special.userName); respObj.Code = returnDataObj.Code; respObj.Description = returnDataObj.Description; Loggers.Debug(new DebugLogInfo() { Message = string.Format( "submitEventApply RespContent:{0}", respObj.ToJSON()) }); #region 推送消息 string msgUrl = ConfigurationManager.AppSettings["push_weixin_msg_url"].Trim(); string msgText = "感谢您积极参与我们的活动。"; string msgData = "<xml><OpenID><![CDATA[" + reqContentObj.common.openId + "]]></OpenID><Content><![CDATA[" + msgText + "]]></Content></xml>"; var msgResult = Common.Utils.GetRemoteData(msgUrl, "POST", msgData); #endregion } catch (Exception ex) { respObj.Code = "103"; respObj.Description = "数据库操作错误"; respObj.Exception = ex.ToString(); } content = respObj.ToJSON(); return(content); }
/// <summary> /// 活动详细内容获取 /// </summary> public string getEventDetail() { string ReqContent = string.Empty; string content = string.Empty; var respObj = new getEventDetailRespData(); string respStr = string.Empty; try { ReqContent = Request["ReqContent"]; ReqContent = HttpUtility.HtmlDecode(ReqContent); var reqContentObj = ReqContent.DeserializeJSONTo <getEventDetailReqData>(); Loggers.Debug(new DebugLogInfo() { Message = string.Format( "getEventDetail ReqContent:{0}", ReqContent) }); if (!string.IsNullOrEmpty(reqContentObj.common.customerId)) { customerId = reqContentObj.common.customerId; } var loggingSessionInfo = Default.GetBSLoggingSession(customerId, "1"); //LoggingSessionInfo loggingSessionInfo = Default.GetBSLoggingSession(customerId, "1"); var service = new LEventsBLL(loggingSessionInfo); //var service = new EventsBLL(Default.GetBasicUserInfo(reqContentObj)); GetResponseParams <LEventsEntity> returnDataObj = service.WEventGetEventDetail( reqContentObj.special.eventId, reqContentObj.common.userId); var contentObj = new getEventDetailRespContentData(); respObj.code = returnDataObj.Code; respObj.description = returnDataObj.Description; // if (returnDataObj.Flag == "1" && returnDataObj.Params != null) { contentObj.eventId = returnDataObj.Params.EventID; contentObj.title = returnDataObj.Params.Title; contentObj.city = returnDataObj.Params.CityID; contentObj.address = Default.ToStr(returnDataObj.Params.Address); contentObj.contact = Default.ToStr(returnDataObj.Params.Content); contentObj.email = Default.ToStr(returnDataObj.Params.Email); //qianzhi 2013-05-25 添加结束时间 if (returnDataObj.Params.BeginTime == null || Convert.ToDateTime(returnDataObj.Params.BeginTime).ToString("yyyy-MM-dd").Equals("0001-01-01")) { contentObj.timeStr = "待定"; } else { if (returnDataObj.Params.EndTime == null || returnDataObj.Params.EndTime.Equals("")) { contentObj.timeStr = Default.ToStr(Convert.ToDateTime(returnDataObj.Params.BeginTime).ToString("yyyy-MM-dd HH:mm")); } else { contentObj.timeStr = Default.ToStr(Convert.ToDateTime(returnDataObj.Params.BeginTime).ToString("yyyy-MM-dd HH:mm")) + " 至 " + Default.ToStr(Convert.ToDateTime(returnDataObj.Params.EndTime).ToString("yyyy-MM-dd HH:mm")); } } contentObj.imageUrl = Default.ToStr(returnDataObj.Params.ImageURL); contentObj.organizer = ""; contentObj.organizerType = ""; contentObj.applyCount = Default.ToStr(returnDataObj.Params.signUpCount); //报名数量 contentObj.checkinCount = Default.ToStr(returnDataObj.Params.CheckinsCount); //签到数量 contentObj.hasPrize = ""; contentObj.intervalDays = Default.ToStr(returnDataObj.Params.IntervalDays); contentObj.description = HttpUtility.HtmlDecode(returnDataObj.Params.Description); contentObj.longitude = Default.ToStr(returnDataObj.Params.Longitude); contentObj.latitude = Default.ToStr(returnDataObj.Params.Latitude); } respObj.content = contentObj; Loggers.Debug(new DebugLogInfo() { Message = string.Format( "getEventDetail RespContent:{0}", respObj.ToJSON()) }); } catch (Exception ex) { respObj.code = "103"; respObj.description = "数据库操作错误"; respObj.exception = ex.ToString(); } content = respObj.ToJSON(); return(content); }
/// <summary> /// 活动报名表数据提交 /// </summary> public string submitEventApply() { string ReqContent = string.Empty; string content = string.Empty; var respObj = new submitEventApplyRespData(); string respStr = string.Empty; try { ReqContent = Request["Form"]; //ReqContent = "{\"common\":{\"locale\":\"zh\",\"userId\":\"4f4ef63846f646b68e796cbc3604f2ed\",\"openId\":\"o8Y7Ejv3jR5fEkneCNu6N1_TIYIM\",\"customerId\":\"f6a7da3d28f74f2abedfc3ea0cf65c01\"},\"special\":{\"eventId\":\"8D41CDD7D5E4499195316E4645FCD7B9\",\"questions\":[{\"questionId\":\"87871FCE7117481DB2F72F28D627579F\",\"isSaveOutEvent\":\"0\",\"cookieName\":\"110801\",\"questionValue\":\"E9EAAE121543475EB57B1936EB98B4B7\"},{\"questionId\":\"CF21F654796F4E0B8F6F47D9D05B9407\",\"isSaveOutEvent\":\"0\",\"cookieName\":\"110802\",\"questionValue\":\"81E327E3252F4071AD9556F89580DCE2\"},{\"questionId\":\"4A73FEA6C1484ED4B1730A1EBC54E5B8\",\"isSaveOutEvent\":\"0\",\"cookieName\":\"110803\",\"questionValue\":\"11778879013148F2A424D5220FB02E09\"}],\"userName\":\"\",\"mobile\":\"\",\"email\":\"\"}}"; //ReqContent = HttpUtility.HtmlDecode(ReqContent); var reqContentObj = ReqContent.DeserializeJSONTo <submitEventApplyReqData>(); Loggers.Debug(new DebugLogInfo() { Message = string.Format( "submitEventApply ReqContent:{0}", ReqContent) }); if (!string.IsNullOrEmpty(reqContentObj.common.customerId)) { customerId = reqContentObj.common.customerId; } LoggingSessionInfo loggingSessionInfo = Default.GetBSLoggingSession(customerId, "1"); var service = new LEventsBLL(loggingSessionInfo); // WEventUserMappingEntity WEventUserMappingEntity userMappingEntity = new WEventUserMappingEntity(); userMappingEntity.UserName = reqContentObj.special.userName; userMappingEntity.Mobile = reqContentObj.special.mobile; userMappingEntity.Email = reqContentObj.special.email; // quesAnswerList IList <QuesAnswerEntity> quesAnswerList = new List <QuesAnswerEntity>(); if (reqContentObj.special.questions != null) { foreach (var question in reqContentObj.special.questions) { QuesAnswerEntity quesAnswerEntity = new QuesAnswerEntity(); quesAnswerEntity.QuestionID = question.questionId; quesAnswerEntity.QuestionValue = question.questionValue; quesAnswerList.Add(quesAnswerEntity); } } GetResponseParams <bool> returnDataObj = service.WEventSubmitEventApply( reqContentObj.special.eventId, reqContentObj.common.userId, userMappingEntity, quesAnswerList); respObj.code = returnDataObj.Code; respObj.description = returnDataObj.Description; //Jermyn20131108 提交问题之后微信推送 Jermyn20131209 更改了业务逻辑,暂时关闭 //PushWeiXin(reqContentObj.common.openId, loggingSessionInfo, reqContentObj.special.eventId, reqContentObj.common.userId); Loggers.Debug(new DebugLogInfo() { Message = string.Format( "submitEventApply RespContent:{0}", respObj.ToJSON()) }); } catch (Exception ex) { respObj.code = "103"; respObj.description = "数据库操作错误"; //respObj.exception = ex.ToString(); } content = respObj.ToJSON(); return(content); }