コード例 #1
1
 /// <summary>
 /// Elimina entidades (usuarios o grupos) a la regla con el id especificado
 /// </summary>
 /// <param name="rule"></param>
 /// <param name="entities"></param>
 public static IObservable<Rule> DeleteEntities(Rule rule, IList<IEntity> entities)
 {
     if (rule.Id == null) throw new InvalidDataException("The provided rule must have an Id");
     if (entities == null || entities.IsEmpty())
         return Observable.Defer(() => Observable.Return(rule));
     return RestEndpointFactory
         .Create<IRulesEndpoint>(SessionManager.Instance.CurrentLoggedUser)
         .DeleteEntities(rule.Id, entities.IsEmpty()
             ? "0"
             : entities.ToString(e => e.Id)).ToObservable()
         .SubscribeOn(ThreadPoolScheduler.Instance)
         .InterpretingErrors();
 }
コード例 #2
0
ファイル: ImportDmDPC.cs プロジェクト: szp11/gaopincai
        private static DmDPC GetDmDPC(IList <int> list, string type)
        {
            DmDPC dto = new DmDPC();

            dto.Id          = list.ToString("");
            dto.Number      = list.ToString(" ");
            dto.DaXiao      = list.GetDaXiao(4);
            dto.DanShuang   = list.GetDanShuang();
            dto.ZiHe        = list.GetZiHe();
            dto.Lu012       = list.GetLu012();
            dto.He          = list.GetHe();
            dto.HeWei       = dto.He.GetWei();
            dto.DaCnt       = dto.DaXiao.Count("1");
            dto.XiaoCnt     = dto.DaXiao.Count("0");
            dto.DanCnt      = dto.DanShuang.Count("1");
            dto.ShuangCnt   = dto.DanShuang.Count("0");
            dto.ZiCnt       = dto.ZiHe.Count("1");
            dto.HeCnt       = dto.ZiHe.Count("0");
            dto.Lu0Cnt      = dto.Lu012.Count("0");
            dto.Lu1Cnt      = dto.Lu012.Count("1");
            dto.Lu2Cnt      = dto.Lu012.Count("2");
            dto.Ji          = list.GetJi();
            dto.JiWei       = dto.Ji.GetWei();
            dto.KuaDu       = list.GetKuaDu();
            dto.AC          = list.GetAC();
            dto.DaXiaoBi    = list.GetDaXiaoBi(4);
            dto.ZiHeBi      = list.GetZiHeBi();
            dto.DanShuangBi = list.GetDanShuangBi();
            dto.Lu012Bi     = list.GetLu012Bi();
            dto.NumberType  = type.Contains("C") ? dto.Id.GetNumberType() : type;

            return(dto);
        }
コード例 #3
0
ファイル: Extensions.cs プロジェクト: vzabavnov/Sudoku
        public static bool IsValid(this IEnumerable <Cell> cells)
        {
            Contract.Requires(cells != null);

            IList <Cell> en = cells as IList <Cell> ?? cells.ToList();

            ISet <int> set = new HashSet <int>();

            // check duplicate values
            foreach (var cell1 in en.Where(z => z.IsCompleted))
            {
                Contract.Assume(cell1.Value != null);
                if (set.Contains(cell1.Value.Value))
                {
                    Trace.WriteLine($"Duplicate values in {{{en.ToString(", ")}}}");
                    return(false);
                }
                set.Add(cell1.Value.Value);
            }

            if (set.Count != Grid.LENGTH)
            {
                // check when variants contains any cell's values
                var values = en.Where(z => z.IsCompleted).Select(z => z.Value ?? 0).ToSet();
                if (en.Where(z => z.IsEmpty).Any(z => z.HasVariants(values)))
                {
                    Trace.WriteLine($"The values presented in Variants in {{{en.ToString(", ")}}}");
                    return(false);
                }
            }

            return(true);
        }
コード例 #4
0
        public void NU_AddStart(int[] ini, int val, int size, string exp)
        {
            list.Init(ini);
            list.AddStart(val);
            string act = list.ToString();

            Assert.AreEqual(size, list.Size());
            Assert.AreEqual(exp, act);
        }
コード例 #5
0
        public void Load(IList <object> values)
        {
            Id = values.ToInt(0) ?? throw new ArgumentNullException();

            _name = values.ToString(1);

            _username = values.ToString(2).Remove(0, 1);

            Status = values.ToString(3);

            Timestamp = values.ToDateTime(4);
        }
