Exemplo n.º 1
0
        public ActionResult Create()
        {
            List <SponsorItem> lst        = new List <SponsorItem>();
            SponsorService     objService = new SponsorService();
            int cid = 0;

            if (Session["CompID"] != null)
            {
                cid = Convert.ToInt32(Session["CompID"].ToString());
            }
            lst = objService.getSponsorData(cid);
            SponsorItem objModel = new SponsorItem();

            objModel.ListSponsor = new List <SponsorItem>();
            objModel.ListSponsor.AddRange(lst);

            List <CompanyItem> lstCompany = new List <CompanyItem>();

            lstCompany           = objService.GetCompany();
            objModel.ListCompany = new List <CompanyItem>();
            objModel.ListCompany.AddRange(lstCompany);

            VehicleMasterService objVehicle = new VehicleMasterService();

            #region Bind DropDown Branch
            List <BranchItem> lstBranch = new List <BranchItem>();
            lstBranch           = objVehicle.GetBranch();
            objModel.ListBranch = new List <BranchItem>();
            objModel.ListBranch.AddRange(lstBranch);

            #endregion

            ViewBag.Menuid = Request.QueryString["menuId"];
            return(View(objModel));
        }
Exemplo n.º 2
0
        // GET: Sponsor
        public ActionResult Index()
        {
            SponsorService service = CreateSponsorService(_userId);
            var            model   = service.GetSponsors();

            return(View(model));
        }
Exemplo n.º 3
0
        public ActionResult View(int id)
        {
            CredentialService objAppointService = new CredentialService();
            CredentialItem    objAItem          = new CredentialItem();

            objAItem = objAppointService.GetById(id);
            //Session["Empid"] = objPassItem.EmpId;
            List <CredentialItem> lstAppoint = new List <CredentialItem>();

            objAItem.ListCredential = new List <CredentialItem>();
            objAItem.ListCredential.AddRange(lstAppoint);
            ViewBag.Menuid = Request.QueryString["menuId"];


            SponsorService     objService1 = new SponsorService();
            List <CompanyItem> lstCompany  = new List <CompanyItem>();

            lstCompany           = objService1.GetCompany();
            objAItem.ListCompany = new List <CompanyItem>();
            objAItem.ListCompany.AddRange(lstCompany);

            VehicleMasterService objVehicle = new VehicleMasterService();

            #region Bind DropDown Branch
            List <BranchItem> lstBranch = new List <BranchItem>();
            lstBranch           = objVehicle.GetBranch();
            objAItem.ListBranch = new List <BranchItem>();
            objAItem.ListBranch.AddRange(lstBranch);

            #endregion

            return(View(objAItem));
        }
Exemplo n.º 4
0
        public DetailViewModel(SponsorService SponsorService)
        {
            Title    = "Sponsor detail";
            Subtitle = "In this section you can see the detailed data of an sponsor.";

            this.SponsorService = SponsorService;
        }
Exemplo n.º 5
0
        public CreateViewModel(SponsorService SponsorService)
        {
            Title    = "Create sponsor";
            Subtitle = "In this section you can create a new sponsor.";

            this.SponsorService = SponsorService;
        }
        private SponsorService CreateSponsorService()
        {
            var userId  = Guid.Parse(User.Identity.GetUserId());
            var service = new SponsorService(userId);

            return(service);
        }
Exemplo n.º 7
0
        public ListViewModel(SponsorService SponsorService)
        {
            Title    = "Sponsor dashboard";
            Subtitle = "In this section you can see the list of sponsors registered in the database.";

            this.SponsorService = SponsorService;
        }
Exemplo n.º 8
0
        public EditViewModel(SponsorService SponsorService)
        {
            Title    = "Edit sponsor";
            Subtitle = "In this section, you can edit an sponsor's data.";

            this.SponsorService = SponsorService;
        }
        // GET: Sponsor/Index
        public ActionResult Index()
        {
            var userId  = Guid.Parse(User.Identity.GetUserId());
            var service = new SponsorService(userId);
            var model   = service.GetSponsors();

            return(View(model));
        }
