示例#1
0
        /// <summary>
        ///     This method initializes the NeverBounceSDK
        /// </summary>
        /// <param name="ApiKey">The api key to use to make the requests</param>
        /// <param name="Host">Specify a different host to make the request to. Leave null to use 'https://api.neverbounce.com'</param>
        /// <param name="Client">An instance of IHttpClient to use; useful for mocking HTTP requests</param>
        public NeverBounceSdk(string ApiKey, string Host = null, IHttpClient Client = null)
        {
            _apiKey = ApiKey;

            // Accept debug host
            if (Host != null)
            {
                _host = Host;
            }

            // Check for mocked IHttpClient, if none exists create default
            if (Client == null)
            {
                _client = new HttpClientWrapper();
            }
            else
            {
                _client = Client;
            }

            Account = new AccountService(_client, _apiKey, _host);
            Jobs    = new JobsService(_client, _apiKey, _host);
            POE     = new POEService(_client, _apiKey, _host);
            Single  = new SingleService(_client, _apiKey, _host);
        }
        public ActionResult Edit([Bind(Include = "Singleid,Serviceid,Name,Description,Image,date,Keyword,MetaDescription")] SingleService singleService, HttpPostedFileBase file, Helper Help)
        {
            if (ModelState.IsValid)
            {
                singleService.date  = System.DateTime.Now;
                singleService.Image = file != null?Help.uploadfile(file) : img;

                #region delete file
                string fullPath = Request.MapPath("~/UploadedFiles/" + img);
                if (img == singleService.Image)
                {
                }
                else
                {
                    if (System.IO.File.Exists(fullPath))
                    {
                        System.IO.File.Delete(fullPath);
                    }
                }
                #endregion
                db.Entry(singleService).State = EntityState.Modified;
                db.SaveChanges();
                TempData["Success"] = "Updated Successfully";
                return(RedirectToAction("Index"));
            }
            ViewBag.Serviceid = new SelectList(db.Services, "Serviceid", "Name", singleService.Serviceid);
            return(View(singleService));
        }
示例#3
0
        void SetupServiceToggle(SingleService singleService)
        {
            m_MainServiceToggle.SetProperty(k_ServiceNameProperty, singleService.name);
            m_MainServiceToggle.SetValueWithoutNotify(singleService.IsServiceEnabled());
            SetupServiceToggleLabel(m_MainServiceToggle, singleService.IsServiceEnabled());
            m_MainServiceToggle.SetEnabled(false);
            if (m_GoToDashboard != null)
            {
                m_GoToDashboard.style.display = (singleService.IsServiceEnabled()) ? DisplayStyle.Flex : DisplayStyle.None;
            }

            if (singleService.displayToggle)
            {
                m_MainServiceToggle.RegisterValueChangedCallback(evt =>
                {
                    if (currentUserPermission != UserRole.Owner && currentUserPermission != UserRole.Manager)
                    {
                        m_MainServiceToggle.SetValueWithoutNotify(evt.previousValue);
                        SetupServiceToggleLabel(m_MainServiceToggle, evt.previousValue);
                        return;
                    }
                    SetupServiceToggleLabel(m_MainServiceToggle, evt.newValue);
                    singleService.EnableService(evt.newValue);
                    if (m_GoToDashboard != null)
                    {
                        m_GoToDashboard.style.display = (evt.newValue) ? DisplayStyle.Flex : DisplayStyle.None;
                    }
                });
            }
            else
            {
                m_MainServiceToggle.style.display = DisplayStyle.None;
            }
        }
        public InstallPackageSection(VisualElement containerElement, SingleService service)
        {
            m_ServiceInstance = service;

            VisualElementUtils.AddUxmlToVisualElement(containerElement, VisualElementConstants.UxmlPaths.InstallPackageTemplate);
            SetupInstallMessage(containerElement, service.title);
            SetupInstallButton(containerElement);
            SetupInstallationHandler(service);
        }
        public ActionResult DeleteConfirmed(int id)
        {
            SingleService singleService = db.SingleServices.Find(id);

            db.SingleServices.Remove(singleService);
            db.SaveChanges();
            TempData["Success"] = "Deleted Successfully";
            return(RedirectToAction("Index"));
        }
        // GET: OfficialAdmin/SingleServices/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            SingleService singleService = db.SingleServices.Find(id);

            if (singleService == null)
            {
                return(HttpNotFound());
            }
            return(View(singleService));
        }
