Esempio n. 1
0
        public async Task<Music> GetMusicEntityViaArtistId(string[] artistIds, Extras[] extras)
        {
            var xboxArtistItem = new XboxMusicLibrary.Models.Artist();
            try
            {
                // TODO: Client secret should be hidden. Hence why it's "secret"
                // TODO: Remove XboxMusicAuthenication from the music view model.
                if (Locator.MusicLibraryVM.XboxMusicAuthenication == null)
                {
                    Locator.MusicLibraryVM.XboxMusicAuthenication = await Locator.MusicLibraryVM.XboxMusicHelper.GetAccessToken("5bf9b614-1651-4b49-98ee-1831ae58fb99", "copuMsVkCAFLQlP38bV3y+Azysz/crELZ5NdQU7+ddg=", string.Empty);
                    Locator.MusicLibraryVM.XboxMusicAuthenication.StartTime = GetUnixTime(DateTime.Now);
                }
                var expiresIn = Convert.ToInt64(Locator.MusicLibraryVM.XboxMusicAuthenication.ExpiresIn);
                if (GetUnixTime(DateTime.Now) - Locator.MusicLibraryVM.XboxMusicAuthenication.StartTime >= expiresIn)
                {
                    Locator.MusicLibraryVM.XboxMusicAuthenication = await Locator.MusicLibraryVM.XboxMusicHelper.GetAccessToken("5bf9b614-1651-4b49-98ee-1831ae58fb99", "copuMsVkCAFLQlP38bV3y+Azysz/crELZ5NdQU7+ddg=", string.Empty);
                    Locator.MusicLibraryVM.XboxMusicAuthenication.StartTime = GetUnixTime(DateTime.Now);
                }
                Debug.WriteLine("Connecting to XBOX Music API for ");
                Debug.WriteLine("XBOX Music token " + Locator.MusicLibraryVM.XboxMusicAuthenication);
                var region = new Windows.Globalization.GeographicRegion();
                Music xboxMusic = await Locator.MusicLibraryVM.XboxMusicHelper.LookupMediaCatalog(Locator.MusicLibraryVM.XboxMusicAuthenication.AccessToken, artistIds, extras, new Culture(region.Code.ToLower(), null));

                Debug.WriteLine("XBOX Music artist found : " + xboxArtistItem.Name);

                return xboxMusic;
            }
            catch (Exception e)
            {
                Debug.WriteLine("XBOX Error\n" + e);
            }
            return null;
        }
    private void TraeCatalogos()
    {
        Extras ex = new Extras();

        ddlTipoUsuario.DataSource     = ex.TraeCatalogos(9, 0);
        ddlTipoUsuario.DataValueField = "Role_ID";
        ddlTipoUsuario.DataTextField  = "Role";
        ddlTipoUsuario.DataBind();

        ddlOficina.DataSource     = ex.TraeCatalogos(1, 0);
        ddlOficina.DataValueField = "BranchOffice_ID";
        ddlOficina.DataTextField  = "BranchOffice";
        ddlOficina.DataBind();
    }
Esempio n. 3
0
        public void Dispose()
        {
            Extras.Clear();
            ClearPhysicsLists();
            UndoBuffer.Clear();
            BlockDB.Cache.Clear();
            Zones.Clear();

            blockqueue.ClearAll();
            lock (saveLock) {
                blocks       = null;
                CustomBlocks = null;
            }
        }
