public void Test_When_Save_With_Invalid_Expiry_Date()
        {
            var package = new Package()
            {
                Title = "testsers",
                Description = "testers",
                ModifiedDate = DateTime.Now.AddDays(-5)
            };

            var repositoryMock = new Mock<UnitOfWork>();
            repositoryMock.Setup(x => x.PackageRepository.Insert(package));

            var repository = new PackageService(repositoryMock.Object);

            repository.InsertPackage(package);
        }
Example #2
0
        private static PackageService GetPackageService()
        {
            var packageRegistrationRepository = new FakeEntityRepository <PackageRegistration>();
            var packageRepository             = new FakeEntityRepository <Package>();
            var certificateRepository         = new FakeEntityRepository <Certificate>();
            var auditingService       = new FakeAuditingService();
            var telemetryService      = new FakeTelemetryService();
            var securityPolicyService = new FakeSecurityPolicyService();
            var contextFake           = new FakeEntitiesContext();

            var packageService = new PackageService(
                packageRegistrationRepository,
                packageRepository,
                certificateRepository,
                auditingService,
                telemetryService,
                securityPolicyService,
                contextFake);

            return(packageService);
        }
Example #3
0
        static void Main(string[] args)
        {
            var packageService  = new PackageService();
            var package         = packageService.OpenPackage(@"C:\Users\aghisa\Desktop\Transit packages\PACK_00000228_TRA_HUN_00_HUN.PPF");
            var templateService = new TemplateService();
            var templateList    = templateService.LoadProjectTemplates();
            var packageModel    = new PackageModel
            {
                //Name = package.Name,
                //Description = package.Description,
                //StudioTemplates = templateList,
                //SourceLanguage = package.SourceLanguage,
                //TargetLanguage = package.TargetLanguage,
                //SourceFiles = package.SourceFiles,
                //TargetFiles = package.TargetFiles
            };

            StarTransitMainWindow mainWindow = new StarTransitMainWindow(packageModel);

            mainWindow.ShowDialog();
        }
Example #4
0
        private async Task DownloadModule(string moduledefinitionname, string version)
        {
            try
            {
                await PackageService.DownloadPackageAsync(moduledefinitionname, version, "Modules");

                await logger.LogInformation("Module Downloaded {ModuleDefinitionName} {Version}", moduledefinitionname, version);

                ShowProgressIndicator();
                var interop = new Interop(JSRuntime);
                await interop.RedirectBrowser(NavigateUrl(), 10);

                await ModuleDefinitionService.InstallModuleDefinitionsAsync();
            }
            catch (Exception ex)
            {
                await logger.LogError(ex, "Error Downloading Module {ModuleDefinitionName} {Version} {Error}", moduledefinitionname, version, ex.Message);

                AddModuleMessage("Error Downloading Module", MessageType.Error);
            }
        }
Example #5
0
 /// <summary>
 /// Handles the Click event of the lbExport control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
 protected void lbExport_Click(object sender, EventArgs e)
 {
     if (_pageId.HasValue)
     {
         var pageService    = new PageService(new RockContext());
         var page           = pageService.Get(_pageId.Value);
         var packageService = new PackageService();
         var pageName       = page.InternalName.Replace(" ", "_") + (cbExportChildren.Checked ? "_wChildPages" : string.Empty);
         using (var stream = packageService.ExportPage(page, cbExportChildren.Checked))
         {
             EnableViewState = false;
             Response.Clear();
             Response.ContentType = "application/octet-stream";
             Response.AddHeader("content-disposition", "attachment; filename=" + pageName + ".nupkg");
             Response.Charset = string.Empty;
             Response.BinaryWrite(stream.ToArray());
             Response.Flush();
             Response.End();
         }
     }
 }
Example #6
0
        public static bool MakeSignup(RequesterViewModel requesterViewModel)
        {
            var response = new PackageService().SaveRequesterDetails(requesterViewModel);

            if (response == null)
            {
                return(false);
            }

            SessionWrapper.LoggedUser = new EknowIDModel.User()
            {
                FirstName = response.FirstName,
                LastName  = response.LastName,
                UserId    = response.UserId,
                Email     = response.Email,
                IsAdmin   = true,
                CompanyId = response.CompanyId
            };

            return(true);
        }
