Beispiel #1
0
        public ActionResult Upload(string tablename)
        {
            var rep      = new MetadataRepositoty();
            var metadata = rep.GetEntityMetadataByTableName("UploadedFiles", "dbo", 1);

            var result = new List <object>();

            for (int i = 0; i < Request.Files.Count; i++)
            {
                var file = Request.Files[i] as HttpPostedFileWrapper;

                var newAttachment = metadata.New();
                newAttachment.Id               = Guid.NewGuid();
                newAttachment.ObjectId         = Guid.Empty;
                newAttachment.Name             = file.FileName;
                newAttachment.CreatedBy        = SecurityCache.CurrentUser.Name;
                newAttachment.CreatedDate      = DateTime.Now;
                newAttachment.Data             = ReadFile(file.InputStream);
                newAttachment.AttachmentLength = (int)Math.Round((decimal)file.ContentLength / 1024, 0);
                newAttachment.TableName        = tablename;
                metadata.Insert(newAttachment as DynamicEntity, ExternalMethodsCallMode.None);

                var res = new
                {
                    id               = newAttachment.Id,
                    name             = newAttachment.Name,
                    createdby        = newAttachment.CreatedBy,
                    createddate      = newAttachment.CreatedDate,
                    attachmentlength = newAttachment.AttachmentLength
                };

                result.Add(res);
            }

            StringBuilder sb      = new StringBuilder("[");
            bool          isFirst = true;

            foreach (var c in result)
            {
                if (!isFirst)
                {
                    sb.Append(",");
                }
                isFirst = false;
                sb.Append(ServiceStack.Text.JsonSerializer.SerializeToString(c));
            }

            sb.Append("]");

            return(new ContentResult
            {
                ContentType = "text/html",
                Content =
                    string.Format("{{\"success\":\"true\",\"result\":{0}}}"
                                  , sb.ToString())
            });
        }
        public ActionResult Download(string token, string filename)
        {
            var data = new byte[0];

            if (string.IsNullOrEmpty(filename))
                filename = "download";

            var rep = new MetadataRepositoty();
            var metadata = rep.GetEntityMetadataByTableName("UploadedFiles", "dbo", 1);

            var attachment = metadata.Get(FilterCriteriaSet.And.Equal(token, "Id")).FirstOrDefault();

            if (attachment == null)
                return new EmptyResult();

            return File(attachment.Data, "application/file", filename);
        }
Beispiel #3
0
        public void DeleteEntityByViews(string columnName, object valueId, List <string> views)
        {
            if (views == null)
            {
                return;
            }

            var replaceIds = new Dictionary <object, object>();
            var mdRep      = new MetadataRepositoty();

            foreach (var viewName in views)
            {
                EntityMetadata md      = mdRep.GetEntityMetadataByViewName(viewName);
                List <dynamic> records = md.Get(FilterCriteriaSet.And.Equal(valueId, columnName), ExternalMethodsCallMode.None);
                DynamicRepository.DeleteByView(md.Name, records.Select(c => (c as DynamicEntity).GetId()).ToList(), false);
            }
        }