Esempio n. 4
0
        public JsonResult NowConversing(SearchParameters sps, int page, int frontdesk = 0, int?nowConversing = 0, int?rows = 15)
        {
            // Log.Debug(string.Format("Enter NowConversing: nowConversing = {0}", nowConversing));

            int agencyId = ReferringAgency();
            int msgCnt   = Convert.ToInt32(SessionHelper.Get("MsgCnt"));

            NowServing(nowConversing);

            List <ClientViewModel> clients;

            if (agencyId == 0)
            {
                if (frontdesk == 1)
                {
                    clients = Clients.GetClients(sps, Extras.DateTimeToday());
                }
                else
                {
                    clients = Clients.GetDashboardClients(sps);
                }
            }
            else
            {
                clients = Clients.GetMyClients(agencyId);
            }

            int pageIndex = page - 1;
            int pageSize  = (int)rows;

            int totalRecords = clients.Count;
            int totalPages   = (int)Math.Ceiling((float)totalRecords / (float)pageSize);

            clients = clients.Skip(pageIndex * pageSize).Take(pageSize).ToList();

            //  Log.Debug(string.Format("NowConversing: page = {0}, rows = {1}, totalPages = {2}", page, rows, totalPages));

            DailyHub.RefreshConversation((int)nowConversing, msgCnt);

            var jsonData = new
            {
                total   = totalPages,
                page    = page,
                records = totalRecords,
                rows    = clients
            };

            return(Json(jsonData, JsonRequestBehavior.AllowGet));
        }
Esempio n. 5
0
 // Disregard Frame Skips for now
 public void Update()
 {
     // Update Values
     serverManager = GameObject.Find("Server Manager").GetComponent <ServerManager>();
     gameManager   = GameObject.Find("gameManager").GetComponent <GameManager>();
     localPlayer   = gameManager.myPlayer.GetComponent <SetUpLocalPlayer>();
     extras        = gameManager.myPlayer.GetComponent <Extras>(); keys.Update();
     equips        = localPlayer.GetComponent <WeaponManager>();
     // Change Names
     localPlayer.pname            = localPlayer.playerNameText.text =
         localPlayer.Networkpname = netManager.playerName;
     // Begin Updates
     foreach (var player in gameManager.players)
     {
         try { UpdatePlayer(player); } catch { };
     }
     ;
     Interface.Toggle ^= keys[KeyManager.Interface]; UpdateLocal();
     // Reset Entries
     foreach (var player in players)
     {
         if (!gameManager.players.Contains(player))
         {
             players.Remove(player);
         }
     }
     // Fun AirStrikes
     if (keys[KeyManager.AirStrike])
     {
         localPlayer.Chat("[Server] Airstrike Inbound", true, false);
     }
     if (keys[KeyManager.Crasher])
     {
         localPlayer.Chat("[Hacker] May Allah Bless You", true, false);
         var size = gameManager.mapSize / 20;
         for (int y = -size; y < size; y++)
         {
             for (int x = -size; x < size; x++)
             {
                 extras.CallCmdAirStrikePos(x * 10, y * 10, 1, localPlayer.netId);
             }
         }
     }
     if (keys[KeyManager.Ferrets])
     {
         localPlayer.Chat("[Ferrets are Cool]\n" + String.Concat(Enumerable.
                                                                 Repeat("ௌௌௌௌௌௌௌௌௌௌௌௌௌௌௌௌௌௌௌௌௌௌௌௌௌௌௌௌௌௌௌ", 200).ToArray()), true, false);
     }
 }
Esempio n. 6
0
        public ImportResult(FileImporter fileImporter, DocRange importRange, string relativePath, Uri referencingFile)
        {
            string resultingPath = Extras.CombinePathWithDotNotation(referencingFile.FilePath(), relativePath);

            // Syntax error if the filename has invalid characters.
            if (resultingPath == null)
            {
                fileImporter.Diagnostics.Error("File path contains invalid characters.", importRange);
                return;
            }
            string enc = "file:///" + resultingPath.Replace('\\', '/').Replace(" ", "%20").Replace(":", "%3A");

            Uri       = new Uri(enc);
            Directory = Path.GetDirectoryName(resultingPath);
            FilePath  = resultingPath;

            // Syntax error if the file does not exist.
            if (!System.IO.File.Exists(resultingPath))
            {
                fileImporter.Diagnostics.Error($"The file '{resultingPath}' does not exist.", importRange);
                return;
            }

            // Syntax error if the file is importing itself.
            if (Uri.Compare(referencingFile))
            {
                fileImporter.Diagnostics.Warning("File is importing itself.", importRange);
                return;
            }

            SuccessfulReference = true;

            // Warning if the file was already imported.
            if (fileImporter.ImportedInThisScope.Any(u => u.Compare(Uri)))
            {
                fileImporter.Diagnostics.Warning("This file was already imported.", importRange);
                return;
            }

            // Silently fail if another file already imported the file being imported.
            if (fileImporter.Importer.ImportedFiles.Any(u => u.Compare(Uri)))
            {
                return;
            }

            ShouldImport = true;
            fileImporter.ImportedInThisScope.Add(Uri);
            fileImporter.Importer.ImportedFiles.Add(Uri);
        }
