Пример #1
0
        //tapash why these fields are static???
        internal static List <ColumnAndField> GetItemSelectDetailsWithValue(Guid tenantId, Guid itemId, string entityContext, string subtype, string rowName, bool active, Guid updatedBy, string code)
        {
            var itemTableColumns = ItemHelper.GetItemSelectDetails(tenantId, entityContext);

            foreach (var item in itemTableColumns)
            {
                if (item.ColumnName.Equals("[Id]"))
                {
                    item.Value = itemId;
                }
                else if (item.ColumnName.Equals("[EntityCode]") && !string.IsNullOrEmpty(entityContext))
                {
                    item.Value = entityContext;
                }
                else if (item.ColumnName.Equals("[EntitySubTypeCode]"))
                {
                    item.Value = subtype;
                }
                else if (item.ColumnName.Equals("[Name]") && !string.IsNullOrEmpty(rowName))
                {
                    item.Value = rowName;
                }
                else if (item.ColumnName.Equals("[Active]"))
                {
                    item.Value = active;
                }
                else if (item.ColumnName.Equals("[Code]") && !string.IsNullOrEmpty(code))
                {
                    item.Value = code;
                }
                else if (item.ColumnName.Equals("[UpdatedBy]"))
                {
                    item.Value = updatedBy;
                }
                else if (item.ColumnName.Equals("[UpdatedOn]"))
                {
                    item.Value = DateTime.UtcNow.ToString("MM/dd/yyyy HH:mm:ss");;
                }
            }

            //added tenant with value..
            var column6 = new ColumnAndField();

            column6.FieldName    = "TenantId";
            column6.ColumnName   = "TenantId";
            column6.TableName    = ItemTableName;
            column6.PrimaryKey   = ItemTablePrimarykey;
            column6.EntityPrefix = Alias;
            column6.Value        = tenantId;
            itemTableColumns.Add(column6);

            return(itemTableColumns);
        }
Пример #2
0
        public List <ColumnAndField> GetBasicColumnOfPickListOrLookup(Guid tenantId, List <ColumnAndField> pickListOrLookupWhichFoundInQuery)
        {
            List <ColumnAndField> matchingColumns = new List <ColumnAndField> ();
            IMetadataManager      entityManager   = new MetadataManager.Contracts.MetadataManager();

            foreach (var item in pickListOrLookupWhichFoundInQuery)
            {
                var virtualName = !string.IsNullOrEmpty(item.ClientName) ? item.ClientName + "." + item.FieldName : item.FieldName;
                if (item.DataType.Equals(VPC.Metadata.Business.DataAnnotations.DataType.Lookup))
                {
                    //newly added condition need to fix this portion
                    //reason product :: product version workflow..

                    if (
                        !string.IsNullOrEmpty(item.ReferenceColumnName)
                        )
                    {
                        continue;
                    }

                    var isItem = entityManager.EntityIsAnItem(item.TypeOf, false);
                    if (isItem)
                    {
                        var context          = entityManager.GetEntityContextByEntityName(item.TypeOf, false);
                        var itemTableColumns = ItemHelper.GetItemSelectDetails(tenantId, context, 0);
                        List <ColumnAndField> basicColumn = new List <ColumnAndField> ();
                        var itemId   = itemTableColumns.FirstOrDefault(t => t.ColumnName.Equals(ItemHelper.ItemTablePrimarykey));
                        var itemText = itemTableColumns.FirstOrDefault(t => t.ColumnName.Equals(ItemHelper.ItemTableItemNameField));
                        basicColumn.Add(itemId);
                        basicColumn.Add(itemText);
                        MapBasicFields(matchingColumns, entityManager, item, virtualName, basicColumn);
                    }
                }
                else
                {
                    var basicColumn = entityManager.GetBasicColumnNameByEntityName(item.TypeOf, null);
                    if (basicColumn.Any())
                    {
                        MapBasicFields(matchingColumns, entityManager, item, virtualName, basicColumn);
                    }
                }
            }
            return(matchingColumns);
        }