public List<Title> Get(Titles request)
		{
			TitleRepository repository = GetTitleRepository();
			List<TitleEntity> entities = repository.Read();
			
			return entities.TranslateToResponse();
		}
Ejemplo n.º 2
0
 public ActionResult Titles(TitleSearch titleSearch, int?pageNumber)
 {
     try
     {
         TitleService _title       = new TitleService();
         var          titles       = _title.GetTitles().ToPagedList(pageNumber ?? 1, 10);
         var          searchValues = _title.GetSearchValues();
         searchValues.SelectedTitleList = searchValues.SelectedTitles.Select(x => new SelectListItem()
         {
             Text  = x,
             Value = x
         }).Distinct().ToList();
         searchValues.TerritoryList = searchValues.Territories.Select(x => new SelectListItem()
         {
             Text  = x,
             Value = x
         }).Distinct().ToList();
         searchValues.LanguageList = searchValues.Languages.Select(x => new SelectListItem()
         {
             Text  = x,
             Value = x
         }).Distinct().ToList();
         searchValues.MPMList = searchValues.MPMs.Select(x => new SelectListItem()
         {
             Text  = x,
             Value = x
         }).Distinct().ToList();
         searchValues.VendorIdList = searchValues.VendorIds.Select(x => new SelectListItem()
         {
             Text  = x,
             Value = x
         }).Distinct().ToList();
         searchValues.VideoVersionList = searchValues.VideoVersions.Select(x => new SelectListItem()
         {
             Text  = x,
             Value = x
         }).Distinct().ToList();
         Titles title = new Titles();
         title.TitleSearch = searchValues;
         title.TitleList   = titles;
         return(View(title));
     }
     catch (Exception ex)
     {
         return(View("Error"));
     }
 }
Ejemplo n.º 3
0
        public override void OnDoubleClick(Mobile from)
        {
            if (from.InRange(this.GetWorldLocation(), 2))
            {
                bool LookInside = true;

                if (from.Backpack.FindItemByType(typeof(ThiefNote)) != null)
                {
                    Item      mail     = from.Backpack.FindItemByType(typeof(ThiefNote));
                    ThiefNote envelope = (ThiefNote)mail;

                    if (envelope.NoteOwner == from && envelope.NoteItemGot > 0 && HayTown == envelope.NoteDeliverTo && envelope.NoteDeliverType == 2)
                    {
                        LoggingFunctions.LogStandard(from, "has stolen " + envelope.NoteItem + ".");
                        from.AddToBackpack(new Gold(envelope.NoteReward));
                        Titles.AwardFame(from, ((int)(envelope.NoteReward / 100)), true);
                        Titles.AwardKarma(from, -((int)(envelope.NoteReward / 100)), true);
                        Server.Items.ThiefNote.SetupNote(envelope, from);
                        from.LocalOverheadMessage(MessageType.Emote, 1150, true, "You collected your reward.");
                        from.SendMessage("You found another secret note for you.");
                        from.SendSound(0x3D);
                        from.CloseGump(typeof(Server.Items.ThiefNote.NoteGump));
                        Server.Items.ThiefNote.ThiefTimeAllowed(from);
                        LookInside = false;
                    }
                }

                if (LookInside)
                {
                    string message = "There is nothing of interest in here.";

                    if (Utility.RandomMinMax(1, 20) == 1 && Stackable == false)
                    {
                        Server.Misc.ContainerFunctions.GiveRandomItem(from);
                        message = "You pull something out of the hay and it falls by your feet.";
                    }
                    Stackable = true;

                    from.SendSound(0x057);
                    from.SendMessage(message);
                }
            }
            else
            {
                from.SendLocalizedMessage(502138);                   // That is too far away for you to use
            }
        }
Ejemplo n.º 4
0
        public List <Title> OrderTitlesByBest()
        {
            List <Title> list = new List <Title>();

            foreach (TitleType type in Priority) // first find the types that need to be in a specifc order
            {
                Title title = Titles.FirstOrDefault(x => x?.Metadata.Type == type);
                if (title != null)
                {
                    list.Add(title);
                }
            }
            IEnumerable <Title> unorganized = Titles.Except(list); // then add the types that don't need to be organized afterwards

            list.AddRange(unorganized);
            return(list);
        }
Ejemplo n.º 5
0
        public virtual void EndQuest(PlayerMobile pm)
        {
            TeiravonMobile tm = (TeiravonMobile)pm;

            if (Titles.AwardExp(tm, QuestExp))
            {
                pm.SendMessage("You have gained {0} experience.", QuestExp);
            }
            pm.AddToBackpack(new Gold(GoldAmt));
            if (this.Backpack != null)
            {
                if (this.Backpack.Items.Count > 0)
                {
                    pm.AddToBackpack((Item)this.Backpack.Items[Utility.Random(this.Backpack.Items.Count)]);
                }
            }
        }
        public void TitleChoose(Titles title)
        {
            switch (title)
            {
            case Titles.Mr:
                MrRadioButton.Click();
                break;

            case Titles.Mrs:
                MrsRadioButton.Click();
                break;

            default:
                MrRadioButton.Click();
                break;
            }
        }