コード例 #6
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void joinByConfig() throws java.util.concurrent.TimeoutException
        private void JoinByConfig()
        {
            IList <HostnamePort> hosts = _config.InitialHosts;

            _cluster.addClusterListener(new UnknownJoiningMemberWarning(this, hosts));

            if (hosts == null || hosts.Count == 0)
            {
                _userLog.info("No cluster hosts specified. Creating cluster %s", _config.ClusterName);
                _cluster.create(_config.ClusterName);
            }
            else
            {
//JAVA TO C# CONVERTER TODO TASK: Method reference constructor syntax is not converted by Java to C# Converter:
                URI[] memberURIs = hosts.Select(member => URI.create("cluster://" + ResolvePortOnlyHost(member))).ToArray(URI[] ::new);

                while (true)
                {
                    _userLog.info("Attempting to join cluster of %s", hosts.ToString());
                    Future <ClusterConfiguration> clusterConfig = _cluster.join(this._config.ClusterName, memberURIs);

                    try
                    {
                        ClusterConfiguration clusterConf = _config.ClusterJoinTimeout > 0 ? clusterConfig.get(_config.ClusterJoinTimeout, TimeUnit.MILLISECONDS) : clusterConfig.get();
                        _userLog.info("Joined cluster: %s", clusterConf);
                        return;
                    }
                    catch (InterruptedException)
                    {
                        _userLog.warn("Could not join cluster, interrupted. Retrying...");
                    }
                    catch (ExecutionException e)
                    {
                        _messagesLog.debug("Could not join cluster " + this._config.ClusterName);
                        if (e.InnerException is System.InvalidOperationException)
                        {
                            throw (System.InvalidOperationException)e.InnerException;
                        }

                        if (_config.AllowedToCreateCluster)
                        {
                            // Failed to join cluster, create new one
                            _userLog.info("Could not join cluster of %s", hosts.ToString());
                            _userLog.info("Creating new cluster with name [%s]...", _config.ClusterName);
                            _cluster.create(_config.ClusterName);
                            break;
                        }

                        _userLog.warn("Could not join cluster, timed out. Retrying...");
                    }
                }
            }
        }
コード例 #7
0
        public void ShouldInsertElementCorrectly()
        {
            IList <String> list = MyList <String> .fromArray(
                new String[] { "a", "b", "c", "d" });

            list.Insert(0, "z");
            Assert.AreEqual("z, a, b, c, d", list.ToString());

            list.Insert(list.Count - 1, "w");
            Assert.AreEqual("z, a, b, c, w, d", list.ToString());

            list.Insert(2, "y");
            Assert.AreEqual("z, a, y, b, c, w, d", list.ToString());
        }
コード例 #8
0
        public void ShouldRemoveByIndex()
        {
            IList <String> list = MyList <String> .fromArray(
                new String[] { "a", "b", "c", "d", "a" });

            list.RemoveAt(0);
            Assert.AreEqual("b, c, d, a", list.ToString());

            list.RemoveAt(list.Count - 1);
            Assert.AreEqual("b, c, d", list.ToString());

            list.RemoveAt(1);
            Assert.AreEqual("b, d", list.ToString());
        }
コード例 #9
0
        public void VerifyUpdate()
        {
            //SavenewWaitListBtn.Click();
            IList <string> result = Wait.UntilToastMessageShow();

            if (result.Any(e => e == "Saved successfully" || e == "Updated successfully"))
            {
                Logger.Log(LogingType.TestCasePass, "Wait list Save Successfully");
            }
            else
            {
                Logger.Log(LogingType.TextCaseFail, result.ToString());
                throw new Exception(result.ToString());
            }
        }
コード例 #10
0
ファイル: ModConsole.cs プロジェクト: Kreyren/MSCModLoader
 /// <summary>
 /// Logs a list (and optionally its elements) to the ModConsole and output_log.txt
 /// </summary>
 /// <param name="list">List to print.</param>
 /// <param name="printAllElements">(Optional) Should it log all elements of the list/array or should it only log the list/array itself. (default: true)</param>
 public static void Log(IList list, bool printAllElements = true)
 {
     // Check if it should print the elements or the list itself.
     if (printAllElements)
     {
         Log(list.ToString());
         for (int i = 0; i < list.Count; i++)
         {
             Log(list[i]);
         }
     }
     else
     {
         Log(list.ToString());
     }
 }
コード例 #11
0
        public void VerifySaveNewAdd()
        {
            SavenewWaitListBtn.Click();
            IList <string> result = Wait.UntilToastMessageShow();

            if (result.Any(e => e == "Saved successfully" || e == "Saved and added successfully"))
            {
                Logger.Log(LogingType.TestCasePass, "Wait list Save Successfully");
            }
            else
            {
                this.CancelWaitList();
                Logger.Log(LogingType.TextCaseFail, result.ToString());
                throw new Exception(result.ToString());
            }
        }
コード例 #12
0
        private async void GetWindowModeDetails()
        {
            switch (token)
            {
            case "TOKEN_WINDOW_MODE":
                //Gets Contact details in Window Mode.
                var resultContactWindow             = mEngine.GetContactWindowAsync(token);
                IList <ContactWindow> contactWindow = await resultContactWindow;
                if (resultContactWindow.Status.Equals(System.Threading.Tasks.TaskStatus.RanToCompletion))
                {
                    Log.Debug(TAG, "ContactWindow: " + contactWindow.ToString());
                }
                break;

            default:
                //Gets Contact Shield Summary.
                var           resultSketch  = mEngine.GetContactSketchAsync(token);
                ContactSketch contactSketch = await resultSketch;
                if (resultSketch.Status.Equals(System.Threading.Tasks.TaskStatus.RanToCompletion))
                {
                    Log.Debug(TAG, "ContactSketch : " + contactSketch.ToString());
                }
                break;
            }
        }
