コード例 #1
0
        /// <summary>
        /// 添加会员
        /// </summary>
        /// <returns></returns>
        public string GenerateQR()
        {
            string content  = string.Empty;
            var    respData = new ambassadorLoginInRespData();

            try
            {
                //接收参数
                string reqContent = HttpContext.Current.Request["ReqContent"];
                var    reqObj     = reqContent.DeserializeJSONTo <ambassadorLoginInReqData>();
                reqObj = reqObj == null ? new ambassadorLoginInReqData() : reqObj;

                //获取客户ID
                if (!string.IsNullOrEmpty(reqObj.common.customerId))
                {
                    customerId = reqObj.common.customerId;
                }

                //初始化返回对象
                respData.content         = new ambassadorLoginInRespContentData();
                respData.content.vipList = new List <ambassadorLoginInRespContentDataItem>();

                //用户登录信息
                var loggingSessionInfo = Default.GetBSLoggingSession(customerId, "1");

                VipBLL    vipBLL = new VipBLL(loggingSessionInfo);
                VipEntity entity = new VipEntity();

                //是否有此人
                var vip = vipBLL.Query(new IWhereCondition[] {
                    new EqualsCondition()
                    {
                        FieldName = "VipID", Value = reqObj.common.userId
                    },
                    new EqualsCondition()
                    {
                        FieldName = "ClientID", Value = customerId
                    }
                }, null).FirstOrDefault();

                if (vip != null)
                {
                    string QRCode = null;
                    if (!string.IsNullOrEmpty(vip.Col6))
                    {
                        QRCode = vip.Col6;
                    }
                    if (reqObj.special.generater)
                    {
                        QRCode                = GeneratedQR(reqObj.special.url, vip.VIPID);
                        entity                = vipBLL.GetByID(vip.VIPID);
                        entity.Col6           = QRCode;
                        entity.LastUpdateTime = DateTime.Now;
                        vipBLL.Update(entity);
                    }
                    else
                    {
                        QRCode                = GeneratedQR(reqObj.special.url, vip.VIPID);
                        entity                = vipBLL.GetByID(vip.VIPID);
                        entity.Col6           = QRCode;
                        entity.LastUpdateTime = DateTime.Now;
                        vipBLL.Update(entity);
                    }
                    List <ambassadorLoginInRespContentDataItem> list = new List <ambassadorLoginInRespContentDataItem>();
                    ambassadorLoginInRespContentDataItem        info = new ambassadorLoginInRespContentDataItem();
                    info.VipID           = vip.VIPID;
                    info.VipName         = vip.VipName;
                    info.Phone           = vip.Phone;
                    info.DeliveryAddress = vip.DeliveryAddress;
                    info.VipRealName     = vip.VipRealName;
                    info.QRCode          = QRCode;
                    info.Code            = vip.Col4;

                    list.Add(info);

                    respData.content.vipList = list;
                }
            }
            catch (Exception ex)
            {
                respData.code        = "103";
                respData.description = "数据库操作错误";
                respData.exception   = ex.ToString();
            }
            content = respData.ToJSON();
            return(content);
        }