Ejemplo n.º 7
0
        private void SetObservableCollections(
            IList <ILinguisticVariable> linguistics,
            IList <FactorFuzzyValue> termSets)
        {
            foreach (ILinguisticVariable linguistic in linguistics)
            {
                Titles.Add(linguistic.Title);
            }

            foreach (FactorFuzzyValue term in termSets)
            {
                FuzzyValues.Add(term);
            }

            Connections.Add(LogicalConnection.AND);
            Connections.Add(LogicalConnection.OR);
        }
Ejemplo n.º 8
0
        private void ExcuteAddNewTitleCommand()
        {
            var category = new Categories(NameTypes.TitleType);

            category.ShowDialog();
            var dialogueResult = category.DialogResult;

            if (dialogueResult != null && (bool)dialogueResult)
            {
                LoadTitles();//should also get the latest updates in each row
                SelectedTitle = Titles.FirstOrDefault(c => c.DisplayName == category.TxtCategoryName.Text);
                if (SelectedTitle != null)
                {
                    SelectedRepresentee.TitleId = SelectedTitle.Id;
                }
            }
        }
Ejemplo n.º 9
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            var ticket = new Tickets {
                ID = Convert.ToInt32(TicketID)
            };

            ticket.GetById();
            var userInSession = (Users)Session["userinsession"];

            UserID = userInSession.ID.ToString();

            pnlOldTickets.Visible = false;
            lvAllGoods.Visible    = true;
            var goods = new Goods {
                TicketFullSecureID = ticket.FullSecureID
            };

            lvAllGoods.DataSource = goods.GetAllItems("ID", "ASC", "TicketFullSecureID");
            lvAllGoods.DataBind();
            foreach (var item in lvAllGoods.Items)
            {
                var lblGoodsDescription = (Label)item.FindControl("lblDescription");
                var pnlWithoutAkciza    = (Panel)item.FindControl("pnlWithoutAkciza");
                var cbWithoutAkciza     = (CheckBox)item.FindControl("cbWithoutAkciza");
                var hfWithoutAkciza     = (HiddenField)item.FindControl("hfWithoutAkciza");
                var category            = new Titles {
                    Name = lblGoodsDescription.Text
                };
                category.GetByName();
                if (category.ID != 0 && category.CanBeWithoutAkciza != 0)
                {
                    pnlWithoutAkciza.Visible = true;
                    if (hfWithoutAkciza.Value == "1")
                    {
                        cbWithoutAkciza.Checked = true;
                    }
                }
                //ограничения
                var rolesList   = Application["RolesList"] as List <Roles>;
                var currentRole = (Roles)rolesList.SingleOrDefault(u => u.Name.ToLower() == userInSession.Role.ToLower());
                if (currentRole.ActionControlActiza != 1)
                {
                    cbWithoutAkciza.Enabled = false;
                }
            }
        }
