/// <summary> /// 导入数据 /// </summary> /// <param name="list"></param> /// <returns></returns> public string ImportProCateData(List <AdminEntity> list) { string msg = ""; try { foreach (var entity in list) { entity.IncludeAll(); entity.UserCode = SequenceProvider.GetSequence(typeof(AdminEntity)); entity.PassWord = "******"; entity.IsDelete = (int)EIsDelete.NotDelete; entity.CreateTime = DateTime.Now; entity.UpdateTime = DateTime.Now; entity.ParentCode = string.Empty; entity.RoleNum = string.Empty; } this.Admin.Add(list); } catch (Exception ex) { msg = ex.Message; } return(msg); }
/// <summary> /// 新增菜单项或者操作项 /// </summary> /// <param name="entity"></param> /// <returns></returns> public int AddResource(SysResourceEntity entity) { entity.ThrowIfNull("添加资源信息对象为空"); //父类的处理 if (!entity.ParentNum.IsEmpty()) { SysResourceEntity parentRes = GetResource(entity.ParentNum); if (parentRes.IsNotNull()) { parentRes.ChildCount++; entity.Depth = parentRes.Depth + 1; parentRes.IncludeChildCount(true) .Where <SysResourceEntity>("ResNum", ECondition.Eth); this.SysResource.Update(parentRes); } } entity.ResNum = entity.ResNum.IsNullOrEmpty() ? SequenceProvider.GetSequence(typeof(SysResourceEntity)) : entity.ResNum; entity.IncludeAll(); int line = this.SysResource.Add(entity); if (line > 0) { CacheHelper.Remove(CacheKey.JOOSHOW_SYSRESOURCE_CACHE); } return(line); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); RouteConfig.RegisterRoutes(RouteTable.Routes); //加载缓存修改文 ResourceManager.LoadCache(); //注册枚举值 EnumToJsonHelper.Reg(typeof(EAudite), typeof(EBadType), typeof(ECusType), typeof(EInType), typeof(EEquipmentStatus), typeof(EIsDelete), typeof(ELocalType), typeof(EMoveType), typeof(EOutType), typeof(EProductType), typeof(EReturnStatus), typeof(EStorageType), typeof(EOpType), typeof(ECheckType), typeof(EReturnType), typeof(EChange), typeof(EOrderStatus), typeof(EOrderType), typeof(ESupType), typeof(EDataSourceType), typeof(EReportType), typeof(EElementType), typeof(ESequence), typeof(EBool)); SetVersion(); //初始化规则 SequenceProvider sequenceProvider = new SequenceProvider(); sequenceProvider.Init(); }
/// <summary> /// 获得表的序列号 /// </summary> /// <returns></returns> public string GetSequence(Type type) { Func <int, string, int, string> Func = (int SequenceType, string SequenceRule, int SequenceLength) => { string value = string.Empty; if (SequenceType > 0) { if (SequenceType == (int)ESequence.Constant) { value = SequenceRule; } else if (SequenceType == (int)ESequence.Guid) { value = TNumProvider.CreateGUID(); } else if (SequenceType == (int)ESequence.CustomerTime) { value = DateTime.Now.ToString(SequenceRule); } else if (SequenceType == (int)ESequence.Sequence) { if (SequenceLength == 0) { value = new TNumProvider(this.CompanyID).GetSwiftNum(type); } else { value = new TNumProvider(this.CompanyID).GetSwiftNum(type, SequenceLength); } } else if (SequenceType == (int)ESequence.SequenceOfDay) { if (SequenceLength == 0) { value = new TNumProvider(this.CompanyID).GetSwiftNumByDay(type); } else { value = new TNumProvider(this.CompanyID).GetSwiftNumByDay(type, SequenceLength); } } } return(value); }; TableInfo tableInfo = EntityTypeCache.Get(type); string TabName = tableInfo.Table.Name; SequenceProvider provider = new SequenceProvider(CompanyID); SequenceEntity entity = provider.GetSingle(TabName); string result = string.Empty; if (entity != null) { List <string> list = new List <string>(); if (entity.FirstType > 0) { list.Add(Func(entity.FirstType, entity.FirstRule, entity.FirstLength)); } if (entity.SecondType > 0) { list.Add(Func(entity.SecondType, entity.SecondRule, entity.SecondLength)); } if (entity.ThirdType > 0) { list.Add(Func(entity.ThirdType, entity.ThirdRule, entity.ThirdLength)); } if (entity.FourType > 0) { list.Add(Func(entity.FourType, entity.FourRule, entity.FourLength)); } result = string.Join(entity.JoinChar, list.ToArray()); } else { result = new TNumProvider(this.CompanyID).GetSwiftNum(type, 6); } return(result); }
/// <summary> /// 获得表的序列号 /// </summary> /// <returns></returns> public static string GetSequence(Type type) { Func<int, string, int, string> Func = (int SequenceType, string SequenceRule, int SequenceLength) => { string value = string.Empty; if (SequenceType > 0) { if (SequenceType == (int)ESequence.Constant) { value = SequenceRule; } else if (SequenceType == (int)ESequence.Guid) { value = TNumProivder.CreateGUID(); } else if (SequenceType == (int)ESequence.CustomerTime) { value = DateTime.Now.ToString(SequenceRule); } else if (SequenceType == (int)ESequence.Sequence) { if (SequenceLength == 0) { value = new TNumProivder().GetSwiftNum(type); } else { value = new TNumProivder().GetSwiftNum(type, SequenceLength); } } else if (SequenceType == (int)ESequence.SequenceOfDay) { if (SequenceLength == 0) { value = new TNumProivder().GetSwiftNumByDay(type); } else { value = new TNumProivder().GetSwiftNumByDay(type, SequenceLength); } } } return value; }; TableInfo tableInfo = EntityTypeCache.Get(type); string TabName = tableInfo.Table.Name; SequenceProvider provider = new SequenceProvider(); SequenceEntity entity = provider.GetSingle(TabName); string result = string.Empty; if (entity != null) { List<string> list = new List<string>(); if (entity.FirstType > 0) { list.Add(Func(entity.FirstType, entity.FirstRule, entity.FirstLength)); } if (entity.SecondType > 0) { list.Add(Func(entity.SecondType, entity.SecondRule, entity.SecondLength)); } if (entity.ThirdType > 0) { list.Add(Func(entity.ThirdType, entity.ThirdRule, entity.ThirdLength)); } if (entity.FourType > 0) { list.Add(Func(entity.FourType, entity.FourRule, entity.FourLength)); } result = string.Join(entity.JoinChar, list.ToArray()); } else { result = TNumProivder.CreateGUID(); } return result; }
public ActionResult UpdateSn() { SequenceEntity entity = WebUtil.GetFormObject<SequenceEntity>("entity"); if (entity != null) { SequenceProvider provider = new SequenceProvider(); int line = provider.Update(entity); } return Content(this.ReturnJson.ToString()); }
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()); }