コード例 #13
0
        public override void Visit(WColumnReferenceExpression columnReference)
        {
            IList <Identifier> columnList   = columnReference.MultiPartIdentifier.Identifiers;
            string             propertyName = "";

            if (columnList.Count == 2)
            {
                string originalColumnName = columnList[1].Value;

                if (originalColumnName.Equals(GremlinKeyword.NodeID) ||
                    originalColumnName.Equals(GremlinKeyword.Label))
                {
                    return;
                }

                string encodeName = EncodeString(originalColumnName);
                referencedProperties[encodeName] = originalColumnName;
                columnList[0].Value = encodeName;
                columnList[1].Value = GraphViewKeywords.KW_PROPERTY_VALUE;
            }
            else
            {
                throw new QueryCompilationException("Identifier " + columnList.ToString() + " should be bound to a table.");
            }
        }
コード例 #14
0
        // Callback handlers handle events received from the session and message flows.
        #region Callback Handlers
        /// Simply prints the content of the message to the Console
        public static void PrintMessageEvent(Object source, MessageEventArgs args)
        {
            IMessage oMsg = args.Message;
            string   msg  = string.Format("Received message id={0}", oMsg.ADMessageId);

            msg += string.Format("\n\tDeliveryMode: {0}", oMsg.DeliveryMode);
            if (oMsg.Destination != null)
            {
                msg += string.Format("\n\tDestination: {0}", oMsg.Destination.Name);
            }
            if (oMsg.XmlContent != null)
            {
                msg += string.Format("\n\tXmlContent: {0} bytes", oMsg.XmlContent.Length);
            }
            if (oMsg.BinaryAttachment != null)
            {
                msg += string.Format("\n\tBinaryPayload: {0} bytes", oMsg.BinaryAttachment.Length);
            }
            IList <long> consumerIds = oMsg.ConsumerIdList;

            if (consumerIds != null)
            {
                msg += string.Format("\n\tConsumerIds: {0}", consumerIds.ToString());
            }
            Console.WriteLine("Received: \n" + oMsg.Dump());
        }
コード例 #15
0
ファイル: Parser.cs プロジェクト: orf53975/hadoop.net
        /// <summary>Combine results</summary>
        internal static IDictionary <Bellard.Parameter, T> Combine <T>(IDictionary <Bellard.Parameter
                                                                                    , IList <T> > m)
            where T : Combinable <T>
        {
            IDictionary <Bellard.Parameter, T> combined = new SortedDictionary <Bellard.Parameter
                                                                                , T>();

            foreach (Bellard.Parameter p in Bellard.Parameter.Values())
            {
                //note: results would never be null due to the design of Util.combine
                IList <T> results = Util.Combine(m[p]);
                [email protected]("%-6s => ", p);
                if (results.Count != 1)
                {
                    [email protected](results.ToString().Replace(", ", ",\n           "));
                }
                else
                {
                    T r = results[0];
                    combined[p] = r;
                    [email protected](r);
                }
            }
            return(combined);
        }
コード例 #16
0
        private static UIDropDown AddDynamicDropdown <T>(this UIHelperBase group, string text, string propertyName, IList <string> items, Action <string> action) where T : IModOptions
        {
            var property      = typeof(T).GetProperty(propertyName);
            var defaultString = (string)property.GetValue(OptionsWrapper <T> .Options, null);
            int defaultSelection;

            try
            {
                defaultSelection = items.IndexOf(defaultString);
            }
            catch
            {
                defaultSelection = 0;
                property.SetValue(OptionsWrapper <T> .Options, items[0], null);
            }

            Debug.Log("Option Items");
            Debug.Log(items.ToString());

            return((UIDropDown)group.AddDropdown(text, items.ToArray(), defaultSelection, sel =>
            {
                var selection = items[sel];
                property.SetValue(OptionsWrapper <T> .Options, selection, null);
                OptionsWrapper <T> .SaveOptions();
                action.Invoke(selection);
            }));
        }
コード例 #17
0
        private static IList <IWebElement> GetElements(By locator)
        {
            IList <IWebElement> element = null;
            int tryCount = 0;

            while (element == null)
            {
                try
                {
                    element = driver.FindElements(locator);
                }
                catch (Exception e)
                {
                    if (tryCount == 3)
                    {
                        SaveScreenshot();
                        test.Log(LogStatus.Fail, String.Format("Element not found after {0} tries thus test with error {1}", tryCount, e));
                        throw e;
                    }

                    var second = new TimeSpan(0, 0, 2);
                    Thread.Sleep(second);

                    tryCount++;
                    test.Log(LogStatus.Info, String.Format("Number of times element was sought was {0}", tryCount));
                }
            }

            Console.WriteLine(element.ToString() + " is now retrieved");
            test.Log(LogStatus.Pass, String.Format("The total number of element found is {0}", element.Count()));
            return(element);
        }