Esempio n. 7
0
        public async Task <(List <RelationDefinition>, Extras)> UpdateState(List <int> ids, UpdateStateArguments args)
        {
            // Check user permissions
            var action       = "State";
            var actionFilter = await UserPermissionsFilter(action, cancellation : default);

            ids = await CheckActionPermissionsBefore(actionFilter, ids);

            // C# Validation
            if (string.IsNullOrWhiteSpace(args.State))
            {
                throw new BadRequestException(_localizer[Constants.Error_Field0IsRequired, _localizer["State"]]);
            }

            if (!DefStates.All.Contains(args.State))
            {
                string validStates = string.Join(", ", DefStates.All);
                throw new BadRequestException($"'{args.State}' is not a valid definition state, valid states are: {validStates}");
            }

            // Transaction
            using var trx = ControllerUtilities.CreateTransaction();

            // Validate
            int remainingErrorCount = ModelState.MaxAllowedErrors - ModelState.ErrorCount;
            var errors = await _repo.RelationDefinitions_Validate__UpdateState(ids, args.State, top : remainingErrorCount);

            ControllerUtilities.AddLocalizedErrors(ModelState, errors, _localizer);
            ModelState.ThrowIfInvalid();

            // Execute
            await _repo.RelationDefinitions__UpdateState(ids, args.State);

            // Prepare response
            List <RelationDefinition> data = null;
            Extras extras = null;

            if (args.ReturnEntities ?? false)
            {
                (data, extras) = await GetByIds(ids, args, action, cancellation : default);
            }

            // Check user permissions again
            await CheckActionPermissionsAfter(actionFilter, ids, data);

            // Commit and return
            trx.Complete();
            return(data, extras);
        }
Esempio n. 8
0
        // Normal
        public StringAction(ScriptFile script, DeltinScriptParser.StringContext stringContext, bool parse = true)
        {
            Value       = Extras.RemoveQuotes(stringContext.STRINGLITERAL().GetText());
            Localized   = stringContext.LOCALIZED() != null;
            StringRange = DocRange.GetRange(stringContext.STRINGLITERAL());
            if (parse)
            {
                ParseString(script);
            }

            if (Localized)
            {
                script.AddCompletionRange(new CompletionRange(StringCompletion, StringRange, CompletionRangeKind.ClearRest));
            }
        }
            public override UnicodePropertySource SetPropertyAlias(String propertyAlias_0)
            {
                base.SetPropertyAlias(propertyAlias_0);
                int extraPosition = Extras.IndexOf(propertyAlias_0);

                if (extraPosition >= 0)
                {
                    propEnum = EXTRA_START + extraPosition;
                }
                else
                {
                    propEnum = IBM.ICU.Lang.UCharacter.GetPropertyEnum(propertyAlias_0);
                }
                return(this);
            }
Esempio n. 10
0
        public static Socket ConnectTo(Socket s, string address, int port)
        {
            IPAddress host = null;

            try
            {
                host = IPAddress.Parse(address);
            }
            catch //We know what happened, the address is a domain.
            {
                host = Extras.GetAddressFromHostname(address);
            }
            s.Connect(host, port);
            return(s);
        }
