You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using POSV.Entity;
|
|
|
|
|
using POSV.Utils;
|
|
|
|
|
|
|
|
|
|
namespace POSV.Component
|
|
|
|
|
{
|
|
|
|
|
public class ProductMerge
|
|
|
|
|
{
|
|
|
|
|
public static List<ProductExt> Merge(int rows , int cols , List<ProductExt> dataSource , bool touchEnabled)
|
|
|
|
|
{
|
|
|
|
|
//启用触摸屏,不分页
|
|
|
|
|
if (touchEnabled)
|
|
|
|
|
{
|
|
|
|
|
return dataSource;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//移除可能存在的分页标识
|
|
|
|
|
dataSource.RemoveAll(x => Constant.PREV_PAGER.Equals(x.Name) || Constant.NEXT_PAGER.Equals(x.Name));
|
|
|
|
|
|
|
|
|
|
int pageSize = rows * cols;
|
|
|
|
|
int totalCount = dataSource.Count;
|
|
|
|
|
|
|
|
|
|
//启用分页
|
|
|
|
|
int pageCount = ((totalCount - 1) + (pageSize - 2) - 1) / (pageSize - 2);
|
|
|
|
|
|
|
|
|
|
int offset = 0;
|
|
|
|
|
|
|
|
|
|
for (int i = 1; i < pageCount; i++)
|
|
|
|
|
{
|
|
|
|
|
offset += (pageSize - 1);
|
|
|
|
|
|
|
|
|
|
ProductExt entity = new ProductExt();
|
|
|
|
|
entity.Id = IdWorkerUtils.Instance.NextId();
|
|
|
|
|
entity.Name = Constant.NEXT_PAGER;
|
|
|
|
|
entity.Memo = (i + 1).ToString();
|
|
|
|
|
dataSource.Insert(offset , entity);
|
|
|
|
|
|
|
|
|
|
offset++;
|
|
|
|
|
|
|
|
|
|
entity = new ProductExt();
|
|
|
|
|
entity.Id = IdWorkerUtils.Instance.NextId();
|
|
|
|
|
entity.Name = Constant.PREV_PAGER;
|
|
|
|
|
entity.Memo = i.ToString();
|
|
|
|
|
|
|
|
|
|
dataSource.Insert(offset , entity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return dataSource;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|