Beispiel #1
0
        /// <summary>
        /// 创建表分区配置
        /// </summary>
        /// <param name="table"></param>
        /// <param name="error"></param>
        /// <returns></returns>
        public bool Create(Table table, out string error)
        {
            error = "";
            var query = GetLambdaQuery();

            query.Where(b => b.DataBaseName == table.DataBaseName && b.TableName == table.TableName);
            query.Top(1);
            query.OrderBy(b => b.MainDataEndIndex, true);
            var       part1 = query.ToList().FirstOrDefault();
            var       start = part1.MainDataEndIndex += 1;
            var       end   = start + table.MaxPartDataTotal - 1;
            TablePart part  = new TablePart()
            {
                DataBaseName = table.DataBaseName, TableName = table.TableName, MainDataStartIndex = start, MainDataEndIndex = end, PartIndex = part1.PartIndex + 1
            };

            if (part.PartIndex == 0)
            {
                part.PartName = table.TableName;
            }
            else
            {
                part.PartName = string.Format("{0}_{1}", table.TableName, part.PartIndex);
            }
            Add(part);
            table.TablePartTotal = part.PartIndex + 1;
            DBExtend.Update(table);
            return(true);
        }
Beispiel #2
0
        /// <summary>
        /// 更改数量
        /// </summary>
        /// <param name="item"></param>
        public static void AddNum(ICartItem item)
        {
            DBExtend         helper = dbHelper;
            ParameCollection c      = new ParameCollection();

            c["$Num"] = "Num+" + item.Num;
            //int n = GetCartCount(item.CartType) + item.Num;
            //SetCartCount(item.CartType, n);
            helper.Update <ICartItem>(b => b.UserId == item.UserId && b.ProductId == item.ProductId && b.StyleId == item.StyleId && b.CartType == item.CartType, c);
        }
Beispiel #3
0
        /// <summary>
        /// 更改数量
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="num"></param>
        /// <param name="id"></param>
        public static void ChangeNum(string userId, int num, int id)
        {
            DBExtend helper   = dbHelper;
            var      cartItem = helper.QueryItem <ICartItem>(b => b.UserId == userId && b.Id == id);

            if (cartItem != null)
            {
                //int n = GetCartCount(cartItem.CartType) + num - cartItem.Num;
                //SetCartCount(cartItem.CartType, n);
            }
            ParameCollection c = new ParameCollection();

            c["Num"] = num;
            helper.Update <ICartItem>(b => b.UserId == userId && b.Id == id, c);
        }