Ejemplo n.º 1
0
 static Program()
 {
     _listService = DependencyInjection.Setup().GetService <IListService>();
     numbers      = new List <long> {
         1, 2, 4, 5, 6, 7
     };
 }
Ejemplo n.º 2
0
        public BulkCreateValidator(ITaskService taskService, IListService listService)
        {
            RuleFor(dto => dto.UserId)
            .NotEmpty().WithMessage("Unauthorized")
            .Must((dto, userId) => listService.UserOwnsOrShares(dto.ListId, userId)).WithMessage("Unauthorized");

            RuleFor(dto => dto.ListId)
            .Must((dto, listId) =>
            {
                var taskNames = dto.TasksText.Split("\n").Where(x => !string.IsNullOrWhiteSpace(x));
                return(taskService.Count(listId) + taskNames.Count() <= 250);
            }).WithMessage("TasksPerListLimitReached");

            RuleFor(dto => dto.TasksText).NotEmpty().WithMessage("Tasks.BulkCreate.TextIsRequired").Must(tasksText =>
            {
                var tasks = tasksText.Split("\n").Where(x => !string.IsNullOrWhiteSpace(x));
                return(tasks.Any());
            }).WithMessage("Tasks.BulkCreate.NoTasks").Must((dto, tasksText) =>
            {
                IEnumerable <string> taskNames = tasksText.Split("\n").Where(x => !string.IsNullOrWhiteSpace(x));
                return(!taskService.Exists(taskNames, dto.ListId, dto.UserId));
            }).WithMessage("Tasks.BulkCreate.SomeTasksAlreadyExist").Must(tasksText =>
            {
                var tasks      = tasksText.Split("\n").Where(x => !string.IsNullOrWhiteSpace(x));
                var duplicates = tasks.GroupBy(x => x).Where(g => g.Count() > 1).Select(y => y.Key).ToList();
                return(!duplicates.Any());
            }).WithMessage("Tasks.BulkCreate.DuplicateTasks").Must(tasksText =>
            {
                var tasks = tasksText.Split("\n").Where(x => !string.IsNullOrWhiteSpace(x) && x.Length > 50);
                return(!tasks.Any());
            }).WithMessage("Tasks.BulkCreate.TasksNameMaxLength");
        }
Ejemplo n.º 3
0
        private void frmEmailCampaign_Load(object sender, EventArgs e)
        {
            try
            {
                string state = "ok";
                _accessToken = OAuth.AuthenticateFromWinProgram(ref state);

                if (string.IsNullOrEmpty(_accessToken))
                {
                    Application.Exit();
                }

                //initialize ConstantContact members
                IUserServiceContext    userServiceContext      = new UserServiceContext(_accessToken, _apiKey);
                ConstantContactFactory _constantContactFactory = new ConstantContactFactory(userServiceContext);
                _emailCampaignService         = _constantContactFactory.CreateEmailCampaignService();
                _emailCampaginScheduleService = _constantContactFactory.CreateCampaignScheduleService();
                _listService    = _constantContactFactory.CreateListService();
                _accountService = _constantContactFactory.CreateAccountService();
            }
            catch (OAuth2Exception oauthEx)
            {
                MessageBox.Show(string.Format("Authentication failure: {0}", oauthEx.Message), "Warning");
            }

            PopulateCampaignTypeList();
            PopulateListOfCountries();
            PopulateUSAndCanadaListOfStates();

            GetListOfContacts();
            PopulateEmailLists();
        }