Ejemplo n.º 10
0
        public NewEmployeeViewModel()
        {
            //Departments = new BindableCollection<DepartmentModel>(GlobalConfig.Connection.GetAllDepartments());
            //Functions = new BindableCollection<FunctionModel>(GlobalConfig.Connection.GetAllFunctions());
            //Titles = new BindableCollection<TitleModel>(GlobalConfig.Connection.GetAllTitles());
            Departments.Add(new DepartmentModel {
                Id = 2, DeptName = "Fork Licensing"
            });
            Departments.Add(new DepartmentModel {
                Id = 3, DeptName = "Lab"
            });

            Functions.Add(new FunctionModel {
                Id = 3, DeptId = 2, FunctionName = "Fork", RenewalMonths = 36
            });
            Functions.Add(new FunctionModel {
                Id = 4, DeptId = 2, FunctionName = "Clamp", RenewalMonths = 36
            });
            Functions.Add(new FunctionModel {
                Id = 5, DeptId = 2, FunctionName = "Arial", RenewalMonths = 36
            });
            Functions.Add(new FunctionModel {
                Id = 6, DeptId = 3, FunctionName = "Deviation", RenewalMonths = 0
            });
            Functions.Add(new FunctionModel {
                Id = 7, DeptId = 3, FunctionName = "Approve Deviation", RenewalMonths = 0
            });
            Functions.Add(new FunctionModel {
                Id = 8, DeptId = 3, FunctionName = "MMC", RenewalMonths = 0
            });

            Titles.Add(new TitleModel {
                Id = 9, TitleName = "Utility"
            });
            Titles.Add(new TitleModel {
                Id = 7, TitleName = "Drum Operator"
            });
            Titles.Add(new TitleModel {
                Id = 2, TitleName = "Adhesive Room"
            });

            GetEmployees();
            IsSelected = true;
            NotifyOfPropertyChange(() => ModeSwitch);
        }
        public bool LoadData()
        {
            try
            {
                using (SqlConnection cn = new SqlConnection(Properties.Settings.Default.ConnectionString))
                {
                    string commandText = @"
                        SELECT [TitleOfCourtesy] + ' ' + [LastName] + ' ' + [FirstName] As FullName FROM [NORTHWND.MDF].[dbo].[Employees]; 
                        SELECT DISTINCT [Title] FROM [NORTHWND.MDF].[dbo].[Employees];";

                    using (SqlCommand cmd = new SqlCommand(commandText, cn))
                    {
                        cn.Open();

                        SqlDataReader reader = cmd.ExecuteReader();

                        // get results into first list from first select
                        if (reader.HasRows)
                        {
                            while (reader.Read())
                            {
                                Names.Add(reader.GetString(0));
                            }

                            // move on to second select
                            reader.NextResult();

                            // get results into first list from first select
                            if (reader.HasRows)
                            {
                                while (reader.Read())
                                {
                                    Titles.Add(reader.GetString(0));
                                }
                            }
                        }
                    }
                }
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Ejemplo n.º 12
0
        public IHttpActionResult GetTitles(string isbn)
        {
            Titles titles = db.Titles.FirstOrDefault(t => t.ISBN == isbn);

            if (titles == null)
            {
                return(NotFound());
            }
            var title = new Titles()
            {
                Copyright     = titles.Copyright,
                ISBN          = titles.ISBN,
                Title         = titles.Title,
                EditionNumber = titles.EditionNumber
            };

            return(Ok(title));
        }
Ejemplo n.º 13
0
 public void CreateTitile(TitleCreateDto model)
 {
     try
     {
         Titles create = new Titles
         {
             TitleId   = Guid.NewGuid(),
             TitleName = model.TitleName,
             Price     = model.Price
         };
         _titles.Create(create);
         _titles.SaveContext();
     }
     catch (Exception ex)
     {
         Debug.WriteLine(ex.Message);
     }
 }
Ejemplo n.º 14
0
        public Title(string title)
        {
            if (String.IsNullOrWhiteSpace(title))
            {
                this.title = Titles.Unknown;
                return;
            }

            try
            {
                this.title = (Titles)Enum.Parse(typeof(Titles), title.Trim('.'), IgnoreCase);
                this.title.GetDescription(); //catch int value outside the allowed range
            }
            catch (Exception)
            {
                this.title = Titles.Unknown;
            }
        }
Ejemplo n.º 15
0
        public void Test_ResourceAppService_CustomClient()
        {
            try
            {
                string url = AppSettingsReader <IAppSettings> .Get(x => x.ResourceAppServiceUrl);

                string cultureName = "nl-NL";

                var      client   = new ResourceAppServiceClient(url);
                Labels   labels   = client.GetLabels(cultureName);
                Messages messages = client.GetMessages(cultureName);
                Titles   titles   = client.GetTitles(cultureName);
            }
            catch (WebException ex)
            {
                Assert.Inconclusive(ex.Message);
            }
        }
Ejemplo n.º 16
0
        /// <summary>
        /// For SampleTest1
        /// </summary>
        /// <returns></returns>
        private Team55LibraryContext MakeTinyLibrary()
        {
            /*MOCK DATABASE SETUP*/
            var optionsBuilder      = new DbContextOptionsBuilder <Team55LibraryContext>();
            Team55LibraryContext db = new Team55LibraryContext(optionsBuilder.UseInMemoryDatabase("tiny_library").Options);
            /*END MOCK DATABASE SETUP*/

            /*Add in data*/
            Titles t = new Titles();

            t.Author = "Tony Diep";
            t.Title  = "Tony's Life";
            t.Isbn   = "978-1111111111";

            db.Titles.Add(t);
            db.SaveChanges();

            return(db);
        }
Ejemplo n.º 17
0
        public void ParseRaceInformation(Event evnt, XmlNode node)
        {
            foreach (XmlNode informationNode in node.ChildNodes)
            {
                switch (informationNode.Name)
                {
                // Use GB only without localisation for the time being
                case "title":
                    foreach (XmlNode titleNode in informationNode.ChildNodes)
                    {
                        if (Titles.TryGetValue(titleNode.Name, out _))
                        {
                            if (titleNode.Name == "GB")
                            {
                                evnt.Name = titleNode.InnerText;
                            }
                            Titles[titleNode.Name] = titleNode.InnerText;
                        }
                    }
                    break;

                case "description":
                    foreach (XmlNode descNode in informationNode.ChildNodes)
                    {
                        if (Descriptions.TryGetValue(descNode.Name, out _))
                        {
                            Descriptions[descNode.Name] = descNode.InnerText;
                        }
                    }
                    break;

                case "one_line_title":
                    foreach (XmlNode descNode in informationNode.ChildNodes)
                    {
                        if (Descriptions.TryGetValue(descNode.Name, out _))
                        {
                            OneLineTitles[descNode.Name] = descNode.InnerText;
                        }
                    }
                    break;
                }
            }
        }
Ejemplo n.º 18
0
        //private double PixelPerInterval
        //{
        //    get { return _pixelPerInterval; }
        //    set
        //    {
        //        _pixelPerInterval = value;
        //        //ChartAreas[0].AxisX.ScaleView.Size = 10 * PixelPerInterval;
        //        var a = (ChartAreas[0].InnerPlotPosition.Width / 100);
        //        //var count = Width / (ChartAreas[0].AxisX.ScaleView.ViewMaximum - ChartAreas[0].AxisX.ScaleView.ViewMinimum);
        //        var count = a * Width / (ChartAreas[0].AxisX.ScaleView.ViewMaximum - ChartAreas[0].AxisX.ScaleView.ViewMinimum);
        //        count = a*Width*PixelPerInterval;
        //        count = 5;
        //        count = a*Width/25;
        //        ChartAreas[0].AxisX.ScaleView.Zoom(ChartAreas[0].AxisX.Minimum, count, DateTimeIntervalType.Days);
        //    }
        //}

        //private double _pixelPerInterval = 10;
        //private bool _updatePixelPerInterval = true;

        #endregion

        #region Constructor

        public BiodataChart(Func <BiodataEntry[]> getEntries) : base(() => getEntries().Cast <Entry>().ToArray(), true)
        {
            Titles.Add("Biodata");

            //Paint += (s, e) =>
            //             {
            //                 if (!_updatePixelPerInterval || ChartAreas.Count <= 0) return;
            //                 var firstDate = DateTime.FromOADate(Series[0].Points[0].XValue);
            //                 PixelPerInterval =
            //                     ChartAreas[0].AxisX.ValueToPixelPosition(firstDate.AddDays(1).ToOADate()) -
            //                     ChartAreas[0].AxisX.ValueToPixelPosition(firstDate.ToOADate());
            //                 _updatePixelPerInterval = false;
            //             };

            //Resize += (s, e) =>
            //              {
            //                  _updatePixelPerInterval = true;
            //              };
        }
        public async override Task GetEntitiesFromServer()
        {
            List <Task> tasks = new List <Task>();

            Task <List <RefereeModel> > entitiesTask = interactor.GetEntities("api/floorball/referees", "Error during getting referees");

            tasks.Add(entitiesTask);

            await Task.WhenAll(tasks);

            var entities = entitiesTask.Result;

            /*var leagues = leaguesTask.Result;
             * var teams = teamsTask.Result;*/

            RefereeModel prevEntity = null;

            List <SearchCell> searchList = new List <SearchCell>();

            foreach (var entity in entities.OrderBy(e => e.Country).ThenBy(e => e.Name).ThenByDescending(e => e.Number))
            {
                if (prevEntity == null || entity.Country != prevEntity.Country)
                {
                    SearchModel.Add(new List <SearchCell>());
                    Titles.Add(new SearchTitle {
                        MainTitle = AppDelegate.SharedAppDelegate.TextManager.GetText(entity.Country), Subtitle = ""
                    });
                }

                SearchModel.Last().Add(new SearchCell
                {
                    Id          = entity.Id,
                    Title       = entity.Name,
                    Subtitle    = "Match count: " + entity.Number.ToString(),
                    RightDetail = ""
                });

                prevEntity = entity;
            }

            FilteredSearchModel = new List <List <SearchCell> >(SearchModel);
            FilteredTitles      = new List <SearchTitle>(Titles);
        }
Ejemplo n.º 20
0
        public static string GetAllInsideContent(TAGBlock block)
        {
            string ret = string.Empty;

            if (block.Name == null || Excluded.Contains(block.Name))
            {
                return(ret);
            }
            if (Titles.ContainsKey(block.Name))
            {
                ret = DataResource.GetMarkFormatted(Titles[block.Name]);
            }
            ret = string.Format("{0}{1}", ret, block.content);
            if (block.FirstInside != null)
            {
                ret = string.Format("{0}{1}", ret, GetAllContent(block.FirstInside));
            }
            return(ret);
        }
Ejemplo n.º 21
0
        public List <Titles> GetAllTitles()
        {
            List <Titles> titlesList = null;

            try
            {
                using (SqlConnection con = _databaseFactory.GetDBConnection())
                {
                    using (SqlCommand cmd = new SqlCommand())
                    {
                        if (con.State == ConnectionState.Closed)
                        {
                            con.Open();
                        }
                        cmd.Connection  = con;
                        cmd.CommandText = "[Accounts].[GetAllTitles]";
                        cmd.CommandType = CommandType.StoredProcedure;
                        using (SqlDataReader sdr = cmd.ExecuteReader())
                        {
                            if ((sdr != null) && (sdr.HasRows))
                            {
                                titlesList = new List <Titles>();
                                while (sdr.Read())
                                {
                                    Titles _titlesObj = new Titles();
                                    {
                                        _titlesObj.Title = (sdr["Title"].ToString() != "" ? sdr["Title"].ToString() : _titlesObj.Title);
                                    }
                                    titlesList.Add(_titlesObj);
                                }
                            }
                        }
                    }
                }
            }

            catch (Exception ex)
            {
                throw ex;
            }

            return(titlesList);
        }
        public MainViewModel()
        {
            try
            {
                string json    = File.ReadAllText(dbName);
                var    _titles = new ObservableCollection <TitleModel>(JsonConvert.DeserializeObject <List <TitleModel> >(json).OrderBy(x => x.System).ThenBy(y => y.Title));
                foreach (var title in Titles.Where(t =>
                                                   string.IsNullOrWhiteSpace(t.CartImage) && !string.IsNullOrWhiteSpace(t.CartUrl)))
                {
                    title.CartImage = title.CartUrl;
                }

                Titles = _titles;
            }
            catch
            {
            }

            if (File.Exists("config.json"))
            {
                string configJson = File.ReadAllText("config.json");
                Config config     = JsonConvert.DeserializeObject <Config>(configJson);

                GameScannerPath = config.Path;
                UserName        = config.UserName;
                PassWord        = config.Password;
            }

            string scc = File.ReadAllText("systems.cfg");

            SystemConfigs = new ObservableCollection <ConsoleLabelConfig>(JsonConvert.DeserializeObject <List <ConsoleLabelConfig> >(scc));
            foreach (ConsoleLabelConfig consoleLabelConfig in SystemConfigs)
            {
                FoundSystems.Add(new System
                {
                    HasConfig = true,
                    Name      = consoleLabelConfig.EmuVRMedia,
                });
            }

            FoundSystems = new ObservableCollection <System>(FoundSystems.OrderBy(x => x.Name));
        }
Ejemplo n.º 23
0
        public ChartControl(List <Series> seriesList, string name) : base()
        {
            Name      = name;
            MaxPoints = 1000;

            title     = new Title(Name);
            ChartArea = new ChartArea("ChartArea");
            ChartArea.AxisX.Enabled             = AxisEnabled.False;
            ChartArea.AxisY.IsStartedFromZero   = false;
            ChartArea.AxisY.Enabled             = AxisEnabled.False;
            ChartArea.AxisY2.Enabled            = AxisEnabled.False;
            ChartArea.AxisX.LabelStyle.Enabled  = false;
            ChartArea.AxisY.LabelStyle.Enabled  = false;
            ChartArea.AxisY2.LabelStyle.Enabled = false;
            ChartArea.Position.X      = 0;
            ChartArea.Position.Y      = 40;
            ChartArea.Position.Height = 60;
            ChartArea.Position.Width  = 100;
            //chartArea.AxisY2.Title = "kVAR";
            //chartArea.AxisY.Title = "W";
            //chartArea.AxisY.LabelStyle.IsEndLabelVisible = true;

            Legends.Add(new Legend("LeftLegend")
            {
                Enabled     = false,
                LegendStyle = LegendStyle.Column,
            });
            Legends.Add(new Legend("RightLegend")
            {
                Enabled     = false,
                LegendStyle = LegendStyle.Column,
            });
            ChartAreas.Add(ChartArea);
            Titles.Add(title);
            if (seriesList != null)
            {
                foreach (Series series in seriesList)
                {
                    Series.Add(series);
                }
            }
        }
Ejemplo n.º 24
0
        public override bool CheckCast()
        {
            if (!base.CheckCast())
            {
                return(false);
            }

            if (Caster.Skills[CastSkill].Value < RequiredSkill)
            {
                Caster.SendMessage("You lack the skills to use this necromancer liquid!");
                return(false);
            }

            if (Caster.Karma > -2459)
            {
                Titles.AwardKarma(Caster, -50, true);
            }

            return(true);
        }
Ejemplo n.º 25
0
        public static void Main(string[] args)
        {
            DvdAuthor a = new DvdAuthor();

            Titles b = new Titles(a.XmlDoc);
            Titles c = new Titles(a.XmlDoc);

            b.AddFile("/hello/world.mpg");
            b.AddFile("/hello/world/version2.mpg");

            c.AddFile("/big/buck/bunny.mpg");
            c.AddFile("/big/world/version2.mpg");

            a.AddTitle(b.GetTitle());
            a.AddTitle(c.GetTitle());

            a.Save(@"C:\Documents and Settings\Peter\Desktop\test.xml");

            Console.WriteLine("Hello World!");
        }
Ejemplo n.º 26
0
                protected override void OnTarget(Mobile from, object targeted)
                {
                    TradeOrderCrate order = targeted as TradeOrderCrate;

                    if (order != null)
                    {
                        if (CityLoyaltySystem.CityTrading.TryTurnInToSlim(from, order, Slim))
                        {
                            from.AddToBackpack(Slim.GiveAward());
                            from.SendLocalizedMessage(1073621); // Your reward has been placed in your backpack.

                            Titles.AwardKarma(from, -100, true);
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(1151731);                         // That is not a valid trade order. Please try again.
                        from.Target = new InternalTarget(Slim);
                    }
                }
Ejemplo n.º 27
0
        public async Task <IActionResult> Create([Bind("TTL_NAME")] Titles titles)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    _context.Add(titles);
                    await _context.SaveChangesAsync();

                    return(RedirectToAction(nameof(Index)));
                }
            }
            catch
            {
                ModelState.AddModelError("", "Unable to save changes. " +
                                         "Try again, and if the problem persists " +
                                         "you are done. Bye-bye");
            }
            return(View(titles));
        }
