Пример #1
0
        /// <summary>
        /// 获取所有未注册用户数据统计列表
        /// </summary>
        /// <param name="unRegisterUser"></param>
        /// <returns></returns>
        public List <UnRegisterUserDetail> QueryUnRegisterUser(UnRegisterUserRefer unRegisterUser)
        {
            var result = new List <UnRegisterUserDetail>();
            var req    = new UnRegisterUserListRequest();

            var res = MKMSClient.Send <UnRegisterUserListResponse>(req);

            if (res.DoFlag)
            {
                result = Mapper.MappGereric <UnRegisterUserList, UnRegisterUserDetail>(res.Data);
            }
            return(result);
        }
Пример #2
0
        //public ActionResult UnRegisterUserItem()
        //{
        //    return View();
        //}
        #endregion

        #region 导出获取所有未注册用户数据统计列表

        public JsonResult DrowldUnRegisterUser()
        {
            var result = new BaseResponse();

            try
            {
                var req = new UnRegisterUserRefer();

                var list = SpreadInfoClient.Instance.QueryUnRegisterUser(req);
                try
                {
                    string        strFile = "地推未注册的用户-" + DateTime.Now.ToString("yyyyMMddhhmmss") + ".csv"; //生成的Excel名称
                    StringBuilder sb      = new StringBuilder();
                    sb.Append("手机号,宝宝生日/预产期,参加的活动,推广点名称,提交日期");
                    sb.AppendLine();
                    if (list != null && list.Count > 0)
                    {
                        for (int i = 0; i < list.Count; i++)
                        {
                            sb.Append(list[i].Phone + "," + list[i].BirthDay + "," + list[i].ActivityName + "," +
                                      list[i].SpreadUserName + "," + list[i].SubmitTime);
                            sb.AppendLine();
                        }
                    }
                    StringWriter sw = new StringWriter(sb);

                    Response.Clear();
                    Response.AddHeader("Content-Disposition", string.Format("attachment;filename={0}", "e:\\" + strFile));
                    Response.ContentType     = "text/xml";
                    Response.Charset         = "UTF-8";
                    Response.ContentEncoding = System.Text.Encoding.GetEncoding("gb2312");
                    Response.Write(sw);
                    Response.Flush();
                    Response.End();
                    sw.Close();
                    result.DoFlag   = true;
                    result.DoResult = "导出数据成功!";
                }
                catch (Exception ex)
                {
                    result.DoResult = "导出数据失败,请稍后重试!";
                }
            }
            catch (Exception)
            {
                result.DoResult = "导出数据失败,请稍后重试!";
            }
            return(Json(result, JsonRequestBehavior.AllowGet));
        }