コード例 #18
0
        public static Uri GetSignUpUrl(ulong appId, IList <string> permissions, string redirectUri, TempDataDictionary tempData)
        {
            if (permissions == null)
            {
                throw new ArgumentNullException("permissions", "Value cannot be null.");
            }
            if (appId < 1)
            {
                throw new ArgumentOutOfRangeException("appId", "Value cannot be less than 1.");
            }
            if (redirectUri.IsNullOrEmpty())
            {
                throw new ArgumentNullException("redirecturi", "Value cannot be Null or Empty.");
            }

            tempData[TempDataStringResuorce.FacebookStateData] = Guid.NewGuid().ToString("x");
            var queryparameters = new Dictionary <string, object>
            {
                { "client_id", appId },
                { "redirect_uri", redirectUri },
                { "scope", permissions.ToString(',') },
                { "state", CryptographyHelper.GetOneTimeHash(tempData.Peek(TempDataStringResuorce.FacebookStateData).ToString()) }
            };
            var uribuilder = new UriBuilder
            {
                Scheme = "https",
                Host   = "www.facebook.com",
                Path   = "dialog/oauth",
                Query  = queryparameters.ToUriQueryString(false)
            };
            var result = uribuilder.Uri;

            return(result);
        }
コード例 #19
0
        private static void Compare(
            ICollection <object> receivedObjects,
            IList <string> expected)
        {
            if (expected.IsEmpty())
            {
                Assert.IsNull(receivedObjects);
                return;
            }

            if (receivedObjects == null)
            {
                Assert.Fail("Did not receive expected " + expected);
            }

            IList <string> received = new List <string>();

            foreach (var item in receivedObjects)
            {
                received.Add(item.ToString());
            }

            received.SortInPlace();
            expected.SortInPlace();
            var receivedText = received.ToString();
            var expectedText = expected.ToString();

            if (!expectedText.Equals(receivedText))
            {
                Log.Info("Expected:" + expectedText);
                Log.Info("Received:" + receivedText);
            }

            Assert.AreEqual(expectedText, receivedText);
        }
コード例 #20
0
        public override void Visit(WColumnReferenceExpression columnReference)
        {
            IList <Identifier> columnList   = columnReference.MultiPartIdentifier.Identifiers;
            string             propertyName = "";

            if (columnList.Count == 2)
            {
                string originalColumnName = columnList[1].Value;

                if (originalColumnName.Equals(GremlinKeyword.NodeID, StringComparison.InvariantCultureIgnoreCase) ||
                    originalColumnName.Equals(GremlinKeyword.Label, StringComparison.InvariantCultureIgnoreCase))
                {
                    return;
                }

                string encodeName = EncodeString(originalColumnName);
                referencedProperties[encodeName] = originalColumnName;
                columnList[0].Value = encodeName;
                columnList[1].Value = NormalizeWColumnReferenceExpressionVisitor.ReservedPropertyKeyName;
            }
            else
            {
                throw new QueryCompilationException("Identifier " + columnList.ToString() + " should be bound to a table.");
            }
        }
コード例 #21
0
ファイル: MACFunctions.cs プロジェクト: fhchina/nMAC
        private static async Task <DeviceModel> DetectDevice()
        {
            List <DeviceModel> devices = new List <DeviceModel>() // Priority, 1 is highest
            {
                new Nexus5(),                                     // 100
                new Nexus5X(),                                    //100
                new Samsung(),                                    // 100
                new YuYuphoria(),                                 //100
                new OnePlusOne()                                  // 1000 - conflict - N5X
            };

            IList <string> result = null;

            foreach (DeviceModel device in devices)
            {
                string path = device.Path;

                await Task.Run(() => result = Shell.SU.Run($"cat {path}"));

                if (result == null || result.Count == 0 || string.IsNullOrWhiteSpace(result.ToString()))
                {
                    continue;
                }

                return(device);
            }

            return(null);
        }
コード例 #22
0
ファイル: TWSCallback.cs プロジェクト: see0/SSAddin
        public void MktDataTick(IList <object> tick)
        {
            if (tick.Count < m_MktDataRecord.Length)
            {
                Logr.Log(String.Format("TWSCallback.MktDataTick: fld count under {0}! {1}",
                                       m_MktDataRecord.Length, tick.ToString( )));
                return;
            }
            string ticker = tick[m_TickerIndex].ToString();

            lock (m_Client) {
                if (!m_Subscriptions.ContainsKey(ticker))
                {
                    return;
                }
                SortedSet <string> fldset = m_Subscriptions[ticker];
                for (int inx = 0; inx < m_MktDataRecord.Length; inx++)
                {
                    string fld = m_MktDataRecord[inx];
                    object val = tick[inx];
                    if (fldset.Contains(fld) && val != null)
                    {
                        UpdateRTD(m_Key, String.Format("{0}_{1}", ticker, fld), tick[inx].ToString( ));
                    }
                }
            }
            // TODO: add TWSCache to s_Cache so that we only need an RTD sub to one field in a record, for
            // instance bid, and then the rest can be pulled from the cache...
            // s_Cache.UpdateWSCache( m_Key, updates );
        }
