Exemple #1
0
        public static ModelDataViewModel GetModel(int modelId)
        {
            var viewModel = new ModelDataViewModel
            {
                ModelID = modelId
            };

            try
            {
                using (_certonaService = new CertonaServiceClient())
                {
                    try
                    {
                        var request = new GetModelRequest
                        {
                            ModelID = modelId,
                            User    = FormsAuthenticationWrapper.User
                        };
                        GetModelResponse response = _certonaService.GetModel(request);

                        var columnGroupHeaders = new List <string>();


                        if (response.Errors != null && response.Errors.Count != 0)
                        {
                            viewModel.Errors = response.Errors.ToList();
                        }

                        if (response.Model != null)
                        {
                            ModelDTO mDTO = response.Model;
                            GetModelData(mDTO, ref viewModel.GridData, ref columnGroupHeaders);
                        }

                        viewModel.ColumnGroupHeaders = new string[columnGroupHeaders.Count];
                        viewModel.ColumnGroupHeaders = columnGroupHeaders.ToArray();
                        if (response.Model != null)
                        {
                            viewModel.CatalogName = response.Model.CatalogName;
                            viewModel.ModelName   = response.Model.Name;
                        }
                    }
                    catch (TimeoutException exception)
                    {
                        _certonaService.Abort();
                        throw;
                    }
                    catch (CommunicationException exception)
                    {
                        _certonaService.Abort();
                        throw;
                    }
                }
            }
            catch (Exception ex)
            {
                viewModel.Errors.Add(new ErrorResult
                {
                    Description = ex.Message
                });
            }

            return(viewModel);
        }
Exemple #2
0
        public ActionResult ModelsGridSelect([DataSourceRequest] DataSourceRequest request, int ModelID)
        {
            ModelDataViewModel viewModel = ModelsModel.GetModel(ModelID);

            return(Json(viewModel.GridData.ToDataSourceResult(request), JsonRequestBehavior.AllowGet));
        }