Exemplo n.º 10
0
        public async Task <Sponsor> Create([FromBody] NewSponsor model)
        {
            await Validate(model);

            model.Approved = Actor.IsRegistrar;

            return(await SponsorService.Create(model));
        }
Exemplo n.º 11
0
        public async Task Update([FromBody] ChangedSponsor model)
        {
            await Validate(model);

            model.Approved = Actor.IsRegistrar;

            await SponsorService.AddOrUpdate(model);
        }
Exemplo n.º 12
0
 public void GetAll_ShouldReturn_NonNull_ListOf_SponsorDTO()
 {
     //Act
     ISponsorService service = new SponsorService();
     IList<SponsorDTO> sponsors = service.GetAll();
     //Assert
     sponsors.ShouldNotBeNull("Expected Not Null");
     Assert.IsInstanceOfType(sponsors, typeof (IList<SponsorDTO>));
 }
Exemplo n.º 13
0
        public async Task CreateBatch([FromBody] ChangedSponsor[] model)
        {
            foreach (var s in model)
            {
                s.Approved = Actor.IsRegistrar;

                await SponsorService.AddOrUpdate(s);
            }
        }
Exemplo n.º 14
0
        public ActionResult Edit(SponsorItem model)
        {
            //    int Empid = Convert.ToInt32(Url.RequestContext.RouteData.Values["id"].ToString());
            //model.EmpID = Empid;
            SponsorService objAppoint = new SponsorService();

            objAppoint.Update(model);
            return(RedirectToAction("Create", new { @menuId = model.Viewbagidformenu }));
        }
Exemplo n.º 15
0
 public DefaultViewModel(
     SponsorService SponsorService,
     OrganizerService OrganizerService,
     EventService EventService,
     SessionService SessionService)
 {
     Title = "Hello from DotVVM!";
     this.SponsorService   = SponsorService;
     this.OrganizerService = OrganizerService;
     this.EventService     = EventService;
     this.SessionService   = SessionService;
 }
Exemplo n.º 16
0
 public SponsorController(
     ILogger <SponsorController> logger,
     IDistributedCache cache,
     SponsorValidator validator,
     SponsorService sponsorService,
     CoreOptions options
     ) : base(logger, cache, validator)
 {
     _logger        = logger;
     SponsorService = sponsorService;
     Options        = options;
 }
Exemplo n.º 17
0
        /// <summary>
        /// Initializes a new instance for the <see cref="ArticleListViewModel" /> class.
        /// </summary>
        public SponsorsViewModel()
        {
            FeaturedStories       = new ObservableCollection <SponsorViewModel>();
            LatestStories         = new ObservableCollection <SponsorViewModel>();
            _sponsorService       = new SponsorService();
            _backgroundTaskHelper = new BackgroundTaskHelper(GetSponsors);

            this.MenuCommand           = new Command(this.MenuClicked);
            this.BookmarkCommand       = new Command(this.BookmarkButtonClicked);
            this.FeatureStoriesCommand = new Command(this.FeatureStoriesClicked);
            this.ItemSelectedCommand   = new Command(this.ItemSelected);
        }
Exemplo n.º 18
0
 public void GetAll_ShouldReturn_NonNull_ListOf_SponsorDTO()
 {
     //Arrange
     _mockDomain.Expect(x => x.GetAll()).Return(new List<SponsorDTO>()).Repeat.Once();
     _mockRepository.ReplayAll();
     //Act
     ISponsorService service = new SponsorService(_mockDomain);
     IList<SponsorDTO> sponsors = service.GetAll();
     //Assert
     _mockRepository.VerifyAll();
     sponsors.ShouldNotBeNull("Expected Not Null");
     Assert.IsInstanceOfType(sponsors, typeof (IList<SponsorDTO>));
 }