Ejemplo n.º 28
0
        public UxChartControl(bool useDefaultPopupMechanism = true)
        {
            Titles.Clear();

            _title       = createTitle(TITLE_DEFAULT_FONT_SIZE, StringAlignment.Center, ChartTitleDockStyle.Top);
            _description = createTitle(DESCRIPTION_DEFAULT_FONT_SIZE, StringAlignment.Near, ChartTitleDockStyle.Bottom);

            Titles.Add(_title);
            Titles.Add(_description);

            _barManager = new BarManager {
                Form = this
            };
            PopupMenu = new PopupMenu(_barManager);

            if (useDefaultPopupMechanism)
            {
                initializePopup();
            }
        }
Ejemplo n.º 29
0
        /// <summary>
        /// Conversion from Entry to string seq seq
        /// Contrary function of LoadContentToFile()
        /// </summary>
        /// <returns></returns>
        private IEnumerable <IEnumerable <string> > SaveFileToContent()
        {
            var titles = Titles;

            if (_titleRules != null)
            {
                _titleRules(ref titles);
            }

            var content = new List <List <string> > {
                titles
            };

            foreach (var aEntry in Content)
            {
                var newEntry = aEntry;
                if (_entryRules != null)
                {
                    _entryRules(ref newEntry);
                }
                var newContentLine = new List <string>();
                foreach (var propName in Titles.Select(
                             title => (from prop in EntryType.GetProperties()
                                       from attr in prop.GetCustomAttributes(typeof(TitleName), false)
                                       where ((TitleName)attr).Name == title
                                       select prop.Name).FirstOrDefault()))
                {
                    if (propName != null)
                    {
                        var contentField = EntryType.GetProperty(propName).GetValue(newEntry, null);
                        newContentLine.Add(contentField.ToString());
                    }
                    else
                    {
                        newContentLine.Add("");
                    }
                }
                content.Add(newContentLine);
            }
            return(content);
        }