Beispiel #4
0
        public static List <Tuple <Guid, string, List <Tuple <Guid, string> > > > GetDependingEntityAccess(string metaviewName, Guid[] ids, int deep = 1)
        {
            DynamicEntityRepository           repo     = new DynamicEntityRepository();
            EntityMetadata                    metadata = repo.GetEntityMetadataByEntityName(metaviewName);
            List <Guid>                       dependingEntityMetadataIds = MetadataRepositoty.GetDependingEntityIds(new TableDescription(metadata.SchemaName, metadata.TableName));
            Dictionary <Guid, EntityMetadata> dependingMetadata          = dependingEntityMetadataIds.Select(id => new KeyValuePair <Guid, EntityMetadata>(id, repo.GetEntityMetadataByEntityId(id)))
                                                                           .ToDictionary(kvp => kvp.Key, kvp => kvp.Value);

            var dependingEntities = new List <Tuple <Guid, string, List <Tuple <Guid, string> > > >();

            foreach (var entityMetadata in dependingMetadata)
            {
                FilterCriteriaSet    filters = FilterCriteriaSet.Empty;
                AttributeDescription entityCaptionAttribute = OptimaJet.BJet.CommonMethods.GetEntityCaptionAttribute(entityMetadata.Value);

                List <FilterCriteriaSet> filterSets = entityMetadata.Value.PlainAttributes.Where(a => a.IsReference && a.ReferencedSchemaName == metadata.SchemaName && a.ReferencedTableName == metadata.TableName)
                                                      .Select(a => FilterCriteriaSet.And.In(ids.ToList(), entityMetadata.Value.GetColumn(a))).ToList();

                filterSets.ForEach(f => filters = filters != FilterCriteriaSet.Empty ? filters.Merge(f) : f);

                var entities = repo.GetEntitiesByMetadata(entityMetadata.Value, filters).Entities;
                if (entities == null || entities.Count() == 0)
                {
                    continue;
                }

                var dependingEntity = new Tuple <Guid, string, List <Tuple <Guid, string> > >(
                    entityMetadata.Key,
                    entityMetadata.Value.TableName,
                    new List <Tuple <Guid, string> >(entities.Select(e =>
                                                                     new Tuple <Guid, string>((Guid)e.Id, e.GetProperty(entityCaptionAttribute.PropertyName).ToString())
                                                                     ).ToList()));
                dependingEntities.Add(dependingEntity);

                if (deep > 0)
                {
                    dependingEntities.AddRange(GetDependingEntityAccess(dependingEntity.Item2, dependingEntity.Item3.Select(t => t.Item1).ToArray(), deep - 1));
                }
            }
            return(dependingEntities);
        }
Beispiel #5
0
        public ActionResult Download(string token, string filename)
        {
            var data = new byte[0];

            if (string.IsNullOrEmpty(filename))
            {
                filename = "download";
            }

            var rep      = new MetadataRepositoty();
            var metadata = rep.GetEntityMetadataByTableName("UploadedFiles", "dbo", 1);

            var attachment = metadata.Get(FilterCriteriaSet.And.Equal(token, "Id")).FirstOrDefault();

            if (attachment == null)
            {
                return(new EmptyResult());
            }

            return(File(attachment.Data, "application/file", filename));
        }
