当前位置: 首页>>代码示例>>C#>>正文


C# SortedSet.Contains方法代码示例

本文整理汇总了C#中System.Collections.SortedSet.Contains方法的典型用法代码示例。如果您正苦于以下问题:C# SortedSet.Contains方法的具体用法?C# SortedSet.Contains怎么用?C# SortedSet.Contains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Collections.SortedSet的用法示例。


在下文中一共展示了SortedSet.Contains方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: IsSequenced

        /// <summary>
        /// Tests whether a <see cref="Geometry" /> is sequenced correctly.
        /// <see cref="LineString" />s are trivially sequenced.
        /// <see cref="MultiLineString" />s are checked for correct sequencing.
        /// Otherwise, <c>IsSequenced</c> is defined
        /// to be <c>true</c> for geometries that are not lineal.
        /// </summary>
        /// <param name="geom">The <see cref="Geometry" /> to test.</param>
        /// <returns>
        /// <c>true</c> if the <see cref="Geometry" /> is sequenced or is not lineal.
        /// </returns>
        public static bool IsSequenced(IGeometry geom)
        {
            if (!(geom is IMultiLineString)) 
                return true;
        
            IMultiLineString mls = geom as IMultiLineString;

            // The nodes in all subgraphs which have been completely scanned
            ISet<ICoordinate> prevSubgraphNodes = new SortedSet<ICoordinate>();

            ICoordinate lastNode = null;
            IList<ICoordinate> currNodes = new List<ICoordinate>();
            for (int i = 0; i < mls.NumGeometries; i++) 
            {
                ILineString line = (ILineString) mls.GetGeometryN(i);
                ICoordinate startNode = line.GetCoordinateN(0);
                ICoordinate endNode   = line.GetCoordinateN(line.NumPoints - 1);

                /*
                 * If this linestring is connected to a previous subgraph, geom is not sequenced
                 */
                if (prevSubgraphNodes.Contains(startNode)) 
                    return false;
                if (prevSubgraphNodes.Contains(endNode)) 
                    return false;

                if (lastNode != null && startNode != lastNode) 
                {
                    // start new connected sequence
                    prevSubgraphNodes.AddAll(currNodes);
                    currNodes.Clear();
                }                

                currNodes.Add(startNode);
                currNodes.Add(endNode);
                lastNode = endNode;
            }
            return true;
        }
开发者ID:ExRam,项目名称:DotSpatial-PCL,代码行数:50,代码来源:LineSequencer.cs

示例2: QKeyedTable

        /// <summary>
        ///     Initializes a new instance of the QKeyedTable with specified column names and data matrix.
        /// </summary>
        public QKeyedTable(string[] columns, string[] keyColumns, Array data)
        {
            if (columns == null || columns.Length == 0)
            {
                throw new ArgumentException("Columns array cannot be null or 0-length");
            }

            if (keyColumns == null || keyColumns.Length == 0)
            {
                throw new ArgumentException("Key columns array cannot be null or 0-length");
            }

            if (data == null || data.Length == 0)
            {
                throw new ArgumentException("Data matrix cannot be null or 0-length");
            }

            if (columns.Length != data.Length)
            {
                throw new ArgumentException("Columns array and data matrix cannot have different length");
            }

            if (data.Cast<object>().Any(col => !col.GetType().IsArray))
            {
                throw new ArgumentException("Non array column found in data matrix");
            }

            if (keyColumns.Any(keyCol => !columns.Contains(keyCol)))
            {
                throw new ArgumentException("Non array column found in data matrix");
            }

            var keyIndices = new SortedSet<int>();
            for (int i = 0; i < columns.Length; i++)
            {
                if (keyColumns.Contains(columns[i]))
                {
                    keyIndices.Add(i);
                }
            }

            var keyArrays = new object[keyIndices.Count];
            var keyHeaders = new string[keyIndices.Count];
            var dataArrays = new object[data.Length - keyIndices.Count];
            var dataHeaders = new string[data.Length - keyIndices.Count];

            int ki = 0;
            int di = 0;

            for (int i = 0; i < data.Length; i++)
            {
                if (keyIndices.Contains(i))
                {
                    keyHeaders[ki] = columns[i];
                    keyArrays[ki++] = data.GetValue(i);
                }
                else
                {
                    dataHeaders[di] = columns[i];
                    dataArrays[di++] = data.GetValue(i);
                }
            }

            keys = new QTable(keyHeaders, keyArrays);
            values = new QTable(dataHeaders, dataArrays);
        }
开发者ID:CharlesSkelton,项目名称:qSharp,代码行数:69,代码来源:QKeyedTable.cs