Example #7
0
        public Distributor(int maxAddThreads = 10, int maxPackageThreads = 10, MegaBytes maxMemory = MegaBytes.OneGB)
        {
            Bootstrapper.Init();

            _packageTasks   = new BlockingCollection <Action>(new ConcurrentQueue <Action>());
            _addDataTasks   = new BlockingCollection <Action>(new ConcurrentQueue <Action>());
            _packageService = new PackageService();

            Cts = new CancellationTokenSource();

            _threadManager = new ThreadManager(maxAddThreads,
                                               maxPackageThreads,
                                               Cts.Token,
                                               new List <Task>
            {
                ManageTaskAction(TaskType.AddData),
                ManageTaskAction(TaskType.Package)
            }, (int)maxMemory);

            Logger.Debug("Created");
        }
Example #8
0
        public ActionResult Create(PackageModel model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    var package = Mapper.Map <Package>(model);
                    var result  = PackageService.AddPackage(package);

                    if (result.Succes)
                    {
                        return(RedirectToAction("List"));
                    }
                }
            }
            catch
            {
                return(View(model));
            }
            return(View(model));
        }
Example #9
0
 public ActionResult Edit(PackageViewModel viewModel, int?page)
 {
     if (ModelState.IsValid && viewModel.SelectedProductId > 0 && viewModel.SelectedPackageConfigurationId > 0)
     {
         var package = AutoMapper.Mapper.Map <PackageViewModel, IPackage>(viewModel);
         if (viewModel != null)
         {
             if (viewModel.SelectedProductId > 0)
             {
                 package.Product = ProductService.GetById(viewModel.SelectedProductId);
             }
             if (viewModel.SelectedPackageConfigurationId > 0)
             {
                 package.PackageConfiguration = PackageConfigurationService.GetById(viewModel.SelectedPackageConfigurationId);
             }
         }
         PackageService.CreateOrUpdate(package);
         return(RedirectToAction("Index", new { page }));
     }
     return(View(viewModel));
 }
Example #10
0
 public ActionResult CreatePackage(PackagemasterModel model)
 {
     if (ModelState.IsValid)
     {
         Package package = new Package();
         package.PackageId             = model.PackageId;
         package.Name                  = model.Name;
         package.Detail                = model.Detail;
         package.Cost                  = model.Cost;
         package.Validity              = model.Validity;
         package.No_of_Registration    = model.No_of_Registration;
         package.Cost_per_Registration = model.Cost_per_Registration;
         package.No_of_Events          = model.No_of_Events;
         package.IsActive              = model.IsActive;
         package.Createddate           = DateTime.Now;
         package.Updateddate           = DateTime.Now;
         PackageService.InsertPackage(package);
         ViewBag.Message = "Package successfully added ";
     }
     return(View(model));
 }
        private async Task DownloadTheme(string themename, string version)
        {
            try
            {
                await PackageService.DownloadPackageAsync(themename, version, "Themes");

                await logger.LogInformation("Theme Downloaded {ThemeName} {Version}", themename, version);

                ShowProgressIndicator();
                var interop = new Interop(JSRuntime);
                await interop.RedirectBrowser(NavigateUrl(), 10);

                await ThemeService.InstallThemesAsync();
            }
            catch (Exception ex)
            {
                await logger.LogError(ex, "Error Downloading Theme {ThemeName} {Version} {Error}", themename, version, ex.Message);

                AddModuleMessage("Error Downloading Theme", MessageType.Error);
            }
        }