Beispiel #6
0
        public Dictionary <string, Dictionary <object, object> > CopyEntityByForms(string columnName, object fromId, object toId, List <string> formNames, Dictionary <string, FilterCriteriaSet> filters)
        {
            var replaceIds = new Dictionary <string, Dictionary <object, object> >();
            var formList   = new List <FormModel>();

            var mdRep = new MetadataRepositoty();

            #region Вставка основной записи
            foreach (var formName in formNames)
            {
                var form = FormModelRepository.GetFormModel(formName, FormModelType.All);

                EntityMetadata md = mdRep.GetEntityMetadataByViewName(form.MainViewName);

                var filter = FilterCriteriaSet.And.Equal(fromId, columnName);
                if (filters.ContainsKey(form.MainViewName))
                {
                    filter = filter.Merge(filters[form.MainViewName]);
                }

                List <dynamic> records = md.Get(filter, ExternalMethodsCallMode.None);

                foreach (DynamicEntity r in records)
                {
                    var oldId = r[md.PrimaryKeyAttribute.ColumnName];
                    md.SetNewPrimaryKey(r);
                    if (!replaceIds.ContainsKey(md.TableName))
                    {
                        replaceIds.Add(md.TableName, new Dictionary <object, object>());
                    }

                    replaceIds[md.TableName].Add(oldId, r[md.PrimaryKeyAttribute.ColumnName]);
                    r[columnName] = toId;
                }

                md.Insert(records, ExternalMethodsCallMode.None);
                formList.Add(form);
            }
            #endregion

            #region Вставка дочерних и обновленеи ids
            foreach (var form in formList)
            {
                EntityMetadata md         = mdRep.GetEntityMetadataByViewName(form.MainViewName);
                var            replaceAtt = md.Attributes.Where(c => !string.IsNullOrEmpty(c.ReferencedTableName) &&
                                                                replaceIds.ContainsKey(c.ReferencedTableName)).ToList();

                if (form.Blocks.Where(c => !string.IsNullOrWhiteSpace(c.BaseEntityIdName)).Count() == 1 &&
                    replaceAtt.Count == 0)
                {
                    continue;
                }

                var filter1 = FilterCriteriaSet.And.Equal(toId, columnName);
                if (filters.ContainsKey(form.MainViewName))
                {
                    filter1 = filter1.Merge(filters[form.MainViewName]);
                }

                List <dynamic> records = md.Get(filter1, ExternalMethodsCallMode.None);

                foreach (DynamicEntity r in records)
                {
                    foreach (AttributeDescription rAtt in replaceAtt)
                    {
                        var replaceIdsForTable = replaceIds[rAtt.ReferencedTableName];
                        if (r[rAtt.PropertyName] != null && replaceIdsForTable.ContainsKey(r[rAtt.PropertyName]))
                        {
                            r[rAtt.PropertyName] = replaceIdsForTable[r[rAtt.PropertyName]];
                        }
                    }

                    #region Создаем записи в дочерних таблицах
                    foreach (var block in form.Blocks.Where(c => form.MainViewName != c.ViewName &&
                                                            !string.IsNullOrWhiteSpace(c.BaseEntityIdName)))
                    {
                        EntityMetadata blockMd = mdRep.GetEntityMetadataByViewName(block.ViewName);
                        if (md.TableName == blockMd.TableName)
                        {
                            continue;
                        }

                        object oldParentEntityId = replaceIds[md.TableName].Where(c => c.Value.Equals(r.GetId())).Select(c => c.Key).First();

                        var filter2 = FilterCriteriaSet.And.Equal(oldParentEntityId, block.BaseEntityIdName);
                        if (filters.ContainsKey(block.ViewName))
                        {
                            filter2 = filter2.Merge(filters[block.ViewName]);
                        }

                        List <dynamic> blockRecords = blockMd.Get(filter2, ExternalMethodsCallMode.None);

                        foreach (DynamicEntity blockR in blockRecords)
                        {
                            var oldId = blockR[blockMd.PrimaryKeyAttribute.ColumnName];
                            blockMd.SetNewPrimaryKey(blockR);
                            if (!replaceIds.ContainsKey(blockMd.TableName))
                            {
                                replaceIds.Add(blockMd.TableName, new Dictionary <object, object>());
                            }

                            replaceIds[blockMd.TableName].Add(oldId, blockR[blockMd.PrimaryKeyAttribute.ColumnName]);

                            var replaceAttForBlock = blockMd.Attributes.Where(c => !string.IsNullOrEmpty(c.ReferencedTableName) &&
                                                                              replaceIds.ContainsKey(c.ReferencedTableName)).ToList();

                            foreach (AttributeDescription rAtt in replaceAttForBlock)
                            {
                                var replaceIdsForTable = replaceIds[rAtt.ReferencedTableName];
                                if (replaceIdsForTable.ContainsKey(blockR[rAtt.PropertyName]))
                                {
                                    blockR[rAtt.PropertyName] = replaceIdsForTable[blockR[rAtt.PropertyName]];
                                }
                            }
                        }

                        blockMd.Insert(blockRecords, ExternalMethodsCallMode.None);
                    }
                    #endregion
                }

                md.Update(records, ExternalMethodsCallMode.None);
            }

            return(replaceIds);

            #endregion
        }
        public ActionResult Upload(string tablename)
        {
            var rep = new MetadataRepositoty();
            var metadata = rep.GetEntityMetadataByTableName("UploadedFiles", "dbo", 1);

            var result = new List<object>();

            for (int i = 0; i < Request.Files.Count; i++)
            {
                var file = Request.Files[i] as HttpPostedFileWrapper;

                var newAttachment = metadata.New();
                newAttachment.Id = Guid.NewGuid();
                newAttachment.ObjectId = Guid.Empty;
                newAttachment.Name = file.FileName;
                newAttachment.CreatedBy = SecurityCache.CurrentUser.Name;
                newAttachment.CreatedDate = DateTime.Now;
                newAttachment.Data = ReadFile(file.InputStream);
                newAttachment.AttachmentLength = (int)Math.Round((decimal)file.ContentLength / 1024, 0);
                newAttachment.TableName = tablename;
                metadata.Insert(newAttachment as DynamicEntity, ExternalMethodsCallMode.None);

                var res = new
                {
                    id = newAttachment.Id,
                    name = newAttachment.Name,
                    createdby = newAttachment.CreatedBy,
                    createddate = newAttachment.CreatedDate,
                    attachmentlength = newAttachment.AttachmentLength
                };

                result.Add(res);
            }

            StringBuilder sb = new StringBuilder("[");
            bool isFirst = true;

            foreach (var c in result)
            {
                if (!isFirst)
                    sb.Append(",");
                isFirst = false;
                sb.Append(ServiceStack.Text.JsonSerializer.SerializeToString(c));
            }

            sb.Append("]");

            return new ContentResult
            {
                ContentType = "text/html",
                Content =
                    string.Format("{{\"success\":\"true\",\"result\":{0}}}"
                        , sb.ToString())
            };
        }