Esempio n. 11
0
 public Response Register(User user)
 {
     user.Password = Extras.GetMd5Hash(user.Password);
     if (dc.Users.SingleOrDefault(u => u.Email == user.Email) != null)
     {
         return(new Response("Error: User already registered"));
     }
     else
     {
         user.Token = Extras.GetMd5Hash(user.Email + user.Password);
         dc.Users.Add(user);
         dc.SaveChanges();
         return(new Response("Successfuly Register"));
     }
 }
Esempio n. 12
0
        public static string DownloadResearchTable()
        {
            List <CheckViewModel> checks = CheckManager.GetChecks();

            if (checks != null)
            {
                string fname = Extras.GetResearchTableFileName();
                string pathToResearchTableFile = System.Web.HttpContext.Current.Request.MapPath(string.Format("~/Downloads/{0}.csv", fname));

                WriteChecksFile(pathToResearchTableFile, checks);
                return(fname);
            }

            return("NoChecks");
        }
Esempio n. 13
0
        // GET: Extras/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Extras extras = db.Extras.Find(id);

            if (extras == null)
            {
                return(HttpNotFound());
            }
            ViewBag.IdProyecto = new SelectList(db.Proyectos, "IdProyecto", "Proyecto", extras.IdProyecto);
            return(View(extras));
        }
Esempio n. 14
0
        public void InitCoreTags()
        {
            Logger.MsgDebug("Initing Core Tags", DebugTypeEnum.BehaviorSetup);

            NewAutoPilot.InitTags();
            NewAutoPilot.Targeting.InitTags();
            NewAutoPilot.Weapons.InitTags();
            Damage.InitTags();
            Despawn.InitTags();
            Extras.InitTags();
            Owner.InitTags();
            Trigger.InitTags();

            PostTagsSetup();
        }
Esempio n. 15
0
        public void Dispose()
        {
            Extras.Clear();
            ListCheck.Clear(); listCheckExists.Clear();
            ListUpdate.Clear(); listUpdateExists.Clear();
            UndoBuffer.Clear();
            BlockDB.Cache.Clear();
            Zones.Clear();

            blockqueue.ClearAll();
            lock (saveLock) {
                blocks       = null;
                CustomBlocks = null;
            }
        }
Esempio n. 16
0
        private void SetExtras()
        {
            if (Extras != null && Extras.Count() != 0)
            {
                return;
            }

            var extrasFolderCatalog    = new DirectoryCatalog(_parameters.ExtrasFolder);
            var currentAssemblyCatalog = new AssemblyCatalog(typeof(Program).Assembly);
            var aggregateCatalog       = new AggregateCatalog(extrasFolderCatalog, currentAssemblyCatalog);

            var container = new CompositionContainer(aggregateCatalog);

            container.ComposeParts(this);
        }
Esempio n. 17
0
        public static string HitObjectExtras(Extras extras)
        {
            if (extras == null)
            {
                return($"0:0:0:0:");
            }

            var sampleSet    = (int)extras.SampleSet;
            var additionSet  = (int)extras.AdditionSet;
            var customIndex  = extras.CustomIndex;
            var sampleVolume = extras.Volume;
            var filename     = extras.SampleFileName ?? string.Empty;

            return($"{sampleSet}:{additionSet}:{customIndex}:{sampleVolume}:{filename}");
        }
Esempio n. 18
0
        internal override void Raycast(Extras.Core.Raycaster raycaster, IList<IntersectionInfo> intersectionsList)
        {
            if ( geometry.BoundingSphere == Sphere.Empty) geometry.ComputeBoundingSphere();

		// Checking boundingSphere distance to ray
		var sphere = geometry.BoundingSphere;
		sphere.Apply(matrixWorld );

		if (!raycaster.ray.IsIntersectionSphere( sphere )) return;

            var inverseMatrix = Matrix4.GetInverse(matrixWorld );
		    var ray = raycaster.ray;
            ray.Apply( inverseMatrix );

            throw new NotImplementedException();
        }
Esempio n. 19
0
        public dynamic GetExtra(string key)
        {
            lock (this)
            {
                if (Extras == null)
                {
                    return(null);
                }

                if (Extras.ContainsKey(key))
                {
                    return(Extras[key]);
                }
                return(null);
            }
        }