Example #12
0
        protected override async void Execute()
        {
            Utils.EnsureApplicationResources();

            var pathToTempFolder = CreateTempPackageFolder();

            try
            {
                var fileDialog = new OpenFileDialog
                {
                    Filter = @"Transit Project Package Files (*.ppf)|*.ppf"
                };
                var dialogResult = fileDialog.ShowDialog();
                if (dialogResult == DialogResult.OK)
                {
                    var path           = fileDialog.FileName;
                    var packageService = new PackageService();
                    var package        = await packageService.OpenPackage(path, pathToTempFolder);

                    var templateService = new TemplateService();
                    var templateList    = templateService.LoadProjectTemplates();

                    var packageModel = new PackageModel
                    {
                        Name            = package.Name,
                        Description     = package.Description,
                        StudioTemplates = templateList,
                        LanguagePairs   = package.LanguagePairs,
                        PathToPrjFile   = package.PathToPrjFile
                    };

                    // Start BackgroundWorder in InitializeMain method to have app working separately than Trados Studio process
                    Program.InitializeMain(packageModel);
                }
            }
            catch (PathTooLongException ptle)
            {
                System.Windows.Forms.MessageBox.Show(ptle.Message);
            }
        }
Example #13
0
        /// <summary>
        /// Run the code example.
        /// </summary>
        public void Run(AdManagerUser user)
        {
            using (PackageService packageService = user.GetService <PackageService>())
            {
                // Create a statement to select packages.
                int pageSize = StatementBuilder.SUGGESTED_PAGE_LIMIT;
                StatementBuilder statementBuilder = new StatementBuilder()
                                                    .Where("status = :status")
                                                    .OrderBy("id ASC")
                                                    .Limit(pageSize)
                                                    .AddValue("status", PackageStatus.IN_PROGRESS.ToString());

                // Retrieve a small amount of packages at a time, paging through until all
                // packages have been retrieved.
                int totalResultSetSize = 0;
                do
                {
                    PackagePage page =
                        packageService.getPackagesByStatement(statementBuilder.ToStatement());

                    // Print out some information for each package.
                    if (page.results != null)
                    {
                        totalResultSetSize = page.totalResultSetSize;
                        int i = page.startIndex;
                        foreach (Package pkg in page.results)
                        {
                            Console.WriteLine(
                                "{0}) Package with ID {1}, name \"{2}\", and proposal ID {3} was " +
                                "found.",
                                i++, pkg.id, pkg.name, pkg.proposalId);
                        }
                    }

                    statementBuilder.IncreaseOffsetBy(pageSize);
                } while (statementBuilder.GetOffset() < totalResultSetSize);

                Console.WriteLine("Number of results found: {0}", totalResultSetSize);
            }
        }
Example #14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            IPackageRepository packageRepository = new PackageRepository(ConfigurationManager.ConnectionStrings["ENetCare"].ConnectionString);

            _packageService = new PackageService(packageRepository);

            IEmployeeRepository repository = new EmployeeRepository(ConfigurationManager.ConnectionStrings["ENetCare"].ConnectionString);

            _employeeService = new EmployeeService(repository);

            ucPackageBarcode.AddValidate += PackageBarcodeOnAdd;

            if (!Page.IsPostBack)
            {
                SetReceiveDateTextBox(DateTime.Today);
            }
            else if (!string.IsNullOrEmpty(Request.Form[txtReceiveDate.UniqueID]))
            {
                DateTime receiveDate = DateTime.Parse(Request.Form[txtReceiveDate.UniqueID]);
                SetReceiveDateTextBox(receiveDate);
            }
        }
        public void DeletePackageEnsureRepositoryIsCalled()
        {
            var             isCalled = false;
            var             packRepo = new Mock <IPackageRepository>();
            IPackageService service  = new PackageService(packRepo.Object);
            Package         package  = new Package()

            {
                Id          = 1,
                description = "hej",
                price       = "500 pr billede"
            };

            packRepo.Setup(x => x.Delete(package.Id)).Callback(() => isCalled = true).Returns(new Package()
            {
                Id          = 1,
                description = "hej",
                price       = "500 pr billede"
            });
            service.Delete(package.Id);
            Assert.True(isCalled);
        }