Beispiel #8
0
        public ActionResult Get(string metaViewName)
        {
            ActionResult res = new EmptyResult();

            var dataSource = new DynamicEntityJSONDataSource();

            if (Request.HttpMethod.Equals("GET", StringComparison.InvariantCultureIgnoreCase))
            {
                if (!SecurityCache.ViewCan(metaViewName, SecurityPermissionBaseTypeEnum.View))
                {
                    return(new ContentResult
                    {
                        ContentType = "text/html",
                        Content = DynamicEntityJSONDataSource.GetNotSuccess(WsFactory.GetАccessDeniedPage())
                    });
                }

                var extra = DynamicEntityJSONDataSource.GetExtra(Request.QueryString).ToLower();
                res = Get(metaViewName, dataSource, extra);
            }
            else if (Request.HttpMethod.Equals("POST", StringComparison.InvariantCultureIgnoreCase))
            {
                if (!SecurityCache.ViewCan(metaViewName, SecurityPermissionBaseTypeEnum.Add))
                {
                    return(new ContentResult
                    {
                        ContentType = "text/html",
                        Content = DynamicEntityJSONDataSource.GetNotSuccess(WsFactory.GetАccessDeniedPage())
                    });
                }

                var updatedJson = Request.Body();
                res = new ContentResult
                {
                    ContentType = "text/html",
                    Content     = dataSource.Insert(metaViewName,
                                                    DynamicEntityJSONDataSource.GetEntityOperationType(Request.QueryString),
                                                    updatedJson,
                                                    DynamicEntityJSONDataSource.GetExtra(Request.Params),
                                                    DynamicEntityJSONDataSource.GetVisibility(Request.QueryString),
                                                    DynamicEntityJSONDataSource.GetBaseEntityIdName(Request.Params),
                                                    DynamicEntityJSONDataSource.GetBaseEntityIdValue(Request.Params))
                };
            }
            else if (Request.HttpMethod.Equals("PUT", StringComparison.InvariantCultureIgnoreCase))
            {
                if (!SecurityCache.ViewCan(metaViewName, SecurityPermissionBaseTypeEnum.Edit))
                {
                    return(new ContentResult
                    {
                        ContentType = "text/html",
                        Content = DynamicEntityJSONDataSource.GetNotSuccess(WsFactory.GetАccessDeniedPage())
                    });
                }

                var updatedJson = Request.Body();

                res = new ContentResult
                {
                    ContentType = "text/html",
                    Content     =
                        dataSource.Update(metaViewName,
                                          updatedJson,
                                          DynamicEntityJSONDataSource.GetExtra(Request.Params),
                                          DynamicEntityJSONDataSource.GetVisibility(Request.QueryString),
                                          DynamicEntityJSONDataSource.GetBaseEntityIdName(Request.QueryString),
                                          DynamicEntityJSONDataSource.GetBaseEntityIdValue(Request.QueryString))
                };
            }
            else if (Request.HttpMethod.Equals("DELETE", StringComparison.InvariantCultureIgnoreCase))
            {
                if (!SecurityCache.ViewCan(metaViewName, SecurityPermissionBaseTypeEnum.Delete))
                {
                    return(new ContentResult
                    {
                        ContentType = "text/html",
                        Content = DynamicEntityJSONDataSource.GetNotSuccess(WsFactory.GetАccessDeniedPage())
                    });
                }

                var    updatedJson = Request.Body();
                string validateRes = string.Empty;

                if (metaViewName != "Budget")
                {
                    if (!MetadataRepositoty.ValidadateDelete(metaViewName, updatedJson, out validateRes))
                    {
                        return(new ContentResult
                        {
                            ContentType = "text/html",
                            Content = DynamicEntityJSONDataSource.GetNotSuccess(validateRes)
                        });
                    }
                }

                res = new ContentResult
                {
                    ContentType = "text/html",
                    Content     =
                        dataSource.Delete(metaViewName,
                                          updatedJson,
                                          DynamicEntityJSONDataSource.GetExtra(Request.Params),
                                          DynamicEntityJSONDataSource.GetBaseEntityIdName(Request.QueryString),
                                          DynamicEntityJSONDataSource.GetBaseEntityIdValue(Request.QueryString))
                };
            }


            return(res);
        }
