Beispiel #1
0
        /// <summary>
        /// Создает на сервере указанные счета с указанными параметрами на счете
        /// </summary>
        /// <param name="users">Список счетов для создания</param>
        /// <returns></returns>
        public static IEnumerable <KeyValuePair <UserRecord, string> > UserRecordsNew(this MT4Manager mt4, IEnumerable <UserRecord> users)
        {
            if (users != null && users.Count() > 0)
            {
                var success = new Dictionary <UserRecord, string>();
                var failed  = new Dictionary <UserRecord, string>();
                foreach (var user in users)
                {
                    try
                    {
                        var newUser = mt4.UserRecordNew(user);
                        success.Add(newUser, "ok");
                    }
                    catch (Exception e)
                    {
                        failed.Add(user, e.Message);
                    }
                }

                return(success.Union(failed));
            }
            else
            {
                return(null);
            }
        }