Example #16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            IPackageRepository packageRepository = new PackageRepository(ConfigurationManager.ConnectionStrings["ENetCare"].ConnectionString);

            _packageService = new PackageService(packageRepository);

            //Use the custom Barcode event which is triggered when a new barcode is to be added
            ucPackageBarcode.AddValidate += PackageBarcodeOnAdd;

            if (!Page.IsPostBack)
            {
                IEmployeeRepository repository = new EmployeeRepository(ConfigurationManager.ConnectionStrings["ENetCare"].ConnectionString);
                var employeeService            = new EmployeeService(repository);

                EmployeeMembershipUser user   = (EmployeeMembershipUser)System.Web.Security.Membership.GetUser();
                DistributionCentre     centre = employeeService.GetDistributionCentre(user.DistributionCentreId);

                //Save centre and username in the viewstate
                ViewState["DistributionCentre"] = centre;
                ViewState["EmployeeUsername"]   = user.UserName;
            }
        }
Example #17
0
        private async void button1_Click(object sender, EventArgs e)
        {
            string error   = "";
            var    project = new UserProject("xxxxx", "D:\\ApowerCompress\\trunck\\src\\ApowerCompress\\ApowerCompress.csproj", "D:\\ApowerCompress\\trunck\\src");

            if (CertificateSerive.StartSignServer(out error))
            {
                var connected = await CertificateSerive.Connect();

                if (!connected)
                {
                    return;
                }
                await PackageService.Pack(project);

                CertificateSerive.DisConnect();
            }
            else
            {
                MessageBox.Show($"自动签名工具启动失败,{error}");
            }
        }
Example #18
0
        private void DisplayPackage()
        {
            // get package id
            int packageId = -1;

            if (!string.IsNullOrWhiteSpace(PageParameter("PackageId")))
            {
                packageId = Convert.ToInt32(PageParameter("PackageId"));
            }

            PackageService packageService = new PackageService();
            var            package        = packageService.GetPackage(packageId);

            var mergeFields = new Dictionary <string, object>();

            mergeFields.Add("Package", package);
            mergeFields.Add("CurrentPerson", CurrentPerson);

            var globalAttributeFields = Rock.Web.Cache.GlobalAttributesCache.GetMergeFields(CurrentPerson);

            globalAttributeFields.ToList().ForEach(d => mergeFields.Add(d.Key, d.Value));

            lOutput.Text = GetAttributeValue("LavaTemplate").ResolveMergeFields(mergeFields);

            if (GetAttributeValue("SetPageTitle").AsBoolean())
            {
                string pageTitle = package.Name;
                RockPage.PageTitle    = pageTitle;
                RockPage.BrowserTitle = String.Format("{0} | {1}", pageTitle, RockPage.Site.Name);
                RockPage.Header.Title = String.Format("{0} | {1}", pageTitle, RockPage.Site.Name);
            }

            // show debug info
            if (GetAttributeValue("EnableDebug").AsBoolean() && IsUserAuthorized(Authorization.EDIT))
            {
                lDebug.Visible = true;
                lDebug.Text    = mergeFields.lavaDebugInfo();
            }
        }
Example #19
0
        /// <summary>
        /// Run the code example.
        /// </summary>
        /// <param name="user">The DFP user object running the code example.</param>
        public override void Run(DfpUser user)
        {
            // Get the PackageService.
            PackageService packageService =
                (PackageService)user.GetService(DfpService.v201602.PackageService);

            // Create a statement to only select packages that are in progress.
            StatementBuilder statementBuilder = new StatementBuilder()
                                                .Where("status = :status")
                                                .OrderBy("id ASC")
                                                .Limit(StatementBuilder.SUGGESTED_PAGE_LIMIT)
                                                .AddValue("status", PackageStatus.IN_PROGRESS.ToString());

            // Set default for page.
            PackagePage page = new PackagePage();

            try {
                do
                {
                    // Get packages by statement.
                    page = packageService.getPackagesByStatement(statementBuilder.ToStatement());

                    if (page.results != null && page.results.Length > 0)
                    {
                        int i = page.startIndex;
                        foreach (Package package in page.results)
                        {
                            Console.WriteLine("{0}) Package with ID = \"{1}\", name = \"{2}\" for proposal ID " +
                                              "\"{3}\" was found.", i++, package.id, package.name, package.proposalId);
                        }
                    }
                    statementBuilder.IncreaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
                } while(statementBuilder.GetOffset() < page.totalResultSetSize);
                Console.WriteLine("Number of results found: " + page.totalResultSetSize);
            } catch (Exception e) {
                Console.WriteLine("Failed to get packages. Exception says \"{0}\"",
                                  e.Message);
            }
        }
