コード例 #1
0
        /// <summary>
        /// 数据库,获取所有创意分析数据
        /// </summary>
        /// <param name="minClick"></param>
        /// <param name="catId"></param>
        /// <returns></returns>
        public List <EntityCreativeAnalysis> GetCreativeAnalysisFromDB(long minClick, string catId)
        {
            //var query = DefaultDbContext.Current().CreativeAnalysis
            //    .Where(o => o.click > minClick && o.cat_id.StartsWith(catId)).OrderByDescending(o => o.ctr);

            var query = from u in DefaultDbContext.Current().CreativeAnalysis
                        where (u.click > minClick && u.cat_id.StartsWith(catId))
                        orderby u.ctr descending
                        select u;

            string sql = query.ToString();

            List <EntityCreativeAnalysis> lstCreative = query.ToList();

            return(lstCreative);
        }
コード例 #2
0
        /// <summary>
        /// 保存或更新用户信息,自己登录更新Session及LoginUrl,代理用户登录使用被代理用户的登录信息,不更新LoginUrl
        /// </summary>
        /// <param name="param">登录参数</param>
        /// <param name="IsProxyLogin">是否代理方式登录</param>
        public EntityUser UpdateUserInfo(Dictionary <string, object> param, Boolean IsProxyLogin)
        {
            EntityUser session     = null;
            string     subUserName = param["subUserName"].ToString();

            EntityUser existUser = DefaultDbContext.Current().User.FirstOrDefault(o => o.fUserName == o.fSubUserName && o.fSubUserName == subUserName);


            if (existUser != null)
            {
                if (IsProxyLogin && !string.IsNullOrEmpty(existUser.fLoginUrl))
                {                                            //代理用户登录使用被代理用户的登录信息,不更新LoginUrl
                    param["loginUrl"] = existUser.fLoginUrl; //使用被代理账户的登录参数,如果被代理账户从未登录过则还是使用代理账户的登录参数
                }
                //使用被代理账户的用户编号,保证编号唯一
                param["userId"] = existUser.fUserID;
            }
            else
            {
                param["userId"] = System.DateTime.Now.ToString("yyyyMMddHHmmss");
            }


            var dsUserInfo = DefaultDbContext.Current().Database.SqlQuery <EntityUser>("exec pro_add_or_update_user_info @userName,@subUserName,@userId,@isPoxy,@session,@Ip,@Versions,@loginUrl,@FeeCode",
                                                                                       SqlNameAndParamer.ConvertSqlParameter(param)).ToList();


            if (dsUserInfo != null && dsUserInfo.Count > 0)
            {
                session = dsUserInfo.First();
            }

            //保留收费代码
            session.FeeCode = param["FeeCode"].ToString();
            return(session);
        }