示例#7
0
 private async void Enrol(object obj)
 {
     if (Date != null)
     {
         var s = new SingleService
         {
             Customer      = SelectedCustomer,
             Date          = Date.Value,
             ServiceTypeId = SelectedServiceType.Id,
             InstructorId  = SelectedInstructor.Id
         };
         await _serviceProxy.EnrolSingleService(s);
     }
     NavigationCommands.GoToPage.Execute("/Home.xaml", null);
 }
        public ActionResult Create([Bind(Include = "Singleid,Serviceid,Name,Description,Image,date,Keyword,MetaDescription")] SingleService singleService, HttpPostedFileBase file, Helper Help)
        {
            if (ModelState.IsValid)
            {
                singleService.date  = System.DateTime.Now;
                singleService.Image = Help.uploadfile(file);
                db.SingleServices.Add(singleService);
                db.SaveChanges();
                TempData["Success"] = "Saved Successfully";
                return(RedirectToAction("Index"));
            }

            ViewBag.Serviceid = new SelectList(db.Services, "Serviceid", "Name", singleService.Serviceid);
            return(View(singleService));
        }
        /// <summary>
        ///     This method initializes the NeverBounceSDK
        /// </summary>
        /// <param name="ApiKey">The api key to use to make the requests</param>
        /// <param name="Version">The api version to make this request on</param>
        /// <param name="Host">Specify a different host to make the request to. Leave null to use 'https://api.neverbounce.com'</param>
        /// <param name="Client">An instance of IHttpClient to use; useful for mocking HTTP requests</param>
        public NeverBounceSdk(string ApiKey, string Version = "v4.2", string Host = null, IHttpClient Client = null)
        {
            _apiKey  = ApiKey;
            _version = Version;

            // Check for mocked IHttpClient, if none exists create default
            _client = Client ?? new HttpClientWrapper();

            var url = $"{Host ?? _host}/{_version}";

            Account = new AccountService(_client, _apiKey, url);
            Jobs    = new JobsService(_client, _apiKey, url);
            POE     = new POEService(_client, _apiKey, url);
            Single  = new SingleService(_client, _apiKey, url);
        }
示例#10
0
        /// <summary>
        ///     Business object to data access conversion
        /// </summary>
        /// <param name="service">Business object single service</param>
        /// <returns>Data access course object</returns>
        public static SingleService DtoToViewModelSingleService(DtoService service)
        {
            var ret = new SingleService
            {
                Id                 = service.Id,
                ServiceTypeId      = service.ServiceTypeId,
                ServiceTypeName    = service.ServiceTypeName,
                InstructorId       = service.InstructorId,
                InstructorFullName = service.InstructorFullName,
                Date               = service.Dates.First(),
                Customer           = CustomerConverter.DtoToViewModel(service.Customers.First()),
                SportName          = service.SportName
            };

            return(ret);
        }
        void SetupInstallationHandler(SingleService singleService)
        {
            m_PackageInstallationHandler = new PackageInstallationHandler(singleService);
            m_PackageInstallationHandler.packageSearchComplete       += OnPackageSearchComplete;
            m_PackageInstallationHandler.packageInstallationComplete += OnPackageInstallationComplete;

            if (IsInternetReachable())
            {
                m_PackageInstallationHandler.StartPackageSearch();
                SetInstallButtonTooltip(Tooltips.Choice.SearchingForPackage);
            }
            else
            {
                SetInstallButtonTooltip(Tooltips.Choice.InternetUnreachable);
            }
        }
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            SingleService singleService = db.SingleServices.Find(id);

            img = singleService.Image;
            if (singleService == null)
            {
                return(HttpNotFound());
            }
            ViewBag.Serviceid = new SelectList(db.Services, "Serviceid", "Name", singleService.Serviceid);
            return(View(singleService));
        }