Example #20
0
        public void AddDocumentsToPackagesTest()
        {
            //Arrange
            setUp();
            PackageService s = new PackageService();

            //Act
            var Repository = new DocuRepository(MockContext);
            int p          = s.AddPackage("foo");
            int p2         = s.AddPackage("bar");

            s.AddDocumentToPackage(Repository.GetDocumentByName("Test Document").DocumentID, p);
            s.AddDocumentToPackage(Repository.GetDocumentByName("Test Document 2").DocumentID, p);
            s.AddDocumentToPackage(Repository.GetDocumentByName("Test Document 2").DocumentID, p2);

            //Assert
            Assert.AreEqual(Repository.GetPDs().Count(), 3);
            Assert.AreEqual(Repository.GetPDsByDocName("Test Document").Count(), 1);
            Assert.AreEqual(Repository.GetPDsByDocName("Test Document 2").Count(), 2);
            Assert.AreEqual(Repository.GetPDsByDocName("foo").Count(), 2);
            Assert.AreEqual(Repository.GetPDsByDocName("bar").Count(), 1);
        }
Example #21
0
        private void LoadPackages()
        {
            // get category
            int?categoryId = null;

            if (!string.IsNullOrWhiteSpace(GetAttributeValue("CategoryId")))
            {
                categoryId = Convert.ToInt32(GetAttributeValue("CategoryId"));
            }
            else if (!string.IsNullOrWhiteSpace(PageParameter("CategoryId")))
            {
                categoryId = Convert.ToInt32(PageParameter("CategoryId"));
            }

            string categoryName = PageParameter("CategoryName");

            if (GetAttributeValue("SetPageTitle").AsBoolean() && !string.IsNullOrWhiteSpace(categoryName))
            {
                string pageTitle = "Items for " + categoryName;
                RockPage.PageTitle    = pageTitle;
                RockPage.BrowserTitle = String.Format("{0} | {1}", pageTitle, RockPage.Site.Name);
                RockPage.Header.Title = String.Format("{0} | {1}", pageTitle, RockPage.Site.Name);
            }

            PackageService packageService = new PackageService();
            var            packages       = packageService.GetAllPackages(categoryId);

            var mergeFields = Rock.Lava.LavaHelper.GetCommonMergeFields(this.RockPage, this.CurrentPerson);

            // add link to detail page
            Dictionary <string, object> linkedPages = new Dictionary <string, object>();

            linkedPages.Add("DetailPage", LinkedPageRoute("DetailPage"));
            mergeFields.Add("LinkedPages", linkedPages);

            mergeFields.Add("Packages", packages);

            lOutput.Text = GetAttributeValue("LavaTemplate").ResolveMergeFields(mergeFields);
        }
        public async Task CreateAsyncShouldCreateAndSavePackageToDb()
        {
            var db = DbInfrastructure.GetDatabase();

            var mockUserManager = this.GetUserManagerMock();

            mockUserManager
            .Setup(m => m.FindByIdAsync(It.IsAny <string>()))
            .Returns((string id) => db.Users.SingleOrDefaultAsync(u => u.Id == id));

            var receiptService = new Mock <IReceiptService>().Object;

            var packageService = new PackageService(db, receiptService, mockUserManager.Object);

            var user = new User
            {
                UserName = "******"
            };

            await db.AddAsync(user);

            await db.SaveChangesAsync();

            var model = await packageService.CreateAsync(Description, Weight, ShippingAddress, user.Id);

            var package = await db.Packages.FirstOrDefaultAsync();

            package
            .Should()
            .Match <Package>(p => p.Description == Description)
            .And
            .Match <Package>(p => p.RecipientId == user.Id)
            .And
            .Match <Package>(p => p.ShippingAddress == ShippingAddress)
            .And
            .Match <Package>(p => p.Status == Status.Pending)
            .And
            .Match <Package>(p => p.Weight == Weight);
        }
        public async Task AllShippedAsyncShouldReturnOnlyShippedPackages()
        {
            var db = DbInfrastructure.GetDatabase();

            var mockUserManager = this.GetUserManagerMock();

            mockUserManager
            .Setup(m => m.FindByIdAsync(It.IsAny <string>()))
            .Returns((string id) => db.Users.SingleOrDefaultAsync(u => u.Id == id));

            var receiptService = new Mock <IReceiptService>().Object;

            var packageService = new PackageService(db, receiptService, mockUserManager.Object);

            await AddPackagesToDb(db);

            var shipped = await packageService.AllShippedAsync();

            shipped
            .Should()
            .HaveCount(30);
        }
        /// <summary>
        /// Run the code example.
        /// </summary>
        /// <param name="user">The DFP user object running the code example.</param>
        public override void Run(DfpUser user)
        {
            // Get the PackageService.
            PackageService packageService =
                (PackageService)user.GetService(DfpService.v201505.PackageService);

            // Create a statement to get all packages.
            StatementBuilder statementBuilder = new StatementBuilder()
                                                .OrderBy("id ASC")
                                                .Limit(StatementBuilder.SUGGESTED_PAGE_LIMIT);

            // Set default for page.
            PackagePage page = new PackagePage();

            try {
                do
                {
                    // Get packages by statement.
                    page = packageService.getPackagesByStatement(statementBuilder.ToStatement());

                    if (page.results != null && page.results.Length > 0)
                    {
                        int i = page.startIndex;
                        foreach (Package package in page.results)
                        {
                            Console.WriteLine("{0}) Package with ID = \"{1}\", name = \"{2}\" was found for " +
                                              "proposal ID \"{3}\".", i++, package.id, package.name, package.proposalId);
                        }
                    }

                    statementBuilder.IncreaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
                } while (statementBuilder.GetOffset() < page.totalResultSetSize);

                Console.WriteLine("Number of results found: {0}", page.totalResultSetSize);
            } catch (Exception ex) {
                Console.WriteLine("Failed to get all packages. Exception says \"{0}\"",
                                  ex.Message);
            }
        }