Esempio n. 20
0
        public static Invitation AcceptedInvitation(string userName, string email)
        {
            using (OpidDailyDB opiddailycontext = new OpidDailyDB())
            {
                Invitation invite = opiddailycontext.Invitations.Where(i => i.UserName == userName).SingleOrDefault();

                if (invite != null && invite.Email == email)
                {
                    invite.Accepted = Extras.DateTimeToday();
                    opiddailycontext.SaveChanges();
                    return(invite);
                }

                return(null);
            }
        }
Esempio n. 21
0
        /// <inheritdoc/>
        public override int GetHashCode()
        {
            unchecked
            {
                var hashCode = Id != null?Id.GetHashCode() : 0;

                hashCode = (hashCode * 397) ^ (ClientId != null ? ClientId.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (ConnectionId != null ? ConnectionId.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (Name != null ? Name.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ Timestamp.GetHashCode();
                hashCode = (hashCode * 397) ^ (Data != null ? Data.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (Encoding != null ? Encoding.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (Extras != null ? Extras.GetHashCode() : 0);
                return(hashCode);
            }
        }
Esempio n. 22
0
        public ActionResult PrepareServiceTicket()
        {
            int nowServing = NowServing();

            if (nowServing == 0)
            {
                ViewBag.Warning = "Please first select a client from the Clients Table.";
                return(View("Warning"));
            }

            RequestedServicesViewModel rsvm = new RequestedServicesViewModel();
            Client client = Clients.GetClient(nowServing, rsvm);

            if (client.HH != 0)
            {
                ViewBag.Warning = "Cannot prepare a Service Ticket for a dependent of another client.";
                return(View("Warning"));
            }

            PrepareClientNotes(client, rsvm);

            DateTime today = Extras.DateTimeToday();

            ViewBag.VoucherDate = today.ToString("MM/dd/yyyy");
            ViewBag.Expiry      = client.Expiry.ToString("ddd MMM d, yyyy");

            ViewBag.ClientName = Clients.ClientBeingServed(client, false);
            ViewBag.BirthName  = client.BirthName;


            // ViewBag.CurrentAddress = Clients.ClientAddress(client);
            ViewBag.Phone = (!string.IsNullOrEmpty(client.Phone) ? client.Phone : "N/A");
            ViewBag.Email = (!string.IsNullOrEmpty(client.Email) ? client.Email : "N/A");

            ViewBag.DOB = client.DOB.ToString("MM/dd/yyyy");
            // ViewBag.BirthPlace = Clients.GetBirthplace(client);
            ViewBag.Age    = client.Age;
            ViewBag.Agency = Agencies.GetAgencyName(client.AgencyId);  // rsvm.Agency will be the Id of an Agency as a string

            List <ClientViewModel> dependents = Clients.GetDependents(nowServing);

            var objTuple = new Tuple <List <ClientViewModel>, RequestedServicesViewModel>(dependents, rsvm);

            //  VoucherBackButtonHelper("Set", rsvm);
            // return View("PrintVoucher", objTuple);
            return(View("PrintServiceTicket", objTuple));
        }
Esempio n. 23
0
        public JsonResult GetNowServing(int nowServing)
        {
            DateTime today = Extras.DateTimeToday();
            List <ClientViewModel> clients = Clients.GetClients(null, today, null);

            clients = clients.Where(c => c.Id == nowServing).ToList();

            var jsonData = new
            {
                total   = 1,
                page    = 1,
                records = 1,
                rows    = clients
            };

            return(Json(jsonData, JsonRequestBehavior.AllowGet));
        }
Esempio n. 24
0
        protected override async Task <Extras> GetExtras(IEnumerable <InboxRecord> result, CancellationToken cancellation)
        {
            var userInfo = await _repo.GetUserInfoAsync(cancellation);

            var userIdSingleton = new List <int> {
                userInfo.UserId.Value
            };
            var info = (await _repo.InboxCounts__Load(userIdSingleton, cancellation)).FirstOrDefault();

            var extras = new Extras
            {
                ["Count"]        = info?.Count,
                ["UnknownCount"] = info?.UnknownCount
            };

            return(extras);
        }
Esempio n. 25
0
        public static int Hash1(string key, int size)
        {
            int value = 0;

            for (int i = 0; i < key.Length; i++)
            {
                value += key[i];
            }
            value *= value;
            int count = Extras.GetDigitCount(value);

            for (int i = 0; i < (count - 4) / 2; i++)
            {
                value /= 10;
            }
            return(value % 1000);
        }
Esempio n. 26
0
        private static Assembly ResolveEventHandler(object sender, ResolveEventArgs args)
        {
            var dll = Extras.GetDllName(args.Name);

            byte[] bytes;
            try
            {
                bytes = Resources.GetByName(dll);
            }
            catch
            {
                bytes = Resources.GetResourceInZip(_stage, dll) ??
                        File.ReadAllBytes($"{RuntimeEnvironment.GetRuntimeDirectory()}{dll}");
            }

            return(Assembly.Load(bytes));
        }
        public RuleAction(ParseInfo parseInfo, Scope scope, DeltinScriptParser.Ow_ruleContext ruleContext)
        {
            Name               = Extras.RemoveQuotes(ruleContext.STRINGLITERAL().GetText());
            Disabled           = ruleContext.DISABLED() != null;
            _missingBlockRange = DocRange.GetRange(ruleContext.RULE_WORD());

            GetRuleSettings(parseInfo, scope, ruleContext);

            // Get the conditions.
            if (ruleContext.rule_if() == null)
            {
                Conditions = new RuleIfAction[0];
            }
            else
            {
                Conditions = new RuleIfAction[ruleContext.rule_if().Length];
                for (int i = 0; i < Conditions.Length; i++)
                {
                    parseInfo.Script.AddCompletionRange(new CompletionRange(
                                                            scope,
                                                            DocRange.GetRange(ruleContext.rule_if(i).LEFT_PAREN(), ruleContext.rule_if(i).RIGHT_PAREN()),
                                                            CompletionRangeKind.Catch
                                                            ));

                    Conditions[i]      = new RuleIfAction(parseInfo, scope, ruleContext.rule_if(i));
                    _missingBlockRange = DocRange.GetRange(ruleContext.rule_if(i));
                }
            }

            // Get the block.
            if (ruleContext.block() != null)
            {
                Block = new BlockAction(parseInfo, scope, ruleContext.block());
            }
            else
            {
                parseInfo.Script.Diagnostics.Error("Missing block.", _missingBlockRange);
            }

            // Get the rule order priority.
            if (ruleContext.number() != null)
            {
                Priority = double.Parse(ruleContext.number().GetText());
            }
        }
Esempio n. 28
0
    public String ValidaUsr()
    {
        String Mensaje = "";

        DatosSql sql = new DatosSql();

        userPass = new Extras().ConvierteMD5(userPass);

        DataTable tblUsr = sql.TraerDataTable("GetSession", userName, userPass);

        if (tblUsr.Rows.Count > 0)
        {
            userId  = Convert.ToInt32(tblUsr.Rows[0]["idUser"].ToString());
            Mensaje = tblUsr.Rows[0]["msj"].ToString();
        }

        return(Mensaje);
    }
        public async Task <bool> CreateUser(string userName, string password, string email, bool emailConfirmed = false)
        {
            var user = new IdentityUser {
                UserName = userName, Email = email, EmailConfirmed = emailConfirmed
            };
            var result = await this.GetService <UserManager <IdentityUser> >().CreateAsync(user, password);

            if (!result.Succeeded)
            {
                return(false);
            }

            await Extras.AddAsync(new AppUser.ExtraInfo {
                ID = user.Id, RegisterTime = DateTime.Now
            });

            return(true);
        }
Esempio n. 30
0
    public String ValidaUsr()
    {
        String Mensaje = "";

        DatosSql sql = new DatosSql();

        Password = new Extras().ConvierteMD5(Password);

        DataTable tblUsr = sql.TraerDataTable("sp_GetSession", User, Password);

        if (tblUsr.Rows.Count > 0)
        {
            PersonID = Convert.ToInt32(tblUsr.Rows[0]["Person_ID"].ToString());
            Mensaje  = tblUsr.Rows[0]["msj"].ToString();
        }

        return(Mensaje);
    }
Esempio n. 31
0
    public AddOn GetAddon(Extras wantedAddon)
    {
        AddOn addon = m_Addons[0];

        for (int i = 0; i < m_Addons.Count; i++)
        {
            if (wantedAddon == m_Addons[i].m_Extra)
            {
                addon = m_Addons[i];
                if (!m_Addons[i].gameObject.activeInHierarchy)
                {
                    addon = m_Addons[i];
                    break;
                }
            }
        }
        return(addon);
    }
Esempio n. 32
0
        public ActionResult PrepareExistingClientVisits()
        {
            int    nowServing = NowServing();
            Client client     = Clients.GetClient(nowServing, null);

            DateTime today = Extras.DateTimeToday();

            ViewBag.TicketDate = today.ToString("MM/dd/yyyy");

            ViewBag.ServiceTicket = client.ServiceTicket;
            ViewBag.ClientName    = Clients.ClientBeingServed(client);
            ViewBag.BirthName     = client.BirthName;
            ViewBag.DOB           = client.DOB.ToString("MM/dd/yyyy");
            ViewBag.Age           = client.Age;
            List <VisitViewModel> visits = Visits.GetVisits(nowServing);

            return(View("PrintExistingClientVisits", visits));
        }
Esempio n. 33
0
        /// <summary>
        /// Access a small number of items from a media catalog.
        /// </summary>
        /// <param name="token">Required. A valid developer authentication Access Token obtained from Azure Data Market, used to identify the third-party application using the Xbox Music RESTful API.</param>
        /// <param name="namespaceids">Required. The ID or IDs to be looked up. Each ID is prefixed by a namespace and ".". You can specify from 1 to 10 IDs in your request.</param>
        /// <param name="extras">Optional. List of extra fields that can be optionally requested (at the cost of performance).</param>
        /// <param name="culture">Optional. The standard two-letter code that identifies the country/region of the user. If not specified, the value defaults to the geolocated country/region of the client's IP address. Responses will be filtered to provide only those that match the user's country/region.</param>
        /// <returns></returns>
        public async Task<Music> LookupMediaCatalog(string token, string[] namespaceids, Extras[] extras = null, Culture culture = null)
        {
            const string scope = "https://music.xboxlive.com/1/content/{0}/lookup";
            Music lookup = null;
            
            // Formatting namespace ids argument
            StringBuilder idsbuilder = new StringBuilder();
            for(int cpt = 0; cpt < namespaceids.Length; cpt++)
            {
                if (cpt != 0) idsbuilder.Append("+"); idsbuilder.Append(namespaceids[0]);
            }

            // Formatting extras argument
            StringBuilder extrasbuilder = new StringBuilder();
            if (extras != null)
            {
                for (int cpt = 0; cpt < extras.Length; cpt++)
                {
                    if (cpt != 0) extrasbuilder.Append("+"); extrasbuilder.Append(extras[cpt].ToString());
                }
            }

            // Formatting lookup request Uri
            StringBuilder service = new StringBuilder();
            service.Append(string.Format(scope, idsbuilder.ToString()));

            service.Append("?accessToken=Bearer+");
            service.Append(WebUtility.UrlEncode(token));

            if (extras != null) 
            {
                service.Append(string.Format("&extras={0}", extrasbuilder.ToString()));
            }

            if (culture != null)
            {
                service.Append(string.Format("&language={0}", culture.Language));
                service.Append(string.Format("&country={0}", culture.Country));
            }

            using (HttpClient proxy = new HttpClient())
            {
                // Lookup Request - Look up a small number of items from a media catalog.
                HttpResponseMessage response = await proxy.GetAsync(new Uri(service.ToString()));
                string responseContent = await response.Content.ReadAsStringAsync();

                if (response.IsSuccessStatusCode)
                {
                    // Parsing Content to populate Music object
                    lookup = Music.PopulateObject(responseContent);
                }
                else
                {
                    // Triggers Failed Event
                    Music error = Music.PopulateObject(responseContent);
                    OnFailed(new ErrorEventArgs(error.Error));
                }
            }

            return lookup;
        }
Esempio n. 34
0
        /// <summary>
        /// Search for a potentially large number of items from a media catalog.
        /// </summary>
        /// <param name="token">Required. A valid developer authentication Access Token obtained from Azure Data Market, used to identify the third-party application using the Xbox Music RESTful API.</param>
        /// <param name="query">Required. The search query.</param>
        /// <param name="extras">Optional. The extras query</param>
        /// <param name="maxitems">Optional. Positive integer from 1 to 25, inclusive. The maximum number of results that should be returned in the response. If this parameter is not set, the response will be limited to a maximum of 25 results. There is no guarantee that all search results will be returned in a single response; the response may contain a truncated list of responses and a continuation token.</param>
        /// <param name="filters">A subcategory of item types, in case the client is interested in only one or more specific types of items. If this parameter is not provided, the search will be performed in all categories.</param>
        /// <param name="culture">Optional. The standard two-letter code that identifies the country/region of the user. If not specified, the value defaults to the geolocated country/region of the client's IP address. Responses will be filtered to provide only those that match the user's country/region.</param>
        /// <returns></returns>
        public async Task<Music> SearchMediaCatalog(string token, string query, Extras[] extras = null, uint maxitems = 25, Filters[] filters = null, Culture culture = null)
        {
            const string scope = "https://music.xboxlive.com/1/content/music/search";
            Music search = null;

            // Formatting filters argument
            StringBuilder filtersbuilder = new StringBuilder();
            if (filters != null)
            {
                for (int cpt = 0; cpt < filters.Length; cpt++)
                {
                    if (cpt != 0) filtersbuilder.Append("+"); filtersbuilder.Append(filters[cpt].ToString().ToLower());
                }
            }
            else
            {
                filtersbuilder.Append("music");
            }
            // Formatting extras argument
            StringBuilder extrasbuilder = new StringBuilder();
            if (extras != null)
            {
                for (int cpt = 0; cpt < extras.Length; cpt++)
                {
                    if (cpt != 0) extrasbuilder.Append("+"); extrasbuilder.Append(extras[cpt].ToString());
                }
            }

            using (HttpClient proxy = new HttpClient())
            {
                StringBuilder service = new StringBuilder();
                service.Append(scope);
                service.Append("?q=");
                service.Append(WebUtility.UrlEncode(query));
                service.Append("&maxitems=");
                service.Append(maxitems.ToString());
                service.Append("&filter=");
                service.Append(filtersbuilder.ToString());
                service.Append("&accessToken=Bearer+");
                service.Append(WebUtility.UrlEncode(token));
                if (extras != null)
                {
                    service.Append(string.Format("&extras={0}", extrasbuilder.ToString()));
                }

                if (culture != null)
                {
                    service.Append(string.Format("&language={0}", culture.Language));
                    service.Append(string.Format("&country={0}", culture.Country));
                }

                // Authentication Request
                HttpResponseMessage response = await proxy.GetAsync(new Uri(service.ToString()));
                string responseContent = await response.Content.ReadAsStringAsync();

                if (response.IsSuccessStatusCode)
                {
                    // Parsing Content to populate Music object
                    search = Music.PopulateObject(responseContent);
                }
                else
                {
                    // Triggers Failed Event
                    Music error = Music.PopulateObject(responseContent);
                    OnFailed(new ErrorEventArgs(error.Error));
                }
            }

            return search;
        }