Ejemplo n.º 30
0
        public override void OnCast()
        {
            if (this.CheckSequence())
            {
                TimeSpan duration = TimeSpan.FromSeconds((2 * this.Caster.Skills.Magery.Fixed) / 5);

                if (Core.AOS)  /* Why two diff daemons? TODO: solve this */
                {
                    BaseCreature m_Daemon = new SummonedDaemon();
                    SpellHelper.Summon(m_Daemon, this.Caster, 0x216, duration, false, false);
                    m_Daemon.FixedParticles(0x3728, 8, 20, 5042, EffectLayer.Head);
                }
                else
                {
                    SpellHelper.Summon(new Daemon(), this.Caster, 0x216, duration, false, false);
                }
                Titles.AwardKarma(this.Caster, -50, true);
            }

            this.FinishSequence();
        }
Ejemplo n.º 31
0
        public int CompareTo(object obj)
        {
            var b = (Book)obj;
            var conditionTitle = Titles.CompareTo(b.Titles);

            if (conditionTitle != 0)
            {
                return(conditionTitle);
            }

            var conditionPages = Pages.CompareTo(b.Pages);

            if (conditionPages != 0)
            {
                return(conditionPages);
            }

            var conditionWords = Words.CompareTo(b.Words);

            return(conditionWords);
        }
