Esempio n. 1
0
        private async void DoRefreshQueriesAsync(object obj)
        {
            Loading = true;
            try
            {
                ClearQuery.Execute(this);
                Queries = new ObservableCollection <QueryVM>();
                var result = await RestHub.MyQueries();

                if (result.UserObject != null)
                {
                    MyQueriesDTO    myQueriesDto = (MyQueriesDTO)result.UserObject;
                    List <QueryDTO> dtos         = myQueriesDto.Queries;
                    foreach (var dto in dtos)
                    {
                        Queries.Add(new QueryVM
                        {
                            Id           = dto.Id,
                            TanId        = dto.TanId,
                            DocumentPath = dto.DocumentPath,
                            TanNumber    = dto.TanNumber,
                            Comment      = dto.Comment,
                            Page         = dto.Page,
                            QueryType    = dto.QueryType,
                            Title        = dto.Title
                        });
                    }
                }
            }
            catch (Exception ex)
            {
                AppErrorBox.ShowErrorMessage("Error while loading Queries", ex.ToString());
            }
            Loading = false;
        }
Esempio n. 2
0
        private async void DoSubmitAsync(object obj)
        {
            if (FormQuery != null && FormQuery.Id > 0)
            {
                if (String.IsNullOrEmpty(Response))
                {
                    MessageBox.Show("Please Add Your Message . .");
                    return;
                }
                try
                {
                    var result = await RestHub.Submit(FormQuery.Id, Response);

                    if (result.UserObject != null && (bool)result.UserObject)
                    {
                        ClearQuery.Execute(this);
                        MessageBox.Show(result.StatusMessage);
                        RefreshQueries.Execute(this);
                    }
                    else
                    {
                        MessageBox.Show("Can't Submitting Query . .");
                    }
                }
                catch (Exception ex)
                {
                    AppErrorBox.ShowErrorMessage("Error while Submitting Query . .", ex.ToString());
                }
            }
            else
            {
                MessageBox.Show("Please save query or select already created query to proceed . .");
            }
        }
Esempio n. 3
0
        private async void DoSaveQueryAsync(object obj)
        {
            Loading = true;
            if (FormQuery != null && FormQuery.TanId > 0 && !String.IsNullOrEmpty(FormQuery.TanNumber) && !String.IsNullOrEmpty(FormQuery.Title) && !String.IsNullOrEmpty(FormQuery.Comment) && U.RoleId != 4)
            {
                try
                {
                    QueryDTO dto = new QueryDTO()
                    {
                        Comment   = FormQuery.Comment,
                        Id        = FormQuery.Id,
                        Page      = FormQuery.Page,
                        QueryType = FormQuery.QueryType,
                        TanId     = FormQuery.TanId,
                        Title     = FormQuery.Title,
                    };
                    var result = await RestHub.SaveQuery(dto);

                    if (result.UserObject != null && (bool)result.UserObject)
                    {
                        MessageBox.Show(result.StatusMessage);
                        RefreshQueries.Execute(this);
                        ClearQuery.Execute(this);
                    }
                    else
                    {
                        MessageBox.Show("Can't Save Query . .");
                    }
                }
                catch (Exception ex)
                {
                    AppErrorBox.ShowErrorMessage("Error while saving Query . .", ex.ToString());
                }
            }
            else
            {
                AppInfoBox.ShowInfoMessage("Query can't be created without all required information . .");
            }
            Loading = false;
        }