/// <summary>
        /// Initialise using the saved data
        /// </summary>
        /// <param name="entity"></param>
        public override void Initialize(object entity)
        {
            _perfMonCollector = entity as PerfMonCollector;
            if (_perfMonCollector == null)
            {
                throw new ControlTypeMismatchException(entity, typeof(PerfMonCollector));
            }

            //Bind to the controls that make sense
            name_TextBox.DataBindings.Add("Text", _perfMonCollector, "Name");

            PopulateServerList();

            //browse throught the virtual resource metadata and add them to our listbox
            foreach (VirtualResourceMetadata vmdata in _perfMonCollector.VirtualResourceMetadataSet)
            {
                PerfMonCounterData tempCounter = LegacySerializer.DeserializeXml <PerfMonCounterData>(vmdata.Metadata);
                tempCounter.VirtualResourceMetadataId = vmdata.VirtualResourceMetadataId;
                _selectedCountersDataList.Add(tempCounter);
            }

            platform_ComboBox.SetPlatform(_perfMonCollector.Platform, VirtualResourceType.PerfMonCollector);

            LoadSystemSetting();

            selectedCounters_DataGridView.DataSource = _selectedCountersDataList;
        }
示例#2
0
 private void UpdateFilter(SortableBindingList <PositionSummaryObject> pos, SortableBindingList <PositionSummaryObject> filt)
 {
     filt.Clear();
     if (cbxFilter.Text == "All")
     {
         foreach (PositionSummaryObject p in pos)
         {
             filt.Add(p);
         }
     }
     else if (cbxFilter.Text == "OverBorrows")
     {
         foreach (PositionSummaryObject p in pos)
         {
             if (p.Status == "OverBorrow")
             {
                 filt.Add(p);
             }
         }
     }
     else if (cbxFilter.Text == "OverLoans")
     {
         foreach (PositionSummaryObject p in pos)
         {
             if (p.Status == "OverLoan")
             {
                 filt.Add(p);
             }
         }
     }
 }
        private bool Form_LoadData(object sender, object data)
        {
            _tempDataSource.Clear();
            _spotDataSource.Clear();

            var items = _templateBLL.GetTemplates();

            if (items != null)
            {
                foreach (var item in items)
                {
                    _tempDataSource.Add(item);
                }

                if (items.Count > 0)
                {
                    LoadTemplateStock(items[0].TemplateId);
                }
            }

            _securityInfoList = SecurityInfoManager.Instance.Get();
            _benchmarkList    = _benchmarkBLL.GetAll();

            SetCurrentTemplate();

            return(true);
        }
示例#4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SeriesFilterForm"/> class.
        /// </summary>
        /// <param name="seriesList">The series list.</param>
        public SeriesFilterForm(IEnumerable <SeriesInfo> seriesList, IEnumerable <SubstringFilter> substringFilters)
        {
            if (seriesList == null)
            {
                throw new ArgumentNullException("seriesList");
            }

            InitializeComponent();

            UserInterfaceStyler.Configure(series_radGridView, GridViewStyle.FullEdit);
            UserInterfaceStyler.Configure(hidden_radGridView, GridViewStyle.ReadOnly);

            foreach (SeriesInfo series in seriesList)
            {
                _bindingList.Add(series);
            }

            foreach (SubstringFilter filter in substringFilters)
            {
                _filters.Add(filter);
            }

            hidden_radGridView.DataSource = _filters;

            series_radGridView.DataSource = _bindingList;

            ApplySeriesFilters();
        }
示例#5
0
        private void UpdatePositions(RealTimePositionObject pos)
        {
            try
            {
                if (pos != null)
                {
                    //find the position
                    int i = AllRealTimePositions.Find("Cusip", pos.Cusip);

                    if (i != -1)
                    {
                        //position already exists, remove it and add new one
                        pos.Notes = AllRealTimePositions[i].Notes;

                        AllRealTimePositions.RemoveAt(i);
                        AllRealTimePositions.Add(pos);
                    }
                    else
                    {
                        //new position. add it
                        AllRealTimePositions.Add(pos);
                    }
                    AllRealTimePositions.Sort("SortField", ListSortDirection.Descending);
                    ColorRows();

//                    dgvRealTimePosition.Refresh();

                    DtcChannel.Instance.PositionUpdated(pos);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
        private void ServerForm_Load(object sender, EventArgs e)
        {
            try
            {
                //load the data from the table first
                foreach (RealTimePositionObject pos in calc.RealTimePositions.Values)
                {
                    if (pos.DtcActivity.Exists(d => IsHedge(d.ReasonCode)))
                    {
                        RealTimeOccPositionObject r = new RealTimeOccPositionObject(pos);
                        AllRealTimePositions.Add(r);
                    }
                }

                AllRealTimePositions.Sort("SortField", ListSortDirection.Descending);

                ColorRows();
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex, TraceEnum.LoggedError);
                MessageBox.Show("Error starting app: \r\n" + ex.ToString());
            }

            foreach (DataGridViewColumn c in dgvRealTimePosition.Columns)
            {
                c.ReadOnly = true;
            }
            dgvRealTimePosition.Columns["Notes"].ReadOnly = false;
        }
示例#7
0
        private void LoadAllData()
        {
            _tempDataSource.Clear();
            _spotDataSource.Clear();

            var items = _templateBLL.GetTemplates();

            if (items != null)
            {
                foreach (var item in items)
                {
                    _tempDataSource.Add(item);
                }

                if (items.Count > 0)
                {
                    LoadTemplateStock(items[0].TemplateId);
                }
            }

            _securityInfoList = SecurityInfoManager.Instance.Get();
            _benchmarkList    = _benchmarkBLL.GetAll();

            SetCurrentTemplate();
        }
示例#8
0
        public bool OlderParents(int minAge)
        {
            this.Text = "Parents aged " + minAge + "+ at time of child's birth";
            selectRow = true;
            SortableBindingList <IDisplayIndividual> dsInd = new SortableBindingList <IDisplayIndividual>();
            SortableBindingList <IDisplayFamily>     dsFam = new SortableBindingList <IDisplayFamily>();

            families = new Dictionary <IDisplayIndividual, IDisplayFamily>();
            foreach (Family f in ft.AllFamilies)
            {
                bool added = false;
                foreach (Individual child in f.Children)
                {
                    if (child.BirthDate.IsKnown)
                    {
                        if (f.Husband != null && f.Husband.BirthDate.IsKnown)
                        {
                            Age age = f.Husband.GetAge(child.BirthDate);
                            if (age.MinAge >= minAge && !dsInd.Contains(f.Husband))
                            {
                                dsInd.Add(f.Husband);
                                families.Add(f.Husband, f);
                                added = true;
                            }
                        }
                        if (f.Wife != null && f.Wife.BirthDate.IsKnown)
                        {
                            Age age = f.Wife.GetAge(child.BirthDate);
                            if (age.MinAge >= minAge && !dsInd.Contains(f.Wife))
                            {
                                dsInd.Add(f.Wife);
                                families.Add(f.Wife, f);
                                added = true;
                            }
                        }
                    }
                }
                if (added && !dsFam.Contains(f))
                {
                    dsFam.Add(f);
                }
            }
            if (dsInd.Count > 0)
            {
                dgIndividuals.DataSource = dsInd;
                SortIndividuals();
                dgIndividuals.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
                dgFamilies.DataSource       = dsFam;
                SortFamilies();
                dgFamilies.SelectionMode       = DataGridViewSelectionMode.FullRowSelect;
                dgIndividuals.Rows[0].Selected = true; // force a selection to update both grids
                return(true);
            }
            else
            {
                MessageBox.Show("You have no parents older than " + minAge + " at time of children's birth.", "FTAnalyzer");
                return(false);
            }
        }
        private void LoadInstallers()
        {
            foreach (SoftwareInstaller installer in _dataContext.SoftwareInstallers.Include("SoftwareInstallerSettings"))
            {
                _installers.Add(installer);
            }

            RefreshInstallerGrid();
        }
        void AddIndividualsFacts(Individual individual)
        {
            IEnumerable <Fact> list = individual.AllFacts.Union(individual.ErrorFacts.Where(f => f.FactErrorLevel != Fact.FactError.WARNINGALLOW));

            foreach (Fact f in list)
            {
                facts.Add(new DisplayFact(individual, f));
            }
        }
示例#11
0
        private void AddDirectoryButton_Click(object sender, RoutedEventArgs e)
        {
            var dialog = new FolderBrowserDialog();

            if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                sources.Add(dialog.SelectedPath);
            }
        }
示例#12
0
        /// <summary>
        /// Populates the virtual machine grid.
        /// </summary>
        private void PopulateMachinesGrid()
        {
            _machines.Clear();
            foreach (VirtualMachine machine in VirtualMachine.SelectAll().OrderBy(f => f.Name))
            {
                _machines.Add(machine);
            }

            machines_DataGridView.DataSource = null;
            machines_DataGridView.DataSource = _machines;
        }
        private void RefreshSettings()
        {
            _settings.Clear();

            string settingType = _settingType.ToString();

            foreach (SystemSetting item in _context.SystemSettings.Where(n => n.Type.Equals(settingType)))
            {
                _settings.Add(item);
            }
        }
示例#14
0
        private void Initialize(IEnumerable <Badge> badges)
        {
            dataGridView.DataSource = null;
            _badges.Clear();

            foreach (Badge badge in badges)
            {
                _badges.Add(badge);
            }

            dataGridView.DataSource = _badges;
        }
示例#15
0
        /// <summary>
        /// Opens the data saved at a specified path
        /// </summary>
        /// <param name="path">The path.</param>
        public void Open(string path)
        {
            Cursor = Cursors.WaitCursor;
            _queueDefinitions.Clear();
            foreach (QueueInstallationData data in _manager.Open(path))
            {
                data.Progress = string.Empty;
                _queueDefinitions.Add(data);
            }
            Cursor = Cursors.Default;

            queueCount_Label.Text = "0 / {0,-5}".FormatWith(_queueDefinitions.Count);
        }
        private void RefreshServerDisplay()
        {
            printServer_GridView.DataSource = null;
            _printServers.Clear();

            foreach (FrameworkServer item in _controller.GetServersByType(_serverType))
            {
                _printServers.Add(item);
            }

            printServer_GridView.DataSource = _printServers;
            printServer_GridView.BestFitColumns();
        }
        /// <summary>
        /// Populates the platform grid.
        /// </summary>
        private void PopulateUserGroupGrid()
        {
            foreach (UserGroup group in _context.UserGroups.OrderBy(f => f.GroupName))
            {
                _groups.Add(group);
            }

            groups_RadGridView.DataSource = null;
            groups_RadGridView.DataSource = _groups;

            groups_RadGridView.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
            groups_RadGridView.BestFitColumns();
        }
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            _originalWidth = this.Width;

            foreach (FrameworkServerType serverType in _controller.ServerTypes)
            {
                _serverTypes.Add(serverType);
            }

            dataGridView_Types.DataSource = null;
            dataGridView_Types.DataSource = _serverTypes;
        }
示例#19
0
        private void AssetPoolList_Load(object sender, EventArgs e)
        {
            using (new BusyCursor())
            {
                foreach (var item in _context.AssetPools)
                {
                    _assetPools.Add(item);
                }

                _bindingSource                   = new BindingSource();
                _bindingSource.DataSource        = _assetPools;
                assetPool_RadGridView.DataSource = _bindingSource;
            }
        }
        private void DomainAccountList_Load(object sender, System.EventArgs e)
        {
            using (new BusyCursor())
            {
                foreach (var item in _context.DomainAccountPools)
                {
                    _userPools.Add(item);
                }

                _bindingSource                       = new BindingSource();
                _bindingSource.DataSource            = _userPools;
                domainAccount_RadGridView.DataSource = _bindingSource;
            }
        }