コード例 #23
0
ファイル: NH898Fixture.cs プロジェクト: jrauber/GH1429
        public void Bug()
        {
            using (ISession s = OpenSession())
                using (ITransaction t = s.BeginTransaction())
                {
                    ClassA a = new ClassA();
                    s.Save(a);
                    t.Commit();
                }

            using (ISession session = OpenSession())
                using (ITransaction t = session.BeginTransaction())
                {
                    IList l = session.CreateQuery("from ClassA a left join fetch a.B b").List();
                    Console.Write(l.ToString());
                    t.Commit();
                }

            using (ISession s = OpenSession())
                using (ITransaction t = s.BeginTransaction())
                {
                    s.Delete("from ClassA");
                    s.Flush();
                    t.Commit();
                }
        }
コード例 #24
0
        public void NU_ToString(int[] ini, string exp)
        {
            list.Init(ini);
            string act = list.ToString();

            Assert.AreEqual(exp, act);
        }
コード例 #25
0
        private static IList <IWebElement> GetElements(By locator)
        {
            IList <IWebElement> element = null;
            int tryCount = 0;

            while (element == null)
            {
                try
                {
                    element = driver.FindElements(locator);
                }
                catch (Exception e)
                {
                    if (tryCount == 3)
                    {
                        SaveScreenshot();
                        throw e;
                    }

                    var second = new TimeSpan(0, 0, 2);
                    Thread.Sleep(second);

                    tryCount++;
                }
            }

            Console.WriteLine(element.ToString() + " is now retrieved");
            return(element);
        }
コード例 #26
0
ファイル: NH898Fixture.cs プロジェクト: jrauber/GH1429
        public async Task BugAsync()
        {
            using (ISession s = OpenSession())
                using (ITransaction t = s.BeginTransaction())
                {
                    ClassA a = new ClassA();
                    await(s.SaveAsync(a));
                    await(t.CommitAsync());
                }

            using (ISession session = OpenSession())
                using (ITransaction t = session.BeginTransaction())
                {
                    IList l = await(session.CreateQuery("from ClassA a left join fetch a.B b").ListAsync());
                    Console.Write(l.ToString());
                    await(t.CommitAsync());
                }

            using (ISession s = OpenSession())
                using (ITransaction t = s.BeginTransaction())
                {
                    await(s.DeleteAsync("from ClassA"));
                    await(s.FlushAsync());
                    await(t.CommitAsync());
                }
        }
コード例 #27
0
 public void OnSuccess(object obj)
 {
     if (obj is Game)
     {
         Game gameObj = (Game)obj;
         result = gameObj.ToString();
         Debug.Log("GameName : " + gameObj.GetName());
         if (gameObj.GetScoreList() != null)
         {
             IList <Game.Score> scoreList = gameObj.GetScoreList();
             for (int i = 0; i < scoreList.Count; i++)
             {
                 Debug.Log("UserName is  : " + scoreList [i].GetUserName());
                 Debug.Log("CreatedOn is  : " + scoreList [i].GetCreatedOn());
                 Debug.Log("ScoreId is  : " + scoreList [i].GetScoreId());
                 Debug.Log("Value is  : " + scoreList [i].GetValue());
             }
         }
     }
     else
     {
         IList <Game> game = (IList <Game>)obj;
         result = game.ToString();
         for (int j = 0; j < game.Count; j++)
         {
             Debug.Log("GameName is   : " + game [j].GetName());
             Debug.Log("Description is  : " + game [j].GetDesription());
         }
     }
 }
コード例 #28
0
        public void ShouldRemoveByElement()
        {
            IList <String> list = MyList <String> .fromArray(
                new String[] { "a", "b", "c", "d", "a" });

            Assert.AreEqual(true, list.Remove("a"));
            Assert.AreEqual("b, c, d, a", list.ToString());

            Assert.AreEqual(true, list.Remove("a"));
            Assert.AreEqual("b, c, d", list.ToString());

            Assert.AreEqual(true, list.Remove("c"));
            Assert.AreEqual("b, d", list.ToString());

            Assert.AreEqual(false, list.Remove("a"));
        }
コード例 #29
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            //alle coins i listen
            IList <Coin> cList = GetCoinsAsync().Result;

            Console.WriteLine(string.Join("\n", cList.ToString()));
            //Fast write out
            for (int i = 0; i < cList.Count; i++)
            {
                Console.WriteLine(cList[i].ToString());
            }
            Console.WriteLine();
            Console.WriteLine("________________________");


            ////specific id på customer
            //Console.WriteLine("Angiv et id");

            //string idStr = Console.ReadLine();
            //int id = int.Parse(idStr);
            //Coin coin = GetOneCoinAsync(id).Result;
            ////Customer customer = TaskController.GetOneCustomerAsync(id).Result;
            //Console.WriteLine(coin.ToString());
            //Console.WriteLine();

            //Insert customer
            Console.WriteLine("Genstand navn: ");
            String genstand = Console.ReadLine();

            Console.WriteLine("Dit bud: ");
            String budstr = Console.ReadLine();
            int    bud    = Int32.Parse(budstr);

            Console.WriteLine("Dit navn: ");
            String navn = Console.ReadLine();


            Coin newCoin = new Coin(genstand, bud, navn);
            Coin coin    = AddCustomerAsync(newCoin).Result;

            Console.WriteLine("Customer inserted");
            Console.WriteLine(coin.ToString());

            Console.WriteLine("________________________");
            //alle coins i listen
            IList <Coin> cList2 = GetCoinsAsync().Result;

            Console.WriteLine(string.Join("\n", cList2.ToString()));
            //Fast write out
            for (int i = 0; i < cList2.Count; i++)
            {
                Console.WriteLine(cList2[i].ToString());
            }
            Console.WriteLine();
            Console.WriteLine("________________________");

            Console.ReadLine();
        }