Ejemplo n.º 4
0
        public UpdateTaskValidator(ITaskService taskService, IListService listService)
        {
            RuleFor(dto => dto.UserId)
            .NotEmpty().WithMessage("Unauthorized")
            .Must((dto, userId) => !taskService.Exists(dto.Id, dto.Name, dto.ListId, userId)).WithMessage("AlreadyExists");

            RuleFor(dto => dto.ListId)
            .MustAsync(async(dto, listId, val) =>
            {
                SimpleTask originalTask = await taskService.GetAsync(dto.Id);
                bool listChanged        = listId != originalTask.ListId;

                if (listChanged && taskService.Count(dto.ListId) == 250)
                {
                    return(false);
                }

                return(true);
            }).WithMessage("Tasks.UpdateTask.SelectedListAlreadyContainsMaxTasks");

            RuleFor(dto => dto.AssignedToUserId)
            .Must((dto, assignedToUserId) =>
            {
                if (dto.AssignedToUserId.HasValue && !listService.UserOwnsOrSharesAsPending(dto.ListId, assignedToUserId.Value))
                {
                    return(false);
                }

                return(true);
            }).WithMessage("Tasks.UpdateTask.TheAssignedUserIsNotAMember");

            RuleFor(dto => dto.Name)
            .NotEmpty().WithMessage("Tasks.ModifyTask.NameIsRequired")
            .MaximumLength(50).WithMessage("Tasks.ModifyTask.NameMaxLength");
        }
Ejemplo n.º 5
0
        private void frmEmailCampaign_Load(object sender, EventArgs e)
        {
            try
            {
                string state = "ok";
                _accessToken = OAuth.AuthenticateFromWinProgram(ref state);

                if (string.IsNullOrEmpty(_accessToken))
                {
                    Application.Exit();
                }

                //initialize ConstantContact members
                IUserServiceContext userServiceContext = new UserServiceContext(_accessToken, _apiKey);
                ConstantContactFactory _constantContactFactory = new ConstantContactFactory(userServiceContext);
                _emailCampaignService = _constantContactFactory.CreateEmailCampaignService();
                _emailCampaginScheduleService = _constantContactFactory.CreateCampaignScheduleService();
                _listService = _constantContactFactory.CreateListService();
                _accountService = _constantContactFactory.CreateAccountService();
            }
            catch (OAuth2Exception oauthEx)
            {
                MessageBox.Show(string.Format("Authentication failure: {0}", oauthEx.Message), "Warning");
            }

            PopulateCampaignTypeList();
            PopulateListOfCountries();
            PopulateUSAndCanadaListOfStates();

            GetListOfContacts();
            PopulateEmailLists();
        }
Ejemplo n.º 6
0
 public AccountController(
     UserManager <ApplicationUser> userManager,
     SignInManager <ApplicationUser> signInManager,
     IIdentityServerInteractionService interaction,
     IClientStore clientStore,
     IEventService events,
     IEmailTemplateService emailTemplateService,
     IAccountService accountService,
     IListService listService,
     IRecipeService recipeService,
     ICdnService cdnService,
     IHttpClientFactory httpClientFactory,
     IConfiguration configuration,
     IStringLocalizer <AccountController> localizer,
     IWebHostEnvironment webHostEnvironment,
     ILogger <AccountController> logger)
 {
     _userManager          = userManager;
     _signInManager        = signInManager;
     _interaction          = interaction;
     _clientStore          = clientStore;
     _events               = events;
     _emailTemplateService = emailTemplateService;
     _accountService       = accountService;
     _listService          = listService;
     _recipeService        = recipeService;
     _cdnService           = cdnService;
     _httpClientFactory    = httpClientFactory;
     _configuration        = configuration;
     _localizer            = localizer;
     _webHostEnvironment   = webHostEnvironment;
     _logger               = logger;
 }
Ejemplo n.º 7
0
 public ListController(
     IListService listService,
     IChannelService channelService)
 {
     _listService    = listService;
     _channelService = channelService;
 }
 public ListServicesTests()
 {
     _listService = DependencyInjection.Setup().GetService <IListService>();
     numbers      = new List <long> {
         1, 2, 4, 5, 6, 7
     };
 }