示例3: IntegrateGamesFromVdf

        /// <summary>
        /// Loads in games from a VDF node containing a list of games.
        /// Any games in the node not found in the game list will be added to the gamelist.
        /// If a game in the node has a tags subnode, the "favorite" field will be overwritten.
        /// If a game in the node has a category set, it will overwrite any categories in the gamelist.
        /// If a game in the node does NOT have a category set, the category in the gamelist will NOT be cleared.
        /// </summary>
        /// <param name="appsNode">Node containing the game nodes</param>
        /// <param name="ignore">Set of games to ignore</param>
        /// <returns>Number of games loaded</returns>
        private int IntegrateGamesFromVdf( VdfFileNode appsNode, SortedSet<int> ignore, bool ignoreDlc )
        {
            int loadedGames = 0;

            Dictionary<string, VdfFileNode> gameNodeArray = appsNode.NodeArray;
            if( gameNodeArray != null ) {
                foreach( KeyValuePair<string, VdfFileNode> gameNodePair in gameNodeArray ) {
                    int gameId;
                    if( int.TryParse( gameNodePair.Key, out gameId ) ) {
                        if( ( ignore != null && ignore.Contains( gameId ) ) || ( ignoreDlc && Program.GameDB.IsDlc( gameId ) ) ) {
                            Program.Logger.Write( LoggerLevel.Verbose, GlobalStrings.GameData_SkippedProcessingGame, gameId );
                            continue;
                        }
                        if( gameNodePair.Value != null && gameNodePair.Value.ContainsKey( "tags" ) ) {
                            SortedSet<Category> cats = new SortedSet<Category>();

                            loadedGames++;

                            VdfFileNode tagsNode = gameNodePair.Value["tags"];
                            Dictionary<string, VdfFileNode> tagArray = tagsNode.NodeArray;
                            if( tagArray != null ) {
                                foreach( VdfFileNode tag in tagArray.Values ) {
                                    string tagName = tag.NodeString;
                                    if( tagName != null ) {
                                        Category c = GetCategory( tagName );
                                        if( c != null ) cats.Add( c );
                                    }
                                }
                            }

                            bool hidden = false;
                            if( gameNodePair.Value.ContainsKey( "hidden" ) ) {
                                VdfFileNode hiddenNode = gameNodePair.Value["hidden"];
                                hidden = ( hiddenNode.NodeString == "1" || hiddenNode.NodeInt == 1 );
                            }

                            // Add the game to the list if it doesn't exist already
                            if( !Games.ContainsKey( gameId ) ) {
                                GameInfo newGame = new GameInfo( gameId, string.Empty );
                                Games.Add( gameId, newGame );
                                newGame.Name = Program.GameDB.GetName( gameId );
                                Program.Logger.Write( LoggerLevel.Verbose, GlobalStrings.GameData_AddedNewGame, gameId, newGame.Name );
                            }

                            if( cats.Count > 0 ) {
                                this.SetGameCategories( gameId, cats, false );
                            }
                            Games[gameId].Hidden = hidden;

                            //TODO: Don't think SortedSet.ToString() does what I hope
                            Program.Logger.Write( LoggerLevel.Verbose, GlobalStrings.GameData_ProcessedGame, gameId, ( cats.Count == 0 ) ? "~" : cats.ToString() );
                        }
                    }
                }
            }

            return loadedGames;
        }
开发者ID:newzealandpaul,项目名称:depressurizer,代码行数:68,代码来源:GameData.cs

示例4: IntegrateGame

 /// <summary>
 /// Adds a new game to the database, or updates an existing game with new information.
 /// </summary>
 /// <param name="appId">App ID to add or update</param>
 /// <param name="appName">Name of app to add, or update to</param>
 /// <param name="overWrite">If true, will overwrite any existing games. If false, will fail if the game already exists.</param>
 /// <param name="ignore">Set of games to ignore. Can be null. If the game is in this list, no action will be taken.</param>
 /// <param name="ignoreDlc">If true, ignore the game if it is marked as DLC in the loaded database.</param>
 /// <param name="isNew">If true, a new game was added. If false, an existing game was updated, or the operation failed.</param>
 /// <returns>True if the game was integrated, false otherwise.</returns>
 private bool IntegrateGame( int appId, string appName, bool overWrite, SortedSet<int> ignore, bool ignoreDlc, out bool isNew )
 {
     isNew = false;
     if( ( ignore != null && ignore.Contains( appId ) ) || ( ignoreDlc && Program.GameDB.IsDlc( appId ) ) ) {
         Program.Logger.Write( LoggerLevel.Verbose, GlobalStrings.GameData_SkippedIntegratingGame, appId, appName );
         return false;
     }
     isNew = SetGameName( appId, appName, overWrite );
     Program.Logger.Write( LoggerLevel.Verbose, GlobalStrings.GameData_IntegratedGameIntoGameList, appId, appName, isNew );
     return true;
 }
开发者ID:newzealandpaul,项目名称:depressurizer,代码行数:21,代码来源:GameData.cs

