/// <summary> /// 根据结点数据计算最终条件表达式的值 /// </summary> /// <param name="item">高级查询对象</param> /// <returns>二元组</returns> Tuple <string, object[]> CalcFinalExpr(AdvQueryItem item) { //检查查询项数据 if (item == null || item.Nodes == null) { return(null); } if (!item.Nodes.Exists(t => t.ParentId == 0)) { return(null); } string whereExp = ""; IList <object> parameters = new List <object>(); //查询到根节点。 AdvQueryNode rootNode = item.Nodes.FirstOrDefault(t => t.ParentId == 0); //生成ODT模型的对象 object odtObj = RefHelper.LoadClass(item.ModelName); ProcessQueryNode(rootNode, item, odtObj, ref whereExp, ref parameters); //是否有查询条件 if (parameters.Count == 0) { return(null); } Tuple <string, object[]> result = new Tuple <string, object[]>(whereExp, parameters.ToArray()); return(result); }
/// <summary> /// 将本对象的用户配置值保存到内存中或持久化的配置文件中 /// </summary> public void Save(bool persistent = false) { if (CurrentContextDict != null) { foreach (string propertyName in CurrentContextDict.Keys.ToList()) { string[] propertyNames = propertyName.Split('.'); object obj = propertyNames.Length == 1 ? ContextObject : FindObject(propertyNames); obj = RefHelper.GetValue(obj, propertyNames[propertyNames.Length - 1]); if (obj == null) { CurrentContextDict.Remove(propertyName); } else if (obj.GetType() == typeof(String) || !obj.GetType().IsClass) { CurrentContextDict[propertyName] = new TypeAndValue { TypeName = obj.GetType().AssemblyQualifiedName, Value = CommOp.ToFullStr(obj) }; } else { CurrentContextDict[propertyName] = new TypeAndValue { TypeName = obj.GetType().AssemblyQualifiedName, Value = JsonHelper.ToJson(obj) }; } } } if (persistent) { SaveAllToPersistent(); } }
private IResultFilter CreaterInnerFilter(Type _queryType) { string typeName = _queryType.AssemblyQualifiedName; //RefHelper.LoadType( // "Jurassic.CommonModels.EFProvider.OrgEFAuditDataService`1[[Jurassic.CommonModels.Organization.Dep_Department, Jurassic.CommonModels]],Jurassic.CommonModels.EFProvider")); return(RefHelper.LoadClass("Jurassic.WebQuery.AdvQueryFilterWrapper`1[[" + typeName + "]], Jurassic.WebQuery") as IResultFilter); }
/// <summary> /// 使用Ninject用于本系统的自定义接口注入 /// </summary> /// <param name="ninjectKernel"></param> protected virtual void AddBindings(IKernel ninjectKernel) { ninjectKernel.Bind <IDataProvider <AppUser> >().To( RefHelper.LoadType("Jurassic.CommonModels.EFProvider.MyUserProvider")); ninjectKernel.Bind <IDataProvider <AppRole> >().To( RefHelper.LoadType("Jurassic.CommonModels.EFProvider.MyRoleProvider")); ninjectKernel.Bind <IStateProvider>().To( RefHelper.LoadType("Jurassic.CommonModels.EFProvider.MyStateProvider")); ninjectKernel.Bind <IDataProvider <Base_Catalog> >().To( RefHelper.LoadType("Jurassic.CommonModels.EFProvider.CatalogProvider")); ninjectKernel.Bind <CatalogManager>().ToSelf().InSingletonScope(); ninjectKernel.Bind <IAuditDataService <Base_CatalogArticle> >().To( RefHelper.LoadType("Jurassic.CommonModels.EFProvider.ArticleProvider")); ninjectKernel.Bind <LogManager>().ToSelf().InSingletonScope(); ninjectKernel.Bind <ICacheProvider <Stream> >().To( RefHelper.LoadType("Jurassic.AppCenter.Caches.StreamCacheProvider,Jurassic.AppCenter.Core")); ninjectKernel.Bind <IJLogManager>().To( RefHelper.LoadType("Jurassic.Log4.JLogManager")).WithConstructorArgument("logName", "MyLog"); ninjectKernel.Bind(typeof(IAuditDataService <>)).To(typeof(EFAuditDataService <>)); //组织结构管理注入配置 ninjectKernel.Bind <IOrganizationProvider>().To <OrganizationProvider>(); //服务授权管理注入配置 ninjectKernel.Bind <IServerAuthProvider>().To <ServerAuthProvider>(); ninjectKernel.Bind <IDataAuthorizeProvider>().To <DataAuthorizeProvider>(); ninjectKernel.Bind <IServiceInfoProvider>().To <ServiceInfoProvider>(); ninjectKernel.Bind <IOAuthDataProvider>().To <OAuthDataProvider>(); SiteManager.Kernel.Bind <IFileLocator>().To(typeof(FileLocator)) .WithConstructorArgument("rootPath", _fileRootPath); SiteManager.Kernel.Bind <IFileRepository>().To(typeof(WindowsFileRepository)); ninjectKernel.Bind <DBHelper>().ToSelf() .WithConstructorArgument("connStrOrName", "DefaultConnection"); ninjectKernel.Bind <DbContext, ModelContext>().To <ModelContext>() // .InRequestScope() //在一个请求中只生成一个Context, 实际使用中出现了DbContext已释放异常,暂时想不到解决办法,先注释 //.InThreadScope() // 以下的一句代码是连接数据库时声明数据库的Schema. // 其中"WEBFRAME"是Oracle库的Schema名称,如果直接运行WebFrame,它默认是连接oracle库,如果运行WebTemplate,它是连sqlserver //.WithPropertyValue("Schema", "PMDB"); .WithPropertyValue("Schema", "dbo"); ninjectKernel.Bind <UserConfig>().ToSelf() .WithPropertyValue("ShowTab", false) //如果需要系统默认以多标签形式显示页,请设置为true .WithPropertyValue("Theme", "blue") //系统默认皮肤 .WithPropertyValue("GridLineStyle", GridLineStyle.Horizental); //默认表格线样式 ninjectKernel.Bind <UserConfigStorage <UserConfig> >().ToSelf().InSingletonScope(); }
/// <summary> /// 获取数据模型对象中的对应集合数据 /// </summary> /// <param name="data"></param> /// <param name="itemEntityType"></param> /// <returns></returns> private IList GetCollectionInEntity(TEntity data, Type itemEntityType) { var rule = _entityRule.CollectionRules.FirstOrDefault(r => r.ModelType == itemEntityType); if (rule != null) { return(RefHelper.GetValue(data, rule.Name) as IList); } return(null); }
private WidgetModel ConvertToWidget(AppFunction func, WidgetModel userWidget) { userWidget.Id = func.Id; userWidget.Title = ResHelper.GetStr(func.Name); //将参数赋值给其他可能的属性 foreach (var p in func.Arguments) { RefHelper.SetValue(userWidget, p.Key, p.Value); } return(userWidget); }
/// <summary> /// 返回数据模型中子类的集合 /// </summary> /// <param name="name"></param> /// <param name="pm"></param> /// <returns></returns> public virtual ActionResult Details(string name, PageModel pm) { var obj = Session[typeof(TModel).Name] as TModel; var propVal = RefHelper.GetValue(obj, name); if (propVal == null) { return(Content("[]")); } return(JsonNT(propVal)); }
void AssignNameValue(object t) { var type = t.GetType(); RefHelper.SetValue(t, "Name", t.GetType().Name); foreach (PropertyInfo prop in type.GetProperties(BindingFlags.Public | BindingFlags.Instance)) { if (prop.PropertyType == typeof(string) && prop.Name != "Name") { prop.SetValue(t, prop.Name, null); } } }
public void OnComponentChanged(uint entityID, ref T oldValue, ref T newValue) { if (!RefHelper.IsNull(ref oldValue)) { var key = _lookupFunc(oldValue); _lookup.Remove(key); } if (!RefHelper.IsNull(ref newValue)) { var key = _lookupFunc(newValue); _lookup.Add(key, entityID); } }
/// <summary> /// ctor /// </summary> public LangDataMapper() { //Stopwatch sw = new Stopwatch(); //sw.Start(); string entityName = typeof(TEntity).Name; ModelRule modelRule = ModelRule.Get <TModel>(); ModelRule entityRule = ModelRule.Get <TEntity>(); string lang = ResHelper.CurrentCultureName.ToLower(); _converter = GetConverter <TModel, TEntity>(); IMappingExpression <TModel, TEntity> expm2t = null; IMappingExpression <TEntity, TModel> expt2m = null; Mapper.Initialize(cfg => { expm2t = cfg.CreateMap <TModel, TEntity>(); expt2m = cfg.CreateMap <TEntity, TModel>(); }); if (_converter != null) { expt2m.ProjectUsing(_converter.EntityToModel); // expm2t.ConstructUsing(_converter.ModelToEntity.Compile()); 不知为何这句无效 } else { if (typeof(IMultiLanguage).IsAssignableFrom(typeof(TEntity))) { RefHelper.CallMethod(this, "MapperLangProperties", new Type[] { typeof(TModel), typeof(TEntity) }); } foreach (var r in modelRule.CollectionRules) { if (r.Attr.EntityType != null && Mapper.Configuration.FindTypeMapFor(r.ModelType, r.Attr.EntityType) == null) { Mapper.Initialize(cfg => { cfg.CreateMap(r.Attr.EntityType, r.ModelType); cfg.CreateMap(r.ModelType, r.Attr.EntityType); }); } expt2m.ForMember(r.Name, opt => opt.Ignore()); } foreach (var r in entityRule.CollectionRules) { expm2t.ForMember(r.Name, opt => opt.Ignore()); } } //Debug.WriteLine("Mapper Elapsed == " + sw.ElapsedMilliseconds); }
protected override void OnResultExecuting(ResultExecutingContext filterContext) { base.OnResultExecuting(filterContext); var result = filterContext.Result as JsonResult; if (result == null) { return; } var data = RefHelper.GetValue(result.Data, "data") as Pager <TModel>; if (data == null) { return; } BeforeShowingPage(data); }
/// <summary> /// 从Profile中获取并设置本窗体的指定控件的属性值,如果为空则设置默认值 /// </summary> /// <param name="propertyName">用'.'号分隔的控件及属性名称 </param> /// <param name="defaultValue">默认值</param> public void Load(string propertyName, string defaultValue) { TypeAndValue value = GetContextValue(propertyName); if (String.IsNullOrEmpty(value.Value)) { value.Value = defaultValue; } // if (String.IsNullOrEmpty(value.Value)) return; string[] propertyNames = propertyName.Split('.'); object obj = FindObject(propertyNames); if (obj == null) { return; } RefHelper.SetValue(obj, propertyNames[propertyNames.Length - 1], value.Value, RefHelper.LoadType(value.TypeName)); }
/// <summary> /// 将对象型数据导入到excel中, wang /// </summary> /// <param name="data">要导入的数据</param> /// <param name="isColumnWritten">DataTable的列名是否要导入</param> /// <param name="sheetName">要导入的excel的sheet的名称</param> /// <returns>导入数据行数(包含列名那一行)</returns> public int ObjectToExcel <T>(IEnumerable <T> data, string sheetName, bool isColumnWritten) { int i = 0; int j = 0; int count = 0; ISheet sheet = null; sheet = workbook.GetSheet(sheetName) ?? workbook.CreateSheet(sheetName); var props = RefHelper.GetElementType(data).GetProperties(); if (isColumnWritten == true) //写入DataTable的列名 { IRow row = sheet.CreateRow(0); for (j = 0; j < props.Length; ++j) { row.CreateCell(j).SetCellValue(ResHelper.GetStr(props[j].Name)); } count = 1; } else { count = 0; } for (j = 0; j < data.Count(); ++j) { var element = data.ElementAt(j); IRow row = sheet.CreateRow(count); for (i = 0; i < props.Length; ++i) { ICell cell = row.CreateCell(i); object val = props[i].GetValue(element, null); SetCellValue(cell, val); } count++; } workbook.Write(_innerStream); //写入到excel _innerStream.Close(); _innerStream = null; return(count); }
/// <summary> /// 将Form表单中的数据导入实体对象中的同名属性 /// </summary> /// <param name="form">表单数据</param> /// <param name="model">实体对象</param> public static void AssignFormValues(this NameValueCollection form, object model) { //添加其他程序子类中的特殊属性 foreach (string key in form.Keys) { var prop = model.GetType().GetProperty(key); if (prop != null) { if (prop.PropertyType == typeof(bool)) { //在复选框时,勾选会传回两个值: true,false; 所以要分辨 RefHelper.SetValue(model, key, CommOp.ToStr(form[key]).Split(',').First()); } else { RefHelper.SetValue(model, key, CommOp.ToStr(form[key])); } } } }
/// <summary> /// 刷新右侧组件信息界面 /// </summary> public void SetRightTreeView(GameObject gameObject, bool firstOpen) { Dictionary <Type, Component> components = RefHelper.GetPrivateProperty <Dictionary <Type, Component> >(gameObject, "ComponentDict"); var node = AddGameObjectNode(treeViewCom.Nodes, gameObject); if (firstOpen) { node.Expand(); } foreach (Component component in components.Values) { node = AddCompontNode(treeViewCom.Nodes, component); if (firstOpen && node != null) { node.Expand(); } } }
/// <summary> /// 反射获取用'.'号隔开的对象路径中的对象 /// </summary> /// <param name="propertyNames">将'.'号分隔的对象路径split后的名称数组</param> /// <returns>反射获取的对象</returns> object FindObject(string[] propertyNames) { object obj = ContextObject; foreach (string p in propertyNames.Take(propertyNames.Length - 1)) { FieldInfo fi = obj.GetType().GetField(p, bindAttr); if (fi != null) { obj = fi.GetValue(obj); } else { PropertyInfo pi = RefHelper.GetPropertyInfo(obj, p); if (pi == null) { return(null); } obj = pi.GetValue(obj, null); } } return(obj); }
public object Done(string actionName, string controllerName, string ids) { var controller = ControllerBuilder.Current.GetControllerFactory() .CreateController(this.Request.RequestContext, controllerName) as BaseController; controller.ControllerContext = this.ControllerContext; int[] idArr = CommOp.ToIntArray(ids, ','); ResourceFileInfo[] results = new ResourceFileInfo[idArr.Length]; int i = 0; foreach (int id in idArr) { //调用业务逻辑得到stream数组 var file = _resourceFileService.GetFile(id); results[i++] = file; } var obj = RefHelper.CallMethod(controller, actionName, new object[] { results }); results.Each(r => r.FileStream.Dispose()); return(obj); }
object Init(Type catType) { int? tParentId = null; object catDef; catDef = Activator.CreateInstance(catType); AssignNameValue(catDef); var parentTree = _catalogTree.FindTree(n => n.GetType() == catType.BaseType); //如果在树中找不到父结点,则它为根结点的一级子结点 if (parentTree == null) { var tree = _catalogTree.Add(catDef); //判断有无其它先期加入的结点应该是它的子结点(根据类继承关系来判断) //判断过于复杂,先不做,这就要求初始化顺序一定要按父子关系来 //foreach (object node in _catalogTree) //{ // if (node.GetType().IsAssignableFrom(catType)) // { // tree.Add(node); // var id = (int)RefHelper.GetValue(node, "Id"); // var nodeCat = SiteManager.Catalog.GetById(id); // } //} } else { tParentId = RefHelper.GetValue(parentTree.Node, "Id") as int?; parentTree.Add(catDef); } var catalog = SiteManager.Catalog.GetAll().FirstOrDefault(cat => cat.ParentId == tParentId && cat.Name == (string)RefHelper.GetValue(catDef, "Name")); if (catalog == null) { catalog = new Base_Catalog() { Name = (string)RefHelper.GetValue(catDef, "Name"), ParentId = tParentId, State = ArticleState.Static + ArticleState.Published, OwnerType = CatalogOwnerType.System, EditTime = DateTime.Now, CreateTime = DateTime.Now }; ChangeExts(catalog, catType); SiteManager.Catalog.Add(catalog); } else if (ChangeExts(catalog, catType)) { SiteManager.Catalog.Change(catalog); } PropertyInfo pi = catType.GetProperty("Id", BindingFlags.Public | BindingFlags.Instance); pi.SetValue(catDef, catalog.Id, null); return(catDef); }
/// <summary> /// 处理一个查询定义节点。依次递归子节点循环。 /// </summary> /// <param name="node">当前节点</param> /// <param name="item">查询项集合</param> /// <param name="odtObj"></param> /// <param name="exp">查询表达式</param> /// <param name="parameters">查询表达式参数</param> private void ProcessQueryNode(AdvQueryNode node, AdvQueryItem item, object odtObj, ref string exp, ref IList <object> parameters) { if (node == null) { return; } //查询当前节点的子节点 List <AdvQueryNode> children = item.Nodes.Where(t => t.ParentId == node.Id).ToList(); if (children.Count == 0) { //没有子节点,这是一个表达式节点 if (node.Operator.IsEmpty()) { return; } string p = "@" + parameters.Count; if (node.Operator.Trim().ToUpper().Equals("LIKE")) { exp = exp + node.Expression.Trim() + ".Contains(" + p + ") "; } else if (node.Operator.Trim().ToUpper().Equals("NOT LIKE")) { exp = exp + " !" + node.Expression.Trim() + ".Contains(" + p + ") "; } else { exp = exp + " (" + node.Expression.Trim() + node.Operator + p + ") "; } RefHelper.SetValue(odtObj, node.Expression, node.Value); parameters.Add(RefHelper.GetValue(odtObj, node.Expression)); return; } else { //有子节点,这是一个逻辑运算符节点 exp = exp + "("; int i = 0; foreach (AdvQueryNode child in children) { //子节点是逻辑运算符 if (child.Type.ToLower() == "operator") { if (!item.Nodes.Exists(t => t.ParentId == child.Id)) { continue; } } if (i > 0) { exp = exp + " " + node.Expression + " "; } //递归子节点循环。 ProcessQueryNode(child, item, odtObj, ref exp, ref parameters); i++; } exp = exp + ")"; } }
/// <summary> /// 使用Ninject用于本系统的自定义接口注入 /// </summary> /// <param name="ninjectKernel"></param> protected virtual void AddBindings(IKernel ninjectKernel) { ninjectKernel.Bind <IAuditDataService <JLogInfo> >().To( RefHelper.LoadType("Jurassic.CommonModels.EFProvider.LogProvider")); ninjectKernel.Bind <IDataProvider <AppUser> >().To( RefHelper.LoadType("Jurassic.CommonModels.EFProvider.MyUserProvider")); ninjectKernel.Bind <IDataProvider <AppRole> >().To( RefHelper.LoadType("Jurassic.CommonModels.EFProvider.MyRoleProvider")); ninjectKernel.Bind <IStateProvider>().To( RefHelper.LoadType("Jurassic.CommonModels.EFProvider.MyStateProvider")); ninjectKernel.Bind <IDataProvider <Base_Catalog> >().To( RefHelper.LoadType("Jurassic.CommonModels.EFProvider.CatalogProvider")); ninjectKernel.Bind <CatalogManager>().ToSelf().InSingletonScope(); ninjectKernel.Bind <IAuditDataService <Base_CatalogArticle> >().To( RefHelper.LoadType("Jurassic.CommonModels.EFProvider.ArticleProvider")); ninjectKernel.Bind <LogManager>().ToSelf().InSingletonScope(); ninjectKernel.Bind <ICacheProvider <Stream> >().To( RefHelper.LoadType("Jurassic.AppCenter.Caches.StreamCacheProvider,Jurassic.AppCenter.Core")); //string connstrOrKey, string collectionName //_ninjectKernel.Bind<ICacheProvider<Stream>>().To( // RefHelper.LoadType("Jurassic.MongoDb.StreamCacheProvider")) // .InSingletonScope() // .WithConstructorArgument("connstrOrKey", "mongoDb") // .WithConstructorArgument("collectionName", "WebTemplateDB"); ninjectKernel.Bind <IJLogManager>().To( RefHelper.LoadType("Jurassic.Log4.JLogManager")).WithConstructorArgument("logName", "MyLog"); //ninjectKernel.Bind<ArticleManager>().ToSelf().InThreadScope(); //ninjectKernel.Bind<LogHelper>().ToSelf().WithConstructorArgument("logName", "MyLog"); //组织管理注入配置-------------------------------------------------------------- //统一了ModelContext以后,以下写法已没有必要 //ninjectKernel.Bind<IAuditDataService<Dep_Department>>().To( //RefHelper.LoadType( // "Jurassic.CommonModels.EFProvider.OrgEFAuditDataService`1[[Jurassic.CommonModels.Organization.Dep_Department, Jurassic.CommonModels]],Jurassic.CommonModels.EFProvider")); //ninjectKernel.Bind<IAuditDataService<UserProfile>>().To<EFAuditDataService<UserProfile>>(); //ninjectKernel.Bind<IAuditDataService<Base_ArticleText>>().To<EFAuditDataService<Base_ArticleText>>(); ninjectKernel.Bind(typeof(IAuditDataService <>)).To(typeof(EFAuditDataService <>)); //组织结构管理注入配置 ninjectKernel.Bind <IOrganizationProvider>().To <OrganizationProvider>(); //服务授权管理注入配置 ninjectKernel.Bind <IServerAuthProvider>().To <ServerAuthProvider>(); ninjectKernel.Bind <IDataAuthorizeProvider>().To <DataAuthorizeProvider>(); ninjectKernel.Bind <IServiceInfoProvider>().To <ServiceInfoProvider>(); SiteManager.Kernel.Bind <IFileLocator>().To(typeof(FileLocator)) .WithConstructorArgument("rootPath", _fileRootPath); SiteManager.Kernel.Bind <IFileRepository>().To(typeof(WindowsFileRepository)); ninjectKernel.Bind <DBHelper>().ToSelf() .WithConstructorArgument("connStrOrName", "DefaultConnection"); ninjectKernel.Bind <DbContext, ModelContext>().To <ModelContext>() .InRequestScope() //在一个请求中只生成一个Context, webframe 3.0新增 //.InThreadScope() // 以下的一句代码是连接数据库时声明数据库的Schema. // 其中"WEBFRAME"是Oracle库的Schema名称,如果直接运行WebFrame,它默认是连接oracle库,如果运行WebTemplate,它是连sqlserver //.WithPropertyValue("Schema", "PMDB"); .WithPropertyValue("Schema", "dbo"); //注册本框架特有的基于内嵌资源的视图引擎 //ninjectKernel.Bind<ResViewEngine>().ToSelf() // .WithPropertyValue("ResNamespaces", innerControllerSpaces); ninjectKernel.Bind <UserConfig>().ToSelf() .WithPropertyValue("ShowTab", false) //如果需要系统默认以多标签形式显示页,请设置为true .WithPropertyValue("Theme", "blue") //系统默认皮肤 .WithPropertyValue("GridLineStyle", GridLineStyle.Horizental); //默认表格线样式 ninjectKernel.Bind <UserConfigStorage <UserConfig> >().ToSelf().InSingletonScope(); }
/// <summary> /// 保存多语言的文本信息 /// </summary> /// <param name="dataService">当前的数据服务</param> /// <param name="e">数据实体对象</param> /// <param name="t">业务实体对象</param> public void SaveLanguages(EFAuditDataService <TEntity> dataService, TEntity e, TModel t) { var me = e as IMultiLanguage; if (me == null) { return; } ModelRule modelRule = ModelRule.Get <TModel>(); string entityType = typeof(TEntity).Name; var langs = ResHelper.GetUsedCultureNames().Select(l => l.ToLower()).ToArray(); if (me.LangTexts == null) { me.LangTexts = dataService.GetContext().Set <Sys_DataLanguage>().Where(d => d.BillId == e.Id && d.BillType == entityType).ToList(); } var sysLangs = me.LangTexts; foreach (var rule in modelRule.SingleRules.Where(r => r.DataType == ExtDataType.MultiLanguage)) { //先处理主文本框name不带语言后缀的表单值,表示是当前语言 string langVal = HttpContext.Current.Request.Form[rule.Name]; string currentLang = ResHelper.CurrentCultureName.ToLower(); var langEntity = sysLangs.FirstOrDefault(l => l.Language == currentLang); if (langEntity == null) { langEntity = new Sys_DataLanguage { BillId = e.Id, BillType = entityType, Language = currentLang, Name = rule.Name, Text = langVal }; dataService.MarkState(langEntity, EntityState.Added); } else if (langVal != langEntity.Text) { langEntity.Text = langVal; dataService.MarkState(langEntity, EntityState.Modified); } RefHelper.SetValue(e, rule.Name, langVal); //再处理下拉列表中的文本框name带语言后缀的表单值 foreach (var lang in langs.Where(l => l != currentLang)) { langVal = HttpContext.Current.Request.Form[rule.Name + "-" + lang]; langEntity = sysLangs.FirstOrDefault(l => l.Language == lang); if (langEntity == null) { langEntity = new Sys_DataLanguage { BillId = e.Id, BillType = entityType, Language = lang, Name = rule.Name, Text = langVal }; dataService.MarkState(langEntity, EntityState.Added); } else if (langVal != langEntity.Text) { langEntity.Text = langVal; dataService.MarkState(langEntity, EntityState.Modified); } } } }