Exemplo n.º 19
0
 public void Insert_ShouldReturn_NonNull_Boolean()
 {
     using (new TransactionScope()) {
         //Arrange
         long attendeeID = new AttendeeService().GetAll()[0].AttendeeID;
         long sponsorID = new SponsorService().GetAllThatProvidedSwag()[0].SponsorID;
         long swagID = new SwagService().GetAllBySponsor(sponsorID)[0].SwagID;
         //Act
         IWinnerService service = new WinnerService();
         bool result = service.Insert(new WinnerDTO {AttendeeID = attendeeID, SponsorID = sponsorID, SwagID = swagID, Name = "Big Winner",});
         //Assert
         Assert.IsInstanceOfType(result, typeof (bool));
     }
 }
Exemplo n.º 20
0
        public ActionResult Create(SponsorItem model)
        {
            SponsorService objService = new SponsorService();

            model.Status = 1;
            int cid = 0;

            if (Session["CompID"] != null)
            {
                cid = Convert.ToInt32(Session["CompID"].ToString());
            }
            if (model.CompID == null)
            {
                model.CompID = cid;
            }

            objService.Insert(model);
            return(RedirectToAction("Create", new { @menuId = model.Viewbagidformenu }));
        }
Exemplo n.º 21
0
        public ActionResult Edit(int ItemId)
        {
            CategoryService    objCatServ  = new CategoryService();
            CategoryItem       objCatItem  = new CategoryItem();
            ItemService        objItemServ = new ItemService();
            AssestsItem        objItem     = new AssestsItem();
            List <AssestsItem> lstItems    = new List <AssestsItem>();

            objItem = objItemServ.GetItemsById(ItemId);
            int cid = 0;

            if (Session["CompID"] != null)
            {
                cid = Convert.ToInt32(Session["CompID"].ToString());
            }
            lstItems           = objItemServ.GetALLItems(cid);
            objItem.lstOfItems = new List <AssestsItem>();
            objItem.lstOfItems.AddRange(lstItems);

            List <CategoryItem> lstCat = new List <CategoryItem>();

            lstCat = objCatServ.GetALL(cid);
            objItem.lstCategory = new List <CategoryItem>();
            objItem.lstCategory.AddRange(lstCat);

            SponsorService     objService = new SponsorService();
            List <CompanyItem> lstCompany = new List <CompanyItem>();

            lstCompany          = objService.GetCompany();
            objItem.ListCompany = new List <CompanyItem>();
            objItem.ListCompany.AddRange(lstCompany);

            VehicleMasterService objVehicle = new VehicleMasterService();

            #region Bind DropDown Branch
            List <BranchItem> lstBranch = new List <BranchItem>();
            lstBranch          = objVehicle.GetBranch();
            objItem.ListBranch = new List <BranchItem>();
            objItem.ListBranch.AddRange(lstBranch);
            #endregion

            return(View(objItem));
        }
Exemplo n.º 22
0
 public ActionResult delete(int id, int menuid)
 {
     try
     {
         //int Empid = Convert.ToInt32(Url.RequestContext.RouteData.Values["id"].ToString());
         SponsorService objService = new SponsorService();
         SponsorItem    objDoc     = new SponsorItem();
         objDoc = objService.GetById(id);
         db.CredentialMasters.Remove(db.CredentialMasters.Find(id));
         db.SaveChanges();
         //ViewBag.Empid = Empid;
         ViewBag.Menuid = Request.QueryString["menuId"];
     }
     catch (Exception ex)
     {
         //ViewBag.ErrorMsg = "First Delete This Tenancy No's All Documents. ";
         return(View("Error"));
     }
     return(RedirectToAction("Create", new { @id = id, @menuId = Request.QueryString["menuId"] }));
 }
