예제 #1
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;
        }