コード例 #30
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testExactMatchOnRandomCompositeValues() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
            public virtual void TestExactMatchOnRandomCompositeValues()
            {
                // given
                ValueType[] types = RandomSetOfSupportedTypes();
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: java.util.List<IndexEntryUpdate<?>> updates = new java.util.ArrayList<>();
                IList <IndexEntryUpdate <object> > updates = new List <IndexEntryUpdate <object> >();
                ISet <ValueTuple> duplicateChecker         = new HashSet <ValueTuple>();

                for (long id = 0; id < 30_000; id++)
                {
                    IndexEntryUpdate <SchemaDescriptor> update;
                    do
                    {
                        update = IndexQueryHelper.Add(id, Descriptor.schema(), Random.randomValues().nextValueOfTypes(types), Random.randomValues().nextValueOfTypes(types), Random.randomValues().nextValueOfTypes(types), Random.randomValues().nextValueOfTypes(types));
                    } while (!duplicateChecker.Add(ValueTuple.of(update.Values())));
                    updates.Add(update);
                }
                UpdateAndCommit(updates);

                // when
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: for (IndexEntryUpdate<?> update : updates)
                foreach (IndexEntryUpdate <object> update in updates)
                {
                    // then
                    IList <long> hits = Query(exact(100, update.Values()[0]), exact(101, update.Values()[1]), exact(102, update.Values()[2]), exact(103, update.Values()[3]));
                    assertEquals(update + " " + hits.ToString(), 1, hits.Count);
                    assertThat(single(hits), equalTo(update.EntityId));
                }
            }
コード例 #31
0
        private void btnJoin_Click(object sender, EventArgs e)
        {
            bool     bExists;
            hostChar me = bs_nwChar.Current as hostChar;

            if (me == null)
            {
                return;
            }

            IList <nwdbDataType> campaigns = sess.QueryOver <campCampaign>().List <nwdbDataType>();

            campaigns = FrmSelectsysDataType.Select(campaigns, "Select campaign", this);
            foreach (campCampaign camp in campaigns)
            {
                Debug.Print("Selected" + camp.ToString());
                bExists = false;
                foreach (campCharCampaign c in bs_nwCharCampaign.List)
                {
                    if (c.Campaign == camp)
                    {
                        SetMessage("Skipping " + campaigns.ToString() + "Already a participant");
                        bExists = true;
                    }
                }

                if (!bExists)
                {
                    // add as doesnt exists
                    campCharCampaign newc = new campCharCampaign(camp, me, false);
                    camp.Characters.Add(newc);
                    SetMessage("Applied to join :" + camp.ToString());
                }
            }
        }
コード例 #32
0
        // GET: api/ArtistsAPI/5
        public string Get(int id)
        {
            _artistsData = new List<Artists>();

            var myThreat = new Thread(new ThreadStart(GetAllArtistsData));

            myThreat.Start();

            return _artistsData.ToString();
        }
コード例 #33
0
 /// <summary>
 /// Agrega miembros al grupo con el Id especificado
 /// </summary>
 /// <param name="userGroupId"></param>
 /// <param name="members"></param>
 /// <param name="callback"></param>
 public static IObservable<Unit> AddMembers(string userGroupId, IList<User> members)
 {
     return RestEndpointFactory
             .Create<IUserGroupsEndpoint>(SessionManager.Instance.CurrentLoggedUser)
             .AddMembers(userGroupId,
             members.ToString((u) => u.Username))
             .ToObservable()
             .SubscribeOn(TaskPoolScheduler.Default)
             .InterpretingErrors();
 }
コード例 #34
0
		/// <summary>
		/// 扫描并存储(静态)
		/// </summary>
		/// <exception cref="Exception"> </exception>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void firstScan(java.util.List<String> packageNameList) throws Exception
		public virtual void firstScan(IList<string> packageNameList)
		{

			LOGGER.debug("start to scan package: " + packageNameList.ToString());

			// 获取扫描对象并分析整合
			scanModel = scanStaticStrategy.scan(packageNameList);

			// 增加非注解的配置
			scanModel.JustHostFiles = DisconfCenterHostFilesStore.Instance.JustHostFiles;

			// 放进仓库
			foreach (StaticScannerMgr scannerMgr in staticScannerMgrList)
			{

				// 扫描进入仓库
				scannerMgr.scanData2Store(scanModel);

				// 忽略哪些KEY
				scannerMgr.exclude(DisClientConfig.Instance.IgnoreDisconfKeySet);
			}
		}
