public async Task <Pager <IQueryable <CarouselEntity> > > List(CarouselInfo carouselInfo) { //判断查询参数(组装查询条件) Expression <Func <CarouselEntity, bool> > where_search = LinqUtil.True <CarouselEntity>(); if (!string.IsNullOrEmpty(carouselInfo.carousel_titie)) { where_search = where_search.AndAlso(c => c.carousel_titie.Contains(carouselInfo.carousel_titie)); } if (carouselInfo.disable != -1) { where_search = where_search.AndAlso(c => c.disable == carouselInfo.disable); } //调用仓储方法查询分页并且响应给前台 int total = await carouselRepository.CountAsync(where_search); IQueryable <CarouselEntity> carouselEntitys = await carouselRepository.GetPageAllAsync(carouselInfo.pageindex, carouselInfo.pagesize, where_search, c => c.createtime, (c => new CarouselEntity { carousel_id = c.carousel_id, carousel_titie = c.carousel_titie, carousel_conent = c.carousel_conent, carousel_image = c.carousel_image, carousel_href = c.carousel_href, carousel_sort = c.carousel_sort, createtime = c.createtime, disable = c.disable, disabledesc = c.disabledesc }), false); return(new Pager <IQueryable <CarouselEntity> >(total, carouselEntitys)); }
public async Task <Pager <IQueryable <OrderPay> > > OrderListByUserId(string user_id, int type, string order_id = "0") { //判断查询参数(组装查询条件) Expression <Func <OrderPay, bool> > where_search = LinqUtil.True <OrderPay>(); where_search = where_search.AndAlso(c => c.user_id == user_id); if (type == 1) { where_search = where_search.AndAlso(c => c.order_delete == 1).AndAlso(c => c.orderdetail_delete == 1); } if (type == 2) { where_search = where_search.AndAlso(c => c.order_delete == 1).AndAlso(c => c.orderdetail_delete == 1).AndAlso(c => c.order_paystatus == 1); } if (type == 3) { where_search = where_search.AndAlso(c => c.order_delete == 1).AndAlso(c => c.orderdetail_delete == 1).AndAlso(c => c.order_goods == 2); } if (type == 4) { where_search = where_search.AndAlso(c => c.order_delete == 1).AndAlso(c => c.orderdetail_delete == 1).AndAlso(c => c.order_id == order_id); } var data = await orderRepository.OrderListInfo(where_search); return(new Pager <IQueryable <OrderPay> >(data.Count(), data)); }
public static void ReadFilePointers_ittxt(FileReader reader, List <FilePointer> allpointers, List <FilePointer> stringpointers) { reader.Stream.Position = 0x14; var recordpositions = LinqUtil.Pump(() => reader.ReadFilePointer16(), x => x.Value != 0).ToList(); foreach (var position_record in recordpositions) { allpointers.Add(position_record); reader.Stream.Position = position_record.Value + 4; var ptr1 = reader.ReadFilePointer16(); var ptr2 = reader.ReadFilePointer16(); if (allpointers.Exists(x => x.Position == ptr1.Position && x.Value == ptr1.Value) == false) { allpointers.Add(ptr1); } if (allpointers.Exists(x => x.Position == ptr2.Position && x.Value == ptr2.Value) == false) { allpointers.Add(ptr2); } if (stringpointers.Exists(x => x.Position == ptr1.Position && x.Value == ptr1.Value) == false) { stringpointers.Add(ptr1); } if (stringpointers.Exists(x => x.Position == ptr2.Position && x.Value == ptr2.Value) == false) { stringpointers.Add(ptr2); } } }
public async Task <BaseResult <bool> > UpdatePassword(string user_id, string passwordOld, string passwordNew) { if (string.IsNullOrEmpty(user_id)) { return(new BaseResult <bool>(808)); } Expression <Func <UserEntity, bool> > where = LinqUtil.True <UserEntity>(); where = where.AndAlso(c => c.user_id == user_id); where = where.AndAlso(c => c.user_pwd == CommonUtil.Md5(passwordOld) && c.disable != 1); UserEntity userEntity = await userRepository.GetAsync(where); if (userEntity == null) { return(new BaseResult <bool>(1002, false)); } UserEntity userEntityUpdate = new UserEntity() { user_id = user_id, user_pwd = CommonUtil.Md5(passwordNew) }; var isTrue = await userRepository.UpdateAsync(userEntityUpdate, true, true, u => u.user_pwd); if (isTrue) { return(new BaseResult <bool>(200, true)); } return(new BaseResult <bool>(201, false)); }
private void HandleSelectManyCall(MethodCallExpression call) { //get the association path for the joined entity var collectionSelector = (LambdaExpression)LinqUtil.StripQuotes(call.Arguments[1]); LambdaExpression resultSelector = null; if (call.Arguments.Count == 3) { resultSelector = (LambdaExpression)LinqUtil.StripQuotes(call.Arguments[2]); string alias = resultSelector.Parameters[1].Name; var visitor = new SelectManyVisitor(rootCriteria, alias); visitor.Visit(collectionSelector.Body); } if (resultSelector != null) { //visit the result selector expression after the alias for the association has been created var resultSelectorVisitor = new SelectArgumentsVisitor(rootCriteria, session); resultSelectorVisitor.Visit(resultSelector.Body); rootCriteria.SetProjectionIfNotNull(resultSelectorVisitor.Projection); rootCriteria.SetResultTransformerIfNotNull(resultSelectorVisitor.Transformer); } }
public async Task <Pager <IQueryable <UserDepartRoleInfo> > > List(UserInfo userInfo) { //判断查询参数(组装查询条件) Expression <Func <UserDepartRoleInfo, bool> > where_search = LinqUtil.True <UserDepartRoleInfo>(); if (!string.IsNullOrEmpty(userInfo.name)) { where_search = RegexUtil.Email(userInfo.name) ? where_search.AndAlso(c => c.user_email == userInfo.name) : where_search.AndAlso(c => c.user_phone == userInfo.name); } if (userInfo.gender != -1) { where_search = where_search.AndAlso(c => c.user_gender == userInfo.gender); } if (userInfo.source != -1) { where_search = where_search.AndAlso(c => c.source_type == userInfo.source); } if (userInfo.status != -1) { where_search = where_search.AndAlso(c => c.disable == userInfo.status); } //根据条件查询用户表,部门表,用户部门表查询出来用户信息 int total = 0; IQueryable <UserDepartRoleInfo> user_dep_role = await userRepository.getLeftJoinDepRole(where_search, userInfo.pageindex, userInfo.pagesize, out total); return(new Pager <IQueryable <UserDepartRoleInfo> >(total, user_dep_role)); }
public async Task <BaseResult <UserApplyEntity> > GetById(string id) { if (string.IsNullOrEmpty(id)) { return(new BaseResult <UserApplyEntity>(808)); } Expression <Func <UserApplyEntity, bool> > where_serch = LinqUtil.True <UserApplyEntity>(); where_serch = where_serch.AndAlso(c => c.apply_id.Contains(id)); //调用仓储方法查询分页并且响应给前台 UserApplyEntity query = (from c in await userApplyRepository.GetAllAsync(where_serch) join o in await userRepository.GetAllAsync() on c.user_id equals o.user_id join n in await userRepository.GetAllAsync() on c.detail_id equals n.user_id into joinTemp from tmp in joinTemp.DefaultIfEmpty() select new UserApplyEntity() { //使用申请人用户Id和处理人用户Id返回用户邮箱信息 user_id = o.user_email, createtime = c.createtime, detail_id = tmp == null ? "" : tmp.full_name, apply_id = c.apply_id, apply_reason = c.apply_reason, apply_desc = c.apply_desc, row_number = c.row_number, is_true = c.is_true }).FirstOrDefault(); return(new BaseResult <UserApplyEntity>(200, query)); }
/// <summary> /// Initialize basic /// </summary> /// <param name="jsonFilePath"></param> /// <param name="rep"></param> /// <param name="reqIfLogList"></param> public DoorsModule(string jsonFilePath, EA.Repository rep, List <ReqIfLog> reqIfLogList = null) { _jsonFilePath = jsonFilePath; _rep = rep; _connectionString = LinqUtil.GetConnectionString(_rep, out _provider); _reqIfLogList = reqIfLogList; ReadImportSettings(); }
private static bool IsChild(Transform target, Transform root) { List <Transform> transList = LinqUtil.ToList(root.GetComponentsInChildren <Transform>()); if (transList.Contains(target)) { return(true); } return(false); }
/// <summary> /// Initialize DoorsModule for usage with package. /// </summary> /// <param name="rep"></param> /// <param name="pkg"></param> /// <param name="reqIfLogList"></param> private void Init(EA.Repository rep, EA.Package pkg, List <ReqIfLog> reqIfLogList = null) { _pkg = pkg; _rep = rep; _reqIfDeserialized = null; _reqIfLogList = reqIfLogList; // get connection string of repository _connectionString = LinqUtil.GetConnectionString(_rep, out _provider); }
/// <summary> /// InitializeTable for search results using EA API /// </summary> /// <param name="rep"></param> /// <param name="searchText">Optional: List of packages, EA elements as a comma separated list</param> /// <returns></returns> private static DataTable AddinSearchObjectsNestedInitTable(EA.Repository rep, string searchText) { // get connection string of repository string connectionString = LinqUtil.GetConnectionString(rep, out var provider); _tv = new Dictionary <string, string>(); DataTable dt = new DataTable(); dt.Columns.Add("CLASSGUID", typeof(string)); dt.Columns.Add("CLASSTYPE", typeof(string)); dt.Columns.Add("Name", typeof(string)); dt.Columns.Add("Alias", typeof(string)); dt.Columns.Add("Note", typeof(string)); if (searchText.Trim().StartsWith("{")) { // handle string string[] guidList = GetEaFromCommaSeparatedList(searchText); foreach (var guid in guidList) { EA.Element el = rep.GetElementByGuid(guid); if (el == null) { continue; } if (el.Type != "Package") { NestedElementsRecursive(connectionString, provider, dt, rep.GetPackageByID(el.PackageID).PackageGUID, el.ElementID); } if (el.Type == "Package") { NestedPackageElementsRecursive(connectionString, provider, dt, guid); } } EA.Package pkg = rep.GetPackageByGuid(searchText); if (pkg != null) { NestedPackageElementsRecursive(connectionString, provider, dt, pkg.PackageGUID); } } else { // handle context element rep.GetContextItem(out var item); if (item is EA.Element element) { NestedElementsRecursive(connectionString, provider, dt, rep.GetPackageByID(element.PackageID).PackageGUID, element.ElementID); } if (item is EA.Package package) { NestedPackageElementsRecursive(connectionString, provider, dt, package.PackageGUID); } } return(dt); }
/// <summary>是否已经存在相同名称,有则不注册</summary> private static bool IsExistSameName(Transform parent, Transform select) { Transform[] childTrans = (Transform[])LinqUtil.CustomWhere(parent.GetComponentsInChildren <Transform>(), x => x.name == select.name); if (childTrans.Length > 1) { Debug.LogError("存在相同名称物体"); return(true); } return(false); }
private void HandleSelectCall(MethodCallExpression call) { var lambda = (LambdaExpression)LinqUtil.StripQuotes(call.Arguments[1]); var visitor = new SelectArgumentsVisitor(rootCriteria, session); visitor.Visit(lambda.Body); rootCriteria.SetProjectionIfNotNull(visitor.Projection); rootCriteria.SetResultTransformerIfNotNull(visitor.Transformer); }
public async Task <BaseResult <List <ShopCommentView> > > GetShopCommentInfo(string shop_id, int type) { //判断查询参数(组装查询条件) 1表示好评(5) 2表示中评(2,3,4) 3表示差评(1) Expression <Func <ShopCommentInfo, bool> > where_search = LinqUtil.True <ShopCommentInfo>(); where_search = where_search.AndAlso(c => c.shop_id == shop_id); if (type != 0) { switch (type) { case 3: where_search = where_search.AndAlso(c => c.comment_star == 1); break; case 2: where_search = where_search.AndAlso(c => c.comment_star == 2 || c.comment_star == 3 || c.comment_star == 4); break; default: where_search = where_search.AndAlso(c => c.comment_star == 5); break; } } IQueryable <ShopCommentInfo> shopCommentInfos = await commentRepository.GetShopCommentInfo(where_search); List <ShopCommentView> shopCommentViews = new List <ShopCommentView>(); ShopCommentView shopCommentView = null; //查询到结果之后进行处理,如果已经含有相通版本的,则直接累加图片 foreach (var shopCommentInfo in shopCommentInfos) { shopCommentView = shopCommentViews.FirstOrDefault(c => c.comment_id.Equals(shopCommentInfo.comment_id)); if (shopCommentView == null) { shopCommentView = new ShopCommentView(); shopCommentView.comment_id = shopCommentInfo.comment_id; shopCommentView.user_name = shopCommentInfo.user_name; shopCommentView.user_image = shopCommentInfo.user_image; shopCommentView.shop_code = shopCommentInfo.shop_code; shopCommentView.comment_desc = shopCommentInfo.comment_desc; shopCommentView.comment_reply = shopCommentInfo.comment_reply; shopCommentView.comment_star = shopCommentInfo.comment_star; shopCommentView.createtime = shopCommentInfo.createtime; shopCommentView.image_address.Add(shopCommentInfo.comment_address); shopCommentViews.Add(shopCommentView); } else { shopCommentView.image_address.Add(shopCommentInfo.comment_address); } } return(new BaseResult <List <ShopCommentView> >(200, shopCommentViews)); }
public async Task <OrderPay> OrderInfoByShopSkuId(string user_id, string order_id, string shopsku_id) { //判断查询参数(组装查询条件) Expression <Func <OrderPay, bool> > where_search = LinqUtil.True <OrderPay>(); where_search = where_search.AndAlso(c => c.user_id == user_id).AndAlso(c => c.order_delete == 1).AndAlso(c => c.orderdetail_delete == 1) .AndAlso(c => c.order_id == order_id).AndAlso(c => c.shopsku_id == shopsku_id); var data = await orderRepository.OrderListInfo(where_search); return(data.FirstOrDefault()); }
public static ICriterion GetBinaryCriteria( ICriteria rootCriteria, ISession session, BinaryExpression expr, ComparePropToValue comparePropToValue, ComparePropToProp comparePropToProp, CompareValueToCriteria compareValueToCriteria, ComparePropToCriteria comparePropToCriteria) { var left = new BinaryCriterionVisitor(rootCriteria, session); var right = new BinaryCriterionVisitor(rootCriteria, session); left.Visit(expr.Left); right.Visit(expr.Right); //the query should have been preprocessed so that //only the following combinations are possible: // LEFT RIGHT // ======================== // property value // property property // property criteria // value criteria // criteria criteria <== not supported yet switch (left.Type) { case BinaryCriterionType.Property: switch (right.Type) { case BinaryCriterionType.Value: object val = right.Value; if (left.ConvertTo != null) { val = LinqUtil.ChangeType(val, left.ConvertTo); } return(comparePropToValue(left.Name, val)); case BinaryCriterionType.Property: return(comparePropToProp(left.Name, right.Name)); case BinaryCriterionType.Criteria: return(comparePropToCriteria(left.Name, right.Criteria)); } break; case BinaryCriterionType.Value: return(compareValueToCriteria(left.Value, right.Criteria)); } throw new NotSupportedException("Could not understand: " + expr); }
protected override Expression VisitMethodCall(MethodCallExpression expr) { if (expr.Arguments.Count > 1) { LambdaExpression lambda = LinqUtil.StripQuotes(expr.Arguments[1]) as LambdaExpression; if (lambda != null) { _currentCollectionAliases = lambda.Parameters; } } return(base.VisitMethodCall(expr)); }
protected override void Awake() { base.Awake(); for (int i = 0; i < 5; i++) { transform.gameObject.AddComponent <AudioSource>(); } sources = transform.GetComponents <AudioSource>(); _bgSource = sources[0]; audioSources = (AudioSource[])LinqUtil.CustomWhere(sources, item => item != _bgSource); GetAudioClipByMusicType(); }
public static void ReadFilePointers_magic_ZoK(FileReader reader, Int32 recordcount, List <FilePointer> allpointers, List <FilePointer> stringpointers) { reader.Stream.Position = 0x0; var recordpositions = LinqUtil.Pump(() => reader.ReadFilePointer16(), x => x.Value != 0).ToList(); foreach (var position_record in recordpositions) { allpointers.Add(position_record); reader.Stream.Position = position_record.Value; var key = reader.ReadUInt16(); if (key == 0) { continue; } reader.Stream.Position = position_record.Value + 28; var ptr1 = reader.ReadFilePointer16(); var ptr2 = reader.ReadFilePointer16(); if (ptr1.Value >= reader.Length) { continue; } if (ptr2.Value >= reader.Length) { continue; } if (allpointers.Contains(ptr1) == false) { allpointers.Add(ptr1); } if (allpointers.Contains(ptr2) == false) { allpointers.Add(ptr2); } if (stringpointers.Contains(ptr1) == false) { stringpointers.Add(ptr1); } if (stringpointers.Contains(ptr2) == false) { stringpointers.Add(ptr2); } } }
/// <summary> /// Sets the value of the field or property represented by the specified /// <see cref="T:System.Reflection.MemberInfo"/> for the supplied object instance. /// </summary> /// <param name="memberInfo">A <see cref="T:System.Reflection.MemberInfo"/> object.</param> /// <param name="instance">An instance of an object.</param> /// <param name="valueToSet">The value to set on the specified object.</param> private void SetValue(MemberInfo memberInfo, object instance, object valueToSet) { var field = memberInfo as FieldInfo; if (field != null) { field.SetValue(instance, LinqUtil.ChangeType(valueToSet, field.FieldType)); } else { var prop = memberInfo as PropertyInfo; prop.SetValue(instance, LinqUtil.ChangeType(valueToSet, prop.PropertyType), null); } }
public async Task <IQueryable <OrderPay> > getOrderPay(string id, string user_id) { //判断查询参数(组装查询条件) Expression <Func <OrderPay, bool> > where_search = LinqUtil.True <OrderPay>(); if (!string.IsNullOrEmpty(id)) { where_search = where_search.AndAlso(c => c.order_id == id).AndAlso(c => c.user_id == user_id).AndAlso(c => c.order_delete == 1) .AndAlso(c => c.order_goods == 1).AndAlso(c => c.order_paystatus == 1); } var data = await orderRepository.GetOrderPay(where_search); return(data); }
/// <summary> /// Get the object count of all t_object /// </summary> /// <returns></returns> private int GetObjectCount() { int count; // get connection string of repository string connectionString = LinqUtil.GetConnectionString(_repository, out var provider); using (var db = new DataModels.EaDataModel(provider, connectionString)) { count = (from o in db.t_object select o.Name).Count(); } return(count); }
public async Task <Pager <IQueryable <UserOrderInfo> > > List(OrderInfo orderInfo) { //判断查询参数(组装查询条件) Expression <Func <UserEntity, bool> > user_search = LinqUtil.True <UserEntity>(); Expression <Func <OrderEntity, bool> > order_search = LinqUtil.True <OrderEntity>(); user_search.AndAlso(c => c.disable == 0); if (!string.IsNullOrEmpty(orderInfo.user_email)) { user_search = user_search.AndAlso(c => c.user_email.Contains(orderInfo.user_email)); } if (!string.IsNullOrEmpty(orderInfo.order_number)) { order_search = order_search.AndAlso(c => c.order_number.Contains(orderInfo.order_number)); } if (orderInfo.order_paystatus != -1) { order_search = order_search.AndAlso(c => c.order_paystatus == orderInfo.order_paystatus); } if (orderInfo.disable != -1) { order_search = order_search.AndAlso(c => c.disable == orderInfo.disable); } int pageindex = orderInfo.pageindex; //异步读取总数 int total = await orderRepository.CountAsync(order_search); IQueryable <UserOrderInfo> query = (from o in await orderRepository.GetAllAsync(order_search) join u in await userRepository.GetAllAsync(user_search) on o.user_id equals u.user_id orderby o.createtime descending select new UserOrderInfo() { order_id = o.order_id, order_number = o.order_number, order_total = o.order_total, order_privilege = o.order_privilege, order_actualpay = o.order_actualpay, order_paystatus = o.order_paystatus, order_payway = o.order_payway, order_goods = o.order_goods, order_delete = o.order_delete, createtime = o.createtime, disable = o.disable, user_email = u.user_email }).Skip((--pageindex * orderInfo.pagesize)).Take(orderInfo.pagesize); return(new Pager <IQueryable <UserOrderInfo> >(total, query)); }
public async Task <Pager <IQueryable <CommentShopInfo> > > List(CommentInfo commentInfo) { //使用linq join关联三张表查询评论信息(Pls_Comment、Pls_User、Pls_Shop) Expression <Func <UserEntity, bool> > user_serach = LinqUtil.True <UserEntity>(); Expression <Func <ShopEntity, bool> > shop_serach = LinqUtil.True <ShopEntity>(); Expression <Func <CommentEntity, bool> > comment_serach = LinqUtil.True <CommentEntity>(); user_serach.AndAlso(c => c.disable == 0); shop_serach.AndAlso(c => c.disable == 0); if (!string.IsNullOrEmpty(commentInfo.user_email)) { user_serach = user_serach.AndAlso(b => b.user_email.Contains(commentInfo.user_email)); } if (!string.IsNullOrEmpty(commentInfo.shop_name)) { shop_serach = shop_serach.AndAlso(b => b.shop_name.Contains(commentInfo.shop_name)); } if ((commentInfo.status) != -1) { comment_serach = comment_serach.AndAlso(b => b.disable == commentInfo.status); } int pageindex = commentInfo.pageindex; //页码,因为没有set,所以就重新定义一个变量 //异步读取总数 int total = await commentRepository.CountAsync(comment_serach); //调用仓储方法查询分页并且响应给前台 IQueryable <CommentShopInfo> query = (from c in await commentRepository.GetAllAsync(comment_serach) join d in await userRepository.GetAllAsync(user_serach) on c.user_id equals d.user_id join e in await shopRepository.GetAllAsync(shop_serach) on c.shop_id equals e.shop_id orderby c.createtime descending select new CommentShopInfo { comment_id = c.comment_id, user_email = d.user_email, shop_name = e.shop_name, comment_star = c.comment_star, comment_desc = c.comment_desc, comment_reply = c.comment_reply, createtime = c.createtime, disable = c.disable, disabledesc = null, commentImage = null }).Skip((--pageindex * commentInfo.pagesize)).Take(commentInfo.pagesize); return(new Pager <IQueryable <CommentShopInfo> >(total, query)); }
protected override Expression VisitMethodCall(MethodCallExpression call) { if (call.Method.Name == "SelectMany") { if (call.Arguments.Count == 3) { var resultSelector = (LambdaExpression)LinqUtil.StripQuotes(call.Arguments[2]); string alias = resultSelector.Parameters[1].Name; _associationPathsToInclude.Add(alias); } } return(base.VisitMethodCall(call)); }
public async Task <BaseResult <bool> > checkData(string user_id, string content) { //这里可以用手机号以及电话号码和邮箱登录,判断是否重复 Expression <Func <UserEntity, bool> > where = LinqUtil.True <UserEntity>(); where = RegexUtil.Email(content) ? where.AndAlso(c => c.user_email == content) : where.AndAlso(c => c.user_phone == content); where = where.AndAlso(c => c.user_id != user_id); int count = await userRepository.CountAsync(where); if (count > 0) { return(new BaseResult <bool>(900, true)); } return(new BaseResult <bool>(200, false)); }
public async Task <BaseResult <bool> > LoginFront(string login_name_in, string user_pwd_in) { if (string.IsNullOrEmpty(login_name_in) || string.IsNullOrEmpty(user_pwd_in)) { return(new BaseResult <bool>(808, false)); } //这里可以用邮箱和手机号登陆,需要判断使用什么方式登录,查询用户信息之后验证是否可以访问 Expression <Func <UserEntity, bool> > where = LinqUtil.True <UserEntity>(); where = RegexUtil.Email(login_name_in) ? where.AndAlso(c => c.user_email == login_name_in) : where.AndAlso(c => c.user_phone == login_name_in); where = where.AndAlso(c => c.user_pwd == CommonUtil.Md5(user_pwd_in)); UserEntity userEntity = await userRepository.GetAsync(where); if (userEntity == null) { return(new BaseResult <bool>(1000, false)); } if (userEntity.disable == (int)DisableStatus.disable_true) { return(new BaseResult <bool>(1004, false)); } if (userEntity.user_activation == (int)DisableStatus.disable_true) { return(new BaseResult <bool>(1005, false)); } //修改用户当前时间为当前时间 await userRepository.UpdateAsync(new UserEntity() { user_id = userEntity.user_id, last_time = DateTime.Now }, true, true, c => c.last_time); UserSession userSession = new UserSession { user_id = userEntity.user_id, user_name = userEntity.user_name + userEntity.user_code, user_image = userEntity.user_image }; httpContextUtil.setObjectAsJson(KeyUtil.user_info_front, userSession); return(new BaseResult <bool>(200, true)); }
public override SqlString ToSqlString(ICriteria criteria, int loc, ICriteriaQuery criteriaQuery, IDictionary <string, IFilter> enabledFilter) { if (ParameterValues != null && ParameterValues.Length > 0) { var sql = new SqlStringBuilder(); sql.Add(aggregate).Add("("); bool hasProperty = false; bool hasParameter = false; for (int i = 0; i < ParameterValues.Length; i++) { if (PropertyPosition == i) { if (i > 0) { sql.Add(", "); } sql.Add(criteriaQuery.GetColumn(criteria, propertyName)).Add(", "); hasProperty = true; } else if (i > 0) { sql.Add(", "); } sql.Add(LinqUtil.SqlEncode(ParameterValues[i])); hasParameter = true; } if (!hasProperty) { if (hasParameter) { sql.Add(", "); } sql.Add(criteriaQuery.GetColumn(criteria, propertyName)); } return(sql.Add(") as y").Add(loc.ToString()).Add("_").ToSqlString()); } // if ParameterValues were not specified, we defer to the base functionality return(base.ToSqlString(criteria, loc, criteriaQuery, enabledFilter)); }
static void MyMain() { List<SubClassA> subClassAList = new List<SubClassA> { new SubClassA {SomeBoolValue = true, Value = 0}, new SubClassA {SomeBoolValue = true, Value = 2}, new SubClassA {SomeBoolValue = false, Value = 1}, }; List<SubClassB> subClassBList = new List<SubClassB> { new SubClassB {SomeDecimalValue = 1.3M, Value = 2}, new SubClassB {SomeDecimalValue = 3.5M, Value = 1}, new SubClassB {SomeDecimalValue = 0.2M, Value = 5}, }; IList<SubClassA> orderedAList = LinqUtil<SubClassA>.OrderList(subClassAList) .ToList(); IList<SubClassB> orderedBList = LinqUtil<SubClassB>.OrderList(subClassBList) .ToList(); }
private T HandleAggregateCall(MethodCallExpression call) { var visitor = new SelectArgumentsVisitor(rootCriteria, session); visitor.Visit(call); T value = default(T); if (visitor.Projection != null) { object result = rootCriteria.SetProjection(visitor.Projection).UniqueResult(); if (result != null) { value = (T)LinqUtil.ChangeType(result, typeof(T)); } } return(value); }