Exemplo n.º 23
0
        public ActionResult Edit(int id)
        {
            CategoryItem    objCatItem = new CategoryItem();
            CategoryService objCatServ = new CategoryService();

            objCatItem = objCatServ.GetById(id);
            List <CategoryItem> lstCat = new List <CategoryItem>();
            int cid = 0;

            if (Session["CompID"] != null)
            {
                cid = Convert.ToInt32(Session["CompID"].ToString());
            }
            lstCat = objCatServ.GetALL(cid);
            objCatItem.lstCateory = new List <CategoryItem>();
            objCatItem.lstCateory.AddRange(lstCat);
            ViewBag.Menuid = Request.QueryString["menuId"];


            SponsorService     objService = new SponsorService();
            List <CompanyItem> lstCompany = new List <CompanyItem>();

            lstCompany             = objService.GetCompany();
            objCatItem.ListCompany = new List <CompanyItem>();
            objCatItem.ListCompany.AddRange(lstCompany);

            VehicleMasterService objVehicle = new VehicleMasterService();

            #region Bind DropDown Branch
            List <BranchItem> lstBranch = new List <BranchItem>();
            lstBranch             = objVehicle.GetBranch();
            objCatItem.ListBranch = new List <BranchItem>();
            objCatItem.ListBranch.AddRange(lstBranch);

            #endregion

            return(View(objCatItem));
        }
Exemplo n.º 24
0
        public async Task <ActionResult <Sponsor> > UploadImage(IFormFile file)
        {
            AuthorizeAny(
                () => Actor.IsRegistrar
                );

            string filename = file.FileName.ToLower();

            string path = Path.Combine(Options.ImageFolder, filename);

            using (var stream = new FileStream(path, FileMode.Create))
            {
                await file.CopyToAsync(stream);
            }

            await SponsorService.AddOrUpdate(
                Path.GetFileNameWithoutExtension(filename),
                filename
                );

            return(Ok(new UploadedFile {
                Filename = filename
            }));
        }
Exemplo n.º 25
0
 public SponsorController(MainOperation <Sponsor> SponsorRepository, SponsorService SponsorServises)
 {
     this.SponsorRepository = SponsorRepository;
     this.SponsorServises   = SponsorServises;
 }
Exemplo n.º 26
0
        private SponsorService CreateSponsorService(Guid userId)
        {
            var service = new SponsorService(userId);

            return(service);
        }
Exemplo n.º 27
0
 public async Task <Sponsor[]> List([FromQuery] SearchFilter model)
 {
     return(await SponsorService.List(model));
 }
        public async Task OnLoadAsync(INavigationParameters parameters, int attempt = 0)
        {
            try
            {
                var data = await SponsorService.GetAsync();

                Sponsors.Clear();

                foreach (var item in data.OrderBy(x => x.Level))
                {
                    var sponsor = new Sponsor
                    {
                        Name     = item.Name,
                        Homepage = item.Homepage,
                        Image    = ImageSource.FromStream(() => new MemoryStream(item.Image)),
                        Level    = (SponsorType)item.Level
                    };

                    switch (item.Level)
                    {
                    case Data.Models.SponsorLevel.Title:
                        Sponsors.Add(new TitlePlatinumSponsor
                        {
                            DataContext = sponsor,
                            Level       = SponsorType.Title
                        });
                        break;

                    case Data.Models.SponsorLevel.Platinum:
                        Sponsors.Add(new TitlePlatinumSponsor
                        {
                            DataContext = sponsor,
                            Level       = SponsorType.Platinum
                        });
                        break;
                    }
                }

                var goldGroup = new GeneralSponsor
                {
                    DataContext = data
                                  .Where(x => x.Level == Data.Models.SponsorLevel.Gold)
                                  .Select(x => new Sponsor
                    {
                        Name     = x.Name,
                        Homepage = x.Homepage,
                        Image    = ImageSource.FromStream(() => new MemoryStream(x.Image)),
                        Level    = SponsorType.Gold
                    }),
                    Level = SponsorType.Gold
                };

                var silverGroup = new GeneralSponsor
                {
                    DataContext = data
                                  .Where(x => x.Level == Data.Models.SponsorLevel.Silver)
                                  .Select(x => new Sponsor
                    {
                        Name     = x.Name,
                        Homepage = x.Homepage,
                        Image    = ImageSource.FromStream(() => new MemoryStream(x.Image)),
                        Level    = SponsorType.Silver
                    }),
                    Level = SponsorType.Silver
                };

                var bronzeGroup = new GeneralSponsor
                {
                    DataContext = data
                                  .Where(x => x.Level == Data.Models.SponsorLevel.Bronze)
                                  .Select(x => new Sponsor
                    {
                        Name     = x.Name,
                        Homepage = x.Homepage,
                        Image    = ImageSource.FromStream(() => new MemoryStream(x.Image)),
                        Level    = SponsorType.Bronze
                    }),
                    Level = SponsorType.Bronze
                };

                if (goldGroup.DataContext.Any())
                {
                    Sponsors.Add(goldGroup);
                }

                if (silverGroup.DataContext.Any())
                {
                    Sponsors.Add(silverGroup);
                }

                if (bronzeGroup.DataContext.Any())
                {
                    Sponsors.Add(bronzeGroup);
                }
            }
            catch (Exception)
            {
                await ErrorRetryManager.HandleRetryAsync(this, parameters, attempt);
            }
        }
 public SponsorsController(MvcEpfContext context)
 {
     _context    = context;
     sponService = new SponsorService(context);
 }
