Example #1
0
 /// <summary>
 /// 修改序号
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 public int Update(SequenceEntity entity)
 {
     entity.Include(a => new { a.FirstType,a.FirstRule,a.FirstLength,a.SecondType,a.SecondRule,a.SecondLength,a.ThirdType,a.ThirdRule,a.ThirdLength,a.FourType,a.FourRule,a.FourLength,a.JoinChar,a.Sample,a.CurrentValue,a.Remark });
     entity.Where(a => a.SN == entity.SN);
     int line = this.Sequence.Update(entity);
     return line;
 }
Example #2
0
 /// <summary>
 /// 新增序号管理
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 public int Init()
 {
     DataTable table = this.Sequence.GetTables();
     if (table != null && table.Rows.Count > 0)
     {
         foreach (DataRow row in table.Rows)
         {
             string TabName = row["name"] != null ? row["name"].ToString() : string.Empty;
             if (!TabName.IsEmpty())
             {
                 SequenceEntity entity = new SequenceEntity();
                 entity.Where(a => a.TabName == TabName);
                 if (this.Sequence.GetCount(entity) == 0)
                 {
                     entity = new SequenceEntity();
                     entity.SN = TNumProivder.CreateGUID();
                     entity.TabName = TabName;
                     entity.FirstType = (int)ESequence.Sequence;
                     entity.FirstRule = "";
                     entity.FirstLength = 6;
                     entity.JoinChar = "";
                     entity.IncludeAll();
                     this.Sequence.Add(entity);
                 }
             }
         }
     }
     return 0;
 }
Example #3
0
 /// <summary>
 /// 根据表名序列
 /// </summary>
 /// <param name="TabName"></param>
 /// <returns></returns>
 public SequenceEntity GetSingle(string TabName)
 {
     SequenceEntity entity = new SequenceEntity();
     entity.IncludeAll();
     entity.Where(a => a.TabName == TabName);
     entity = this.Sequence.GetSingle(entity);
     return entity;
 }
Example #4
0
 /// <summary>
 /// 查询序列分页
 /// </summary>
 /// <param name="entity"></param>
 /// <param name="pageInfo"></param>
 /// <returns></returns>
 public List<SequenceEntity> GetList(SequenceEntity entity, ref PageInfo pageInfo)
 {
     entity.IncludeAll();
     entity.OrderBy(a => a.ID, EOrderBy.ASC);
     int rowCount = 0;
     List<SequenceEntity> listResult = this.Sequence.GetList(entity,pageInfo.PageSize,pageInfo.PageIndex,out rowCount);
     pageInfo.RowCount = rowCount;
     return listResult;
 }
Example #5
0
 /// <summary>
 /// 根据SN号获得序列
 /// </summary>
 /// <param name="SN"></param>
 /// <returns></returns>
 public SequenceEntity Get(string SN)
 {
     SequenceEntity entity = new SequenceEntity();
     entity.IncludeAll();
     entity.Where(a => a.SN == SN);
     entity = this.Sequence.GetSingle(entity);
     return entity;
 }
        public ActionResult SN()
        {
            string TabName = WebUtil.GetFormValue<string>("TabName", string.Empty);
            int PageIndex = WebUtil.GetFormValue<int>("PageIndex", 1);
            int PageSize = WebUtil.GetFormValue<int>("PageSize", 10);
            SequenceProvider provider = new SequenceProvider();
            SequenceEntity entity = new SequenceEntity();
            if (!TabName.IsEmpty())
            {
                entity.Where("TabName", ECondition.Like, "%" + TabName + "%");
            }

            PageInfo pageInfo = new PageInfo() { PageIndex = PageIndex, PageSize = PageSize };
            List<SequenceEntity> listResult = provider.GetList(entity, ref pageInfo);
            listResult = listResult.IsNull() ? new List<SequenceEntity>() : listResult;
            string json = JsonConvert.SerializeObject(listResult);
            this.ReturnJson.AddProperty("Data", json);
            this.ReturnJson.AddProperty("RowCount", pageInfo.RowCount);
            return Content(this.ReturnJson.ToString());
        }