示例5: RunTestOneSortedSet

        /// <summary>
        /// adds several items to a collection, then searches for items in that collection. The test is repeated 50 times to get a more consistent result
        /// </summary>
        /// <param name="collection"></param>
        /// <param name="numItemsToTest"></param>
        /// <returns></returns>
        static TimeSpan RunTestOneSortedSet(SortedSet<User> collection, int numItemsToTest)
        {
            Stopwatch timer = new Stopwatch();
            timer.Start();

            // perform the test 50 times:
            for (int counter = 0; counter < 50; counter++)
            {
                collection.Clear();
                // add some random items
                Random rnd = new Random();
                var sequence = from n in Enumerable.Range(1, numItemsToTest)
                               select rnd.Next() * n;

                foreach (var item in sequence)
                   collection.Add(new User(item, "family", "name"));

                // search for 1000 random items
                var sequence2 = from n in Enumerable.Range(1, 1000)
                                select rnd.Next() * n;

                bool found = false;
                foreach (var item in sequence2)
                {
                    // This method is an O(ln n) operation.
                    found &= collection.Contains(new User(item, "family", "name"));
                }
            }

            timer.Stop();
            return timer.Elapsed;
        }
开发者ID:symba2003,项目名称:TradeTheNews-UserTest,代码行数:38,代码来源:Program2.cs