Exemplo n.º 30
0
 public async Task Delete([FromRoute] string id)
 {
     await SponsorService.Delete(id);
 }
Exemplo n.º 31
0
 public async Task <Sponsor> Retrieve([FromRoute] string id)
 {
     return(await SponsorService.Retrieve(id));
 }
        public async void OnNavigatingTo(INavigationParameters parameters)
        {
            var data = await SponsorService.GetAsync();

            Sponsors.Clear();

            foreach (var item in data)
            {
                var sponsor = new Sponsor
                {
                    Name      = item.Name,
                    Homepage  = item.Homepage,
                    ImageLink = item.ImageLink,
                    Level     = (SponsorType)item.Level
                };

                switch (item.Level)
                {
                case Data.Models.SponsorLevel.Title:
                    Sponsors.Add(new TitlePlatinumSponsor
                    {
                        DataContext = sponsor,
                        Level       = SponsorType.Title
                    });
                    break;

                case Data.Models.SponsorLevel.Platinum:
                    Sponsors.Add(new TitlePlatinumSponsor
                    {
                        DataContext = sponsor,
                        Level       = SponsorType.Platinum
                    });
                    break;
                }
            }

            var goldGroup = new GeneralSponsor
            {
                DataContext = data
                              .Where(x => x.Level == Data.Models.SponsorLevel.Gold)
                              .Select(x => new Sponsor
                {
                    Name      = x.Name,
                    Homepage  = x.Homepage,
                    ImageLink = x.ImageLink,
                    Level     = SponsorType.Gold
                }),
                Level = SponsorType.Gold
            };

            var silverGroup = new GeneralSponsor
            {
                DataContext = data
                              .Where(x => x.Level == Data.Models.SponsorLevel.Silver)
                              .Select(x => new Sponsor
                {
                    Name      = x.Name,
                    Homepage  = x.Homepage,
                    ImageLink = x.ImageLink,
                    Level     = SponsorType.Silver
                }),
                Level = SponsorType.Silver
            };

            var bronzeGroup = new GeneralSponsor
            {
                DataContext = data
                              .Where(x => x.Level == Data.Models.SponsorLevel.Bronze)
                              .Select(x => new Sponsor
                {
                    Name      = x.Name,
                    Homepage  = x.Homepage,
                    ImageLink = x.ImageLink,
                    Level     = SponsorType.Bronze
                }),
                Level = SponsorType.Bronze
            };

            if (goldGroup.DataContext.Any())
            {
                Sponsors.Add(goldGroup);
            }

            if (silverGroup.DataContext.Any())
            {
                Sponsors.Add(silverGroup);
            }

            if (bronzeGroup.DataContext.Any())
            {
                Sponsors.Add(bronzeGroup);
            }
        }