Beispiel #1
0
        public async Task <BulkInviteSubmission> SendBulkInvitations(BulkInviteSubmission bulkRequest)
        {
            if (!User.Identity.IsInRole(Roles.CompanyAdministrator))
            {
                //enforcing rule: only Company Administrator can invite Members
                bulkRequest.MemberType = MemberType.Guest;
            }

            bulkRequest.InvitationMessage = HtmlSanitizer.SanitizeHtml(bulkRequest.InvitationMessage);
            bulkRequest.SubmissionDate    = DateTime.UtcNow;

            //this call adds the batch to the DB and creates a pending item for each guest
            bulkRequest = await BulkInviteSubmission.AddItem(bulkRequest, User.Identity.Name);

            string userOid = User.Identity.GetClaim(Settings.ObjectIdentifier);

            //queue the request for processing
            var queue = new BatchQueueItem
            {
                BulkInviteSubmissionId = bulkRequest.Id,
                InvitingUserId         = userOid,
                ProfileUrl             = Utils.GetProfileUrl(Request.RequestUri),
                UserSourceHostName     = Utils.GetFQDN(Request)
            };

            StorageRepo.AddQueueItem(queue, "invitations");

            return(bulkRequest);
        }
        public ActionResult AddStorage()
        {
            var rp  = new StorageRepo(new StorageMssql());
            var cvm = new StorageViewModel((Computer)Session["CurrentBuild"], rp.GetAll());

            return(View(cvm));
        }
        public ActionResult Storage(int computerId)
        {
            var cr  = new ComputerRepo(new ComputerMssql());
            var mr  = new StorageRepo(new StorageMssql());
            var svm = new StorageViewModel(cr.GetById(computerId), mr.GetAll());

            return(View(svm));
        }
Beispiel #4
0
        public ActionResult AddStorage(int storageId)
        {
            var rp = new StorageRepo(new StorageMssql());
            var pc = (Computer)Session["CurrentBuild"];

            pc.Storage = rp.GetById(storageId);
            Session["CurrentBuild"] = pc;
            return(RedirectToAction("NewBuild", "Build"));
        }
Beispiel #5
0
        public ActionResult EditStorage(int computerId, int storageId)
        {
            var cr       = new ComputerRepo(new ComputerMssql());
            var sr       = new StorageRepo(new StorageMssql());
            var editedPc = cr.GetById(computerId);

            editedPc.Storage = sr.GetById(storageId);
            cr.Update(editedPc);
            return(RedirectToAction("EditBuild", "Build", new { computerId }));
        }
Beispiel #6
0
        public static void AddBulkUsersToQueue(IEnumerable <StagedUser> userBatch, IEnumerable <string> siteDomains = null)
        {
            if (siteDomains != null)
            {
                CheckBatchUsers(ref userBatch, siteDomains);
            }

            //this will be queued
            StorageRepo.AddQueueItem(userBatch, "stageduser");
        }
Beispiel #7
0
        public HttpResponseMessage RequeueRequest(dynamic data)
        {
            string signInUserId = User.Identity.GetClaim(Settings.ObjectIdentifier);

            //queue the request for processing
            var queue = new BatchQueueItem
            {
                BulkInviteSubmissionId = data.id,
                InvitingUserId         = signInUserId,
                ProfileUrl             = Utils.GetProfileUrl(Request.RequestUri),
                UserSourceHostName     = Utils.GetFQDN(Request)
            };

            StorageRepo.AddQueueItem(queue, "invitations");
            return(new HttpResponseMessage(HttpStatusCode.Accepted));
        }
Beispiel #8
0
        public static void Main()
        {
            WPF.App app = new WPF.App();

            // view
            var mainWindow = new MainWindow();

            var storageRepo  = new StorageRepo();
            var driveStorage = storageRepo.AddStorage(id => new DriveStorage(id));

            var storagePath = new StoragePath(driveStorage.StorageId, @"Z:\\Temp");
            var workspace   = new Workspace(storageRepo, storagePath);

            // viewModel
            mainWindow.DataContext = new MainWindowVM(workspace);

            app.Run(mainWindow);
        }
Beispiel #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ResourceLogic"/> class.
 /// </summary>
 /// <param name="repo">parameter which is a StorageRepo entity.</param>
 public ResourceLogic(StorageRepo repo)
 {
     this.repo = repo;
 }
Beispiel #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ResourceLogic"/> class.
 /// </summary>
 /// <param name="model">The first parameter which is an IGameModel.</param>
 /// <param name="repo">Second parameter which is a StorageRepo entity.</param>
 public ResourceLogic(IGameModel model, StorageRepo repo)
 {
     this.model = model;
     this.repo  = repo;
 }
 public static void AddBulkLogs(IEnumerable <SyncLogEntry> logBatch, string siteId)
 {
     logBatch.ToList().ForEach(l => l.RemoteSiteID = siteId);
     //this will be queued
     StorageRepo.AddQueueItem(logBatch, "logbatch");
 }
Beispiel #12
0
 public static void AddUserToQueue(StagedUser user)
 {
     //this will be queued
     StorageRepo.AddQueueItem(user, "stageduser");
 }