Beispiel #9
0
        public ActionResult GetAJAXTree(string metaViewName)
        {
            ActionResult res        = new EmptyResult();
            var          dataSource = new DynamicEntityJSONDataSource();

            if (Request.HttpMethod.Equals("GET", StringComparison.InvariantCultureIgnoreCase))
            {
                if (!SecurityCache.ViewCan(metaViewName, SecurityPermissionBaseTypeEnum.View))
                {
                    return(new ContentResult
                    {
                        ContentType = "text/html",
                        Content = DynamicEntityJSONDataSource.GetNotSuccess(WsFactory.GetАccessDeniedPage())
                    });
                }



                res = new ContentResult
                {
                    ContentType = "text/html",

                    Content = dataSource.GetJSONAJAXTreeData(metaViewName,
                                                             DynamicEntityJSONDataSource.GetSort(Request.QueryString),
                                                             DynamicEntityJSONDataSource.GetSearch(Request.QueryString),
                                                             DynamicEntityJSONDataSource.GetExtra(Request.Params),
                                                             DynamicEntityJSONDataSource.GetBaseEntityIdName(Request.QueryString),
                                                             DynamicEntityJSONDataSource.GetBaseEntityIdValue(Request.QueryString),
                                                             DynamicEntityJSONDataSource.GetCallback(Request.QueryString),
                                                             DynamicEntityJSONDataSource.GetNodeValue(Request.QueryString),
                                                             DynamicEntityJSONDataSource.GetVisibility(Request.QueryString), GetShowDeleted(metaViewName)
                                                             )
                };
            }
            else if (Request.HttpMethod.Equals("DELETE", StringComparison.InvariantCultureIgnoreCase))
            {
                if (!SecurityCache.ViewCan(metaViewName, SecurityPermissionBaseTypeEnum.Delete))
                {
                    return(new ContentResult
                    {
                        ContentType = "text/html",
                        Content = DynamicEntityJSONDataSource.GetNotSuccess(WsFactory.GetАccessDeniedPage())
                    });
                }

                var    updatedJson = Request.Body();
                string validateRes = string.Empty;
                if (!MetadataRepositoty.ValidadateDelete(metaViewName, updatedJson, out validateRes))
                {
                    return(new ContentResult
                    {
                        ContentType = "text/html",
                        Content = DynamicEntityJSONDataSource.GetNotSuccess(validateRes)
                    });
                }

                return(new ContentResult
                {
                    ContentType = "text/html",
                    Content =
                        dataSource.Delete(metaViewName,
                                          updatedJson,
                                          DynamicEntityJSONDataSource.GetExtra(Request.Params),
                                          DynamicEntityJSONDataSource.GetBaseEntityIdName(Request.QueryString),
                                          DynamicEntityJSONDataSource.GetBaseEntityIdValue(Request.QueryString))
                });
            }

            return(res);
        }