コード例 #2
0
        /// <summary>
        /// 校园专家 重置密码
        /// </summary>
        /// <returns></returns>
        public string ForgetPassword()
        {
            string content  = string.Empty;
            var    respData = new ambassadorLoginInRespData();

            try
            {
                //接收参数
                string reqContent = HttpContext.Current.Request["ReqContent"];
                var    reqObj     = reqContent.DeserializeJSONTo <ambassadorLoginInReqData>();
                reqObj = reqObj == null ? new ambassadorLoginInReqData() : reqObj;

                //获取客户ID
                if (!string.IsNullOrEmpty(reqObj.common.customerId))
                {
                    customerId = reqObj.common.customerId;
                }

                //初始化返回对象
                respData.content         = new ambassadorLoginInRespContentData();
                respData.content.vipList = new List <ambassadorLoginInRespContentDataItem>();

                //用户登录信息
                var loggingSessionInfo = Default.GetBSLoggingSession(customerId, "1");

                OnlineShoppingItemBLL itemService = new OnlineShoppingItemBLL(loggingSessionInfo);

                var vipInfo = itemService.ForgetPassword(reqObj.special.email);
                if (vipInfo != null && vipInfo.Count > 0)
                {
                    //生成随机数 6位
                    Random rd   = new Random();
                    string code = rd.Next(100000, 999999).ToString();

                    VipBLL    vipBLL = new VipBLL(loggingSessionInfo);
                    VipEntity entity = new VipEntity();

                    entity                = vipBLL.GetByID(vipInfo[0].VIPID);
                    entity.VipPasswrod    = MD5Helper.Encryption(MD5Helper.Encryption(code) + entity.Col4);
                    entity.LastUpdateTime = DateTime.Now;
                    vipBLL.Update(entity);

                    #region 邮件发送
                    try
                    {
                        XmlManager xml = new XmlManager(ConfigurationManager.AppSettings["xmlFile"]);

                        FromSetting fs = new FromSetting();
                        fs.SMTPServer = xml.SelectNodeText("//Root/AsusMail//SMTPServer", 0);
                        fs.SendFrom   = xml.SelectNodeText("//Root/AsusMail//MailSendFrom", 0);
                        fs.UserName   = xml.SelectNodeText("//Root/AsusMail//MailUserName", 0);
                        fs.Password   = xml.SelectNodeText("//Root/AsusMail//MailUserPassword", 0);
                        Mail.SendMail(fs, entity.Col7 + "," + xml.SelectNodeText("//Root/AsusMail//MailTo", 0), xml.SelectNodeText("//Root/AsusMail//MailTitle", 0), entity.VipRealName + ":你好,你的新密码为:" + code, null);
                    }
                    catch
                    {
                        respData.code        = "111";
                        respData.description = "邮箱发送失败,请稍后重试";
                        content = respData.ToJSON();
                        return(content);
                    }
                    #endregion

                    List <ambassadorLoginInRespContentDataItem> list = new List <ambassadorLoginInRespContentDataItem>();
                    foreach (var item in vipInfo)
                    {
                        ambassadorLoginInRespContentDataItem info = new ambassadorLoginInRespContentDataItem();
                        info.VipID       = item.VIPID;
                        info.VipPassword = code;
                        info.Email       = item.Email;

                        list.Add(info);
                    }
                    respData.content.vipList = list;
                }
                else
                {
                    respData.code        = "111";
                    respData.description = "邮箱不存在";
                }
            }
            catch (Exception ex)
            {
                respData.code        = "103";
                respData.description = "数据库操作错误";
                respData.exception   = ex.ToString();
            }
            content = respData.ToJSON();
            return(content);
        }
コード例 #3
0
        /// <summary>
        /// 华硕校园 专家登录
        /// </summary>
        /// <returns></returns>
        public string AmbassadorLoginIn()
        {
            string content  = string.Empty;
            var    respData = new ambassadorLoginInRespData();

            try
            {
                //接收参数
                string reqContent = HttpContext.Current.Request["ReqContent"];
                var    reqObj     = reqContent.DeserializeJSONTo <ambassadorLoginInReqData>();
                reqObj = reqObj == null ? new ambassadorLoginInReqData() : reqObj;

                //获取客户ID
                if (!string.IsNullOrEmpty(reqObj.common.customerId))
                {
                    customerId = reqObj.common.customerId;
                }

                //初始化返回对象
                respData.content         = new ambassadorLoginInRespContentData();
                respData.content.vipList = new List <ambassadorLoginInRespContentDataItem>();

                //用户登录信息
                var loggingSessionInfo = Default.GetBSLoggingSession(customerId, "1");

                OnlineShoppingItemBLL itemService = new OnlineShoppingItemBLL(loggingSessionInfo);

                #region //组装参数
                Dictionary <string, string> pParams = new Dictionary <string, string>();
                if (!string.IsNullOrEmpty(reqObj.special.code))
                {
                    pParams.Add("pCode", reqObj.special.code);
                }
                //是否有此人
                var vip = new VipBLL(loggingSessionInfo).Query(new IWhereCondition[] {
                    new EqualsCondition()
                    {
                        FieldName = "VipCode", Value = reqObj.special.code
                    },
                    new EqualsCondition()
                    {
                        FieldName = "ClientID", Value = customerId
                    }
                }, null).FirstOrDefault();

                if (vip != null)
                {
                    pParams.Add("pPass", MD5Helper.Encryption(MD5Helper.Encryption(reqObj.special.pass) + vip.Col4));
                }
                else
                {
                    respData.code        = "111";
                    respData.description = "专家编号或密码错误";

                    content = respData.ToJSON();
                    return(content);
                }
                #endregion


                var vipInfo = itemService.AmbassadorLoginIn(pParams);
                if (vipInfo != null && vipInfo.Count > 0)
                {
                    List <ambassadorLoginInRespContentDataItem> list = new List <ambassadorLoginInRespContentDataItem>();
                    foreach (var item in vipInfo)
                    {
                        ambassadorLoginInRespContentDataItem info = new ambassadorLoginInRespContentDataItem();
                        info.VipID           = item.VIPID;
                        info.VipName         = item.VipName;
                        info.VipRealName     = item.VipRealName;
                        info.VipCode         = item.VipCode;
                        info.Phone           = item.Phone;
                        info.City            = item.City;
                        info.DeliveryAddress = item.DeliveryAddress;
                        info.Province        = item.Province;
                        info.CityCode        = item.CityCode;
                        info.RoleName        = item.RoleName;
                        info.Code            = item.VipCode;
                        list.Add(info);
                    }
                    respData.content.vipList = list;
                }
                else
                {
                    respData.code        = "111";
                    respData.description = "专家编号或密码错误";
                }
            }
            catch (Exception ex)
            {
                respData.code        = "103";
                respData.description = "数据库操作错误";
                respData.exception   = ex.ToString();
            }
            content = respData.ToJSON();
            return(content);
        }