コード例 #35
0
        /*throws XBeeException */
        /**
         * Discovers and reports all remote XBee devices that match the supplied
         * identifiers.
         *
         * <p>This method blocks until the configured timeout expires. To configure
         * the discovery timeout, use the method {@link #setDiscoveryTimeout(long)}.
         * </p>
         *
         * <p>To configure the discovery options, use the
         * {@link #setDiscoveryOptions(Set)} method.</p>
         *
         * @param ids List which contains the identifiers of the devices to be
         *            discovered.
         *
         * @return A list of the discovered remote XBee devices with the given
         *         identifiers.
         *
         * @throws ArgumentException if {@code ids.size() == 0}.
         * @throws InterfaceNotOpenException if the device is not open.
         * @throws ArgumentNullException if {@code ids == null}.
         * @throws XBeeException if there is an error discovering the devices.
         *
         * @see #discoverDevice(String)
         * @see RemoteXBeeDevice
         */
        public List<RemoteXBeeDevice> discoverDevices(IList<string> ids)
        {
            if (ids == null)
                throw new ArgumentNullException("List of device identifiers cannot be null.");
            if (ids.Count == 0)
                throw new ArgumentException("List of device identifiers cannot be empty.");

            logger.DebugFormat("{0}Discovering all '{1}' devices.", localDevice.ToString(), ids.ToString());

            return nodeDiscovery.discoverDevices(ids);
        }
コード例 #36
0
ファイル: ImportDmDPC.cs プロジェクト: tomdeng/gaopincai
        private static DmDPC GetDmDPC(IList<int> list,string type)
        {
            DmDPC dto = new DmDPC();
            dto.Id = list.ToString("");
            dto.Number = list.ToString(" ");
            dto.DaXiao = list.GetDaXiao(4);
            dto.DanShuang = list.GetDanShuang();
            dto.ZiHe = list.GetZiHe();
            dto.Lu012 = list.GetLu012();
            dto.He = list.GetHe();
            dto.HeWei = dto.He.GetWei();
            dto.DaCnt = dto.DaXiao.Count("1");
            dto.XiaoCnt = dto.DaXiao.Count("0");
            dto.DanCnt = dto.DanShuang.Count("1");
            dto.ShuangCnt = dto.DanShuang.Count("0");
            dto.ZiCnt = dto.ZiHe.Count("1");
            dto.HeCnt = dto.ZiHe.Count("0");
            dto.Lu0Cnt = dto.Lu012.Count("0");
            dto.Lu1Cnt = dto.Lu012.Count("1");
            dto.Lu2Cnt = dto.Lu012.Count("2");
            dto.Ji = list.GetJi();
            dto.JiWei = dto.Ji.GetWei();
            dto.KuaDu = list.GetKuaDu();
            dto.AC = list.GetAC();
            dto.DaXiaoBi = list.GetDaXiaoBi(4);
            dto.ZiHeBi = list.GetZiHeBi();
            dto.DanShuangBi = list.GetDanShuangBi();
            dto.Lu012Bi = list.GetLu012Bi();
            dto.NumberType = type.Contains("C") ? dto.Id.GetNumberType() : type;

            return dto;
        }
コード例 #37
0
 public String UploadLocations(IList<JsonLocation> locations)
 {
     Console.WriteLine(locations.ToString());
     foreach (JsonLocation location in locations)
     {
         Location modelLocation = prepareLocation(location);
         insertLocation(modelLocation);
     }
     return ("Locations uploaded successfully.");
 }
コード例 #38
0
 /// <summary>
 /// Send calls to recipients through default campaign.
 /// Use the API to quickly send individual calls.
 /// A verified Caller ID and sufficient credits are required to make a call.
 /// </summary>
 /// <param name="recipients">call recipients</param>
 /// <param name="campaignId">specify a campaignId to send calls quickly on a previously created campaign</param>
 /// <param name="fields">limit fields returned. Example fields=id,name</param>
 /// <returns>list with created call objects</returns>
 /// <exception cref="BadRequestException">          in case HTTP response code is 400 - Bad request, the request was formatted improperly.</exception>
 /// <exception cref="UnauthorizedException">        in case HTTP response code is 401 - Unauthorized, API Key missing or invalid.</exception>
 /// <exception cref="AccessForbiddenException">     in case HTTP response code is 403 - Forbidden, insufficient permissions.</exception>
 /// <exception cref="ResourceNotFoundException">    in case HTTP response code is 404 - NOT FOUND, the resource requested does not exist.</exception>
 /// <exception cref="InternalServerErrorException"> in case HTTP response code is 500 - Internal Server Error.</exception>
 /// <exception cref="CallfireApiException">         in case HTTP response code is something different from codes listed above.</exception>
 /// <exception cref="CallfireClientException">      in case error has occurred in client.</exception>
 public IList<Call> Send(IList<CallRecipient> recipients, long? campaignId = null, string fields = null)
 {
     Validate.NotBlank(recipients.ToString(), "recipients cannot be blank");
     var queryParams = new List<KeyValuePair<string, object>>(2);
     ClientUtils.AddQueryParamIfSet("campaignId", campaignId, queryParams);
     ClientUtils.AddQueryParamIfSet("fields", fields, queryParams);
     return Client.Post<ListHolder<Call>>(CALLS_PATH, recipients, queryParams).Items;
 }