Ejemplo n.º 9
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            _apiKey             = ConfigurationManager.AppSettings["APIKey"];
            Session["campaign"] = TextBox1.Text;
            try
            {
                string state = "ok";
                OAuth.AuthorizeFromWebApplication(HttpContext.Current
                                                  , state);


                //initialize ConstantContact members
                IUserServiceContext    userServiceContext      = new UserServiceContext(_accessToken, _apiKey);
                ConstantContactFactory _constantContactFactory = new ConstantContactFactory(userServiceContext);
                _emailCampaignService         = _constantContactFactory.CreateEmailCampaignService();
                _emailCampaginScheduleService = _constantContactFactory.CreateCampaignScheduleService();
                _listService    = _constantContactFactory.CreateListService();
                _accountService = _constantContactFactory.CreateAccountService();
            }
            catch (OAuth2Exception oauthEx)
            {
                //  MessageBox.Show(string.Format("Authentication failure: {0}", oauthEx.Message), "Warning");
            }


            //PopulateListOfCountries();
            //PopulateUSAndCanadaListOfStates();

            //GetListOfContacts();
            //PopulateEmailLists();
        }
Ejemplo n.º 10
0
        public ShareListValidator(IListService listService, IUserService userService)
        {
            RuleFor(dto => dto.UserId)
            .NotEmpty().WithMessage("Unauthorized")
            .Must((dto, userId) => listService.UserOwnsOrSharesAsAdmin(dto.ListId, userId)).WithMessage("Unauthorized");

            RuleForEach(dto => dto.NewShares).SetValidator(new ShareUserAndPermissionValidator(userService));
            RuleForEach(dto => dto.EditedShares).SetValidator(new ShareUserAndPermissionValidator(userService));
            RuleForEach(dto => dto.RemovedShares).SetValidator(new ShareUserAndPermissionValidator(userService));

            RuleFor(dto => dto).Must(dto =>
            {
                var userIds = dto.NewShares.Select(x => x.UserId)
                              .Concat(dto.EditedShares.Select(x => x.UserId))
                              .Concat(dto.RemovedShares.Select(x => x.UserId)).ToList();

                return(userIds.Count == userIds.Distinct().Count());
            }).WithMessage("AnErrorOccurred")
            .Must(dto =>
            {
                bool sharedWithCurrentUser = dto.NewShares.Any(x => x.UserId == dto.UserId) ||
                                             dto.EditedShares.Any(x => x.UserId == dto.UserId) ||
                                             dto.RemovedShares.Any(x => x.UserId == dto.UserId);

                return(!sharedWithCurrentUser);
            }).WithMessage("AnErrorOccurred");
        }
Ejemplo n.º 11
0
        // GET: Product
        public ActionResult Index(IListService service)
        {
            var dataForList = new ProductListSupportDataModel(ProductListFilters.AvailableForSale,
                                                              service.GetAll <ProductCategory>());

            return(View(dataForList));
        }
Ejemplo n.º 12
0
        private static CTCT.Components.Contacts.ContactList GetListByID(string p)
        {
            IUserServiceContext    userServiceContext = new UserServiceContext("3f09fe65-10ae-44a9-9db6-d9f2d6de1dec", "cvwkqk7ajrm67rcagvfwn9gx");
            ConstantContactFactory serviceFactory     = new ConstantContactFactory(userServiceContext);
            IListService           listService        = serviceFactory.CreateListService();

            try {
                ContactList lists = listService.GetList(p);

                if (lists != null)
                {
                    return(lists);
                }
            }

            catch (Exception ex)
            {
                CTCTLogger.LogFile(ex.InnerException.ToString(), ex.InnerException.ToString(), ex.Data.ToString(), (int)ex.LineNumber(), ex.Source.ToString());
                return(null);
            }



            return(null);
        }
 public ListsController(
     IListService listService,
     INotificationService notificationService,
     ISenderService senderService,
     IUserService userService,
     IValidator <CreateList> createValidator,
     IValidator <UpdateList> updateValidator,
     IValidator <UpdateSharedList> updateSharedValidator,
     IValidator <ShareList> shareValidator,
     IValidator <CopyList> copyValidator,
     IStringLocalizer <ListsController> localizer,
     IOptions <Urls> urls)
 {
     _listService           = listService;
     _notificationService   = notificationService;
     _senderService         = senderService;
     _userService           = userService;
     _createValidator       = createValidator;
     _updateValidator       = updateValidator;
     _updateSharedValidator = updateSharedValidator;
     _shareValidator        = shareValidator;
     _copyValidator         = copyValidator;
     _localizer             = localizer;
     _urls = urls.Value;
 }