示例#21
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            _context = DbConnect.AssetInventoryContext();

            foreach (BadgeBox badgeBox in _context.BadgeBoxes)
            {
                _badgeBoxes.Add(badgeBox);
            }

            dataGridView_BadgeBox.DataSource = _badgeBoxes;
            badgeListControl.Initialize(_context.Badges, _context);
        }
示例#22
0
        /// <summary>
        /// Refreshes the display of Software Installers.
        /// </summary>
        public override void Refresh()
        {
            base.Refresh();

            _settings.Clear();
            foreach (SoftwareInstallerSetting setting in _package.SoftwareInstallerSettings.OrderBy(s => s.InstallOrderNumber))
            {
                _settings.Add(new InstallerSettingRow(setting));
            }

            installers_DataGridView.DataSource = null;
            installers_DataGridView.DataSource = _settings;
            installers_DataGridView.Refresh();
        }
        public void LoadSecurityData(OpenPositionItem monitorItem)
        {
            int bmkCopies    = 1;
            var templateItem = _templateBLL.GetTemplate(monitorItem.TemplateId);

            if (templateItem != null)
            {
                bmkCopies = templateItem.FutureCopies;
                //Load the future
                OpenPositionSecurityItem futureItem = new OpenPositionSecurityItem
                {
                    Selection     = true,
                    MonitorId     = monitorItem.MonitorId,
                    MonitorName   = monitorItem.MonitorName,
                    SecuCode      = monitorItem.FuturesContract,
                    SecuName      = monitorItem.FuturesContract,
                    WeightAmount  = templateItem.FutureCopies,
                    EntrustAmount = monitorItem.Copies * templateItem.FutureCopies,
                    EDirection    = EntrustDirection.SellOpen,
                    SecuType      = SecurityType.Futures
                };

                _securityDataSource.Add(futureItem);
            }

            List <TemplateStock>            stocks    = _templateBLL.GetStocks(monitorItem.TemplateId);
            List <OpenPositionSecurityItem> secuItems = new List <OpenPositionSecurityItem>();

            int actualCopies = bmkCopies * monitorItem.Copies;

            foreach (var stock in stocks)
            {
                OpenPositionSecurityItem secuItem = new OpenPositionSecurityItem
                {
                    Selection     = true,
                    MonitorId     = monitorItem.MonitorId,
                    MonitorName   = monitorItem.MonitorName,
                    SecuCode      = stock.SecuCode,
                    SecuName      = stock.SecuName,
                    WeightAmount  = stock.Amount,
                    EntrustAmount = actualCopies * stock.Amount,
                    EDirection    = EntrustDirection.BuySpot,
                    SecuType      = SecurityType.Stock
                };

                _securityDataSource.Add(secuItem);
            }
        }
示例#24
0
 public Facts(Family family)
     : this()
 {
     Family = family;
     foreach (DisplayFact f in family.AllDisplayFacts)
     {
         facts.Add(f);
     }
     Text = $"Facts Report for {family.FamilyRef}";
     SetupFacts();
     Analytics.TrackAction(Analytics.FactsFormAction, Analytics.FactsFamiliesEvent);
 }
示例#25
0
        private void SetFilter(string searchPattern, bool seasonN_Only)
        {
            if (String.IsNullOrEmpty(searchPattern) && !seasonN_Only)
            {
                dataGridMembers.DataSource = _easyJudoClubControler.JudoClub.Members;
            }
            else
            {
                var filteredMembersByName = _easyJudoClubControler.GetFilteredMembersByName(searchPattern);

                if (seasonN_Only)
                {
                    filteredMembersByName = _easyJudoClubControler.GetFilteredMembersWithSeasonNOnly(filteredMembersByName);
                }

                var filteredMembersSortableBindingList = new SortableBindingList <Member>();
                foreach (var member in filteredMembersByName)
                {
                    filteredMembersSortableBindingList.Add(member);
                }

                dataGridMembers.DataSource = filteredMembersSortableBindingList;
            }
            RefreshFrmMain();
        }
示例#26
0
        private void GUIControlsExample_Load(object sender, EventArgs e)
        {
            studentsViewModel = new SortableBindingList <Student>();
            dgvStudentList.Columns.Clear();
            dgvStudentList.DataSource = studentsViewModel;
            School school = new School()
            {
                Name    = "Korea Hightschool",
                Address = "Seoul"
            };

            Class classInfo = new Class(school)
            {
                ClassNumber = 5,
                Location    = "Second floor",
            };

            for (int i = 0; i < 20; i++)
            {
                studentsViewModel.Add(new Student(classInfo)
                {
                    NumberInClass = i + 1,
                    Name          = $"{i + 1}_Ben",
                    BirthDate     = DateTime.Now,
                });
            }

            SetGridDefaultStyle();
            ShowHideColumns();

            RegisterEvents();
        }
示例#27
0
        public SortableBindingList <Wartungsvorschlag> CreateWartungsplanungTable()
        {
            var list       = this.GetWartungsmaschinenListe();
            var returnList = new SortableBindingList <Wartungsvorschlag>();

            foreach (var item in list)
            {
                // Maschine und die damit verknüpften Termine ermitteln. Es werden nur
                // Wartungs- und Servicetermine in der Vergangenheit berücksichtigt!
                var machine      = RepoManager.KundenmaschinenRepository.GetKundenmaschine(item.UID);
                var appointments = ModelManager.AppointmentService.GetAppointmentList(machine).Where(
                    a => (a.AppointmentType == "Wartungstermin" | a.AppointmentType == "Servicetermin") & a.StartsAt <= DateTime.Now);
                var letzterTermin = DateTime.MinValue;

                var vorschlag = new Wartungsvorschlag();
                vorschlag.Maschine        = machine;
                vorschlag.LetzteWartung   = DateTime.MinValue;
                vorschlag.Terminvorschlag = DateTime.MinValue;

                // Wenn es bereits Termine gegeben hat
                if (appointments != null && appointments.Count() > 0)
                {
                    letzterTermin           = appointments.Max(a => a.StartsAt);
                    vorschlag.LetzteWartung = letzterTermin;
                    if (machine.Wartungsintervall > 0)
                    {
                        vorschlag.Terminvorschlag = letzterTermin.AddMonths(machine.Wartungsintervall);
                    }
                }
                returnList.Add(vorschlag);
            }
            return(returnList);
        }
示例#28
0
        public void SetSurnameStats(SurnameStats stat)
        {
            this.Text = "Individuals & Families whose surame is " + stat.Surname;
            SortableBindingList <IDisplayIndividual> dsInd = new SortableBindingList <IDisplayIndividual>();
            Predicate <Individual> indSurnames             = x => x.Surname.Equals(stat.Surname);

            foreach (Individual i in ft.AllIndividuals.Filter(indSurnames))
            {
                dsInd.Add(i);
            }
            dgIndividuals.DataSource = dsInd;
            SortIndividuals();
            dgIndividuals.Dock = DockStyle.Fill;

            Predicate <Family> famSurnames             = x => x.ContainsSurname(stat.Surname);
            SortableBindingList <IDisplayFamily> dsFam = new SortableBindingList <IDisplayFamily>();

            foreach (Family f in ft.AllFamilies.Filter(famSurnames))
            {
                dsFam.Add(f);
            }
            dgFamilies.DataSource = dsFam;
            SortFamilies();
            splitContainer.Panel2Collapsed = false;
            UpdateStatusCount();
        }
示例#29
0
        public void SetLocation(FactLocation loc, int level)
        {
            this.Text = "Individuals & Families with connection to " + loc.ToString();
            level     = Math.Min(loc.Level, level); // if location level isn't as detailed as level on tab use location level
            IEnumerable <Individual> listInd = ft.GetIndividualsAtLocation(loc, level);
            SortableBindingList <IDisplayIndividual> dsInd = new SortableBindingList <IDisplayIndividual>();

            foreach (Individual i in listInd)
            {
                dsInd.Add(i);
            }
            dgIndividuals.DataSource = dsInd;
            SortIndividuals();

            IEnumerable <Family> listFam = ft.GetFamiliesAtLocation(loc, level);
            SortableBindingList <IDisplayFamily> dsFam = new SortableBindingList <IDisplayFamily>();

            foreach (Family f in listFam)
            {
                dsFam.Add(f);
            }
            dgFamilies.DataSource = dsFam;
            SortFamilies();
            splitContainer.Panel2Collapsed = false;
            UpdateStatusCount();
        }
        private void LoadHeldUp()
        {
            SortableBindingList <RealTimeOccPositionObject> tmp = new SortableBindingList <RealTimeOccPositionObject>();

            AllocationViewFactory       avf           = new AllocationViewFactory();
            List <AllocationViewObject> heldUpReturns = new List <AllocationViewObject>();
            AllocationViewParam         avp           = new AllocationViewParam();

            tmp.Load(AllRealTimePositions);
            HeldUpRealTimePositions.Clear();

            avp.HeldUp.AddParamValue(1);
            avf.Load(heldUpReturns, avp);

            //now remove the non Held Up positions
            foreach (RealTimeOccPositionObject rt in tmp)
            {
                if (heldUpReturns.Exists(av => av.Cusip == rt.Cusip))
                {
                    HeldUpRealTimePositions.Add(rt);
                }
            }

            HeldUpRealTimePositions.Sort("TradeCategory", ListSortDirection.Ascending);
        }
示例#31
0
 internal void Update()
 {
     var typeList = _model.GetTypesFromGroup(_groupID);
     var infoList = new SortableBindingList<EveTypeInfo>();
     foreach (var type in typeList)
         infoList.Add(EveTypeInfoRepository.GetEveTypeInfo(type));
        _list.DataObject = infoList;
 }
        public SortableBindingList<Auction> LoadMyAuctions()
        {
            var results = new SortableBindingList<Auction>();
            var items = Context.Auctions.AsQueryable();
            foreach (var res  in items)
            {
                results.Add(res.ToDomainObject());
            }

            return results;
        }
        public LegendDuplicatorForm(InputData inputData)
        {
            this.inputData = inputData;

            InitializeComponent();

            // populate data grid view with sheets
            SortableBindingList<SheetWrapper> sheetBindingList = new SortableBindingList<SheetWrapper>();
            foreach (SheetWrapper sw in inputData.Sheets)
            {
                sheetBindingList.Add(sw);
            }
            dgvSheets.AutoGenerateColumns = false;
            dgvSheets.DataSource = sheetBindingList;

        }
示例#34
0
        public void BindTeams(League lge)
        {
            teamGrid.Columns["abbrevColumn"].DataPropertyName = "Abbrev";
            teamGrid.Columns["teamNameColumn"].DataPropertyName = "Name";
            teamGrid.Columns["winsColumn"].DataPropertyName = "Wins";
            teamGrid.Columns["lossesColumn"].DataPropertyName = "Losses";

            bindingList = new SortableBindingList<Team>();

            teams = lge.Teams;

            foreach (Team tm in teams)
            {
                bindingList.Add(tm);
            }

            teamGrid.DataSource = bindingList;
        }