Ejemplo n.º 32
0
        public async Task<Titles> SearchTitles(String Title, Int32 Limit = 10, Boolean OnUserBehalf = true,
            TitleExpansion ExpansionLevel = TitleExpansion.Minimal)
        {
            Login.CheckInformationSet();

            Dictionary<String, String> extraParams = new Dictionary<String, String>();
            extraParams.Add("term", FlixSharp.Helpers.OAuth.OAuthHelpers.Encode(Title));
            extraParams.Add("max_results", Limit.ToString());

            String tokenSecret = "";
            //String token = "";
            if (OnUserBehalf)
            {
                Account na = FlixSharp.Netflix.SafeReturnUserInfo();
                if (na != null)
                {
                    tokenSecret = na.TokenSecret;
                    extraParams.Add("oauth_token", na.Token);
                }
            }

            String titleurl = OAuthHelpers.GetOAuthRequestUrl(Login.SharedSecret,
                Login.ConsumerKey,
                Constants.CatalogTitleSearchUrl,
                "GET",
                tokenSecret,
                extraParams);

            var moviedoc = AsyncHelpers.NetflixLoadXDocumentAsync(titleurl);

            Titles movies = new Titles();

            switch (ExpansionLevel)
            {
                case TitleExpansion.Minimal:
                    movies.AddRange(await Fill.GetBaseTitleInfo(moviedoc, "catalog_title"));
                    break;
                case TitleExpansion.Expanded:
                    movies.AddRange(await AsyncFiller.GetExpandedMovieDetails(await moviedoc));
                    break;
                case TitleExpansion.Complete:
                    movies.AddRange(await AsyncFiller.GetCompleteNetflixMovieDetails(await moviedoc));
                    break;
            }


            return movies;

        }
