Exemple #1
0
 public DtoImportResult ImportPolicy(DtoPolicyExport export)
 {
     Request.Method = Method.POST;
     Request.AddJsonBody(export);
     Request.Resource = string.Format("{0}/ImportPolicy/", Resource);
     return(new ApiRequest().Execute <DtoImportResult>(Request));
 }
Exemple #2
0
 public ImportPolicy(DtoPolicyExport export)
 {
     _export        = export;
     _policyService = new ServicePolicy();
     _policy        = new EntityPolicy();
     _uow           = new UnitOfWork();
 }
Exemple #3
0
 public ExportPolicy()
 {
     _policyService          = new ServicePolicy();
     _filter                 = new DtoModuleSearchFilter();
     _policyExport           = new DtoPolicyExport();
     _filter.IncludeCommand  = true;
     _filter.IncludeFileCopy = true;
     _filter.IncludePrinter  = true;
     _filter.IncludeScript   = true;
     _filter.IncludeSoftware = true;
     _filter.IncludeWu       = true;
     _filter.IncludeMessage  = true;
     _filter.Limit           = Int32.MaxValue;
 }
Exemple #4
0
        protected void btnImport_OnClick(object sender, EventArgs e)
        {
            if (FileImport.HasFile)
            {
                string json;
                using (var inputStreamReader = new StreamReader(FileImport.PostedFile.InputStream))
                {
                    json = inputStreamReader.ReadToEnd();
                }

                var policy = new DtoPolicyExport();
                try
                {
                    policy = JsonConvert.DeserializeObject <DtoPolicyExport>(json);
                }
                catch
                {
                    EndUserMessage = "Could Not Parse JSON";
                    return;
                }

                var result = Call.PolicyApi.ImportPolicy(policy);

                if (result == null)
                {
                    EndUserMessage = "Policy Import Failed.  Unknown Error.";
                    return;
                }

                if (!result.Success)
                {
                    EndUserMessage = "Policy Import Failed.  " + result.ErrorMessage;
                    return;
                }

                EndUserMessage = "Successfully Imported Policy.  ";

                if (result.HasInternalFiles)
                {
                    EndUserMessage += "This Policy Has Additional Files That Must Be Uploaded Prior To Use.  ";
                }

                if (result.HasExternalFiles)
                {
                    EndUserMessage +=
                        "This Policy Has External Files That Have Been Queued For Download.  Policy Cannot Be Activated Until All Downloads Are Completed.";
                }
            }
        }
Exemple #5
0
 public DtoImportResult ImportPolicy(DtoPolicyExport export)
 {
     return(new ImportPolicy(export).Import());
 }