Example #25
0
        public static bool DownloadOrderStatusReport(int orderId)
        {
            try {
                string PDF_File_Path           = GetFilePath() + "\\" + orderId.ToString() + ".pdf";
                string encrypted_PDF_File_Path = GetFilePath() + "\\E" + orderId.ToString() + ".pdf";

                if (!File.Exists(PDF_File_Path))
                {
                    var packageService = new PackageService();
                    var pdf            = new CreatePDF(orderId);
                    pdf.UrlTOPDF(packageService.GetOrderStateStatus(orderId).URL);
                }

                if (!File.Exists(encrypted_PDF_File_Path))
                {
                    FileStream stream = File.OpenRead(PDF_File_Path);

                    int    length = Convert.ToInt32(stream.Length);
                    byte[] data   = new byte[length];
                    stream.Read(data, 0, length);
                    stream.Close();
                    using (MemoryStream input = new MemoryStream(data)) {
                        using (MemoryStream output = new MemoryStream()) {
                            eknowID.Model.Candidate candidate = UserHelper.GetCandidateByOrderId(orderId);
                            string    password = candidate.Email;
                            PdfReader reader   = new PdfReader(input);
                            PdfEncryptor.Encrypt(reader, output, true, password, password, PdfWriter.ALLOW_SCREENREADERS);
                            data = output.ToArray();
                        }
                    }

                    File.WriteAllBytes(encrypted_PDF_File_Path, data);
                }
                return(true);
            } catch (Exception ex) {
                return(false);
            }
        }