示例#13
0
        public async Task Instanced()
        {
            SingleService singleService = new SingleService();

            singleService.Foo = "singleton";

            ServiceContainer services = new ServiceContainer();

            services.AddSingleton <ISingleService, SingleService>(singleService);

            ISingleService s1 = await services.Get <ISingleService>();

            Assert.Equal(singleService.Foo, s1.Foo);

            IContainerScope scope = services.CreateScope();
            ISingleService  s2    = await services.Get <ISingleService>(scope);

            Assert.Equal(singleService.Foo, s2.Foo);
        }
示例#14
0
        /// <summary>
        ///     Data access to business object conversion
        /// </summary>
        /// <param name="service">Data access service</param>
        /// <returns>Business object single service</returns>
        public static DtoService ViewModelSingleServiceToDto(SingleService service)
        {
            var ret = new DtoService
            {
                Id                 = service.Id,
                ServiceTypeId      = service.ServiceTypeId,
                ServiceTypeName    = service.ServiceTypeName,
                InstructorId       = service.InstructorId,
                InstructorFullName = service.InstructorFullName,
                Dates              = new List <DateTime> {
                    service.Date
                },
                Customers = new List <DtoCustomer> {
                    CustomerConverter.ViewModelToDto(service.Customer)
                }
            };

            return(ret);
        }
示例#15
0
        public FallbackProjectSettings(SingleService service, SettingsScope scopes, IEnumerable <string> keywords = null)
            : base(service.projectSettingsPath, scopes, keywords)
        {
            activateHandler += Initialize;

            void Initialize(string s, VisualElement element)
            {
                AddStyleSheets(element);
                AddGeneralTemplate(element, service.title);

                var scrollView      = new ScrollView();
                var scrollContainer = element.Q(className: VisualElementConstants.ClassNames.ScrollContainer);

                if (scrollContainer != null)
                {
                    scrollContainer.Add(scrollView);
                }

                AddInstallPackageSection(scrollView, service);

                TranslateStringsInTree(element);
            }
        }
示例#16
0
 public ValueTask InvokeAsync(InvocationContext invocationContext, SingleService singleService, ScopedService scopedService, TransientService transientService)
 => invocationContext.ProceedAsync();
示例#17
0
 public void StartConsensus(Wallet wallet)
 {
     Consensus = ActorSystem.ActorOf(SingleService.Props(this, wallet));
     Consensus.Tell(new SingleService.Start());
 }
示例#18
0
 public HomeController()
 {
     _dashboardService = new DashboardService();
     _shopService      = new ShopService();
     _singleService    = new SingleService();
 }
示例#19
0
 public PackageInstallationHandler(SingleService serviceInstance)
 {
     m_ServiceInstance = serviceInstance;
 }
示例#20
0
        public ActionResult ServiceDetails(int id)
        {
            SingleService sser = db.SingleServices.Where(x => x.Singleid == id).FirstOrDefault();

            return(View(sser));
        }
 public async Task <bool> EnrolSingleService(SingleService s)
 {
     return(await Post <DtoService, bool>("EnrolSingleService", ServiceConverter.ViewModelSingleServiceToDto(s)));
 }
示例#22
0
 void AddInstallPackageSection(VisualElement installPackageContainer, SingleService service)
 {
     m_InstallPackageSection = new InstallPackageSection(installPackageContainer, service);
     m_InstallPackageSection.packageInstalled += Repaint;
 }