Beispiel #1
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 . .");
            }
        }
Beispiel #2
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;
        }