Ejemplo n.º 33
0
        /// <summary>
        /// Make a catalog/titles search request
        /// </summary>
        /// <param name="SearchTerm"></param>
        /// <param name="Limit"></param>
        /// <param name="OnUserBehalf">Make the request on the user's behalf if a 
        /// GetCurrentUserNetflixUserInfo delegate was provided during creation.</param>
        /// <returns></returns>
        public async Task<SearchResults> SearchEverything(String SearchTerm, Int32 Limit = 20, Boolean OnUserBehalf = true,
            TitleExpansion TitleExpansionLevel = TitleExpansion.Minimal,
            PersonExpansion PersonExpansionLevel = PersonExpansion.Minimal)
        {
            Login.CheckInformationSet();

            Dictionary<String, String> extraParams = new Dictionary<String, String>();
            extraParams.Add("term", OAuthHelpers.Encode(SearchTerm));
            extraParams.Add("max_results", Limit.ToString());

            String tokenSecret = "";
            if (OnUserBehalf)
            {
                Account na = FlixSharp.Netflix.SafeReturnUserInfo();
                if (na != null)
                {
                    tokenSecret = na.TokenSecret;
                    extraParams.Add("oauth_token", na.Token);
                }
            }

            String personurl = OAuthHelpers.GetOAuthRequestUrl(Login.SharedSecret,
                Login.ConsumerKey,
                Constants.CatalogPeopleSearcUrl,
                "GET",
                tokenSecret,
                extraParams);
            var persondoc = AsyncHelpers.NetflixLoadXDocumentAsync(personurl);

            String titleurl = OAuthHelpers.GetOAuthRequestUrl(Login.SharedSecret,
                Login.ConsumerKey,
                Constants.CatalogTitleSearchUrl,
                "GET",
                tokenSecret,
                extraParams);
            var moviedoc = AsyncHelpers.NetflixLoadXDocumentAsync(titleurl);
            
            People people = new People();
            switch (PersonExpansionLevel)
            {
                case PersonExpansion.Minimal:
                    people.AddRange(from person
                                    in (await persondoc).Descendants("person")
                                    select new Person(PersonExpansion.Minimal)
                                    {
                                        IdUrl = person.Element("id").Value,
                                        Name = person.Element("name").Value,
                                        Bio = (String)person.Element("bio")
                                    });
                    break;
                case PersonExpansion.Complete:
                    people.AddRange(await AsyncFiller.GetCompleteNetflixPersonDetails(await persondoc));
                    break;
            }

            Titles movies = new Titles();
            switch (TitleExpansionLevel)
            {
                case TitleExpansion.Minimal:
                    movies.AddRange(await Fill.GetBaseTitleInfo(moviedoc, "catalog_title"));
                    break;
                case TitleExpansion.Expanded:
                    movies.AddRange(await AsyncFiller.GetExpandedMovieDetails(await moviedoc));
                    break;
                case TitleExpansion.Complete:
                    movies.AddRange(await AsyncFiller.GetCompleteNetflixMovieDetails(await moviedoc));
                    break;
            }

            SearchResults sr = new SearchResults();
            sr.MovieResults = movies;
            sr.PeopleResults = people;
            sr.SearchTerm = SearchTerm;
            return sr;
        }
Ejemplo n.º 34
0
        public static List<Models.Movie> GetDatabaseMovies(Titles results)
        {
            var netflixids = results.Select((m) => m.Id + (m.SeasonId != "" ? ";" + m.SeasonId : ""));
            using (FilmTroveContext ftc = new FilmTroveContext())
            {

                ///1) find the matching records from the database
                var matchedmovies = ftc.Movies.Where(m => netflixids.Contains(m.Netflix.Id));
                ///2) find the records that don't have a match
                ///select the ids and get the netflix Ids that aren't in the FT database
                var ftnfids = matchedmovies.Select(m => m.Netflix.Id);
                var netflixidsunmatched = netflixids.Where(m => !ftnfids.Contains(m));
                //Int32 count = 0;
                foreach (String nid in netflixidsunmatched)
                {
                    ///create FT database records for each of these with the movies basic information for now
                    FilmTrove.Models.Movie newmovie = ftc.Movies.Create();
                    FlixSharp.Holders.Title netflixmovie = results.Find(nid);
                    FillBasicTitle(newmovie, netflixmovie);

                    var dbgenreslocal = ftc.Genres.Local.Where(g => netflixmovie.Genres.Contains(g.Name));
                    var dbgenres = ftc.Genres.Where(g => netflixmovie.Genres.Contains(g.Name));
                    HashSet<Genre> genres = new HashSet<Genre>();
                    genres.AddRange(dbgenres);
                    genres.AddRange(dbgenreslocal);

                    var genrenames = genres.Select(g => g.Name);
                    var missinggenres = netflixmovie.Genres.Where(g => !genrenames.Contains(g));
                    foreach (String genre in missinggenres)
                    {
                        Genre g = new Genre() { Name = genre };
                        genres.Add(g);
                        ftc.Genres.Add(g);
                    }
                    //newmovie.Genres = netflixmovie.Genres;
                    foreach (Genre g in genres)
                    {
                        MovieGenre gi = ftc.GenreItems.Create();
                        gi.Genre = g;
                        gi.Movie = newmovie;
                        ftc.GenreItems.Add(gi);
                    }
                    ftc.Movies.Add(newmovie);
                }

                //try
                //{
                    //count =
                ftc.SaveChanges();
                //}
                //catch (Exception ex)
                //{
                //    ///need to add some sort of logging?

                //}
                //if (count > 0)
                if (matchedmovies.Count() < results.Count())
                    matchedmovies = ftc.Movies.Where(m => netflixids.Contains(m.Netflix.Id));
                //else
                //    return matchedmovies.ToList();

                return results.Select(m =>
                    matchedmovies.First(f =>
                        f.Netflix.Id == (m.Id + (m.SeasonId != "" ? ";" + m.SeasonId : "")))).ToList();
            }
        }