示例#35
0
        public void BindPlayers(League lge)
        {
            playerGrid.Columns[0].DataPropertyName = "Name";
            playerGrid.Columns[1].DataPropertyName = "CardSeason";
            playerGrid.Columns[2].DataPropertyName = "CardTeam";
            playerGrid.Columns[3].DataPropertyName = "Points";
            playerGrid.Columns[4].DataPropertyName = "PositionText";
            playerGrid.Columns[5].DataPropertyName = "KeyStatLine";

            SortableBindingList<Player> players = new SortableBindingList<Player>();

            foreach (Player plyr in lge.PlayerList.Values)
            {
                players.Add(plyr);
            }

            playerGrid.DataSource = players;
        }
        private SortableBindingList<StudentViewModel> cloneStudents(SortableBindingList<StudentViewModel> students)
        {
            SortableBindingList<StudentViewModel> clonedStudents = new SortableBindingList<StudentViewModel>();
            foreach (StudentViewModel student in students)
            {
                clonedStudents.Add((StudentViewModel)student.Clone());
            }

            return clonedStudents;
        }
        /// <summary>
        ///   Save as Playlist
        /// </summary>
        /// <param name = "o"></param>
        /// <param name = "e"></param>
        public void tracksGrid_SaveAsPlayList(object o, EventArgs e)
        {
            SortableBindingList<PlayListData> playList = new SortableBindingList<PlayListData>();
              foreach (DataGridViewRow row in tracksGrid.Rows)
              {
            if (!row.Selected)
              continue;

            TrackData track = Options.Songlist[row.Index];
            PlayListData playListItem = new PlayListData();
            playListItem.FileName = track.FullFileName;
            playListItem.Title = track.Title;
            playListItem.Artist = track.Artist;
            playListItem.Album = track.Album;
            playListItem.Duration = track.Duration.Substring(3, 5); // Just get Minutes and seconds
            playList.Add(playListItem);
              }

              SaveFileDialog sFD = new SaveFileDialog();
              sFD.InitialDirectory = _main.CurrentDirectory;
              sFD.Filter = "M3U Format (*.m3u)|*.m3u|PLS Format (*.pls)|*.pls";
              if (sFD.ShowDialog() == DialogResult.OK)
              {
            IPlayListIO saver = PlayListFactory.CreateIO(sFD.FileName);
            saver.Save(playList, sFD.FileName, true);
              }
        }
        public bool Load(SortableBindingList<PlayListData> playlist, string fileName)
        {
            string basePath = String.Empty;
              Stream stream;

              basePath = Path.GetDirectoryName(Path.GetFullPath(fileName));
              stream = File.Open(fileName, FileMode.Open, FileAccess.Read, FileShare.Read);

              playlist.Clear();
              Encoding fileEncoding = Encoding.Default;
              StreamReader file = new StreamReader(stream, fileEncoding, true);
              if (file == null)
              {
            return false;
              }

              string line;
              line = file.ReadLine();
              if (line == null)
              {
            file.Close();
            return false;
              }

              string strLine = line.Trim();
              //CUtil::RemoveCRLF(strLine);
              if (strLine != START_PLAYLIST_MARKER)
              {
            fileEncoding = Encoding.Default;
            stream = File.Open(fileName, FileMode.Open, FileAccess.Read, FileShare.Read);
            file = new StreamReader(stream, fileEncoding, true);
              }

              string infoLine = "";
              string durationLine = "";
              fileName = "";
              line = file.ReadLine();
              while (line != null)
              {
            strLine = line.Trim();
            //CUtil::RemoveCRLF(strLine);
            int equalPos = strLine.IndexOf("=");
            if (equalPos > 0)
            {
              string leftPart = strLine.Substring(0, equalPos);
              equalPos++;
              string valuePart = strLine.Substring(equalPos);
              leftPart = leftPart.ToLower();
              if (leftPart.StartsWith("file"))
              {
            if (valuePart.Length > 0 && valuePart[0] == '#')
            {
              line = file.ReadLine();
              continue;
            }

            if (fileName.Length != 0)
            {
              PlayListData newItem = new PlayListData(infoLine, fileName, "0");
              playlist.Add(newItem);
              fileName = "";
              infoLine = "";
              durationLine = "";
            }
            fileName = valuePart;
              }
              if (leftPart.StartsWith("title"))
              {
            infoLine = valuePart;
              }
              else
              {
            if (infoLine == "")
            {
              infoLine = Path.GetFileName(fileName);
            }
              }
              if (leftPart.StartsWith("length"))
              {
            durationLine = valuePart;
              }

              if (durationLine.Length > 0 && infoLine.Length > 0 && fileName.Length > 0)
              {
            string duration = durationLine;

            // Remove trailing slashes. Might cause playback issues
            if (fileName.EndsWith("/"))
            {
              fileName = fileName.Substring(0, fileName.Length - 1);
            }

            Util.GetQualifiedFilename(basePath, ref fileName);
            PlayListData newItem = new PlayListData(infoLine, fileName, Util.SecondsToHMSString(duration));
            playlist.Add(newItem);
            fileName = "";
            infoLine = "";
            durationLine = "";
              }
            }
            line = file.ReadLine();
              }
              file.Close();

              if (fileName.Length > 0)
              {
            PlayListData newItem = new PlayListData(infoLine, fileName, "0");
              }

              return true;
        }
        public IQueryable<AuctionSearch> Search(string searchText)
        {
            const string searchString = "https://auctions.godaddy.com/trpSearchResults.aspx";
            var auctions = new SortableBindingList<AuctionSearch>();

            var doc = HtmlDocument(Post(searchString,
                "t=16&action=search&hidAdvSearch=ddlAdvKeyword:1|txtKeyword:"+
                searchText.Replace(" ",",")
                +"|ddlCharacters:0|txtCharacters:|txtMinTraffic:|txtMaxTraffic:|txtMinDomainAge:|txtMaxDomainAge:|txtMinPrice:|txtMaxPrice:|ddlCategories:0|chkAddBuyNow:false|chkAddFeatured:false|chkAddDash:true|chkAddDigit:true|chkAddWeb:false|chkAddAppr:false|chkAddInv:false|chkAddReseller:false|ddlPattern1:|ddlPattern2:|ddlPattern3:|ddlPattern4:|chkSaleOffer:false|chkSalePublic:true|chkSaleExpired:true|chkSaleCloseouts:false|chkSaleUsed:false|chkSaleBuyNow:false|chkSaleDC:false|chkAddOnSale:false|ddlAdvBids:0|txtBids:|txtAuctionID:|ddlDateOffset:&rtr=2&baid=-1&searchDir=1&rnd=0.899348703911528&jnkRjrZ=6dd022d"));


            if (QuerySelectorAll(doc.DocumentNode, "tr.srRow2, tr.srRow1") != null)
            {
                foreach (var node in QuerySelectorAll(doc.DocumentNode, "tr.srRow2, tr.srRow1"))
                {
                    if (QuerySelector(node, "span.OneLinkNoTx") != null && QuerySelector(node, "td:nth-child(5)") != null)
                    {
                        AuctionSearch auction = GenerateAuctionSearch();
                        auction.DomainName = HtmlDecode(QuerySelector(node, "span.OneLinkNoTx").InnerText);
                        Console.WriteLine(auction.DomainName);

                        auction.BidCount = TextModifier.TryParse_INT(HtmlDecode(QuerySelector(node, "td:nth-child(5)").FirstChild.InnerHtml.Replace("&nbsp;", "")));
                        auction.Traffic = TextModifier.TryParse_INT(HtmlDecode(QuerySelector(node, "td:nth-child(5) > td").InnerText.Replace("&nbsp;", "")));
                        auction.Valuation = TextModifier.TryParse_INT(HtmlDecode(QuerySelector(node, "td:nth-child(5) > td:nth-child(2)").InnerText.Replace("&nbsp;", "")));
                        auction.Price = TextModifier.TryParse_INT(HtmlDecode(QuerySelector(node, "td:nth-child(5) > td:nth-child(3)").InnerText).Replace("$", "").Replace(",", "").Replace("C", ""));
                        try
                        {
                            if (QuerySelector(node, "td:nth-child(5) > td:nth-child(4) > div") != null)
                            {
                                if (HtmlDecode(QuerySelector(node, "td:nth-child(5) > td:nth-child(4) > div").InnerText).Contains("Buy Now for"))
                                {
                                    auction.BuyItNow = TextModifier.TryParse_INT(Regex.Split(HtmlDecode(QuerySelector(node, "td:nth-child(5) > td:nth-child(4) > div").InnerText), "Buy Now for")[1].Trim().Replace(",", "").Replace("$", ""));
                                }

                            }
                            else
                            {
                                auction.BuyItNow = 0;
                            }

                        }
                        catch (Exception) { auction.BuyItNow = 0; }

                        if (QuerySelector(node, "td:nth-child(5) > td:nth-child(5)") != null &&
                            HtmlDecode(QuerySelector(node, "td:nth-child(5) > td:nth-child(5)").InnerHtml).Contains("Bid $"))
                        {
                            auction.MinBid = TextModifier.TryParse_INT(GetSubString(HtmlDecode(QuerySelector(node, "td:nth-child(5) > td:nth-child(5)").InnerHtml), "Bid $", " or more").Trim().Replace(",", "").Replace("$", ""));
                        }
                        if (QuerySelector(node, "td:nth-child(5) > td:nth-child(5)") != null &&
                            !HtmlDecode(QuerySelector(node, "td:nth-child(5) > td:nth-child(5)").InnerHtml).Contains("Bid $"))
                        {
                            auction.EstimateEndDate = GenerateEstimateEnd(QuerySelector(node, "td:nth-child(5) > td:nth-child(5)"));
                        }
                        if (QuerySelector(node, "td:nth-child(5) > td:nth-child(4)") != null &&
                            HtmlDecode(QuerySelector(node, "td:nth-child(5) > td:nth-child(4)").InnerHtml).Contains("Bid $"))
                        {
                            auction.MinBid = TextModifier.TryParse_INT(GetSubString(HtmlDecode(QuerySelector(node, "td:nth-child(5) > td:nth-child(4)").InnerHtml), "Bid $", " or more").Trim().Replace(",", "").Replace("$", ""));
                        }
                        if (QuerySelector(node, "td > div > span") != null)
                        {
                            foreach (var item in GetSubStrings(QuerySelector(node, "td > div > span").InnerHtml, "'Offer $", " or more"))
                            {
                                auction.MinOffer = TextModifier.TryParse_INT(item.Replace(",", ""));
                            }
                        }
                        auction.EndDate = GetPacificTime;
                        foreach (var item in GetSubStrings(node.InnerHtml, "ShowAuctionDetails('", "',"))
                        {
                            auction.AuctionRef = item;
                            break;
                        }
                        //AppSettings.Instance.AllAuctions.Add(auction);
                        if (auction.MinBid > 0)
                        {
                            auctions.Add(auction);
                        }

                    }

                }
            }

            return auctions.AsQueryable();

        }
    /// <summary>
    /// Revit external command to list all valid
    /// built-in parameters for a given selected
    /// element.
    /// </summary>
    public Result Execute(
      ExternalCommandData commandData,
      ref string message,
      ElementSet elements )
    {
      UIApplication uiapp = commandData.Application;
      UIDocument uidoc = uiapp.ActiveUIDocument;
      Document doc = uidoc.Document;

      // Select element

      Element e
        = Util.GetSingleSelectedElementOrPrompt(
          uidoc );

      if( null == e )
      {
        return Result.Cancelled;
      }

      bool isSymbol = false;

      // For a family instance, ask user whether to
      // display instance or type parameters; in a
      // similar manner, we could add dedicated
      // switches for Wall --> WallType,
      // Floor --> FloorType etc. ...

      if( e is FamilyInstance )
      {
        FamilyInstance inst = e as FamilyInstance;
        if( null != inst.Symbol )
        {
          string symbol_name = Util.ElementDescription(
            inst.Symbol, true );

          string family_name = Util.ElementDescription(
            inst.Symbol.Family, true );

          string msg = string.Format( _type_prompt,
            "is a family instance" );

          if( !Util.QuestionMsg( msg ) )
          {
            e = inst.Symbol;
            isSymbol = true;
          }
        }
      }
      else if( e.CanHaveTypeAssigned() )
      {
        ElementId typeId = e.GetTypeId();
        if( null == typeId )
        {
          Util.InfoMsg( "Element can have a type,"
            + " but the current type is null." );
        }
        else if( ElementId.InvalidElementId == typeId )
        {
          Util.InfoMsg( "Element can have a type,"
            + " but the current type id is the"
            + " invalid element id." );
        }
        else
        {
          Element type = doc.GetElement( typeId );

          if( null == type )
          {
            Util.InfoMsg( "Element has a type,"
              + " but it cannot be accessed." );
          }
          else
          {
            string msg = string.Format( _type_prompt,
              "has an element type" );

            if( !Util.QuestionMsg( msg ) )
            {
              e = type;
              isSymbol = true;
            }
          }
        }
      }

      // Retrieve parameter data

      SortableBindingList<ParameterData> data
        = new SortableBindingList<ParameterData>();

      {
        WaitCursor waitCursor = new WaitCursor();

        ParameterSet set = e.Parameters;
        bool containedInCollection;

        /* 
         * Edited by Chekalin Victor 13.12.2012
         * !!! This implemention does not work properly
         * if enum has the same integer value
         * For example, BuiltInParameter.All_MODEL_COST and
         * BuiltInParameter.DOOR_COST have -1001205 integer value
         * 
           Array bips = Enum.GetValues(
             typeof( BuiltInParameter ) );
         
           int n = bips.Length;
         * 
         */

        /*
         * Edited by Chekalin Victor 13.12.2012
         */
        var bipNames =
            Enum.GetNames( typeof( BuiltInParameter ) );

        Parameter p;

        /*
         * Edited by Chekalin Victor 13.12.2012
         */
        //foreach( BuiltInParameter a in bips )
        foreach( var bipName in bipNames )
        {
          BuiltInParameter a;

          if( !Enum.TryParse( bipName, out a ) )
            continue;

          try
          {
            p = e.get_Parameter( a );

            #region Check for external definition
#if CHECK_FOR_EXTERNAL_DEFINITION
            Definition d = p.Definition;
            ExternalDefinition e = d as ExternalDefinition; // this is never possible
            string guid = ( null == e ) ? null : e.GUID.ToString();
#endif // CHECK_FOR_EXTERNAL_DEFINITION
            #endregion // Check for external definition

            if( null != p )
            {
              string valueString =
                ( StorageType.ElementId == p.StorageType )
                  ? Util.GetParameterValue2( p, doc )
                  : p.AsValueString();

              //containedInCollection = set.Contains( p ); // this does not work
              containedInCollection = ContainedInCollection( p, set );

              data.Add( new ParameterData( a, p,
                valueString,
                containedInCollection,
                bipName ) );
            }
          }
          catch( Exception ex )
          {
            Debug.Print(
              "Exception retrieving built-in parameter {0}: {1}",
              a, ex );
          }
        }
      }

      // Retrieve parameters from Element.Parameters collection

      foreach( Parameter p in e.Parameters )
      {
        string valueString =
          ( StorageType.ElementId == p.StorageType )
            ? Util.GetParameterValue2( p, doc )
            : p.AsValueString();

        ParameterData parameterData = new ParameterData(
          ( p.Definition as InternalDefinition ).BuiltInParameter,
          p,
          valueString,
          true,
          null );

        if( !data.Contains( parameterData ) )
          data.Add( parameterData );
      }

      // Display form

      string description
        = Util.ElementDescription( e, true )
        + ( isSymbol
          ? " Type"
          : " Instance" );

#if USE_LIST_VIEW
      using( BuiltInParamsCheckerFormListView form
        = new BuiltInParamsCheckerFormListView( e,
          description, data ) )
#else
      using (BuiltInParamsCheckerForm form
        = new BuiltInParamsCheckerForm(
          description, data))
#endif // USE_LIST_VIEW
      {
        form.ShowDialog();
      }
      return Result.Succeeded;
    }