コード例 #39
0
ファイル: NpdlException.cs プロジェクト: qwinner/NetBPM
		public NpdlException(IList errorMsgs) : base(errorMsgs.ToString())
		{
			this.errorMsgs = errorMsgs;
		}
コード例 #40
0
ファイル: BofhBot.cs プロジェクト: amauragis/BofhDotNet
 private void ProcessChatCommandBofhwitsdie(IrcClient client, IIrcMessageSource source,
     IList<IIrcMessageTarget> targets, string command, IList<string> parameters)
 {
     client.LocalUser.SendNotice(targets, "You've killed me!");
     ConsoleUtilities.WriteError("Killed by '{0}'. ({1} {2})", source.Name, command, parameters.ToString());
     Stop();
 }
コード例 #41
0
        public void ConvertTo_ReturnsFirstValue_WhenSequenceNeedsToConvertedToSingleValue(IList value, object expected)
        {
            // Arrange
            var valueProviderResult = new ValueProviderResult(value, value.ToString(), CultureInfo.InvariantCulture);

            // Act
            var convertedValue = valueProviderResult.ConvertTo(expected.GetType());

            // Assert
            Assert.Equal(expected, convertedValue);
        }
コード例 #42
0
        /// <summary>
        /// Deserialize the JSON string into a proper object.
        /// </summary>
        /// <param name="content">HTTP body (e.g. string, JSON).</param>
        /// <param name="type">Object type.</param>
        /// <param name="headers"></param>
        /// <returns>Object representation of the JSON string.</returns>
        public object Deserialize(string content, Type type, IList<Parameter> headers=null)
        {
            if (type == typeof(Object)) // return an object
            {
                return content;
            }

            if (type == typeof(Stream))
            {
                var filePath = String.IsNullOrEmpty(Configuration.TempFolderPath)
                    ? Path.GetTempPath()
                    : Configuration.TempFolderPath;

                var fileName = filePath + Guid.NewGuid();
                if (headers != null)
                {
                    var regex = new Regex(@"Content-Disposition:.*filename=['""]?([^'""\s]+)['""]?$");
                    var match = regex.Match(headers.ToString());
                    if (match.Success)
                        fileName = filePath + match.Value.Replace("\"", "").Replace("'", "");
                }
                File.WriteAllText(fileName, content);
                return new FileStream(fileName, FileMode.Open);

            }

            if (type.Name.StartsWith("System.Nullable`1[[System.DateTime")) // return a datetime object
            {
                return DateTime.Parse(content,  null, System.Globalization.DateTimeStyles.RoundtripKind);
            }

            if (type == typeof(String) || type.Name.StartsWith("System.Nullable")) // return primitive type
            {
                return ConvertType(content, type); 
            }
    
            // at this point, it must be a model (json)
            try
            {
                return JsonConvert.DeserializeObject(content, type);
            }
            catch (Exception e)
            {
                throw new ApiException(500, e.Message);
            }
        }
コード例 #43
0
ファイル: RenameItem.xaml.cs プロジェクト: hmehart/Notepad
 private void AlertUserBadChars(IList<string> badCharsInName)
 {
     MessageBox.Show("The following characters are invalid for use in names: " + badCharsInName.ToString(),
         "Invalid characters", MessageBoxButton.OK);
 }
コード例 #44
0
		/**
		 * Discovers and reports all remote XBee devices that match the supplied 
		 * identifiers.
		 * 
		 * <p>This method blocks until the configured timeout in the device (NT) 
		 * expires.</p>
		 * 
		 * @param ids List which contains the identifiers of the devices to be 
		 *            discovered.
		 * 
		 * @return A list of the discovered remote XBee devices with the given 
		 *         identifiers.
		 * 
		 * @throws InterfaceNotOpenException if the device is not open.
		 * @throws XBeeException if there is an error discovering the devices.
		 * 
		 * @see #discoverDevice(String)
		 */
		public List<RemoteXBeeDevice> discoverDevices(IList<string> ids)/*throws XBeeException */{
			// Check if the connection is open.
			if (!xbeeDevice.IsOpen)
				throw new InterfaceNotOpenException();

			logger.DebugFormat("{0}ND for all {1} devices.", xbeeDevice.ToString(), ids.ToString());

			running = true;
			discovering = true;

			performNodeDiscovery(null, null);

			List<RemoteXBeeDevice> foundDevices = new List<RemoteXBeeDevice>(0);
			if (deviceList == null)
				return foundDevices;

			XBeeNetwork network = xbeeDevice.GetNetwork();

			foreach (RemoteXBeeDevice d in deviceList)
			{
				string nID = d.NodeID;
				if (nID == null)
					continue;
				foreach (string id in ids)
				{
					if (nID.Equals(id))
					{
						RemoteXBeeDevice rDevice = network.addRemoteDevice(d);
						if (rDevice != null && !foundDevices.Contains(rDevice))
							foundDevices.Add(rDevice);
					}
				}
			}

			return foundDevices;
		}