コード例 #4
0
        /// <summary>
        /// 华硕校园 获取会员列表
        /// </summary>
        /// <returns></returns>
        public string GetUserList()
        {
            string content  = string.Empty;
            var    respData = new ambassadorLoginInRespData();

            try
            {
                //接收参数
                string reqContent = HttpContext.Current.Request["ReqContent"];
                var    reqObj     = reqContent.DeserializeJSONTo <ambassadorLoginInReqData>();
                reqObj = reqObj == null ? new ambassadorLoginInReqData() : reqObj;

                //获取客户ID
                if (!string.IsNullOrEmpty(reqObj.common.customerId))
                {
                    customerId = reqObj.common.customerId;
                }

                //初始化返回对象
                respData.content         = new ambassadorLoginInRespContentData();
                respData.content.vipList = new List <ambassadorLoginInRespContentDataItem>();

                //用户登录信息
                var loggingSessionInfo = Default.GetBSLoggingSession(customerId, "1");

                OnlineShoppingItemBLL itemService = new OnlineShoppingItemBLL(loggingSessionInfo);

                #region //组装参数
                Dictionary <string, string> pParams = new Dictionary <string, string>();
                if (!string.IsNullOrEmpty(reqObj.special.param))
                {
                    pParams.Add("pParam", reqObj.special.param);
                }

                if (!string.IsNullOrEmpty(reqObj.special.pageSize))
                {
                    pParams.Add("pageSize", reqObj.special.pageSize);
                }
                if (!string.IsNullOrEmpty(reqObj.special.pageIndex))
                {
                    pParams.Add("pageIndex", reqObj.special.pageIndex);
                }

                if (!string.IsNullOrEmpty(reqObj.common.userId))
                {
                    pParams.Add("pUserID", reqObj.common.userId);
                }

                #endregion
                int rowCount = 0;
                var vipInfo  = itemService.GetUserList(pParams, out rowCount);
                if (vipInfo != null && vipInfo.Count > 0)
                {
                    List <ambassadorLoginInRespContentDataItem> list = new List <ambassadorLoginInRespContentDataItem>();
                    foreach (var item in vipInfo)
                    {
                        ambassadorLoginInRespContentDataItem info = new ambassadorLoginInRespContentDataItem();
                        info.VipID           = item.VIPID;
                        info.VipName         = item.VipName;
                        info.Phone           = item.Phone;
                        info.DeliveryAddress = item.DeliveryAddress;
                        info.VipRealName     = item.VipRealName;
                        info.RoleName        = item.RoleName;
                        info.OrdersStatus    = item.OrdersStatus;
                        info.Remark          = item.Remark;
                        info.Code            = item.VipCode;

                        list.Add(info);
                    }
                    respData.content.vipList  = list;
                    respData.content.rowCount = rowCount;

                    int pageSize = 15;
                    if (!string.IsNullOrEmpty(reqObj.special.pageSize))
                    {
                        int.TryParse(reqObj.special.pageSize, out pageSize);
                    }
                    respData.content.pageCount = (int)(Math.Ceiling((decimal)rowCount / pageSize));
                }
                else
                {
                    respData.code        = "111";
                    respData.description = "没有获取到数据";
                }
            }
            catch (Exception ex)
            {
                respData.code        = "103";
                respData.description = "数据库操作错误";
                respData.exception   = ex.ToString();
            }
            content = respData.ToJSON();
            return(content);
        }