示例#41
0
        private void button12_Click(object sender, EventArgs e)
        {
            Program.addAmount = 0;
            Program.tasks = 1;

            SortableBindingList<Bookmark> allURLs = new SortableBindingList<Bookmark>();
            foreach (ObjectCheckBox checkBox in ((Button)sender).Parent.Controls.OfType<ObjectCheckBox>().Where(box => box.Checked == true && box.SyncOrGet == ObjectCheckBox.SyncOrGetEnum.Get))
            {
                allURLs.Union(checkBox.Binding.ReturnBookmarks(), new Program.BookmarkComparer()).ToList().ForEach(a => allURLs.Add(a));
            }

            Display.DisplayBookmarks(allURLs);
        }
示例#42
0
        private void cmbBoxObjVObjTourList_SelectedIndexChanged(object sender, EventArgs e)
        {
            NVPair selectedPair = (NVPair)cmbBoxObjVObjTourList.SelectedItem;
            if (selectedPair == null)
            {
                this.objectVsObjectDOBindingSource.Clear();
                return;
            }

            Registry.Instance.GetPilotStats(_PilotName).ObjVsObjVisibleList.Clear();

            if (selectedPair.Name == "ALL")
            {
                // Collate all the kills, killed by, kills in for each model. Build a temorary list
                // for this one.

                SortableBindingList<ObjectVsObjectDO> compositeList = new SortableBindingList<ObjectVsObjectDO>();
                Registry.Instance.GetPilotStats(_PilotName).ObjVsObjVisibleList.Clear();

                // build a temp place holder object for each model.
                foreach (ObjectVsObjectDO objScore in Registry.Instance.GetPilotStats(_PilotName).ObjVsObjCompleteList)
                {
                    if (!IsModelInObjVsObjList(compositeList, objScore.Model))
                    {
                        ObjectVsObjectDO compositeObject = new ObjectVsObjectDO(objScore.ObjScore, objScore.TourIdentfier, objScore.TourType, objScore.TourNumber);
                        compositeObject.TourIdentfier = "All Tours"; // change the tour id tag.

                        // delete their stats otherwise they get counted twice for the first tour.
                        compositeObject.KilledBy = 0;
                        compositeObject.KillsIn = 0;
                        compositeObject.KillsOf = 0;
                        compositeObject.DiedIn = 0;

                        compositeList.Add(compositeObject);
                    }
                }

                // now sum up for each model.
                foreach (ObjectVsObjectDO compositeObjScore in compositeList)
                {
                    foreach (ObjectVsObjectDO objScore in Registry.Instance.GetPilotStats(_PilotName).ObjVsObjCompleteList)
                    {
                        if (compositeObjScore.Model == objScore.Model)
                        {
                            compositeObjScore.KilledBy += objScore.KilledBy;
                            compositeObjScore.KillsIn += objScore.KillsIn;
                            compositeObjScore.KillsOf += objScore.KillsOf;
                            compositeObjScore.DiedIn += objScore.DiedIn;
                        }
                    }
                }

                // all done rebind to grid and we off singing!
                this.objectVsObjectDOBindingSource.DataSource = compositeList;

                // Hide the Tour Number column, as it makes no sense in this context.
                this.objectVsObjectDODataGridView.Columns[0].Visible = false;

                PopulateObjVObjTotals(compositeList);
            }
            else
            {
                // ensure we re-enable the Tour Number column
                this.objectVsObjectDODataGridView.Columns[0].Visible = true;

                // Else we are just listing from actual stats objects in the registry.

                int selectedTour = System.Convert.ToInt32(selectedPair.Name);
                foreach (ObjectVsObjectDO objScore in Registry.Instance.GetPilotStats(_PilotName).ObjVsObjCompleteList)
                {
                    if (objScore.TourNumber == selectedTour)
                    {
                        Registry.Instance.GetPilotStats(_PilotName).ObjVsObjVisibleList.Add(objScore);
                    }
                }

                this.objectVsObjectDOBindingSource.DataSource = Registry.Instance.GetPilotStats(_PilotName).ObjVsObjVisibleList;
                PopulateObjVObjTotals(Registry.Instance.GetPilotStats(_PilotName).ObjVsObjVisibleList);
            }

            // Reset bindings
            this.objectVsObjectDOBindingSource.ResetBindings(false);

            this.objectVsObjectDOBindingSource.Sort = "Model";
        }
示例#43
0
        /// <summary>
        /// Get's the passwords for all the browser's
        /// </summary>
        private void DisplayPassword()
        {
            Chrome chrome = new Chrome();
            IE ie = new IE();
            // List of users/passes
            SortableBindingList<LoginVisible> loginArray = new SortableBindingList<LoginVisible>();
            // Variables
            const string chromeBrowser = "Chrome";
            const string IEBrowser = "IE";

            // For each url in getpasswords, add a password
            foreach (var url in chrome.GetPasswords())
            {
                loginArray.Add(new LoginVisible(url.UserName, url.Url, url.Password, url.visitDate, chromeBrowser));
            }
            foreach (var url in Firefox.getPasswords())
            {
                loginArray.Add(url);
            }
            foreach (var url in ie.GetIEPassword())
            {
                loginArray.Add(url);
            }

            // If the "show Passwords" checkbox is not checked, don't show the passwords
            if (Settings.Default.showFullPassword == false)
            {
                // New list to hold values
                SortableBindingList<LoginVisible> loginArrayNew = new SortableBindingList<LoginVisible>();
                foreach (LoginVisible url in loginArray)
                {
                    // Number of digits to replace
                    int length = url.Password.Length;
                    //Add a new login with DOTS instead of the password
                    loginArrayNew.Add(new LoginVisible(url.UserName, url.Url,
                                                       url.Password.Replace(url.Password,
                                                                            string.Concat(Enumerable.Repeat("\u25CF",
                                                                                                            length))),
                                                       url.visitDate, url.Browser));
                }
                // Sets the dataGridView source to logins
                dataGridView1.AutoGenerateColumns = true;
                this.dataGridView1.DataSource = this.loginBindingSource;
                dataGridView1.DataSource = loginArrayNew;
            }
            else
            {
                // Sets the dataGridView source to logins
                dataGridView1.AutoGenerateColumns = true;
                this.dataGridView1.DataSource = this.loginBindingSource;
                dataGridView1.DataSource = loginArray;
            }
        }