Beispiel #10
0
        public Dictionary<string, Dictionary<object, object>> CopyEntityByForms(string columnName, object fromId, object toId, List<string> formNames, Dictionary<string, FilterCriteriaSet> filters)
        {
            var replaceIds = new Dictionary<string, Dictionary<object, object>>();
            var formList = new List<FormModel>();

            var mdRep = new MetadataRepositoty();

            #region Вставка основной записи
            foreach (var formName in formNames)
            {
                var form = FormModelRepository.GetFormModel(formName, FormModelType.All);

                EntityMetadata md = mdRep.GetEntityMetadataByViewName(form.MainViewName);

                var filter = FilterCriteriaSet.And.Equal(fromId, columnName);
                if (filters.ContainsKey(form.MainViewName))
                    filter = filter.Merge(filters[form.MainViewName]);

                List<dynamic> records = md.Get(filter, ExternalMethodsCallMode.None);

                foreach (DynamicEntity r in records)
                {
                    var oldId = r[md.PrimaryKeyAttribute.ColumnName];
                    md.SetNewPrimaryKey(r);
                    if (!replaceIds.ContainsKey(md.TableName))
                    {
                        replaceIds.Add(md.TableName, new Dictionary<object, object>());
                    }

                    replaceIds[md.TableName].Add(oldId, r[md.PrimaryKeyAttribute.ColumnName]);
                    r[columnName] = toId;
                }

                md.Insert(records, ExternalMethodsCallMode.None);
                formList.Add(form);
            }
            #endregion

            #region Вставка дочерних и обновленеи ids
            foreach (var form in formList)
            {
                EntityMetadata md = mdRep.GetEntityMetadataByViewName(form.MainViewName);
                var replaceAtt = md.Attributes.Where(c => !string.IsNullOrEmpty(c.ReferencedTableName) &&
                    replaceIds.ContainsKey(c.ReferencedTableName)).ToList();

                if (form.Blocks.Where(c => !string.IsNullOrWhiteSpace(c.BaseEntityIdName)).Count() == 1 &&
                    replaceAtt.Count == 0)
                    continue;

                var filter1 = FilterCriteriaSet.And.Equal(toId, columnName);
                if (filters.ContainsKey(form.MainViewName))
                    filter1 = filter1.Merge(filters[form.MainViewName]);

                List<dynamic> records = md.Get(filter1, ExternalMethodsCallMode.None);

                foreach (DynamicEntity r in records)
                {
                    foreach(AttributeDescription rAtt in replaceAtt)
                    {
                        var replaceIdsForTable = replaceIds[rAtt.ReferencedTableName];
                        if(r[rAtt.PropertyName] != null && replaceIdsForTable.ContainsKey(r[rAtt.PropertyName]))
                        {
                            r[rAtt.PropertyName] = replaceIdsForTable[r[rAtt.PropertyName]];
                        }
                    }

                    #region Создаем записи в дочерних таблицах
                    foreach (var block in form.Blocks.Where(c=> form.MainViewName != c.ViewName &&
                        !string.IsNullOrWhiteSpace(c.BaseEntityIdName)))
                    {
                        EntityMetadata blockMd = mdRep.GetEntityMetadataByViewName(block.ViewName);
                        if (md.TableName == blockMd.TableName)
                            continue;

                        object oldParentEntityId = replaceIds[md.TableName].Where(c => c.Value.Equals(r.GetId())).Select(c => c.Key).First();

                        var filter2 = FilterCriteriaSet.And.Equal(oldParentEntityId, block.BaseEntityIdName);
                        if (filters.ContainsKey(block.ViewName))
                            filter2 = filter2.Merge(filters[block.ViewName]);

                        List<dynamic> blockRecords = blockMd.Get(filter2, ExternalMethodsCallMode.None);

                        foreach (DynamicEntity blockR in blockRecords)
                        {
                            var oldId = blockR[blockMd.PrimaryKeyAttribute.ColumnName];
                            blockMd.SetNewPrimaryKey(blockR);
                            if (!replaceIds.ContainsKey(blockMd.TableName))
                            {
                                replaceIds.Add(blockMd.TableName, new Dictionary<object, object>());
                            }

                            replaceIds[blockMd.TableName].Add(oldId, blockR[blockMd.PrimaryKeyAttribute.ColumnName]);

                            var replaceAttForBlock = blockMd.Attributes.Where(c => !string.IsNullOrEmpty(c.ReferencedTableName) &&
                                replaceIds.ContainsKey(c.ReferencedTableName)).ToList();

                            foreach (AttributeDescription rAtt in replaceAttForBlock)
                            {
                                var replaceIdsForTable = replaceIds[rAtt.ReferencedTableName];
                                if (replaceIdsForTable.ContainsKey(blockR[rAtt.PropertyName]))
                                {
                                    blockR[rAtt.PropertyName] = replaceIdsForTable[blockR[rAtt.PropertyName]];
                                }
                            }
                        }

                        blockMd.Insert(blockRecords, ExternalMethodsCallMode.None);
                    }
                    #endregion
                }

                md.Update(records, ExternalMethodsCallMode.None);
            }

            return replaceIds;

            #endregion
        }
Beispiel #11
0
        public void DeleteEntityByViews(string columnName, object valueId, List<string> views)
        {
            if (views == null)
                return;

            var replaceIds = new Dictionary<object, object>();
            var mdRep = new MetadataRepositoty();

            foreach (var viewName in views)
            {
                EntityMetadata md = mdRep.GetEntityMetadataByViewName(viewName);
                List<dynamic> records = md.Get(FilterCriteriaSet.And.Equal(valueId, columnName), ExternalMethodsCallMode.None);
                DynamicRepository.DeleteByView(md.Name, records.Select(c => (c as DynamicEntity).GetId()).ToList(), false);
            }
        }