Beispiel #1
0
        private async Task UpdateViewModel()
        {
            CurrentUser       = creatioUtils.CurrentUser;
            AccounttHyperlink = new Hyperlink()
            {
                Uri  = new Uri(Domain + @"/0/Nui/ViewModule.aspx#CardModuleV2/AccountPageV2/edit/" + CurrentUser.Account.Value),
                Text = CurrentUser.Account.DisplayValue
            };
            ContactHyperlink = new Hyperlink()
            {
                Uri  = new Uri(Domain + @"/0/Nui/ViewModule.aspx#CardModuleV2/ContactPageV2/edit/" + CurrentUser.Contact.Value),
                Text = $"Loged in as: {CurrentUser.Contact.DisplayValue} ({CurrentUser.User.DisplayValue})"
            };
            CookieCollection cc = creatioUtils.Auth.GetCookies(new Uri(Domain));

            foreach (Cookie c in cc)
            {
                AuthCookies.Add(new MyAuthCookie {
                    Name = c.Name, Value = c.Value
                });
            }
            await GetImageAsync(CurrentUser.Contact.PrimaryImageValue).ConfigureAwait(false);

            //SelectQuery contactQuery = new SelectQuery()
            //{
            //    RootSchemaName = "SysAdminUnit",
            //    RowCount = 10,
            //    RowsOffset = -1,
            //    QueryKind = QueryKind.General,
            //    QuerySource = QuerySource.Filter,
            //    UseLocalization = true,
            //    QueryOptimize = true,
            //    Columns = new SelectQueryColumns()
            //    {
            //        Items = new Dictionary<string, SelectQueryColumn>()
            //        {
            //            {
            //                "Id", new SelectQueryColumn()
            //                {
            //                    Caption = "Id",
            //                    OrderDirection = OrderDirection.Ascending,
            //                    OrderPosition = 0,
            //                    Expression = new ColumnExpression()
            //                    {
            //                        ExpressionType = EntitySchemaQueryExpressionType.SchemaColumn,
            //                        ColumnPath = "Id"
            //                    }
            //                }
            //            },
            //            {
            //                "Name", new SelectQueryColumn()
            //                {
            //                    Caption = "Name",
            //                    OrderDirection = OrderDirection.Ascending,
            //                    OrderPosition = 0,
            //                    Expression = new ColumnExpression()
            //                    {
            //                        ExpressionType = EntitySchemaQueryExpressionType.SchemaColumn,
            //                        ColumnPath = "Name"
            //                    }
            //                }
            //            },
            //            {
            //                "fileName", new SelectQueryColumn()
            //                {
            //                    Caption = "fileName",
            //                    OrderDirection = OrderDirection.Ascending,
            //                    OrderPosition = 0,
            //                    Expression = new ColumnExpression()
            //                    {
            //                        ExpressionType = EntitySchemaQueryExpressionType.SchemaColumn,
            //                        ColumnPath = "Contact.Photo"
            //                    }
            //                }
            //            },
            //            {
            //                "ContactId", new SelectQueryColumn()
            //                {
            //                    Caption = "ContactId",
            //                    OrderDirection = OrderDirection.Ascending,
            //                    OrderPosition = 0,
            //                    Expression = new ColumnExpression()
            //                    {
            //                        ExpressionType = EntitySchemaQueryExpressionType.SchemaColumn,
            //                        ColumnPath = "Contact.Id"
            //                    }
            //                }
            //            },
            //            {
            //                "Photo", new SelectQueryColumn()
            //                {
            //                    Caption = "Photo",
            //                    OrderDirection = OrderDirection.Ascending,
            //                    OrderPosition = 0,
            //                    Expression = new ColumnExpression()
            //                    {
            //                        ExpressionType = EntitySchemaQueryExpressionType.SchemaColumn,
            //                        ColumnPath = "Contact.Photo.Id"
            //                    }
            //                }
            //            }
            //        }
            //    },
            //    Filters = new Filters()
            //    {
            //        IsEnabled = true,
            //        FilterType = FilterType.FilterGroup,
            //        LogicalOperation = LogicalOperationStrict.And,
            //        Items = new Dictionary<string, Filter>
            //        {
            //            {
            //                "CompareByName", new Filter
            //                {
            //                    IsEnabled=true,
            //                    FilterType = FilterType.CompareFilter,
            //                    ComparisonType = FilterComparisonType.Equal,
            //                    LeftExpression = new BaseExpression()
            //                    {
            //                        ExpressionType = EntitySchemaQueryExpressionType.SchemaColumn,
            //                        ColumnPath = "Id"
            //                    },
            //                    RightExpression = new BaseExpression()
            //                    {
            //                        ExpressionType = EntitySchemaQueryExpressionType.Parameter,
            //                        Parameter = new Parameter()
            //                        {
            //                            DataValueType = DataValueType.Guid,
            //                            Value = creatioUtils.CurrentUser.User.Value
            //                        }
            //                    }
            //                }
            //            },
            //        }
            //    }
            //};
            //string json = JsonConvert.SerializeObject(contactQuery);
            //RequestResponse result = await Utils.GetResponseAsync(json, ActionEnum.SELECT).ConfigureAwait(false);
            //System.Data.DataTable dt = creatioUtils.ConvertResponseToDataTable(result.Result);

            //string ImageId = dt.Rows[0]["Photo"].ToString();
            //await GetImageAsync(ImageId).ConfigureAwait(true);
        }