Ejemplo n.º 14
0
 public ListController(ListNestDbContext dbContext,
                       IMapper mapper,
                       IListService listService)
 {
     _dbContext   = dbContext;
     _mapper      = mapper;
     _listService = listService;
 }
Ejemplo n.º 15
0
 public AllServiceBase(string url, ResponseToken token, string endpoint) : base(url, token, endpoint)
 {
     this.ListService   = new ListServiceBase <TResponse>(url, token, endpoint);
     this.DeleteService = new DeleteServiceBase <TResponse>(url, token, endpoint);
     this.GetService    = new GetServiceBase <TResponse>(url, token, endpoint);
     this.CreateService = new CreateServiceBase <TRequest, TResponse>(url, token, endpoint);
     this.UpdateService = new UpdateServiceBase <TRequest, TResponse>(url, token, endpoint);
 }
Ejemplo n.º 16
0
 /// <summary>
 /// ctor
 /// </summary>
 /// <param name="cacheRepository"></param>
 /// <param name="profileLogic"></param>
 /// <param name="elRepo"></param>
 public CacheController(ICacheRefreshRepository cacheRepository, IUserProfileLogic profileLogic, IEventLogRepository elRepo,
                        IListService listService, ICacheListLogic cacheListLogic) : base(profileLogic)
 {
     this.cacheRepository = cacheRepository;
     _listService         = listService;
     _cacheListLogic      = cacheListLogic;
     this._elRepo         = elRepo;
 }
Ejemplo n.º 17
0
 /// <summary>
 /// ctor
 /// </summary>
 /// <param name="profileLogic"></param>
 /// <param name="listService"></param>
 public IntegrationsController(
     IUserProfileLogic profileLogic,
     IListService listService
     ) : base(profileLogic)
 {
     _profileLogic = profileLogic;
     _listService  = listService;
 }
Ejemplo n.º 18
0
 /// <summary>
 /// ctor
 /// </summary>
 /// <param name="listServiceRepository"></param>
 /// <param name="profileLogic"></param>
 /// <param name="logRepo"></param>
 public ItemNoteController(IListLogic listServiceRepository, IUserProfileLogic profileLogic, INotesListLogic notesLogic,
                           IEventLogRepository logRepo, IListService listService) : base(profileLogic)
 {
     this.listServiceRepository = listServiceRepository;
     _notesLogic  = notesLogic;
     _listService = listService;
     _log         = logRepo;
 }