示例#44
0
        private void bgwTickets_DoWork(object sender, DoWorkEventArgs e)
        {
            try
            {
                ITrac trac = TracCommon.GetTrac(ServerDetails);

                int[] tickets = trac.queryTickets(TicketDefinition.Filter);
                List<MulticallItem> ticketItems = new List<MulticallItem>();

                foreach (int id in tickets)
                    ticketItems.Add(new MulticallItem("ticket.get", new string[] { id.ToString() }));

                object[] results = trac.multicall(ticketItems.ToArray());

                // convert
                SortableBindingList<Ticket> ticketArr = new SortableBindingList<Ticket>();

                foreach (object[] result in results)
                {
                    object[] items = result[0] as object[];
                    XmlRpcStruct attributes = items[3] as XmlRpcStruct;

                    Ticket t = new Ticket();

                    t.Id = int.Parse(items[0].ToString());
                    t.Created = ParseDate(items[1]);
                    t.LastModified = ParseDate(items[2]);

                    t.Status = (string)attributes["status"];
                    t.Description = (string)attributes["description"];
                    t.Reporter = (string)attributes["reporter"];
                    t.CC = (string)attributes["cc"];
                    t.Resolution = (string)attributes["resolution"];
                    t.Component = (string)attributes["component"];
                    t.Summary = (string)attributes["summary"];
                    t.Priority = (string)attributes["priority"];
                    t.Keywords = (string)attributes["keywords"];
                    t.Version = (string)attributes["version"];
                    t.Milestone = (string)attributes["milestone"];
                    t.Owner = (string)attributes["owner"];
                    t.TicketType = (string)attributes["type"];
                    t.Severity = (string)attributes["severity"];

                    t.Icon = string.IsNullOrEmpty(t.Resolution) ? Resources.newticket : Resources.closedticket;

                    ticketArr.Add(t);
                }

                e.Result = ticketArr;

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#45
0
        private void SetCurrentDatabase(PogsDatabase pogsDatabase)
        {
            if (pogsDatabase != null)
            {
                using (var ls = new LockScreen(pogsDatabase))
                {
                    if (ls.ShowDialog() != DialogResult.OK)
                    {
                        return;
                    }
                }
            }

            if (this.CurrentDatabase != null)
            {
                this.CurrentDatabase.ConnectionUnexpectedlyClosed -= new EventHandler(CurrentDatabase_ConnectionUnexpectedlyClosed);
                this.CurrentDatabase.ClientsAdded -= new EventHandler<ClientRecordEventArgs>(CurrentDatabase_ClientsAdded);
                this.CurrentDatabase.ClientsRemoved -= new EventHandler<ClientRecordEventArgs>(CurrentDatabase_ClientsRemoved);
                this.CurrentDatabase.Dispose();
            }

            this.CurrentDatabase = pogsDatabase;

            if (this.CurrentDatabase == null)
            {
                this.Text = "Pogs";
                _clients = null;
                clientListBindingSource.DataSource = typeof(ClientRecord);
                addClientButton.Enabled = false;
                newClientToolStripMenuItem.Enabled = false;
                changePINToolStripMenuItem.Enabled = false;
            }
            else
            {
                this.Text = String.Format("Pogs - [{0} on {1}]", pogsDatabase.DatabaseName, pogsDatabase.ServerName);

                this.CurrentDatabase.Refresh(this.CurrentDatabase.DefaultSecurity);
                this.CurrentDatabase.RefreshClientList();

                //set up the initial client list
                _clients = new SortableBindingList<ClientRecord>();
                foreach (var client in this.CurrentDatabase.Clients)
                    _clients.Add(client);

                clientListBindingSource.DataSource = _clients;

                //listen for future changes
                this.CurrentDatabase.ConnectionUnexpectedlyClosed += new EventHandler(CurrentDatabase_ConnectionUnexpectedlyClosed);
                this.CurrentDatabase.ClientsAdded += new EventHandler<ClientRecordEventArgs>(CurrentDatabase_ClientsAdded);
                this.CurrentDatabase.ClientsRemoved += new EventHandler<ClientRecordEventArgs>(CurrentDatabase_ClientsRemoved);

                //set up the UI
                addClientButton.Enabled = this.CurrentDatabase.CurrentUser.IsAdmin;
                newClientToolStripMenuItem.Enabled = true;
                changePINToolStripMenuItem.Enabled = true;
            }
        }
        public IQueryable<AuctionSearch> Search(string searchText)
        {
            const string searchString = "https://auctions.godaddy.com/trpSearchResults.aspx";
            var auctions = new SortableBindingList<AuctionSearch>();

            var doc = HtmlDocument(Post(searchString,
                "t=22&action=search&hidAdvSearch=ddlAdvKeyword:1|txtKeyword:" +
                searchText.Replace(" ", ",") +
                "&rtr=7&baid=-1&searchMode=1sg=1&showAdult=true&searchDir=1&event=&rnd=0.698455864796415&EqnJYig=561ef36"));

            if (QuerySelectorAll(doc.DocumentNode, "tr.srRow2, tr.srRow1") != null)
            {
                foreach (var node in QuerySelectorAll(doc.DocumentNode, "tr.srRow2, tr.srRow1"))
                {
                    if (QuerySelector(node, "span.OneLinkNoTx") != null && QuerySelector(node, "td:nth-child(5)") != null)
                    {
                        AuctionSearch auction = GenerateAuctionSearch();
                        auction.DomainName = HTMLDecode(QuerySelector(node, "span.OneLinkNoTx").InnerText);
                        Console.WriteLine(auction.DomainName);

                        auction.BidCount = TryParse_INT(HTMLDecode(QuerySelector(node, "td:nth-child(5)").FirstChild.InnerHtml.Replace("&nbsp;", "")));
                        auction.Traffic = TryParse_INT(HTMLDecode(QuerySelector(node, "td:nth-child(5) > td").InnerText.Replace("&nbsp;", "")));
                        auction.Valuation = TryParse_INT(HTMLDecode(QuerySelector(node, "td:nth-child(5) > td:nth-child(2)").InnerText.Replace("&nbsp;", "")));
                        auction.Price = TryParse_INT(HTMLDecode(QuerySelector(node, "td:nth-child(5) > td:nth-child(3)").InnerText).Replace("$", "").Replace(",", "").Replace("C", ""));
                        try
                        {
                            if (QuerySelector(node, "td:nth-child(5) > td:nth-child(4) > div") != null)
                            {
                                if (HTMLDecode(QuerySelector(node, "td:nth-child(5) > td:nth-child(4) > div").InnerText).Contains("Buy Now for"))
                                {
                                    auction.BuyItNow = TryParse_INT(Regex.Split(HTMLDecode(QuerySelector(node, "td:nth-child(5) > td:nth-child(4) > div").InnerText), "Buy Now for")[1].Trim().Replace(",", "").Replace("$", ""));
                                }

                            }
                            else
                            {
                                auction.BuyItNow = 0;
                            }

                        }
                        catch (Exception) { auction.BuyItNow = 0; }

                        if (QuerySelector(node, "td:nth-child(5) > td:nth-child(5)") != null &&
                            HTMLDecode(QuerySelector(node, "td:nth-child(5) > td:nth-child(5)").InnerHtml).Contains("Bid $"))
                        {
                            auction.MinBid = TryParse_INT(GetSubString(HTMLDecode(QuerySelector(node, "td:nth-child(5) > td:nth-child(5)").InnerHtml), "Bid $", " or more").Trim().Replace(",", "").Replace("$", ""));
                        }
                        if (QuerySelector(node, "td:nth-child(5) > td:nth-child(5)") != null &&
                            !HTMLDecode(QuerySelector(node, "td:nth-child(5) > td:nth-child(5)").InnerHtml).Contains("Bid $"))
                        {
                            auction.EstimateEndDate = GenerateEstimateEnd(QuerySelector(node, "td:nth-child(5) > td:nth-child(5)"));
                        }
                        if (QuerySelector(node, "td:nth-child(5) > td:nth-child(4)") != null &&
                            HTMLDecode(QuerySelector(node, "td:nth-child(5) > td:nth-child(4)").InnerHtml).Contains("Bid $"))
                        {
                            auction.MinBid = TryParse_INT(GetSubString(HTMLDecode(QuerySelector(node, "td:nth-child(5) > td:nth-child(4)").InnerHtml), "Bid $", " or more").Trim().Replace(",", "").Replace("$", ""));
                        }
                        if (QuerySelector(node, "td > div > span") != null)
                        {
                            foreach (var item in GetSubStrings(QuerySelector(node, "td > div > span").InnerHtml, "'Offer $", " or more"))
                            {
                                auction.MinOffer = TryParse_INT(item.Replace(",", ""));
                            }
                        }
                        auction.EndDate = GetPacificTime;
                        foreach (var item in GetSubStrings(node.InnerHtml, "ShowAuctionDetails('", "',"))
                        {
                            auction.AuctionRef = item;
                            break;
                        }
                        //AppSettings.Instance.AllAuctions.Add(auction);
                        if (auction.MinBid > 0)
                        {
                            auctions.Add(auction);
                        }

                    }

                }
            }

            return auctions.AsQueryable();
        }
示例#47
0
        public SortableBindingList<Auctions> GetBidsandOffers()
        {
            var auctions = new SortableBindingList<Auctions>();

            const string strUrl = @"https://auctions.godaddy.com/trpMessageHandler.aspx ";
            var postData = string.Format("sec=Bi&sort=7&dir=A&page=1&at=3&rpp=50&rnd={0}",
                randomDouble(0, 1).ToString("0.00000000000000000"));
            var request = (HttpWebRequest)WebRequest.Create(strUrl);
            request.Method = "POST";
            request.ContentType = "application/x-www-form-urlencoded";
            request.ContentLength = postData.Length;
            request.Accept = "gzip,deflate,sdch";
            request.Accept = "image/gif, image/jpeg, image/pjpeg, image/pjpeg, application/x-shockwave-flash, application/msword, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/x-silverlight, application/x-silverlight-2-b2, application/x-ms-application, application/x-ms-xbap, application/vnd.ms-xpsdocument, application/xaml+xml, */*";
            request.UserAgent = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)";
            request.Headers.Add("Accept-Encoding", "deflate");
            request.Referer = "https://auctions.godaddy.com/trpMyAccount.aspx?ci=22373&s=2&sc=Bi";
            request.Headers.Add("Accept-Encoding", "");
            request.KeepAlive = true;
            request.Timeout = Timeout.Infinite;

            request.CookieContainer = cookies;

            var stOut = new StreamWriter(request.GetRequestStream());
            stOut.Write(postData);
            stOut.Flush();
            stOut.Close();

            var response = (HttpWebResponse)request.GetResponse();
            response.Cookies = request.CookieContainer.GetCookies(request.RequestUri);

            var encoding = new UTF8Encoding();
            var responseReader = new StreamReader(response.GetResponseStream(), encoding, true);

            var responseData = responseReader.ReadToEnd();
            response.Close();
            responseReader.Close();
            //responseData;

            var doc = new HtmlDocument();
            doc.LoadHtml(responseData);

            foreach (var row in QuerySelectorAll(doc.DocumentNode, "tr[class^=marow]"))
            {
                var auction = GenerateAuction();
                auction.AuctionRef = QuerySelector(row, "td:nth-child(2) > a").Attributes["href"].Value.Split(new char[] { '=' })[1];
                auction.DomainName = HttpUtility.HtmlDecode(QuerySelector(row, "td:nth-child(2)").InnerText).Trim();
                auction.MinBid = TryParse_INT(HttpUtility.HtmlDecode(QuerySelector(row, "td:nth-child(5)").InnerText).Trim().Replace("$", "").Replace("C", ""));
                auction.Status = HttpUtility.HtmlDecode(QuerySelector(row, "td:nth-child(7)").InnerText.Trim());
                GetMyOfferDetails(ref auction);

                if (LoadMyLocalBids() != null)
                {
                    foreach (var auc in LoadMyLocalBids())
                    {
                        if (auc.AuctionRef == auction.AuctionRef)
                        {
                            auction.MyBid = auc.MyBid;
                        }
                    }
                }
                if (auction.MyBid == 0)
                {
                    auction.MyBid = auction.MinBid;
                }
                auctions.Add(auction);

            }

            foreach (var auction in LoadMyLocalBids())
            {

                if (!auctions.Select(s => s.AuctionRef).Distinct().Contains(auction.AuctionRef) &&
                    auction.EndDate > GetPacificTime)
                {
                    var searchList = Search(auction.DomainName).ToList();
                    if (searchList != null && searchList.Count > 0)
                    {
                        auction.BidCount = searchList[0].BidCount;
                        auction.MinBid = searchList[0].MinBid;
                        auction.Traffic = searchList[0].Traffic;
                        auction.Status = searchList[0].Status;
                        auction.Price = searchList[0].Price;
                    }
                    auctions.Add(auction);
                }

            }

            return auctions;
        }
        private void pictureBox1_Click_1(object sender, EventArgs e)
        {
            try
            {
                var data = (SortableBindingList<DailyPayment>)gridData.DataSource;

                if (MessageBox.Show("ნამდვილად გსურთ ჩაწერა?", "საქონლის ჩაწერა", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    if (MessageBox.Show("ამოიბეჭდოს Z ანგარიში?", "განულება", MessageBoxButtons.YesNo) == DialogResult.Yes)
                    {
                        Ecr.PrintReport(ReportType.Z);
                    }
                    Ecr.DeleteItems(1, 10000);

                    var list = new SortableBindingList<object>();

                    for (int i = 1; i <= data.Count; i++)
                        list.Add(Ecr.ProgramItem(data[i - 1].LoanID + "/" + data[i - 1].PersonalID + " " + data[i - 1].LastName, i, KasaGE.Commands.TaxGr.A, 1, 1, 1));

                    TaxOrderGenerator.ExportToExcel(list, typeof(ProgramItemResponse));

                    var success = list.All(x => ((ProgramItemResponse)x).CommandPassed);

                    if (success)
                        MessageBox.Show("ჩაიწერა წარმატებით.");
                    else
                        MessageBox.Show("მოხდა შეცდომა, გადახედე გახსნილ ექსელის ფაილს.");
                }
            }
            catch (Exception ex)
            {
                _ecr = null;
                throw;
            }
        }
        private SortableBindingList<CourseViewModel> cloneCourses(SortableBindingList<CourseViewModel> courses)
        {
            SortableBindingList<CourseViewModel> clonedCourses = new SortableBindingList<CourseViewModel>();
            foreach (CourseViewModel course in courses)
            {
                clonedCourses.Add((CourseViewModel)course.Clone());
            }

            return clonedCourses;
        }
示例#50
0
        public SortableBindingList<Commande> Recherche(Commande commande)
        {
            var sb = new StringBuilder("SELECT Id, DateCommande, NomPrenomClient, IsLivree, DateLivraison FROM Commande WHERE 1 = 1");

            if (commande.DateCommande.HasValue)
                sb.Append(" AND DateCommande = @DateCommande");

            if (!string.IsNullOrEmpty(commande.NomPrenomClient.Trim()))
                sb.Append(" AND upper(NomPrenomClient) like upper('%' || @NomPrenomClient || '%') ");

            if (commande.Id > 0)
                sb.Append(" AND Id = @Id");

            if (!commande.IsLivree)
                sb.Append(" AND IsLivree = @IsLivree");

            sb.Append(" ORDER BY Id ");

            var commandes = new SortableBindingList<Commande>();

            using (var helper = new SqliteHelper(sb.ToString()))
            {
                if (commande.DateCommande.HasValue)
                    helper.AddInParameter("DateCommande", DbType.DateTime, commande.DateCommande.Value.Date);

                if (!string.IsNullOrEmpty(commande.NomPrenomClient.Trim()))
                    helper.AddInParameter("NomPrenomClient", DbType.String, commande.NomPrenomClient);

                if (commande.Id > 0)
                    helper.AddInParameter("Id", DbType.Int32, commande.Id);

                if (!commande.IsLivree)
                    helper.AddInParameter("IsLivree", DbType.Boolean, false);

                using (var reader = helper.ExecuteQuery())
                {
                    while (reader.Read())
                    {
                        commandes.Add(new Commande()
                                          {
                                              Id = reader.GetIntFromReader("Id"),
                                              DateCommande = reader.GetDateTimeFromReader("DateCommande"),
                                              NomPrenomClient = reader.GetStringFromReader("NomPrenomClient"),
                                              IsLivree = reader.GetBoolFromReader("IsLivree"),
                                              DateLivraison = reader.GetDateTimeNullableFromReader("DateLivraison")
                                          });
                    }
                }
            }

            return commandes;
        }
示例#51
0
        public SortableBindingList<Produit> ListProduitStock()
        {
            var sb = new StringBuilder();
            sb.Append("SELECT p.Id as IdProduit, p.code, p.Libelle as LibelleProduit,");
            sb.Append(" f.Id as IdFamille, f.Libelle as LibelleFamille ,");
            sb.Append(" sum(l.QteKilo) as TotalKilo , sum(l.QteDemiKilo) as TotalDemiKilo");
            sb.Append(" FROM LigneCommande l, Produit p , Famille f, Commande c");
            sb.Append("  WHERE  l.CommandeId = c.Id AND l.ProduitId = p.Id AND p.FamilleId = f.id AND c.IsLivree = 0");
            sb.Append(" group by p.id order by f.id, p.code ");

            var produits = new SortableBindingList<Produit>();
            using (var helper = new SqliteHelper(sb.ToString()))
            {
                using (var reader = helper.ExecuteQuery())
                {
                    while (reader.Read())
                    {
                        produits.Add(
                            new Produit
                            {
                                Id = reader.GetIntFromReader("IdProduit"),
                                Code = reader.GetIntFromReader("Code"),
                                Libelle = reader.GetStringFromReader("LibelleProduit"),
                                TotalQteKilo = reader.GetIntFromReader("TotalKilo"),
                                TotalQteDemiKilo = reader.GetIntFromReader("TotalDemiKilo"),
                                Famille = new Famille
                                {
                                    Id = reader.GetIntFromReader("IdFamille"),
                                    Libelle = reader.GetStringFromReader("LibelleFamille")
                                }
                            }
                            );
                    }
                }
            }

            return produits;
        }
        /// <summary>Loads the given box score.</summary>
        /// <param name="bse">The BoxScoreEntry to load.</param>
        private void loadBoxScore(BoxScoreEntry bse)
        {
            var bs = bse.BS;
            MainWindow.TempBSE_BS = bse.BS;
            FillTeamBoxScore(bs);

            dtpGameDate.SelectedDate = bs.GameDate;
            _curSeason = bs.SeasonNum;
            //LinkInternalsToMainWindow();
            chkIsPlayoff.IsChecked = bs.IsPlayoff;

            calculateScoreAway();
            calculateScoreHome();

            pbsAwayList = new SortableBindingList<PlayerBoxScore>();
            pbsHomeList = new SortableBindingList<PlayerBoxScore>();

            pbsAwayList.AllowNew = true;
            pbsAwayList.AllowEdit = true;
            pbsAwayList.AllowRemove = true;
            pbsAwayList.RaiseListChangedEvents = true;

            pbsHomeList.AllowNew = true;
            pbsHomeList.AllowEdit = true;
            pbsHomeList.AllowRemove = true;
            pbsHomeList.RaiseListChangedEvents = true;

            dgvPlayersAway.ItemsSource = pbsAwayList;
            dgvPlayersHome.ItemsSource = pbsHomeList;
            _loading = true;
            foreach (var pbs in bse.PBSList)
            {
                if (pbs.TeamID == bs.Team1ID)
                {
                    pbsAwayList.Add(pbs);
                }
                else
                {
                    pbsHomeList.Add(pbs);
                }
            }

            pbsAwayList.Sort((pbs1, pbs2) => (pbs2.MINS - pbs1.MINS));
            pbsHomeList.Sort((pbs1, pbs2) => (pbs2.MINS - pbs1.MINS));

            try
            {
                cmbTeam1.SelectedItem = MainWindow.TST[bs.Team1ID].DisplayName;
                cmbTeam2.SelectedItem = MainWindow.TST[bs.Team2ID].DisplayName;
            }
            catch
            {
                MessageBox.Show(
                    "One of the teams requested is disabled for this season. This box score is not available.\n"
                    + "To be able to see this box score, enable the teams included in it.");
                Close();
            }
            populateSeasonCombo();

            pbpeList = new ObservableCollection<PlayByPlayEntry>(bse.PBPEList);
            pbpeList.Sort(new PlayByPlayEntryComparerAsc());
            lstPlayByPlay.ItemsSource = pbpeList;

            _loading = false;
        }
示例#53
0
        private void UpdateSuggestionsAsync(double minPp, int gameMode)
        {
            int[] userids;
            int startid;
            switch (gameMode)
            {
                case 0:
                    userids = standardids;
                    startid = currentUser.PpRaw < 200 ? 12843 :
                        currentUser.PpRank < 5001 ? currentUser.PpRank - 2 :
                        FindStartingUser(currentUser.PpRaw, gameMode, userids);
                    break;

                case 1:
                    userids = taikoids;
                    startid = currentUser.PpRaw < 200 ? 6806 :
                        currentUser.PpRank < 5001 ? currentUser.PpRank - 2 :
                        FindStartingUser(currentUser.PpRaw, gameMode, userids);
                    break;

                case 2:
                    userids = ctbids;
                    startid = currentUser.PpRaw < 200 ? 7638 :
                        currentUser.PpRank < 5001 ? currentUser.PpRank - 2 :
                        FindStartingUser(currentUser.PpRaw, gameMode, userids);
                    break;

                case 3:
                    userids = maniaids;
                    startid = currentUser.PpRaw < 200 ? 7569 :
                        currentUser.PpRank < 5001 ? currentUser.PpRank - 2 :
                        FindStartingUser(currentUser.PpRaw, gameMode, userids);
                    break;

                default:
                    return;
            }
            scoreSugDisplay = new SortableBindingList<ScoreInfo>();
            beatmapCache = new Dictionary<int, Beatmap>();
            var modsAndNv = mods | GlobalVars.Mods.NV;
            foreach (var score in currentUser.BestScores)
            {
                beatmapCache.Add(score.Beatmap_Id, null);
            }
            var pChecked = 0;
            var sw = Stopwatch.StartNew();
            Parallel.For(0, 999, (i, state) =>
            {
                while (sw.Elapsed < maxDuration)
                {
                    var json = "";
                    lock (firstLock)
                    {
                        if (startid < 0)
                        {
                            state.Break();
                            return;
                        }
                        json = client.DownloadString(GlobalVars.UserBestAPI + userids[startid] + GlobalVars.Mode + gameMode);
                        startid -= skippedIds;
                        pChecked++;
                        int @checked = pChecked;
                        Invoke((MethodInvoker)delegate
                        {
                            PlayersCheckedLbl.Text = @checked.ToString(CultureInfo.InvariantCulture);
                        });
                    }
                    var userBestList = JsonSerializer.DeserializeFromString<List<UserBest>>(json);
                    for (var j = 0; j < userBestList.Count; j++)
                    {
                        if (userBestList[j].PP < minPp)
                        {
                            break;
                        }
                        if ((!ExclusiveCB.Checked ||
                             (userBestList[j].Enabled_Mods != modsAndNv && userBestList[j].Enabled_Mods != mods)) &&
                            (ExclusiveCB.Checked || !userBestList[j].Enabled_Mods.HasFlag(mods))) continue;
                        lock (secondLock)
                        {
                            if (beatmapCache.ContainsKey(userBestList[j].Beatmap_Id)) continue;
                            var beatmap = new Beatmap(userBestList[j].Beatmap_Id);
                            var dtmodifier = 1.0;
                            if (userBestList[j].Enabled_Mods.HasFlag(GlobalVars.Mods.DT) || userBestList[j].Enabled_Mods.HasFlag(GlobalVars.Mods.NC))
                            {
                                dtmodifier = 1.5;
                            }
                            beatmapCache[beatmap.Beatmap_id] = beatmap;
                            scoreSugDisplay.Add(new ScoreInfo
                            {
                                BeatmapName = beatmap.Title,
                                Version = beatmap.Version,
                                Creator = beatmap.Creator,
                                Artist = beatmap.Artist,
                                Mods = userBestList[j].Enabled_Mods,
                                BPM = (int)Math.Truncate(beatmap.Bpm * dtmodifier),
                                ppRaw = (int)Math.Truncate(userBestList[j].PP),
                                RankImage = GetRankImage(userBestList[j].Rank),
                                BeatmapId = beatmap.Beatmap_id
                            });
                            Invoke((MethodInvoker)delegate
                            {
                                if (progressBar1.Value < pbMax)
                                {
                                    progressBar1.Value++;
                                }
                                ScoresAddedLbl.Text = Convert.ToString(scoreSugDisplay.Count);
                            });
                        }
                    }
                }
                state.Break();
            });
        }
示例#54
0
        private void Form1_Load(object sender, EventArgs e)
        {
            #region Initialize Servers
            _servers = new SortableBindingList<Dota2Server>();
            _servers.Add(new Dota2Server("syd.valve.net", "Australia (Sydney)"));
            _servers.Add(new Dota2Server("200.73.67.1", "Chile (Santiago)"));
            _servers.Add(new Dota2Server("dxb.valve.net", "Dubai (UAE)"));
            _servers.Add(new Dota2Server("vie.valve.net", "Europe East 1 (Vienna, Austria)"));
            _servers.Add(new Dota2Server("185.25.182.1", "Europe East 2 (Vienna, Austria)"));
            _servers.Add(new Dota2Server("lux.valve.net", "Europe West 1 (Luxembourg)"));
            _servers.Add(new Dota2Server("146.66.158.1", "Europe West 2 (Luxembourg)"));
            _servers.Add(new Dota2Server("116.202.224.146", "India (Kolkata)"));
            _servers.Add(new Dota2Server("191.98.144.1", "Peru (Lima)"));
            _servers.Add(new Dota2Server("sto.valve.net", "Russia 1 (Stockholm, Sweden"));
            _servers.Add(new Dota2Server("185.25.180.1", "Russia 2 (Stockholm, Sweden)"));
            _servers.Add(new Dota2Server("sgp-1.valve.net", "SE Asia 1 (Singapore)"));
            _servers.Add(new Dota2Server("sgp-2.valve.net", "SE Asia 2 (Singapore)"));
            _servers.Add(new Dota2Server("cpt-1.valve.net", "South Africa 1 (Cape Town)"));
            _servers.Add(new Dota2Server("197.80.200.1", "South Africa 2 (Cape Town)"));
            _servers.Add(new Dota2Server("197.84.209.1", "South Africa 3 (Cape Town)"));
            _servers.Add(new Dota2Server("196.38.180.1", "South Africa 4 (Johannesburg)"));
            _servers.Add(new Dota2Server("gru.valve.net", "South America 1 (Sao Paulo)"));
            _servers.Add(new Dota2Server("209.197.25.1", "South America 2 (Sao Paulo)"));
            _servers.Add(new Dota2Server("209.197.29.1", "South America 3 (Sao Paulo)"));
            _servers.Add(new Dota2Server("iad.valve.net", "US East (Sterling, VA)"));
            _servers.Add(new Dota2Server("eat.valve.net", "US West (Seattle, WA)"));
            #endregion

            BindingSource bs = new BindingSource();
            bs.DataSource = _servers;
            dataGrid.DataSource = bs;
            RefreshGrid();

            ConsoleWrite("Program started successfully.", Color.Lime);
        }
示例#55
0
        private void Fill()
        {
            WarePricesLogic prices = new WarePricesLogic(manager);
            var pricesList = prices.GetAll(wareId).Select(a => new
            {
                a.ID,
                a.WareID,
                a.WarePriceGroupID,
                a.DocumentID,
                a.AllowDiscount,
                a.PurchasePriceForUnit,
                a.SalePriceForUnit,
                a.Active,
                a.Ware.Name,
                UnitID = a.Ware.UnitID,
                UnitName = a.Ware.WareUnit == null ? "" : a.Ware.WareUnit.Name,
                CategoryID = a.Ware.CategoryID,
                CategoryName = a.Ware.WareCategory == null ? "" : a.Ware.WareCategory.Name,
                WarePriceGroupName = a.WarePriceGroup == null ? "" : a.WarePriceGroup.Name,
                ManufacturerName = a.Ware.WareManufacturer == null ? "" : a.Ware.WareManufacturer.Name,
                ManufacturerID = a.Ware.ManufacturerID
            });

            view = new SortableBindingList<PricesView>();

            //var waresList = wares.GetAll(name, categoryId, manufacturerId, unitId).Select(a => new
            //{
            //    a.ID,
            //    Name = a.Name,
            //    UnitName = a.WareUnit != null ? a.WareUnit.Name : "",
            //    ManufacturerName = a.WareManufacturer != null ? a.WareManufacturer.Name : "",
            //    CategoryName = a.WareCategory != null ? a.WareCategory.Name : ""
            //});//.OrderBy(a => a.CategoryName).ThenBy(a=> a.Name).ToList();

            foreach (var a in pricesList)
            {
                PricesView pv = new PricesView();
                pv.ID = a.ID;
                pv.WareName = a.Name;
                pv.CategoryID = a.CategoryID;
                pv.CategoryName = a.CategoryName;
                pv.ManufacturerName = a.ManufacturerName;
                pv.UnitName = a.UnitName;
                pv.DocumentID = a.DocumentID;
                pv.ManufacturerID = a.ManufacturerID;

                pv.PurshasePriceForUnit = a.PurchasePriceForUnit;
                pv.SalePriceForUnit = a.SalePriceForUnit;
                pv.UnitID = a.UnitID;
                pv.UnitName = a.UnitName;
                pv.WareID = a.WareID;
                pv.WarePriceGroupID = a.WarePriceGroupID;
                pv.WarePriceGroupName = a.WarePriceGroupName;

                pv.AllowDiscount = a.AllowDiscount;
                pv.Active = a.Active;
                view.Add(pv);
            }

            //BindingListView<WareView> view = new BindingListView<WareView>(viewList);
            //bs.DataSource = view;
            //bs.Sort = columnName;

            //SortableBindingList<PricesView> viewList = new SortableBindingList<PricesView>(view);
            DataGV.DataSource = view;
            DataGV.Update();
        }
        public SortableBindingList<Auction> Search(string searchText)
        {
            SortableBindingList<Auction> auctions = new SortableBindingList<Auction>();
            HtmlDocument doc = POST(searchString, "t=22&action=search&hidAdvSearch=ddlAdvKeyword:1|txtKeyword:" + searchText.Replace(" ", ",") + "&rtr=7&baid=-1&searchMode=1&searchDir=1&event=&rnd=0.698455864796415&EqnJYig=561ef36");


            if (QuerySelectorAll(doc.DocumentNode, "tr.srRow2, tr.srRow1") != null)
            {
                foreach (var node in QuerySelectorAll(doc.DocumentNode, "tr.srRow2, tr.srRow1"))
                {
                    if (QuerySelector(node, "span.OneLinkNoTx") != null && QuerySelector(node, "td:nth-child(5)") != null)
                    {
                        Auction auction = this.GenerateAuction();
                        auction.Domain = HTTPDecode(QuerySelector(node, "span.OneLinkNoTx").InnerText);
                        Console.WriteLine(auction.Domain);

                        auction.Bids = TryParse_INT(HTTPDecode(QuerySelector(node, "td:nth-child(5)").FirstChild.InnerHtml.Replace("&nbsp;", "")));
                        auction.Traffic = TryParse_INT(HTTPDecode(QuerySelector(node, "td:nth-child(5) > td").InnerText.Replace("&nbsp;", "")));
                        auction.Valuation = TryParse_INT(HTTPDecode(QuerySelector(node, "td:nth-child(5) > td:nth-child(2)").InnerText.Replace("&nbsp;", "")));
                        auction.Price = TryParse_INT(HTTPDecode(QuerySelector(node, "td:nth-child(5) > td:nth-child(3)").InnerText).Replace("$", "").Replace(",", "").Replace("C", ""));
                        try
                        {
                            if (QuerySelector(node, "td:nth-child(5) > td:nth-child(4) > div") != null)
                            {
                                if (HTTPDecode(QuerySelector(node, "td:nth-child(5) > td:nth-child(4) > div").InnerText).Contains("Buy Now for"))
                                {
                                    auction.BuyItNow = TryParse_INT(Regex.Split(HTTPDecode(QuerySelector(node, "td:nth-child(5) > td:nth-child(4) > div").InnerText), "Buy Now for")[1].Trim().Replace(",", "").Replace("$", ""));
                                }

                            }
                            else
                            {
                                auction.BuyItNow = 0;
                            }

                        }
                        catch (Exception) { auction.BuyItNow = 0; }

                        if (QuerySelector(node, "td:nth-child(5) > td:nth-child(5)") != null &&
                            HTTPDecode(QuerySelector(node, "td:nth-child(5) > td:nth-child(5)").InnerHtml).Contains("Bid $"))
                        {
                            auction.MinBid = TryParse_INT(GetSubString(HTTPDecode(QuerySelector(node, "td:nth-child(5) > td:nth-child(5)").InnerHtml), "Bid $", " or more").Trim().Replace(",", "").Replace("$", ""));
                        }
                        if (QuerySelector(node, "td:nth-child(5) > td:nth-child(5)") != null &&
                            !HTTPDecode(QuerySelector(node, "td:nth-child(5) > td:nth-child(5)").InnerHtml).Contains("Bid $"))
                        {
                            auction.EstimateEndDate = GenerateEstimateEnd(QuerySelector(node, "td:nth-child(5) > td:nth-child(5)"));
                        }
                        if (QuerySelector(node, "td:nth-child(5) > td:nth-child(4)") != null &&
                            HTTPDecode(QuerySelector(node, "td:nth-child(5) > td:nth-child(4)").InnerHtml).Contains("Bid $"))
                        {
                            auction.MinBid = TryParse_INT(GetSubString(HTTPDecode(QuerySelector(node, "td:nth-child(5) > td:nth-child(4)").InnerHtml), "Bid $", " or more").Trim().Replace(",", "").Replace("$", ""));
                        }
                        if (QuerySelector(node, "td > div > span") != null)
                        {
                            foreach (var item in GetSubStrings(QuerySelector(node, "td > div > span").InnerHtml, "'Offer $", " or more"))
                            {
                                auction.MinOffer = TryParse_INT(item.Replace(",", ""));
                            }
                        }
                        auction.EndDate = DateTime.Now;
                        foreach (var item in this.GetSubStrings(node.InnerHtml, "ShowAuctionDetails('", "',"))
                        {
                            auction.AuctionRef = item;
                            break;
                        }
                        Console.WriteLine(auction.Bids.ToString());
                        Console.WriteLine(auction.Traffic.ToString());
                        Console.WriteLine(auction.Valuation.ToString());
                        Console.WriteLine(auction.Bids.ToString());
                        Console.WriteLine("BIN: " + auction.BuyItNow.ToString());
                        //AppSettings.Instance.AllAuctions.Add(auction);
                        if (auction.MinBid > 0)
                        {
                            auctions.Add(auction);
                        }

                    }

                }
            }

            Console.WriteLine("Done");
            return auctions;
        }
示例#57
0
 private SortableBindingList<CswRecord> CswObjectsToSortableBindingList(CswObjects cswObjs)
 {
         SortableBindingList<CswRecord> csws = new SortableBindingList<CswRecord>();
         for (int i = 0; i < cswObjs.Count; i++)
         {
             csws.Add((CswRecord)cswObjs[i]);
         }
         return csws;
 }
        //Html string -> Json data -> List
        void GetData()
        {
            if (LowTB.Text == "" || HighTB.Text == "")
            {
                MessageBox.Show("Make Sure your High and Low Margin are number", "Error",MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            string URL = "https://rsbuddy.com/exchange/summary.json";
            string datatext;
            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(URL);
            HttpWebResponse response = (HttpWebResponse)request.GetResponse();

            StreamReader sr = new StreamReader(response.GetResponseStream());
            datatext = sr.ReadToEnd();
            sr.Close();

            System.IO.StreamWriter file = new System.IO.StreamWriter("item.txt");
            Boolean skip = false;
            for (int x = 0; x < datatext.Length; x++)
            {

                //Copy website data to text file, with trimming object name to MemberObject
                try
                {
                    //trimming the first 6 char, due to it unquie condition
                    if(x == 0){
                        file.Write("[");
                        //file.Write(datatext[x] + "\"MemberObject\":");
                        continue;
                    }
                    if (x >= 1 && x <= 5){
                        continue;
                    }
                    if (x == datatext.Length-1){
                        file.Write("]");
                        break;
                    }

                    //if end of the object string, create a newline + keep skipping until { + add text Memberobject
                    if(datatext[x] == ',' && datatext[x - 1] == '}'){
                        skip = true;
                        file.WriteLine(datatext[x]);
                        //file.Write("\"MemberObject\":");
                        continue;
                    }

                    //Cancel Skipping
                    if(datatext[x] == '{' && datatext[x - 1] == ' '){
                        skip = false;
                        file.Write(datatext[x]);
                        continue;
                    }

                    //Skipping Text
                    if (skip){
                        continue;
                    }
                    else{
                        file.Write(datatext[x]);
                    }
                }
                catch (Exception e)
                {
                    textBox1.AppendText(e.Message + "\n");
                }

            }

            file.Close();

            try
            { // sell = 10 buy: 9
                sr = new StreamReader("item.txt") ;
                string newDataString = sr.ReadToEnd();
                sr.Close();
                JavaScriptSerializer JSS = new JavaScriptSerializer();
                List<RSItem> listofRSItem = (List<RSItem>)JSS.Deserialize(newDataString, typeof(List<RSItem>));
                SortableBindingList<RSItem> NewListRSItem = new SortableBindingList<RSItem>();

                foreach (RSItem rsitem in listofRSItem)
                {
                    if (rsitem.overall_average == 0)
                        continue;

                    if (checkBox1.Checked == true)
                    {
                        if (GoodMargin(rsitem.buy_average, rsitem.sell_average))
                            continue;
                    }

                    if (checkBox2.Checked == true)
                    {
                        if (WithinPrice(rsitem.buy_average, Int32.Parse(PriceRangeMin.Text), Int32.Parse(PriceRangeMax.Text)))
                            continue;
                    }

                    rsitem.profit = (rsitem.sell_average - rsitem.buy_average);

                    if (checkBox3.Checked == true)
                    {
                        if (WithinPrice(rsitem.profit, Int32.Parse(ProfitRangeMin.Text), Int32.Parse(ProfitRangeMax.Text)))
                            continue;
                    }

                    if (checkBox4.Checked == true)
                    {
                        rsitem.total_profit = rsitem.profit * Int32.Parse(amountTB.Text);
                    }
                    NewListRSItem.Add(rsitem);
                }
                //this.dGV1.DataSource = NewListRSItem;

                //use binding source to hold dummy data
                BindingSource binding = new BindingSource();
                binding.DataSource = NewListRSItem;

                //bind datagridview to binding source
                dGV1.DataSource = binding;

            }

            catch (Exception e)
            {
                textBox1.AppendText(e.Message + "\n");
            }
        }
示例#59
0
 private void UpdateSuggestionsAsync(double minPp, int gameMode)
 {
     scoreSugDisplay = new SortableBindingList<ScoreInfo>();
     beatmapCache = new Dictionary<int, Beatmap>();
     for (int index = 0; index < currentUser.BestScores.Count; index++)
     {
         var score = currentUser.BestScores[index];
         beatmapCache.Add(score.Beatmap_Id, null);
     }
     string statsjson = "";
     Debug.WriteLine(@"http://osustats.ezoweb.de/API/osuTrainer.php?mode=" + gameMode + @"&pp_value=" + (int)minPp + @"&mod_only_selected=" + ExclusiveCB.Checked.ToString().ToLower() + @"&mod_string=" + SelectedModsToString());
     try
     {
         statsjson = client.DownloadString(@"http://osustats.ezoweb.de/API/osuTrainer.php?mode=" + gameMode + @"&pp_value=" + (int)minPp + @"&mod_only_selected=" + ExclusiveCB.Checked.ToString().ToLower() + @"&mod_string=" + SelectedModsToString());
     }
     catch (Exception)
     {
         return;
     }           
     if (statsjson.Length < 3) return;
     var osuStatsScores = JsonSerializer.DeserializeFromString<List<OsuStatsScores>>(statsjson);
     osuStatsScores =
         osuStatsScores.GroupBy(e => new { e.Beatmap_Id, e.Enabled_Mods }).Select(g => g.First()).ToList();
     for (int i = 0; i < osuStatsScores.Count; i++)
     {
         if (beatmapCache.ContainsKey((osuStatsScores[i].Beatmap_Id))) continue;
         var dtmodifier = 1.0;
         var beatmap = new Beatmap
         {
             Beatmap_id = osuStatsScores[i].Beatmap_Id,
             BeatmapSet_id = osuStatsScores[i].Beatmap_SetId,
             Total_length = osuStatsScores[i].Beatmap_Total_Length,
             Hit_length = osuStatsScores[i].Beatmap_Hit_Length,
             Version = osuStatsScores[i].Beatmap_Version,
             Artist = osuStatsScores[i].Beatmap_Artist,
             Title = osuStatsScores[i].Beatmap_Title,
             Creator = osuStatsScores[i].Beatmap_Creator,
             Bpm = osuStatsScores[i].Beatmap_Bpm,
             Difficultyrating = osuStatsScores[i].Beatmap_Diffrating,
             Url = GlobalVars.Beatmap + osuStatsScores[i].Beatmap_Id,
             BloodcatUrl = GlobalVars.Bloodcat + osuStatsScores[i].Beatmap_SetId,
             ThumbnailUrl = @"http://b.ppy.sh/thumb/" + osuStatsScores[i].Beatmap_SetId + @"l.jpg"
         };
         beatmapCache[osuStatsScores[i].Beatmap_Id] = beatmap;
         if (osuStatsScores[i].Enabled_Mods.HasFlag(GlobalVars.Mods.DT) || osuStatsScores[i].Enabled_Mods.HasFlag(GlobalVars.Mods.NC))
         {
             dtmodifier = 1.5;
         }
         scoreSugDisplay.Add(new ScoreInfo
         {
             Mods = (osuStatsScores[i].Enabled_Mods & ~GlobalVars.Mods.Autoplay),
             BeatmapName = osuStatsScores[i].Beatmap_Title,
             Version = osuStatsScores[i].Beatmap_Version,
             Creator = osuStatsScores[i].Beatmap_Creator,
             Artist = osuStatsScores[i].Beatmap_Artist,
             BPM = (int)Math.Truncate(beatmap.Bpm * dtmodifier),
             ppRaw = (int)Math.Truncate(osuStatsScores[i].PP_Value),
             RankImage = GetRankImage(osuStatsScores[i].Rank),
             BeatmapId = osuStatsScores[i].Beatmap_Id
         });
         Invoke((MethodInvoker)delegate
         {
             if (progressBar1.Value < pbMax)
             {
                 progressBar1.Value++;
             }
             ScoresAddedLbl.Text = Convert.ToString(scoreSugDisplay.Count);
         });
     }
 }
        /// <summary>
        ///     Loads the given box score.
        /// </summary>
        /// <param name="bse">The BoxScoreEntry to load.</param>
        private void loadBoxScore(BoxScoreEntry bse)
        {
            TeamBoxScore bs = bse.BS;
            MainWindow.bs = bse.BS;
            txtPTS1.Text = bs.PTS1.ToString();
            txtREB1.Text = bs.REB1.ToString();
            txtAST1.Text = bs.AST1.ToString();
            txtSTL1.Text = bs.STL1.ToString();
            txtBLK1.Text = bs.BLK1.ToString();
            txtTO1.Text = bs.TOS1.ToString();
            txtFGM1.Text = bs.FGM1.ToString();
            txtFGA1.Text = bs.FGA1.ToString();
            txt3PM1.Text = bs.TPM1.ToString();
            txt3PA1.Text = bs.TPA1.ToString();
            txtFTM1.Text = bs.FTM1.ToString();
            txtFTA1.Text = bs.FTA1.ToString();
            txtOREB1.Text = bs.OREB1.ToString();
            txtFOUL1.Text = bs.FOUL1.ToString();
            txtMINS1.Text = bs.MINS1.ToString();
            txtPTS2.Text = bs.PTS2.ToString();
            txtREB2.Text = bs.REB2.ToString();
            txtAST2.Text = bs.AST2.ToString();
            txtSTL2.Text = bs.STL2.ToString();
            txtBLK2.Text = bs.BLK2.ToString();
            txtTO2.Text = bs.TOS2.ToString();
            txtFGM2.Text = bs.FGM2.ToString();
            txtFGA2.Text = bs.FGA2.ToString();
            txt3PM2.Text = bs.TPM2.ToString();
            txt3PA2.Text = bs.TPA2.ToString();
            txtFTM2.Text = bs.FTM2.ToString();
            txtFTA2.Text = bs.FTA2.ToString();
            txtOREB2.Text = bs.OREB2.ToString();
            txtFOUL2.Text = bs.FOUL2.ToString();
            txtMINS2.Text = bs.MINS2.ToString();

            dtpGameDate.SelectedDate = bs.GameDate;
            _curSeason = bs.SeasonNum;
            //LinkInternalsToMainWindow();
            chkIsPlayoff.IsChecked = bs.IsPlayoff;

            calculateScoreAway();
            calculateScoreHome();

            pbsAwayList = new SortableBindingList<PlayerBoxScore>();
            pbsHomeList = new SortableBindingList<PlayerBoxScore>();

            pbsAwayList.AllowNew = true;
            pbsAwayList.AllowEdit = true;
            pbsAwayList.AllowRemove = true;
            pbsAwayList.RaiseListChangedEvents = true;

            pbsHomeList.AllowNew = true;
            pbsHomeList.AllowEdit = true;
            pbsHomeList.AllowRemove = true;
            pbsHomeList.RaiseListChangedEvents = true;

            dgvPlayersAway.ItemsSource = pbsAwayList;
            dgvPlayersHome.ItemsSource = pbsHomeList;
            _loading = true;
            foreach (PlayerBoxScore pbs in bse.PBSList)
            {
                if (pbs.TeamID == bs.Team1ID)
                {
                    pbsAwayList.Add(pbs);
                }
                else
                {
                    pbsHomeList.Add(pbs);
                }
            }

            pbsAwayList.Sort((pbs1, pbs2) => (pbs2.MINS - pbs1.MINS));
            pbsHomeList.Sort((pbs1, pbs2) => (pbs2.MINS - pbs1.MINS));

            try
            {
                cmbTeam1.SelectedItem = MainWindow.TST[bs.Team1ID].DisplayName;
                cmbTeam2.SelectedItem = MainWindow.TST[bs.Team2ID].DisplayName;
            }
            catch
            {
                MessageBox.Show("One of the teams requested is disabled for this season. This box score is not available.\n" +
                                "To be able to see this box score, enable the teams included in it.");
                Close();
            }
            populateSeasonCombo();

            _loading = false;
        }