Example #26
0
    public void PackageService_LoadsFiles()
    {
        var packages = GetDefaultTargetTestPackages();

        var logger  = Substitute.For <ILogger <PackageService> >();
        var context = Substitute.For <IContext>();

        context.Settings?.Target.Returns("net6.0");
        context.Settings?.LocalFolder.Returns(Path.GetTempPath());

        var loader = Substitute.For <ILoader <IEnumerable <IPackage> > >();

        loader.TryLoad(Arg.Any <string>(), out Arg.Any <IEnumerable <IPackage> >())
        .Returns(x =>
        {
            x[1] = packages;
            return(true);
        });
        IPackageService sut = new PackageService(loader, logger);

        sut.Refresh("");
        sut.Items.Should().BeEquivalentTo(packages);
    }
Example #27
0
        private IEnumerable GetData(int SearchRecords, string SearchTitle, string Alpha)
        {
            SearchTitle = SearchTitle.Trim().ToLower();
            Alpha       = Alpha.Trim().ToLower();

            List <PackagemasterModel> packagelist = new List <PackagemasterModel>();
            var packagedata = PackageService.PackageDetails(SearchTitle, Alpha);

            foreach (var data in packagedata)
            {
                PackagemasterModel packagemasterModel = new PackagemasterModel();
                packagemasterModel.PackageId             = data.PackageId;
                packagemasterModel.Name                  = data.Name;
                packagemasterModel.Detail                = data.Detail;
                packagemasterModel.Cost                  = data.Cost;
                packagemasterModel.Validity              = data.Validity;
                packagemasterModel.No_of_Registration    = data.No_of_Registration;
                packagemasterModel.Cost_per_Registration = data.Cost_per_Registration;
                packagemasterModel.No_of_Events          = data.No_of_Events;
                packagelist.Add(packagemasterModel);
            }
            return(packagelist);
        }
Example #28
0
 private void init(RestClient restClient, String apiKey)
 {
     packageService               = new PackageService(restClient, this.baseUrl, jsonSerializerSettings);
     reportService                = new ReportService(restClient, this.baseUrl, jsonSerializerSettings);
     systemService                = new SystemService(restClient, this.baseUrl, jsonSerializerSettings);
     signingService               = new SigningService(restClient, this.baseUrl, jsonSerializerSettings);
     signatureImageService        = new SignatureImageService(restClient, this.baseUrl, jsonSerializerSettings);
     sessionService               = new SessionService(apiKey, this.baseUrl);
     fieldSummaryService          = new FieldSummaryService(new FieldSummaryApiClient(apiKey, this.baseUrl));
     auditService                 = new AuditService(apiKey, this.baseUrl);
     eventNotificationService     = new EventNotificationService(new EventNotificationApiClient(restClient, this.baseUrl, jsonSerializerSettings));
     customFieldService           = new CustomFieldService(new CustomFieldApiClient(restClient, this.baseUrl, jsonSerializerSettings));
     groupService                 = new GroupService(new GroupApiClient(restClient, this.baseUrl, jsonSerializerSettings));
     accountService               = new AccountService(new AccountApiClient(restClient, this.baseUrl, jsonSerializerSettings));
     approvalService              = new ApprovalService(new ApprovalApiClient(restClient, this.baseUrl, jsonSerializerSettings));
     reminderService              = new ReminderService(new ReminderApiClient(restClient, this.baseUrl, jsonSerializerSettings));
     templateService              = new TemplateService(new TemplateApiClient(restClient, this.baseUrl, jsonSerializerSettings), packageService);
     authenticationTokenService   = new AuthenticationTokenService(restClient, this.baseUrl);
     attachmentRequirementService = new AttachmentRequirementService(restClient, this.baseUrl, jsonSerializerSettings);
     layoutService                = new LayoutService(new LayoutApiClient(restClient, this.baseUrl, jsonSerializerSettings));
     qrCodeService                = new QRCodeService(new QRCodeApiClient(restClient, this.baseUrl, jsonSerializerSettings));
     authenticationService        = new AuthenticationService(this.webpageUrl);
 }
        protected override async Task OnInitializedAsync()
        {
            try
            {
                var themes = await ThemeService.GetThemesAsync();

                _packages = await PackageService.GetPackagesAsync("theme");

                foreach (Package package in _packages.ToArray())
                {
                    if (themes.Exists(item => Utilities.GetTypeName(item.ThemeName) == package.PackageId))
                    {
                        _packages.Remove(package);
                    }
                }
            }
            catch (Exception ex)
            {
                await logger.LogError(ex, "Error Loading Packages {Error}", ex.Message);

                AddModuleMessage("Error Loading Packages", MessageType.Error);
            }
        }