Ejemplo n.º 19
0
        public override void InitHelpers()
        {
            base.InitHelpers();

            var controller = (ViewContext.Controller as BaseController);

            ListService = controller.ListService;
        }
        public JsonResult GetCompanies(string text, IListService service)
        {
            var companies = service.GetAll <ListCustomerDto>();

            return(string.IsNullOrEmpty(text)
                ? Json(companies, JsonRequestBehavior.AllowGet)
                : Json(companies.Where(p => p.CompanyName.Contains(text)), JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 21
0
 public ListItemController(IWorkContextAccessor workContextAccessor, IListItemService listItemService, IListFieldService listFieldService, IListService listService, IListCategoryService listCategoryService)
     : base(workContextAccessor)
 {
     this.listItemService     = listItemService;
     this.listFieldService    = listFieldService;
     this.listService         = listService;
     this.listCategoryService = listCategoryService;
 }
Ejemplo n.º 22
0
 public ListController(ILogger <ListController> logger
                       , ISystemClockService systemClock
                       , IListService listService)
 {
     _logger      = logger;
     _systemClock = systemClock;
     _listService = listService;
 }
Ejemplo n.º 23
0
 /// <summary>
 /// ctor
 /// </summary>
 /// <param name="listLogic"></param>
 /// <param name="profileLogic"></param>
 /// <param name="logRepo"></param>
 public RecentItemController(IListLogic listLogic, IUserProfileLogic profileLogic, IRecentlyViewedListLogic recentlyViewedLogic,
                             IRecentlyOrderedListLogic recentlyOrderedLogic, IListService listService, IEventLogRepository logRepo)  : base(profileLogic)
 {
     _repo = listLogic;
     _recentlyViewedLogic  = recentlyViewedLogic;
     _recentlyOrderedLogic = recentlyOrderedLogic;
     _listService          = listService;
     _log = logRepo;
 }
Ejemplo n.º 24
0
 public TaskService(
     ITasksRepository tasksRepository,
     IListService listService,
     IMapper mapper)
 {
     _tasksRepository = tasksRepository;
     _listService     = listService;
     _mapper          = mapper;
 }
Ejemplo n.º 25
0
 public TaskService(
     IRepositoryService repositoryService,
     IObjectMapper objectMapper,
     IListService <TaskViewModel> listService)
 {
     this.repositoryService = repositoryService;
     this.objectMapper      = objectMapper;
     this.listService       = listService;
 }
 public MaintenanceHostedService(
     IChannelService channelService,
     IListService listService,
     ILogger <MaintenanceHostedService> logger)
 {
     _channelService = channelService;
     _listService    = listService;
     _logger         = logger;
 }
Ejemplo n.º 27
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="randomizeService">Randomization service</param>
        /// <param name="listService">List Service</param>
        public BasicRandomVM(IRandomizeService randomizeService, IListService listService)
        {
            // Services Interfaces
            _randomizeService = randomizeService;
            _listService      = listService;

            // List Init
            ItemsList = new ObservableCollection <string>();
        }
Ejemplo n.º 28
0
 public ListViewModel()
 {
     CleanUp();
     _listService = new ListService();
     Messenger.Default.Register <ListTypes>(this, message =>
     {
         ListType = message;
     });
 }
Ejemplo n.º 29
0
 public DashboardController(IUserService userService, IBoardService boardService, IListService listService, ICardService cardService, ICardCommentService cardCommentService, IMapper mapper)
 {
     _userService        = userService;
     _boardService       = boardService;
     _listService        = listService;
     _cardService        = cardService;
     _cardCommentService = cardCommentService;
     _mapper             = mapper;
 }
Ejemplo n.º 30
0
 public AssignmentService(
     DbContext context,
     IObjectMapper mapper,
     IListService <AssignmentViewModel> listService)
 {
     this.context     = context;
     this.mapper      = mapper;
     this.listService = listService;
 }
Ejemplo n.º 31
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used such as when the application is launched to open a specific file.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</param>
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
#if DEBUG
            if (System.Diagnostics.Debugger.IsAttached)
            {
                this.DebugSettings.EnableFrameRateCounter = true;
            }
#endif

            // Register dependencies
            var dependencyFactory = new DependencyFactory();

            // Initialize database
            //  On the first run creates database and tables and adds default tables
            InitializeDatabase();

            // Load base models used in the application
            ISyncService syncService = DependencyFactory.Resolve <ISyncService>();
            IListService listService = DependencyFactory.Resolve <IListService>();
            ITaskService taskService = DependencyFactory.Resolve <ITaskService>();

            // load  model for main view
            AppListsModel = new ListViewModel(syncService, listService);
            AppTasksModel = new TaskViewModel(syncService, taskService);

            syncService.Start();

            Frame rootFrame = Window.Current.Content as Frame;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();

                rootFrame.NavigationFailed += OnNavigationFailed;

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: Load state from previously suspended application
                }

                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
            }

            if (rootFrame.Content == null)
            {
                // When the navigation stack isn't restored navigate to the first page,
                // configuring the new page by passing required information as a navigation
                // parameter
                rootFrame.Navigate(typeof(MainPage), e.Arguments);
            }
            // Ensure the current window is active
            Window.Current.Activate();
        }
        //-----------------------------------------------
        public JsonResult GetProducts(string text, IListService service)
        {
            var products =
                service.GetAll<Product>()
                    .Select(x => new KeyTextClass<int> {Key = x.ProductID, Text = x.ProductNumber + " (" + x.ProductCategory.Name + ", " + x.Name + ")"});

            return string.IsNullOrEmpty(text)
                ? Json(products, JsonRequestBehavior.AllowGet)
                : Json(products.Where(p => p.Text.Contains(text)), JsonRequestBehavior.AllowGet);
        }
 // GET: TagsAsync
 public async Task<ActionResult> Index(IListService service)
 {
     return View(await service.GetAll<TagListDto>().ToListAsync());
 }
 public JsonResult IndexListRead([DataSourceRequest]DataSourceRequest request, IListService service)
 {
     var result = service.GetAll<ListProductDto>().OrderBy( x => x.ProductID).ToDataSourceResult(request);
     return Json(result);
 }
 // GET: Product
 public ActionResult Index(IListService service)
 {
     var dataForList = new ProductListSupportDataModel(ProductListFilters.AvailableForSale,
         service.GetAll<ProductCategory>());
     return View(dataForList);
 }
 /// <summary>
 /// reads only the SalesOrderDetail for the given sales order
 /// </summary>
 /// <param name="request"></param>
 /// <param name="salesOrderId"></param>
 /// <param name="service"></param>
 /// <returns></returns>
 public JsonResult ReadLineItems([DataSourceRequest]DataSourceRequest request, int salesOrderId, IListService service)
 {
     var result = service.GetAll<CrudSalesOrderDetailDto>().Where(x => x.SalesOrderID == salesOrderId).OrderBy(x => x.SalesOrderDetailID).ToDataSourceResult(request);
     return Json(result);
 }
 public RoomRepository(IListService<Room> listService)
 {
     this.listService = listService;
 }