示例6: GetAllVideosBasedOnEntitlements

        public ActionResult GetAllVideosBasedOnEntitlements()
        {
            List<ShowLookUpObject> list = null;

            if (!GlobalConfig.IsSynapseEnabled)
                return Json(list, JsonRequestBehavior.AllowGet);
            var registDt = DateTime.Now;
            if (MyUtility.isUserLoggedIn())
            {
                try
                {
                    //var cache = DataCache.Cache;
                    //string cacheKey = "MOBILEGAV:U:" + User.Identity.Name;
                    //list = (List<ShowLookUpObject>)cache[cacheKey];
                    if (list == null)
                    {
                        list = new List<ShowLookUpObject>();
                        var context = new IPTV2Entities();
                        var UserId = new Guid(User.Identity.Name);
                        var user = context.Users.FirstOrDefault(u => u.UserId == UserId);
                        if (user != null)
                        {
                            SortedSet<Int32> ShowIds = new SortedSet<int>();
                            var service = context.Offerings.Find(GlobalConfig.offeringId).Services.FirstOrDefault(s => s.StatusId == GlobalConfig.Visible);
                            foreach (var entitlement in user.Entitlements.Where(e => e.EndDate > registDt))
                            {
                                if (entitlement is PackageEntitlement)
                                {
                                    var packageEntitlement = (PackageEntitlement)entitlement;
                                    var pkgCat = context.PackageCategories.Where(p => p.PackageId == packageEntitlement.PackageId).Select(p => p.Category);
                                    var pkgCatSubCategories = pkgCat.Select(p => p.SubCategories);
                                    foreach (var categories in pkgCatSubCategories)
                                    {
                                        foreach (var category in categories)
                                        {
                                            var listOfIds = service.GetAllMobileShowIds(MyUtility.GetCurrentCountryCodeOrDefault(), category);
                                            var showList = context.CategoryClasses.Where(c => listOfIds.Contains(c.CategoryId) && c.StatusId == GlobalConfig.Visible);
                                            foreach (var show in showList)
                                            {
                                                if (show != null)
                                                {
                                                    if (!(ShowIds.Contains(show.CategoryId)))
                                                    {
                                                        if (show.StartDate < registDt && show.EndDate > registDt)
                                                        {
                                                            if (show is Show)
                                                            {
                                                                if (!(show is LiveEvent))
                                                                {
                                                                    ShowLookUpObject data = new ShowLookUpObject();
                                                                    data.Show = show.Description;
                                                                    data.ShowId = show.CategoryId;
                                                                    data.MainCategory = category.Description;
                                                                    data.MainCategoryId = category.CategoryId;
                                                                    data.ShowType = (show is Movie) ? "MOVIE" : "SHOW";
                                                                    if (!(show is Movie))
                                                                        list.Add(data);
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                            ShowIds.UnionWith(listOfIds); //For checking
                                        }
                                    }
                                }
                                else if (entitlement is ShowEntitlement)
                                {
                                    var showEntitlement = (ShowEntitlement)entitlement;
                                    if (!(ShowIds.Contains(showEntitlement.CategoryId)))
                                    {
                                        if (!(showEntitlement.Show is LiveEvent))
                                        {
                                            ShowLookUpObject data = new ShowLookUpObject();
                                            var show = showEntitlement.Show;
                                            if (show != null)
                                            {
                                                if (show.StartDate < registDt && show.EndDate > registDt)
                                                {
                                                    var CacheDuration = new TimeSpan(0, GlobalConfig.GetParentCategoriesCacheDuration, 0);
                                                    var parentCategories = show.GetAllParentCategories(CacheDuration);
                                                    var parent = context.CategoryClasses.Where(c => parentCategories.Contains(c.CategoryId) && c.StatusId == GlobalConfig.Visible && c is Category);
                                                    data.Show = show.Description;
                                                    data.ShowId = show.CategoryId;
                                                    data.MainCategory = parent.First().Description;
                                                    data.MainCategoryId = parent.First().CategoryId;
                                                    data.ShowType = (show is Movie) ? "MOVIE" : "SHOW";
                                                    if (!(show is Movie))
                                                        ShowIds.Add(show.CategoryId);
                                                    list.Add(data);
                                                }
                                            }
                                        }
                                    }
                                }
                                else if (entitlement is EpisodeEntitlement)
                                {
                                    var episodeEntitlement = (EpisodeEntitlement)entitlement;
                                    var eCacheDuration = new TimeSpan(0, GlobalConfig.GetParentShowsForEpisodeCacheDuration, 0);
//.........这里部分代码省略.........
开发者ID:agentvnod,项目名称:tfctvoldcode,代码行数:101,代码来源:SynapseController.cs

示例7: SourceModifiedDelay_Tick

        /// <summary>
        /// Adds or removes a track from the library collection
        /// </summary>
        /// <param name="sender">The sender of the event (the timer)</param>
        /// <param name="e">The event data</param>
        private void SourceModifiedDelay_Tick(object sender, EventArgs e)
        {
            sourceModifiedDelay.Stop();

            Dispatcher.Invoke(DispatcherPriority.Background, new Action(delegate()
            {
                //ScanProgressBar.IsIndeterminate = true;
                //ScanProgress.Visibility = System.Windows.Visibility.Visible;
                Cursor = Cursors.AppStarting;
            }));

            ThreadStart GUIScanThread = delegate()
            {
                try
                {
                    // copy the tracks into two lists
                    SortedSet<string> trackPaths = new SortedSet<string>();
                    List<TrackData> tracksToAdd = new List<TrackData>();
                    SortedList<string, TrackData> tracksToRemove = new SortedList<string, TrackData>();
                    List<TrackData> tracksToUpdate = new List<TrackData>();

                    foreach (DictionaryEntry de in sourceModifiedTracks)
                    {
                        SourceModificationType modType = (SourceModificationType)de.Value;
                        TrackData track = (TrackData)de.Key;
                        if (modType == SourceModificationType.Added)
                            tracksToAdd.Add(track);
                        else if (modType == SourceModificationType.Removed)
                        {
                            if (!tracksToRemove.ContainsKey(track.Path))
                                tracksToRemove.Add(track.Path, track);
                        }
                        else
                            tracksToUpdate.Add(de.Key as TrackData);
                    }
                    sourceModifiedTracks.Clear();

                    // copy the observable collections so we can work on them
                    // outside the gui thread
                    ObservableCollection<TrackData> files = new ObservableCollection<TrackData>();
                    foreach (TrackData t in SettingsManager.FileTracks)
                    {
                        files.Add(t);
                        trackPaths.Add(t.Path);
                    }

                    // add tracks
                    for (int j = 0; j < tracksToAdd.Count; j++)
                    {
                        TrackData track = tracksToAdd[j];
                        if (trackPaths.Contains(track.Path))
                            tracksToAdd.RemoveAt(j--);
                        else
                            files.Add(track);
                    }

                    // update source for file list
                    U.L(LogLevel.Debug, "MAIN", "Adding tracks to GUI list");
                    //DateTime start = DateTime.Now;
                    Dispatcher.Invoke(DispatcherPriority.Background, new Action(delegate()
                    {
                        SettingsManager.FileTracks = files;
                        SettingsManager.FileTracks.CollectionChanged += new NotifyCollectionChangedEventHandler(LibraryTracks_CollectionChanged);
                        if (FileTracks != null)
                            FileTracks.ItemsSource = files;
                        if (SettingsManager.CurrentSelectedNavigation == "Files")
                            InfoPaneTracks.Text = String.Format(U.T("HeaderTracks"), SettingsManager.FileTracks.Count);
                        //ScanProgressBar.IsIndeterminate = false;
                        //ScanProgressBar.Value = 0;
                    }));

                    // remove tracks
                    //int numTracks = tracksToRemove.Count + tracksToAdd.Count + tracksToUpdate.Count;
                    //double progressDelta = 100.0 / numTracks;
                    //if (Double.IsInfinity(progressDelta)) progressDelta = 0;
                    //double progress = 0;
                    //double removeDelta = progressDelta * tracksToRemove.Count;
                    if (tracksToRemove.Count > 0)
                    {
                        // remove if current track
                        for (int i = 0; i < tracksToRemove.Count; i++)
                        {
                            TrackData track = tracksToRemove.Values[i];
                            if (SettingsManager.CurrentTrack.Path == track.Path)
                                SettingsManager.CurrentTrack = null;
                        }

                        //double lists = SettingsManager.Playlists.Count + 3;
                        //double trackDelta = progressDelta / lists;
                        //double listDelta = removeDelta / lists;
                        double listDelta = 1;
                        foreach (PlaylistData p in SettingsManager.Playlists)
                            RemoveTracks(tracksToRemove, p.Tracks, listDelta);
                        RemoveTracks(tracksToRemove, SettingsManager.QueueTracks, listDelta);
                        RemoveTracks(tracksToRemove, SettingsManager.HistoryTracks, listDelta);
//.........这里部分代码省略.........
开发者ID:Erls-Corporation,项目名称:YAMA,代码行数:101,代码来源:MainWindow.xaml.cs

示例8: ViewAdd

		public void ViewAdd ()
		{
			var set = new SortedSet<int> { 1, 3, 5, 7 };
			var view = set.GetViewBetween (3, 5);

			Assert.IsTrue (view.Add (4));
			Assert.IsTrue (view.Contains (4));
			Assert.IsTrue (set.Contains (4));

			Assert.IsFalse (view.Add (5));
		}
开发者ID:mesheets,项目名称:Theraot-CF,代码行数:11,代码来源:SortedSetTest.cs

示例9: TestFullRankingWithTwoGone

 public void TestFullRankingWithTwoGone()
 {
     var p = new Person(3, new Random());
     var fr = p.FullRanking(new int[] { 1, 0 }).ToArray();
     Assert.AreEqual(1, fr.Length, "Incorrect number came back");
     CheckContiguous(fr.Select(c => c.ranking).ToArray(), 1);
     var s = new SortedSet<int>(fr.Select(c => c.candidate));
     Assert.IsFalse(s.Contains(1), "candidate 1 should not be in there");
     Assert.IsFalse(s.Contains(3), "candidate 3 should not be in there");
 }
开发者ID:gordonwatts,项目名称:Election-Explorer,代码行数:10,代码来源:t_Person.cs

示例10: PerformDFS

 static void PerformDFS(ref string[,] honeyGrid, ref HashSet<string> Dict, ref HashSet<string> prefix, ref SortedSet<string> Found, ref bool[,] visited, int levels, int xc, int yc, StringBuilder word)
 {
     StringBuilder temp = new StringBuilder();
     try
     {
         temp.Append(string.Copy(word.ToString()));
         temp.Append(honeyGrid[xc, yc]);
         if (prefix.Contains(temp.ToString()))
         {
             visited[xc, yc] = true;
             if (Dict.Contains(temp.ToString()))
             {
                 if (!Found.Contains(temp.ToString()))   //to prevent duplicate entries found in different paths...
                     Found.Add(temp.ToString());
             }
             if (xc - 1 >= 0 && honeyGrid[xc - 1, yc] != null && !visited[xc - 1, yc])    //can move up
             {
                 PerformDFS(ref honeyGrid, ref Dict, ref prefix, ref Found, ref visited, levels, xc - 1, yc, temp);
             }
             if (xc - 1 >= 0 && (yc + 1 < 2 * levels - 1) && honeyGrid[xc - 1, yc + 1] != null && !visited[xc - 1, yc + 1])  //can move diagonally up
             {
                 PerformDFS(ref honeyGrid, ref Dict, ref prefix, ref Found, ref visited, levels, xc - 1, yc + 1, temp);
             }
             if ((yc + 1 < 2 * levels - 1) && honeyGrid[xc, yc + 1] != null && !visited[xc, yc + 1])  //can move right
             {
                 PerformDFS(ref honeyGrid, ref Dict, ref prefix, ref Found, ref visited, levels, xc, yc + 1, temp);
             }
             if ((xc + 1 < 2 * levels - 1) && honeyGrid[xc + 1, yc] != null && !visited[xc + 1, yc])  //can move down
             {
                 PerformDFS(ref honeyGrid, ref Dict, ref prefix, ref Found, ref visited, levels, xc + 1, yc, temp);
             }
             if ((xc + 1 < 2 * levels - 1) && (yc - 1 >= 0) && honeyGrid[xc + 1, yc - 1] != null && !visited[xc + 1, yc - 1])  //can move diagonally down
             {
                 PerformDFS(ref honeyGrid, ref Dict, ref prefix, ref Found, ref visited, levels, xc + 1, yc - 1, temp);
             }
             if (yc - 1 >= 0 && honeyGrid[xc, yc - 1] != null && !visited[xc, yc - 1])  //can move left
             {
                 PerformDFS(ref honeyGrid, ref Dict, ref prefix, ref Found, ref visited, levels, xc, yc - 1, temp);
             }
             visited[xc, yc] = false;
         }
     }
     catch (Exception)
     { throw; }
 }
开发者ID:NitinTak,项目名称:Projects,代码行数:45,代码来源:Program.cs

示例11: Details

        public ActionResult Details(string id, int? PackageOption, int? ProductOption)
        {
            var profiler = MiniProfiler.Current;
            #region if (!Request.Cookies.AllKeys.Contains("version"))
            if (!Request.Cookies.AllKeys.Contains("version"))
            {
                List<SubscriptionProductA> productList = null;
                try
                {
                    #region   if user is not loggedin
                    if (!User.Identity.IsAuthenticated)
                    {
                        if (!String.IsNullOrEmpty(id))
                        {
                            if (String.Compare(id, "mayweather-vs-pacquiao-may-3", true) == 0)
                            {
                                HttpCookie pacMayCookie = new HttpCookie("redirect3178");
                                pacMayCookie.Expires = DateTime.Now.AddDays(1);
                                Response.Cookies.Add(pacMayCookie);
                                id = GlobalConfig.PacMaySubscribeCategoryId.ToString();
                            }

                            if (String.Compare(id, GlobalConfig.PacMaySubscribeCategoryId.ToString(), true) != 0)
                            {
                                TempData["LoginErrorMessage"] = "Please register or sign in to avail of this promo.";
                                TempData["RedirectUrl"] = Request.Url.PathAndQuery;

                                if (String.Compare(id, "lckbprea", true) == 0)
                                {
                                    HttpCookie preBlackCookie = new HttpCookie("redirectlckbprea");
                                    preBlackCookie.Expires = DateTime.Now.AddDays(1);
                                    Response.Cookies.Add(preBlackCookie);
                                }
                                else if (String.Compare(id, "Promo201410", true) == 0)
                                {
                                    HttpCookie promo2014010 = new HttpCookie("promo2014cok");
                                    promo2014010.Expires = DateTime.Now.AddDays(1);
                                    Response.Cookies.Add(promo2014010);
                                }
                                else if (String.Compare(id, "aintone", true) == 0)
                                {
                                    HttpCookie preBlackCookie = new HttpCookie("redirectaintone");
                                    preBlackCookie.Expires = DateTime.Now.AddDays(1);
                                    Response.Cookies.Add(preBlackCookie);
                                }

                                //check if id is integer
                                try
                                {
                                    int tempId = 0;
                                    if (Int32.TryParse(id, out tempId))
                                    {
                                        TempData["LoginErrorMessage"] = "Please sign in to purchase this product.";
                                        TempData["RedirectUrl"] = Request.Url.PathAndQuery;

                                        if (Request.Browser.IsMobileDevice)
                                            return RedirectToAction("MobileSignin", "User", new { ReturnUrl = Server.UrlEncode(Request.Url.PathAndQuery) });
                                        else
                                            return RedirectToAction("Login", "User", new { ReturnUrl = Server.UrlEncode(Request.Url.PathAndQuery) });
                                    }
                                }
                                catch (Exception) { }

                                if (Request.Browser.IsMobileDevice)
                                    return RedirectToAction("MobileSignin", "User");
                                else
                                    return RedirectToAction("Login", "User");
                            }
                        }
                        else
                        {
                            TempData["LoginErrorMessage"] = "Please register or sign in to subscribe.";
                            TempData["RedirectUrl"] = Request.Url.PathAndQuery;

                            if (Request.Browser.IsMobileDevice)
                                return RedirectToAction("MobileSignin", "User");
                            else
                                return RedirectToAction("Login", "User");
                        }
                    }
                    #endregion
                    #region user authenticated flow
                    else
                        if (!String.IsNullOrEmpty(id))
                            if (String.Compare(id, "mayweather-vs-pacquiao-may-3", true) == 0)
                                id = GlobalConfig.PacMaySubscribeCategoryId.ToString();

                    var context = new IPTV2Entities();
              
                    string ip = Request.IsLocal ? "78.95.139.99" : Request.GetUserHostAddressFromCloudflare();
                    if (GlobalConfig.isUAT && !String.IsNullOrEmpty(Request.QueryString["ip"]))
                        ip = Request.QueryString["ip"].ToString();
                    var location = MyUtility.GetLocationBasedOnIpAddress(ip);
                    var CountryCode = location.countryCode;
                    //var CountryCode = MyUtility.GetCountryCodeViaIpAddressWithoutProxy();


                    User user = null;
                    Guid? UserId = null;
                    if (User.Identity.IsAuthenticated)
//.........这里部分代码省略.........
开发者ID:agentvnod,项目名称:tfctvoldcode,代码行数:101,代码来源:SubscribeController.cs

示例12: DataTableGetChainForCondition

        public List<Chain> DataTableGetChainForCondition(SortedSet<IL> setIL, int wh)
        {
            var source = DataTableGet(Table.TableRowSource.Name);
            if (source == null) return null;
            if (source.Rows.Count == 0) return null;

            var chainGroup = new List<Chain>();

            foreach (DataRow row in source.Rows)
            {
                var il = new IL { Item = row.GetItem(), Loc = row.GetLoc() };
                if (!setIL.Contains(il)) continue;
                var chain = LogisticChainGet(row.GetItem(), row.GetLoc(), wh);
                chainGroup.Add(chain);
            }

            Chain.Group(chainGroup);

            return chainGroup;
        }
开发者ID:AntonLapshin,项目名称:hcprojects,代码行数:20,代码来源:DBManager.cs

示例13: DataTableRowSourceUpdateCustom

        public bool DataTableRowSourceUpdateCustom(List<FieldValue> setValues, SortedSet<IL> setIL, ref SortedSet<IL> lockedIL)
        {
            var sourceRow = DataTableGet(Table.TableRowSource.Name);
            var sourceSec = DataTableGet(Table.TableSecSource.Name);
            if (sourceRow == null || sourceSec == null) return false;

            var rows = new List<DataRow>();

            foreach (var il in setIL)
            {
                var rowRow = sourceRow.Rows.Find(new[] { (object)il.Item, (object)il.Loc });
                var rowSec = sourceSec.Rows.Find(new[] { (object)il.Item, (object)il.Loc });

                if (rowRow.GetAction() == Actions.Delete) continue;

                if (!CheckPermissions3(rowRow, setValues))
                {
                    if (!lockedIL.Contains(il))
                        lockedIL.Add(il);
                    continue;
                }

                foreach (var value in setValues)
                {
                    if (value.Field == "ACTION" && (int)value.Value == (int)Actions.Leave)
                    {
                        rowRow["ACTION"] = rowRow.GetMeasureStatus() == MeasureStatuses.NotInAssortment
                                            ? (int)Actions.Leave
                                            : (int)Actions.Modify;
                        rowSec["ACTION"] = rowRow["ACTION"];
                    }
                    else
                    {
                        if (value.Field == "DIM_ITEMLOC_SOURCEMETHOD_NEW" &&
                            (char)value.Value == (char)SourceMethods.S &&
                            rowRow.GetAction() == Actions.Close)
                        {
                            rowRow["ACTION"] = rowRow.GetMeasureStatus() == MeasureStatuses.NotInAssortment
                                                ? (int)Actions.Leave
                                                : (int)Actions.Modify;
                            rowSec["ACTION"] = rowRow["ACTION"];
                        }
                        rowRow[value.Field] = value.Value ?? DBNull.Value;
                        rowSec[value.Field] = rowRow[value.Field];
                    }
                }
                rows.Add(rowRow);
                rowSec.AcceptChanges();
            }
            try
            {
                if (rows.Count > 0)
                {
                    ((OracleDataAdapter)_adapters[Table.TableRowSource.Name]).Update(rows.ToArray());
                    DocChanged(this, null);
                }
            }
            catch (Exception ex)
            {
                Error = ex.Message;
                return false;
            }
            //DataTableSecSourceUpdateCustomWithoutDb(setValues, setIL);
            return true;
        }
开发者ID:AntonLapshin,项目名称:hcprojects,代码行数:65,代码来源:DBManager.cs

示例14: DataTableSecSourceUpdateStatus

        public bool DataTableSecSourceUpdateStatus(FormActions actionType, SortedSet<IL> setIL, ref SortedSet<IL> lockedIL)
        {
            var source = DataTableGet(Table.TableSecSource.Name);
            if (source == null) return false;

            var rows = new List<DataRow>();

            var stateRows = new StateRows();

            foreach (var il in setIL)
            {
                var row = source.Rows.Find(new[] { (object)il.Item, (object)il.Loc });
                //if (row.GetLocType() == LocTypes.W && row.GetItemType() != ItemTypes.ExpendMaterial) continue;

                if (!CheckPermissions2(row, actionType))
                {
                    if (!lockedIL.Contains(il))
                        lockedIL.Add(il);
                    continue;
                }

                var action = row.GetAction();
                var measureStatus = row.GetMeasureStatus();
                var measureStatusNew = row.GetMeasureStatusNew();

                object actionWrite = null;
                object measureStatusNewWrite = null;

                switch (actionType)
                {
                    case FormActions.Add:
                        {
                            measureStatusNewWrite = MeasureStatuses.InAssortment;
                            if (measureStatus == MeasureStatuses.NotInAssortment)
                            {
                                if (measureStatusNew == MeasureStatuses.NotInAssortment && action == Actions.Delete)
                                    actionWrite = Actions.NoAction;
                                else
                                    actionWrite = Actions.Leave;
                            }
                            else
                            {
                                if (measureStatusNew == MeasureStatuses.NotInAssortment)
                                    actionWrite = action == Actions.NoAction ? Actions.Leave : Actions.NoAction;
                                else
                                    actionWrite = action;
                            }
                            break;
                        }
                    case FormActions.Delete:
                        {
                            measureStatusNewWrite = MeasureStatuses.NotInAssortment;

                            if (row["DIM_ITEMLOC_SUPPLIER"] != DBNull.Value) row["DIM_ITEMLOC_SUPPLIER_NEW"] = row["DIM_ITEMLOC_SUPPLIER"];
                            if (row["DIM_ITEMLOC_SUPPLIER_DESC_NEW"] != DBNull.Value) row["DIM_ITEMLOC_SUPPLIER_DESC_NEW"] = row["DIM_ITEMLOC_SUPPLIER_DESC"];
                            if (row.GetOrderPlaceNew() != OrderPlaces.None) row["DIM_ITEMLOC_ORDERPLACE_NEW"] = row["DIM_ITEMLOC_ORDERPLACE"];
                            else row["DIM_ITEMLOC_ORDERPLACE_NEW"] = 3;
                            if (row.GetSourceMethodNew() != SourceMethods.None && row.GetSourceMethodNew() == SourceMethods.T) row["DIM_ITEMLOC_SOURCEWH_NEW"] = DBNull.Value;

                            row["DIM_ITEMLOC_SOURCEMETHOD_NEW"] = (char)SourceMethods.S;

                            if (row["DIM_ITEMLOC_SOURCEWH"] != DBNull.Value) row["DIM_ITEMLOC_SOURCEWH_NEW"] = row["DIM_ITEMLOC_SOURCEWH"];

                            if (measureStatus == MeasureStatuses.InAssortment) actionWrite = Actions.Delete;
                            else
                            {
                                if (measureStatusNew == MeasureStatuses.InAssortment)
                                    actionWrite = action == Actions.NoAction ? Actions.Delete : Actions.NoAction;
                                else
                                    actionWrite = action;
                            }
                            break;
                        }
                    case FormActions.Modify:
                        {
                            measureStatusNewWrite = measureStatusNew;
                            actionWrite = (action == Actions.NoAction &&
                                           measureStatusNew == MeasureStatuses.InAssortment)
                                              ? Actions.Modify
                                              : action;

                            // Cleanup SourceMethodNew if permission type is 'W'
                            if (UserStoreList.ContainsKey(Convert.ToInt32(il.Loc)))
                                if (UserStoreList[Convert.ToInt32(il.Loc)] == LocPermissionTypes.WarehouseTransit)
                                    if (row.GetSourceMethod() == SourceMethods.S &&
                                        row.GetSourceMethodNew() == SourceMethods.S)
                                        row["DIM_ITEMLOC_SOURCEMETHOD_NEW"] = DBNull.Value;

                            break;
                        }
                    case FormActions.ModifyCancel:
                        {
                            measureStatusNewWrite = measureStatusNew;
                            actionWrite = action == Actions.Modify ? Actions.NoAction : action;
                            break;
                        }
                    case FormActions.Restore:
                        {
                            measureStatusNewWrite = measureStatus;
                            actionWrite = Actions.NoAction;
//.........这里部分代码省略.........
开发者ID:AntonLapshin,项目名称:hcprojects,代码行数:101,代码来源:DBManager.cs

示例15: CheckSplit

    private Outcome CheckSplit(SortedSet<int> split, ref bool popLater, int timeLimit, int timeLimitPerAssertion, ref int queries)
    {
      var tla = timeLimitPerAssertion * split.Count;

      if (popLater)
      {
        SendThisVC("(pop 1)");
      }

      SendThisVC("(push 1)");
      SendThisVC(string.Format("(set-option :{0} {1})", Z3.SetTimeoutOption(), (0 < tla && tla < timeLimit) ? tla : timeLimit));
      popLater = true;

      SendThisVC(string.Format("; checking split VC with {0} unverified assertions", split.Count));
      var expr = VCExpressionGenerator.True;
      foreach (var i in ctx.TimeoutDiagnosticIDToAssertion.Keys)
      {
        var lit = VCExprGen.Function(VCExpressionGenerator.TimeoutDiagnosticsOp, VCExprGen.Integer(Microsoft.Basetypes.BigNum.FromInt(i)));
        if (split.Contains(i)) {
          lit = VCExprGen.Not(lit);
        }
        expr = VCExprGen.AndSimp(expr, lit);
      }
      SendThisVC("(assert " + VCExpr2String(expr, 1) + ")");
      if (options.Solver == SolverKind.Z3)
      {
        SendThisVC("(apply (then (using-params propagate-values :max_rounds 1) simplify) :print false)");
      }
      FlushLogFile();
      SendCheckSat();
      queries++;
      return GetResponse();
    }
开发者ID:qunyanm,项目名称:boogie,代码行数:33,代码来源:ProverInterface.cs


注:本文中的System.Collections.SortedSet.Contains方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。