Example #30
0
        public ActionResult Create(PackageViewModel viewModel)
        {
            if (ModelState.IsValid)
            {
                var package = AutoMapper.Mapper.Map <PackageViewModel, IPackage>(viewModel);
                if (viewModel.SelectedProductId > 0)
                {
                    package.Product = ProductService.GetById(viewModel.SelectedProductId);
                }
                if (viewModel.SelectedPackageConfigurationId > 0)
                {
                    package.PackageConfiguration = PackageConfigurationService.GetById(viewModel.SelectedPackageConfigurationId);
                }

                PackageService.CreateOrUpdate(package);
            }
            else
            {
                return(View(viewModel));
            }

            return(RedirectToAction("Index"));
        }
Example #31
0
        /// <summary>
        /// Initializes a new instance of the MainViewModel class.
        /// </summary>
        public MainViewModel()
        {
            ////if (IsInDesignMode)
            ////{
            ////    // Code runs in Blend --> create design time data.
            ////}
            ////else
            ////{
            ////    // Code runs "for real"
            ////}

            var commonApplicationData = System.Environment.GetFolderPath(System.Environment.SpecialFolder.CommonApplicationData);

            PackagesDir          = commonApplicationData + @"\RPAStudio\Packages";          //机器人默认读取nupkg包的位置
            InstalledPackagesDir = commonApplicationData + @"\RPAStudio\InstalledPackages"; //机器人默认安装nupkg包的位置
            if (PackageService == null)
            {
                PackageService = new PackageService(this);
            }

            Messenger.Default.Register <RunManager>(this, "BeginRun", BeginRun);
            Messenger.Default.Register <RunManager>(this, "EndRun", EndRun);
        }
Example #32
0
 public void AddPackageService(PackageService packageService)
 {
     packageService.Service = this;
     _packageServices.Add(packageService);
 }
        public ActionResult Lookup(string callsid, string pid)
        {
            var packageService = new PackageService();

            Task<Package>.Factory.StartNew(
                p => packageService.LocatePackage(pid),
                new Dictionary<string, string>() {
                    { "CallSid", callsid },
                    { "FoundRedirectUrl", Url.Action("Complete", null, null, Request.Url.Scheme) },
                    { "NotFoundRedirectUrl", Url.Action("NotFound", null, null, Request.Url.Scheme) },
                    { "ErrorRedirectUrl", Url.Action("Error", null, null, Request.Url.Scheme) }
                },
                CancellationToken.None
            ).ContinueWith(t =>
                {
                    Dictionary<string, string> state = (Dictionary<string, string>)t.AsyncState;

                    if (t.IsCanceled || t.IsFaulted)
                    {
                        RedirectCall(state["CallSid"], state["ErrorRedirectUrl"]);
                    }

                    if (t.Result == null)
                    {
                        RedirectCall(state["CallSid"], state["NotFoundRedirectUrl"]);
                    }
                    else
                    {
                        string url = string.Format("{0}?s={1}", state["FoundRedirectUrl"], t.Result.Status);
                        RedirectCall(state["CallSid"], url);
                    }

                    return;
                }
            );

            var response = new TwilioResponse();
            response.Play(
                Url.AbsoluteContent("~/Content/Audio/clocktickfast.mp3", Request.Url.AbsoluteUri),
                new { loop = "true" });
            return TwiML(response);
        }