Ejemplo n.º 38
0
        /// <summary>
        /// Note that is Index is different in that it has an optional id to filter the list on.
        /// </summary>
        /// <param name="id"></param>
        /// <param name="service"></param>
        /// <returns></returns>
        public ActionResult Index(int? id, IListService service)
        {
            var filtered = id != null && id != 0;
            var query = filtered ? service.GetAll<SimplePostDto>().Where(x => x.BlogId == id) : service.GetAll<SimplePostDto>();
            if (filtered)
                TempData["message"] = "Filtered list";

            return View(query.ToList());
        }
Ejemplo n.º 39
0
 public ActionResult Index(IListService service)
 {
     return View(service.GetAll<BlogListDto>().ToList());
 }
 public SimpleAssetRepository(IListService<Asset> listService)
 {
     this.listService = listService;
 }
Ejemplo n.º 41
0
 public HomeController()
 {
     _listService = new ListService();
     _sessionContext = SessionContext.Current;
 }
Ejemplo n.º 42
0
 public HomeController(IListService listService, ISessionContext sessionContext)
 {
     _listService = listService;
     _sessionContext = sessionContext;
 }
 public UOWAssetRepository(IListService<Asset> listService, IUnitOfWork<Asset> unitOfWork)
 {
     this.listService = listService;
     this.unitOfWork = unitOfWork;
 }
        public JsonResult GetCompanies(string text, IListService service)
        {
            var companies = service.GetAll<ListCustomerDto>();

            return string.IsNullOrEmpty(text)
                ? Json(companies, JsonRequestBehavior.AllowGet)
                : Json(companies.Where(p => p.CompanyName.Contains(text)), JsonRequestBehavior.AllowGet);
        }
 public JsonResult IndexListReadVer2([DataSourceRequest]DataSourceRequest request, IListService service)
 {
     var result = service.GetAll<ListCustomerVer2Dto>().OrderBy(x => x.CustomerID).ToDataSourceResult(request);
     return Json(result, JsonRequestBehavior.AllowGet);
 }
 public ActionResult AjaxProductDescriptionRead([DataSourceRequest]DataSourceRequest request, IListService service)
 {
     return Json(service.GetAll<ProductDescription>().ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
 }
Ejemplo n.º 47
0
 public PersonalController(IListService listService, ISessionContext sessionContext)
 {
     _listService = listService;
     _sessionContext = sessionContext;
 }