Ejemplo n.º 35
0
 static void Main(string[] args)
 {
     bool rodando = true;
     while (rodando)
     {
         Console.WriteLine("API fornecida por themoviedb.org");
         Console.WriteLine("Digite 1 para a lista de filmes de um ator,");
         Console.WriteLine("2 para dois atores,");
         Console.WriteLine("3 para multiplos atores,");
         Console.WriteLine("4 para limpar a tela,");
         Console.WriteLine("e 5 para sair");
         string escolha = Console.ReadLine();
         switch (escolha) {
             case "1":
                 Console.WriteLine("Digite o nome do ator/atriz:");
                 string nomeAtor = Console.ReadLine();
                 Ator ator = new Ator(new PesquisaAPITMDB().pegarID(nomeAtor));
                 Titles titles = new Titles(new PesquisaAPITMDB().filmesPorID(ator.id));
                 Console.WriteLine();
                 Console.WriteLine("FILMES:");
                 foreach (string title in titles.title)
                 {
                     Console.WriteLine(title);
                 }
                 break;
             case "2":
                 Console.WriteLine("Digite o nome do 1° ator/atriz:");
                 string nomePrimeiroAtor = Console.ReadLine();
                 Ator PrimeiroAtor = new Ator(new PesquisaAPITMDB().pegarID(nomePrimeiroAtor));
                 Titles titlesPrimeiroAtor = new Titles(new PesquisaAPITMDB().filmesPorID(PrimeiroAtor.id));
                 Console.WriteLine("Digite o nome do 2° ator/atriz:");
                 string nomeSegundoAtor = Console.ReadLine();
                 Ator SegundoAtor = new Ator(new PesquisaAPITMDB().pegarID(nomeSegundoAtor));
                 Titles titlesSegundoAtor = new Titles(new PesquisaAPITMDB().filmesPorID(SegundoAtor.id));
                 Console.WriteLine();
                 Console.WriteLine("FILMES:");
                 foreach (string title in titlesPrimeiroAtor.title)
                 {
                     if (titlesSegundoAtor.title.Contains(title)) {
                         Console.WriteLine(title);
                     }
                 }
                 break;
             case "3":
                 Console.WriteLine("Digite o numero de atores/atrizes que voce vai utilizar:");
                 int numeroAtores = Convert.ToInt32(Console.ReadLine());
                 List<string> nomeAtores = new List<string>();
                 List<Titles> titlesAtores = new List<Titles>();
                 bool contem = true;
                 for (int ct=1;ct<=numeroAtores;ct++)
                 {
                     Console.WriteLine("ator/atrizes numero "+ct);
                     nomeAtores.Add(Console.ReadLine());
                 }
                 Parallel.ForEach(nomeAtores, atorIndividual => {
                     titlesAtores.Add(new Titles(new PesquisaAPITMDB().filmesPorID(
                                      new Ator(new PesquisaAPITMDB().pegarID(atorIndividual)).id)));
                 });
                 Console.WriteLine();
                 Console.WriteLine("FILMES:");
                 foreach (string title in titlesAtores.ElementAt(0).title)
                 {
                     for (int ct=1;ct<titlesAtores.Count;ct++)
                     {
                         if (!titlesAtores.ElementAt(ct).title.Contains(title))
                         {
                             contem = false;
                         }
                     }
                     if (contem)
                         Console.WriteLine(title);
                     contem = true;
                 }
                 break;
             case "4":
                 Console.Clear();
                 break;
             case "5":
                 rodando = false;
                 break;
             default:
                 Console.WriteLine("COMANDO INVALIDO!");
                 break;
         }
     }
 }
Ejemplo n.º 36
0
 /// <summary>
 /// Moves the title designation from one player to another, along with any hands or tokens for that title
 /// </summary>
 /// <param name="title">The title to be transferred</param>
 /// <param name="newHolder">The player who should now possess the title</param>
 public void ChangePlayerTitle(Titles title, Player newHolder)
 { }