Esempio n. 1
1
 /// <summary>
 /// Constructor
 /// </summary>
 public QueryResult(int pRows, UInt32 pID)
 {
     Rows = pRows;
     ID = pID;
     Records = new Records();
     _success = true;
 }
Esempio n. 2
0
 private void recordLoaderCallback(Records.Loader.States state, Int32 Count, Int32 Total, UInt64 RecordCounts)
 {
     if (this.InvokeRequired)
     {
         Records.Loader.Callback d = new Records.Loader.Callback(recordLoaderCallback);
         this.Invoke(d, new object[] { state, Count, Total, RecordCounts });
     }
     else {
         switch (state)
         {
             case Records.Loader.States.start:
                 toolStripLabel1.Text = String.Format("{0} of {1} databases loaded.", Count, Total, RecordCounts);
                 toolStripProgressBar1.Visible = true;
                 searchBox.Enabled = false;
                 break;
             case Records.Loader.States.update:
                 toolStripLabel1.Text = String.Format("{0} of {1} databases loaded, {2} records availables.", Count, Total, RecordCounts);
                 break;
             case Records.Loader.States.done:
                 toolStripLabel1.Text = String.Format("{2} records availables in {1} databases.", Count, Total, RecordCounts);
                 searchBox.Enabled = true;
                 toolStripProgressBar1.Visible = false;
                 break;
         }
     }
 }
 private void Button_Click_2(object sender, RoutedEventArgs e)
 {
     this.Visibility = Visibility.Collapsed;
     Records recordspage = new Records();
     recordspage.RecordsShow();
     recordspage.ShowDialog();
     this.Visibility = Visibility.Visible;
 }
Esempio n. 4
0
        void before_each()
        {
            seed = new Seed();

            records = new Records();

            seed.PurgeDb();
        }
Esempio n. 5
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     FileStream fs = new FileStream("../../records.txt", FileMode.Append);
     StreamWriter sw = new StreamWriter(fs);
     sw.WriteLine("{0} {1} {2} {3}", TextBox_Name.Text, Game.moves, Letters.hiddenword, DateTime.Now);
     sw.Close();
     fs.Close();
     this.Close();
     Records recordpage = new Records();
     recordpage.RecordsShow();
     recordpage.ShowDialog();
 }
Esempio n. 6
0
        void before_each()
        {
            seed = new Seed();

            records = new Records();

            seed.PurgeDb();

            @"if exists(select * from sysobjects where name = 'GetRecords' and xtype = 'p')
              begin
                drop procedure GetRecords
              end".ExecuteNonQuery();
        }
 private void initMyStuff()
 {
     try
     {
         Records records = new Records();
         Serialisointi.DeSerialisoiXml(Server.MapPath("~/App_Data/LevykauppaX.xml"), ref records);
         Albumit = records.genre.Records;
         ViewState["Records"] = Albumit;
         loadListWiew(Albumit);
     }
     catch (Exception ex)
     {
         er.InnerText = ex.Message;
     }
 }
Esempio n. 8
0
 private void initializeAll()
 {
     try
     {
         Records records = new Records();
         Serialization.DeSerializeXml(Server.MapPath("~/App_Data/LevykauppaX.xml"), ref records);
         Albums = records.genre.Records;
         ViewState["Records"] = Albums;
         loadListWiew(Albums);
     }
     catch (Exception ex)
     {
         er.InnerText = ex.Message;
     }
 }
Esempio n. 9
0
 private void recordLoaderCallback(Records.Loader.States state, Int32 Count, Int32 Total, UInt64 RecordCount)
 {
     switch (state)
     {
         case Records.Loader.States.start:
             statusFooter.Text = String.Format(getResourceString("MainPage_RecordLoaderStart"), Count, Total, RecordCount);
             Initialized = false;
             break;
         case Records.Loader.States.update:
             statusFooter.Text = String.Format(getResourceString("MainPage_RecordLoaderUpdate"), Count, Total, RecordCount);
             break;
         case Records.Loader.States.done:
             statusFooter.Text = String.Format(getResourceString("MainPage_RecordLoaderStop"), Count, Total, RecordCount);
             Initialized = true;
             break;
     }
 }
Esempio n. 10
0
        public override IModelCreationBuilder <SentimentIssue, SentimentPrediction, BinaryClassificationMetricsResult> LoadDefaultData()
        {
            var inputs = LoadFromEmbededResource.GetRecords <InputSentimentIssueRow>("Content.wikiDetoxAnnotated40kRows.tsv", delimiter: "\t", hasHeaderRecord: true);

            // convert int to boolean values
            var result = new List <SentimentIssue>();

            foreach (var item in inputs)
            {
                var newItem = new SentimentIssue
                {
                    Label = item.Label != 0,
                    Text  = item.comment
                };

                result.Add(newItem);
            }

            Records.AddRange(result);
            return(this);
        }
Esempio n. 11
0
        public Type Generate()
        {
            var ag = Generator.CurrentAssemblyGen;

            if (Parent == null || Builtins.IsTrue(Builtins.IsSymbolBound(Parent)))
            {
                var parent = Parent == null ? null : Builtins.SymbolValue(Parent);

                var rtd = Records.GenerateRecordTypeDescriptor(ag, RecordName, parent, Uid, Sealed, Opaque,
                                                               Array.ConvertAll(Fields, x => ((IronSchemeConstant)x).value), FieldTypes);

                var type = (rtd.type as TypeBuilder).CreateType();

                created = true;

                Builtins.SetSymbolValueFast(NameHint, rtd);

                return(type);
            }
            return(null); // cannot create
        }
Esempio n. 12
0
        public int Append(List <List <object> > records)
        {
            if (records == null)
            {
                throw new ArgumentNullException(nameof(records));
            }

            var newRecordCount = Records.Length + records.Count;
            var newrows        = new object[newRecordCount][];

            Records.CopyTo(newrows, 0);

            for (var i = Records.Length; i < newRecordCount; ++i)
            {
                newrows[i] = records[i - Records.Length].ToArray();
            }

            Records = newrows;

            return(records.Count);
        }
Esempio n. 13
0
        public IActionResult OnPost(int mId)
        {
            var Username  = HttpContext.Session.GetString("username");
            var MovieData = repo.GetMoviesById(mId);

            if (string.IsNullOrEmpty(Username))
            {
                return(RedirectToPage("/Login"));
            }
            var newRecord = new Records()
            {
                User       = repo.GetUserByUsername(Username),
                Movies     = MovieData,
                TakenDate  = DateTime.Now,
                ReturnDate = DateTime.Now.AddDays(MovieData.ReturnDays)
            };

            repo.AddRecord(newRecord);
            repo.Commit();
            return(RedirectToPage("/Dashboard/Index", new { user = Username }));
        }
Esempio n. 14
0
        public RecordNode RecordCompilingExpression(List <string> pathComponents, string value, bool isExcludedFromCoverage = false)
        {
            Interlocked.Increment(ref compiledCount);
            if (!isExcludedFromCoverage)
            {
                IsExcludedFromCoverage = false;
            }

            var recordName = pathComponents[0];
            var node       = Records.GetOrAdd(recordName, name => new RecordNode(name, FullName, isExcludedFromCoverage));

            if (pathComponents.Count == 1)
            {
                node.RecordCompilingExpression(value, isExcludedFromCoverage);
            }
            else
            {
                node.RecordCompilingExpression(pathComponents.GetRange(1, pathComponents.Count - 1), value, isExcludedFromCoverage);
            }
            return(node);
        }
Esempio n. 15
0
        public Records GetReportParasitologyData(DateTime from, DateTime to)
        {
            try
            {
                using (MySqlConnection con = new MySqlConnection(connection.conString))
                {
                    string sql = @"SELECT tblrecords.case_number, tblpatients.age, tblrecords.requested_by, 
                                CONCAT(tblpatients.first_name, ' ', tblpatients.last_name) AS patient_name, 
                                tblparasitology.* FROM mmg_lab.tblparasitology 
                                INNER JOIN mmg_lab.tbltransactions ON mmg_lab.tbltransactions.id = mmg_lab.tblparasitology.trans_id
                                INNER JOIN mmg_lab.tblrecords ON mmg_lab.tbltransactions.record_id = mmg_lab.tblrecords.id
                                INNER JOIN mmg_lab.tblpatients ON mmg_lab.tblrecords.patient_id = mmg_lab.tblpatients.id
                                WHERE mmg_lab.tblparasitology.created BETWEEN @from AND @to;";

                    using (MySqlCommand cmd = new MySqlCommand(sql, con))
                    {
                        var from_date = new DateTime(from.Year, from.Month, from.Day, 0, 0, 0);
                        var to_date   = new DateTime(to.Year, to.Month, to.Day, 23, 59, 59);

                        cmd.Parameters.AddWithValue("@from", from_date);
                        cmd.Parameters.AddWithValue("@to", to_date);

                        MySqlDataAdapter da = new MySqlDataAdapter();
                        da.SelectCommand = cmd;
                        DataTable dt             = new DataTable();
                        Records   dsParasitology = new Records();
                        dt.Clear();
                        da.Fill(dt);
                        da.Fill(dsParasitology, "ParasitologyReport");

                        return(dsParasitology);
                    }
                }
            }
            catch (Exception error)
            {
                Console.WriteLine("Error Getting Parasitology Report Data: " + error);
                return(null);
            }
        }
Esempio n. 16
0
 public async Task <bool> DeleteAccount(string password)
 {
     if (IsBusy)
     {
         return(false);
     }
     if (People.HashString(password) != CurrentLoginInfo.PasswordHash)
     {
         ErrorDialog("Wrong password", "Verification failed");
         return(false);
     }
     IsBusy = true;
     return(await Task.Run(async() =>
     {
         try
         {
             System.Net.HttpStatusCode res = await _peopleController.DeleteByID(CurrentLoginInfo.ID);
             if (res == System.Net.HttpStatusCode.OK)
             {
                 Toast = "Successfully deleted";
                 Records.Clear();
                 Reservations.Clear();
                 Rooms.Clear();
                 Services.LocalData.DeleteLoginInfo();
                 IsLoggedIn = false;
                 CurrentLoginInfo = null;
                 return true;
             }
         }
         catch (Exception e)
         {
             ErrorDialog(e.Message, "Task faild");
         }
         finally
         {
             IsBusy = false;
         }
         return true;
     }));
 }
Esempio n. 17
0
        public void UpdateUserSettings(InputModels.UpdateAccountInput input)
        {
            var existingRecords = Records.Where(s => s.UserId == input.Id).ToList();

            if (existingRecords.Any())
            {
                DbContext.RemoveRange(existingRecords);
            }

            foreach (var settingInput in input.Settings)
            {
                if (string.IsNullOrEmpty(settingInput.Value))
                {
                    continue;
                }

                var siteSetting = Records.FirstOrDefault(s => !s.AdminOnly && s.Name == settingInput.Key && string.IsNullOrEmpty(s.UserId));

                if (siteSetting != null)
                {
                    var baseSetting = BaseSettings.Get(siteSetting.Name);

                    if (baseSetting.Options != null && !baseSetting.Options.Contains(settingInput.Value))
                    {
                        throw new HttpBadRequestError();
                    }

                    var record = new DataModels.SiteSetting {
                        UserId    = input.Id,
                        Name      = siteSetting.Name,
                        Value     = settingInput.Value,
                        AdminOnly = siteSetting.AdminOnly
                    };

                    DbContext.SiteSettings.Add(record);
                }
            }

            DbContext.SaveChanges();
        }
Esempio n. 18
0
        // GET: Records/Details/5
        public ActionResult Details(int?id)
        {
            var context = new ApplicationDbContext();

            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Records records = db.Records.Find(id);

            if (records == null)
            {
                return(HttpNotFound());
            }


            ViewBag.Cover       = records.Cover;
            ViewBag.Title       = records.Title;
            ViewBag.Genre       = records.Genre;
            ViewBag.ReleaseDate = records.ReleaseDate;
            ViewBag.ArtistId    = context.Artists.Where(a => a.Id == records.Artists_Id).First().Id;
            ViewBag.Artist      = context.Artists.Where(a => a.Id == records.Artists_Id).First().Name;

            var vm = new List <CommentaireChansons>();

            foreach (var item in context.Songs.Where(s => s.Records_Id == records.Id))
            {
                CommentaireChansons vm2 = new CommentaireChansons();
                vm2.Songs    = item;
                vm2.SComment = context.SComment.Where(c => c.Songs_Id == item.Id).ToList();
                foreach (var item2 in vm2.SComment)
                {
                    item2.User = context.Users.Where(u => u.UserName == item2.Users_Id).FirstOrDefault();
                }
                vm.Add(vm2);
            }

            context.SaveChanges();
            return(View("Details", vm));
        }
        public override void RemoveRecord(string name)
        {
            string[] fullName = name.Split(' ');
            bool     removed  = false;

            switch (fullName.Length)
            {
            case 1:
                foreach (IRecord user in Records)
                {
                    if (user.LastName.ToLower() == fullName[0].ToLower())
                    {
                        RemoveRecord(Records.IndexOf(user));
                        removed = true;
                        break;
                    }
                }
                break;

            case 2:
                foreach (IRecord user in Records)
                {
                    if (user.LastName.ToLower() == fullName[0].ToLower())
                    {
                        if (user.FirstName.ToLower() == fullName[1].ToLower())
                        {
                            RemoveRecord(Records.IndexOf(user));
                            removed = true;
                            break;
                        }
                    }
                }
                break;
            }

            if (!removed)
            {
                OnWarning(string.Format("Failed to remove the entry by name. (name: {0})", name));
            }
        }
Esempio n. 20
0
        public User EditUser(UserEditDto info)
        {
            //check username
            if (Records
                .Any(x => x.Id != info.Id && x.NickName == info.NickName))
            {
                throw new CustomDbException("user name existed");
            }

            var role = context.UserRoles
                .Where(x => x.Name == info.Role)
                .FirstOrDefault();

            if(role == null)
            {
                throw new CustomDbException("Invalid role value");
            }

            var user = Records
                .Include(x => x.Role)
                .FirstOrDefault(x => x.Id == info.Id);

            if (user == null)
            {
                throw new CustomDbException("User not Found");
            }

            var entry = context.Entry(user);
            entry.CurrentValues.SetValues(new { 
                info.NickName,
                info.Mobile,
                info.IsActive,
                info.Email,
                role.RoleId,
                Role = role
            });
            entry.State = EntityState.Modified;
            context.SaveChanges();
            return user;
        }
Esempio n. 21
0
        private void FilterCheckValidation()// us in ApplyFilter methode
        {
            if (_Filters.Check1 == false && _Filters.Check2 == false && _Filters.Check3 == false &&
                _Filters.Check4 == false && _Filters.Check5 == false && _Filters.Check6 == false &&
                _Filters.Check7 == false && _Filters.Check8 == false && _Filters.Check9 == false &&
                _Filters.Check10 == false && _Filters.Check11 == false && _Filters.Check12 == false &&
                _Filters.Check13 == false && _Filters.Check14 == false && _Filters.Check15 == false &&
                _Filters.Check16 == false && _Filters.Check17 == false && _Filters.Check18 == false &&
                _Filters.Check19 == false && _Filters.Check20 == false)

            {
                Records.Clear();
                LoadData();
                return;
            }

            if (Records.Count() == 0)
            {
                dialogService.ShowMessage("Сначала обновите данные (Ctrl+R)");
                return;
            }
        }
Esempio n. 22
0
        public List <ItemViewModels.IndexCategory> CategoryIndex(bool includeReplies = false)
        {
            var categories = Categories.OrderBy(r => r.DisplayOrder).ToList();

            var indexCategories = new List <ItemViewModels.IndexCategory>();

            foreach (var categoryRecord in categories)
            {
                var indexCategory = new ItemViewModels.IndexCategory {
                    Id           = categoryRecord.Id,
                    Name         = categoryRecord.Name,
                    DisplayOrder = categoryRecord.DisplayOrder
                };

                foreach (var board in Records.Where(r => r.CategoryId == categoryRecord.Id))
                {
                    var thisBoardRoles = RoleRepository.BoardRoles.Where(r => r.BoardId == board.Id);

                    var authorized = UserContext.IsAdmin || !thisBoardRoles.Any() || (UserContext.Roles?.Any(userRole => thisBoardRoles.Any(boardRole => boardRole.RoleId == userRole)) ?? false);

                    if (!authorized)
                    {
                        continue;
                    }

                    var indexBoard = GetIndexBoard(board, includeReplies);

                    indexCategory.Boards.Add(indexBoard);
                }

                // Don't index the category if there's no boards available to the user
                if (indexCategory.Boards.Any())
                {
                    indexCategories.Add(indexCategory);
                }
            }

            return(indexCategories);
        }
Esempio n. 23
0
        public bool AddRecord(Records record)
        {
            bool result = true;

            Connect();
            try
            {
                SqlCommand cmd = new SqlCommand(
                    "INSERT INTO Car(CarBrand, CarModel, Cathegory, VINNUmber, PreviousViolation )" +
                    "VALUES ((@CarBrand, @CarModel, @Cathegory, @VINNUmber, @PreviousViolation)", Connection
                    );
                cmd.Parameters.AddWithValue("@CarBrand", record.trname);
                cmd.Parameters.AddWithValue("@CarModel", record.model);
                cmd.Parameters.AddWithValue("@Cathegory", record.cathegory);
                cmd.Parameters.AddWithValue("@VINNUmber", record.vin);
                cmd.Parameters.AddWithValue("@PreviousViolation", record.recedivs);
                cmd.ExecuteNonQuery();
            }
            catch (Exception) { result = false; }
            finally { Disconnect(); }
            return(result);
        }
Esempio n. 24
0
        public ServiceModels.ServiceResponse UpdateSiteSettings(InputModels.EditSettingsInput input)
        {
            var serviceResponse = new ServiceModels.ServiceResponse();

            foreach (var settingInput in input.Settings)
            {
                var existingRecords = Records.Where(s => s.Name == settingInput.Key && string.IsNullOrEmpty(s.UserId)).ToList();

                if (existingRecords.Any())
                {
                    DbContext.RemoveRange(existingRecords);
                }

                if (string.IsNullOrEmpty(settingInput.Value))
                {
                    continue;
                }

                var baseSetting = BaseSettings.Get(settingInput.Key);

                if (baseSetting.Options != null && !baseSetting.Options.Contains(settingInput.Value))
                {
                    throw new HttpBadRequestError();
                }

                var record = new DataModels.SiteSetting {
                    Name      = settingInput.Key,
                    Value     = settingInput.Value,
                    AdminOnly = settingInput.AdminOnly
                };

                DbContext.SiteSettings.Add(record);
            }

            DbContext.SaveChanges();

            serviceResponse.Message = $"Site settings were updated.";
            return(serviceResponse);
        }
 public void Update(DestinyRecordsComponent?other)
 {
     if (other is null)
     {
         return;
     }
     if (!Records.DeepEqualsDictionary(other.Records))
     {
         Records = other.Records;
         OnPropertyChanged(nameof(Records));
     }
     if (RecordCategoriesRootNodeHash != other.RecordCategoriesRootNodeHash)
     {
         RecordCategoriesRootNodeHash = other.RecordCategoriesRootNodeHash;
         OnPropertyChanged(nameof(RecordCategoriesRootNodeHash));
     }
     if (RecordSealsRootNodeHash != other.RecordSealsRootNodeHash)
     {
         RecordSealsRootNodeHash = other.RecordSealsRootNodeHash;
         OnPropertyChanged(nameof(RecordSealsRootNodeHash));
     }
 }
Esempio n. 26
0
        public void AddNewRecord()
        {
            var encrypted = EncryptedRecordDataModel <object> .Create(EncryptedDictionary, Display, Key ?? string.Empty, Secret ?? string.Empty, null);

            Records.Add(encrypted);
            if (EncryptedDictionary.KeyPassword != null)
            {
                EncryptedDictionary.EncryptAll();
                EncryptedDictionary.Save("secrets.json");
                OpenRecords.Add(new OpenRecordDataModel <object>()
                {
                    Display = Display, PairingKey = encrypted.PairingKey
                });
                SaveOpenRecords("open_data.json");
            }

            Display = Key = Secret = null;
            foreach (var value in new string[] { nameof(Display), nameof(Key), nameof(Secret) })
            {
                PropertyChanged(this, new PropertyChangedEventArgs(value));
            }
        }
Esempio n. 27
0
        public bool WriteRecord(string text, int authorID, int ownerID)
        {
            bool done;

            try
            {
                Records record = new Records
                {
                    Text   = text,
                    Author = authorID,
                    Owner  = ownerID
                };
                socialNet.Records.Add(record);
                socialNet.SaveChanges();
                done = true;
            }
            catch
            {
                done = false;
            }
            return(done);
        }
Esempio n. 28
0
 public void DeleteRecord(EncryptedRecordDataModel <OpenCryptoKeysData> record)
 {
     for (int i = OpenRecords.Count - 1; i >= 0; --i)
     {
         if (OpenRecords[i].PairingKey == record.PairingKey)
         {
             OpenRecords.RemoveAt(i);
             break;
         }
     }
     SaveOpenRecords(FilenameOpen);
     for (int i = Records.Count - 1; i >= 0; --i)
     {
         if (Records[i].PairingKey == record.PairingKey)
         {
             Records.RemoveAt(i);
             break;
         }
     }
     record.Remove();
     EncryptedDictionary.Save(FilenameSecret);
 }
Esempio n. 29
0
        public List <BMRecordCurrent> GetLastRecords(TimeSpan interval)
        {
            List <BMRecordCurrent> records = new List <BMRecordCurrent>();

            if (Records.Count < 2)
            {
                return(Records);
            }

            DateTime last  = Records.Last().Date;
            DateTime first = last - interval;

            for (int i = 0; i < Records.Count; i++)
            {
                if (Records[i].Date > first)
                {
                    records.Add(Records[i]);
                }
            }

            return(records);
        }
 public void Calculate()
 {
     if (Records.Count() > 0)
     {
         RecordsCount = Records.Count();
         List <Record> SortedRecords = Records.OrderBy(r => r.Date).ToList();
         TotalPayments = SumOfTopUps();
         TotalCost     = ((SortedRecords.First().Balance - SortedRecords.Last().Balance) + TotalPayments) - SortedRecords.First().TopUp;
         DailyCost     = CalculateDailyAvg(SortedRecords);
         MonthlyCost   = m_dailyCost * Properties.Settings.Default.DaysPerMonth;
         YearlyCost    = m_dailyCost * Properties.Settings.Default.DaysPerYear;
     }
     else
     {
         RecordsCount  = 0;
         TotalPayments = 0;
         TotalCost     = 0;
         DailyCost     = 0;
         MonthlyCost   = 0;
         YearlyCost    = 0;
     }
 }
Esempio n. 31
0
        /// <exception cref="System.Exception"/>
        public virtual void TestNMProxyRetry()
        {
            containerManager.Start();
            containerManager.SetBlockNewContainerRequests(false);
            StartContainersRequest allRequests = Records.NewRecord <StartContainersRequest>();
            ApplicationId          appId       = ApplicationId.NewInstance(1, 1);
            ApplicationAttemptId   attemptId   = ApplicationAttemptId.NewInstance(appId, 1);
            Token nmToken = context.GetNMTokenSecretManager().CreateNMToken(attemptId, context
                                                                            .GetNodeId(), user);
            IPEndPoint address = conf.GetSocketAddr(YarnConfiguration.NmBindHost, YarnConfiguration
                                                    .NmAddress, YarnConfiguration.DefaultNmAddress, YarnConfiguration.DefaultNmPort);

            Org.Apache.Hadoop.Security.Token.Token <NMTokenIdentifier> token = ConverterUtils.
                                                                               ConvertFromYarn(nmToken, SecurityUtil.BuildTokenService(address));
            UserGroupInformation ugi = UserGroupInformation.CreateRemoteUser(user);

            ugi.AddToken(token);
            ContainerManagementProtocol proxy = NMProxy.CreateNMProxy <ContainerManagementProtocol
                                                                       >(conf, ugi, YarnRPC.Create(conf), address);

            retryCount = 0;
            shouldThrowNMNotYetReadyException = false;
            proxy.StartContainers(allRequests);
            NUnit.Framework.Assert.AreEqual(5, retryCount);
            retryCount = 0;
            shouldThrowNMNotYetReadyException = false;
            proxy.StopContainers(Org.Apache.Hadoop.Yarn.Util.Records.NewRecord <StopContainersRequest
                                                                                >());
            NUnit.Framework.Assert.AreEqual(5, retryCount);
            retryCount = 0;
            shouldThrowNMNotYetReadyException = false;
            proxy.GetContainerStatuses(Org.Apache.Hadoop.Yarn.Util.Records.NewRecord <GetContainerStatusesRequest
                                                                                      >());
            NUnit.Framework.Assert.AreEqual(5, retryCount);
            retryCount = 0;
            shouldThrowNMNotYetReadyException = true;
            proxy.StartContainers(allRequests);
            NUnit.Framework.Assert.AreEqual(5, retryCount);
        }
Esempio n. 32
0
        public void Read(Stream stream, bool readNames)
        {
            if (stream == null)
            {
                throw new ArgumentNullException("stream");
            }

            Fields.Clear();
            Records.Clear();

            if (stream != null)
            {
                using (StreamReader sr = new StreamReader(stream))
                {
                    int i = 0;
                    while (sr.Peek() > -1)
                    {
                        string line = sr.ReadLine();

                        if (line.StartsWith("#"))
                        {
                            continue;
                        }

                        string[] ss = line.Split(',');

                        if (readNames && Fields.Count == 0)
                        {
                            Fields.AddRange(ss);
                        }
                        else
                        {
                            Records.Add(ss);
                            i++;
                        }
                    }
                }
            }
        }
Esempio n. 33
0
        private async Task RefreshRecords(bool silent = false)
        {
            if (IsLoadingRecords)
            {
                return;
            }
            IsLoadingRecords = silent ? false : true;
            await Task.Run(async() =>
            {
                try
                {
                    List <Records> records = (await _recordsController.GetAllEntries())?.Where(r => r.Person_Id == CurrentLoginInfo.ID).ToList();

                    if (records == null || records?.Count == 0)
                    {
                        if (!silent)
                        {
                            Toast = "No records available";
                        }
                        //  ErrorDialog("Please try later", "No room available");
                    }
                    else
                    {
                        Records.AddRange(records, true);
                    }
                }
                catch (Exception e)
                {
                    if (!silent)
                    {
                        Toast = "Bad network \n" + e.Message;
                    }
                }
                finally
                {
                    IsLoadingRecords = false;
                }
            });
        }
Esempio n. 34
0
    private void Start()
    {
        records = JsonConvert.DeserializeObject <Records>(
            File.ReadAllText(Path.Combine(ImageDirectory, "records.json")));

        foreach (Record record in records.records)
        {
            string filepath = Path.Combine(ImageDirectory,
                                           record.name + ".png");
            if (!File.Exists(filepath))
            {
                continue;
            }
            // Instantiate the image.
            ModelImage img = Instantiate(imagePrefab.gameObject).GetComponent <ModelImage>();

            // Parent this image to the scroll view.
            img.GetComponent <RectTransform>().SetParent(content);
            // Set the image.
            Texture2D tex = GetMaterialImage(filepath);
            img.image.sprite = Sprite.Create(tex, new Rect(0, 0, tex.width, tex.height),
                                             new Vector2(0.5f, 0.5f));
            img.text.text = record.name;
            // Store the image and model name.
            images.Add(img, record);
        }
        loading.gameObject.SetActive(false);

        buttonQuit.onClick.AddListener(() => Application.Quit());
        PopulateDropdownSearch();
        dropdownSearch.onValueChanged.AddListener(SelectSearchType);
        inputSearch.onValueChanged.AddListener(FilterByName);
        // Set a defaul value.
        dropdownSearch.value = 0;

        // Listen to events.
        ModelImage.OnSelect   += Select;
        ModelImage.OnDeselect += Deselect;
    }
Esempio n. 35
0
        static void PrettyPrintRecords(Records records)
        {
            // Get all the fields first for formatting
            const int columnFormatLength = 26;

            if (records.Count > 0)
            {
                foreach (var field in records[0])
                {
                    Console.Write($"{field.Key, -columnFormatLength}");
                }
                Console.WriteLine();
                foreach (var row in records)
                {
                    foreach (var data in row)
                    {
                        Console.Write($"{data.Value, -columnFormatLength}");
                    }
                    Console.WriteLine();
                }
            }
        }
Esempio n. 36
0
        public void SortUp(string id)
        {
            var item = Records.Where(x => x.Id == id).FirstOrDefault();

            if (item == null)
            {
                return;
            }

            var index = Records.IndexOf(item);

            if (index <= 0)
            {
                return;
            }

            Records.Remove(item);
            Records.Insert(index - 1, item);

            RaisePropertyChanged("Records");
            SaveToJson();
        }
Esempio n. 37
0
        private void ListMergeSort() // merges until only 1 list left
        {
            int totalRounds = Records.Count();
            int round       = totalRounds;
            int percent     = split;
            int oldPercent  = split;

            double logRounds = Math.Log(totalRounds);

            while (Records.Count > 1)
            {
                MergeFirstTwo();
                round--;

                percent = (int)((split * Math.Log(totalRounds / round)) / logRounds) + split;
                if (oldPercent < percent)
                {
                    oldPercent = percent;
                    bgw.ReportProgress(percent);
                }
            }
        }
Esempio n. 38
0
 private void SetInputValue(int windowLength, ref int count, ref double[] inputData, double sinA)
 {
     if (count == 0)
     {
         inputData        = new double[windowLength];
         inputData[count] = sinA;
         count++;
     }
     else if (count == windowLength)
     {
         var rec = new Record(inputData, new double[1] {
             sinA
         });
         Records.Add(rec);
         count = 0;
     }
     else
     {
         inputData[count] = sinA;
         count++;
     }
 }
Esempio n. 39
0
    public void Load(string path, int skipSeq, Vector3 position, bool x, bool y, bool z, float direction, float scale)
    {
        jsonObject = LoadJsonFileFromResources <Records>(path);

        defaultPos     = new Vector3(position.x, position.y, position.z);
        enableX        = x;
        enableY        = y;
        enableZ        = z;
        this.direction = direction;
        this.scale     = scale;

        for (int n = skipSeq; n < jsonObject.records.Count; n++)
        {
            List <RecordNode> list = new List <RecordNode>();
            for (int i = 0; i < jsonObject.records[n].record.data.Count; i++)
            {
                list.Add(jsonObject.records[n].record.data[i]);
            }
            animations.Add(list);
        }
        Debug.Log(string.Format("Loaded Recored Animations {0}", jsonObject.records.Count));
    }
Esempio n. 40
0
 void dgvData_SetDataSource(Records.RecordDataTable source)
 {
     dgvData.DataSource = Meter.Records;
     dgvData.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
     dgvData.Show();
 }
 /// <summary>
 /// 架构中不存在 Records 的注释。
 /// </summary>
 public void AddToRecords(Records records)
 {
     base.AddObject("Records", records);
 }
Esempio n. 42
0
		private bool SecondaryExplosion()
		{
			//Vector3 source = new Vector3(_centerCoordinates.X, _centerCoordinates.Y, _centerCoordinates.Z).Floor();
			//var yield = (1/_size)*100;
			//var explosionSize = _size*2;
			//var minX = Math.Floor(_centerCoordinates.X - explosionSize - 1);
			//var maxX = Math.Floor(_centerCoordinates.X + explosionSize + 1);
			//var minY = Math.Floor(_centerCoordinates.Y - explosionSize - 1);
			//var maxY = Math.Floor(_centerCoordinates.Y + explosionSize + 1);
			//var minZ = Math.Floor(_centerCoordinates.Z - explosionSize - 1);
			//var maxZ = Math.Floor(_centerCoordinates.Z + explosionSize + 1);
			//var explosionBB = new BoundingBox(new Vector3(minX, minY, minZ), new Vector3(maxX, maxY, maxZ));

			var records = new Records();
			foreach (Block block in _afectedBlocks.Values)
			{
				records.Add(block.Coordinates - _centerCoordinates);
			}

			new Task(() =>
			{
				var mcpeExplode = McpeExplode.CreateObject();
				mcpeExplode.x = _centerCoordinates.X;
				mcpeExplode.y = _centerCoordinates.Y;
				mcpeExplode.z = _centerCoordinates.Z;
				mcpeExplode.radius = _size;
				mcpeExplode.records = records;
				_world.RelayBroadcast(mcpeExplode);
			}).Start();

			foreach (Block block in _afectedBlocks.Values)
			{
				Block block1 = block;
				_world.SetBlock(new Air {Coordinates = block1.Coordinates});
				//new Task(() => _world.SetBlock(new Air {Coordinates = block1.Coordinates})).Start();
				//new Task(() => block1.BreakBlock(_world)).Start();
				if (block is Tnt)
				{
					new Task(() => SpawnTNT(block1.Coordinates, _world)).Start();
				}
			}

			// Set stuff on fire
			if (Fire)
			{
				Random random = new Random();
				foreach (BlockCoordinates coord in _afectedBlocks.Keys)
				{
					var block = _world.GetBlock(coord.X, coord.Y, coord.Z);
					if (block is Air)
					{
						var blockDown = _world.GetBlock(coord.X, coord.Y - 1, coord.Z);
						if (!(blockDown is Air) && random.Next(3) == 0)
						{
							_world.SetBlock(new Fire {Coordinates = block.Coordinates});
						}
					}
				}
			}

			return true;
		}
 /// <summary>
 /// Updates the current records.
 /// </summary>
 /// <param name="newRecords">The updated records.</param>
 public void SetRecords(Records newRecords)
 {
     mRecords = newRecords;
 }
Esempio n. 44
0
        /// <summary>
        /// You can iterate over the database and retrieve one Record at a time
        /// in the index order using the combination of MoveFirst, MoveNext and 
        /// GetCurrentRecord.
        /// </summary>
        ///
        private void BtnIterate_Click( object sender, RoutedEventArgs e )
        {
            try
            {
                if( _db.NumRecords > 0 )
                {
                    // we can create our own Records list and add 
                    // all the rows we find and display them in the DataGrid

                    Records records = new Records( _db.NumRecords );

                    _db.MoveFirst();

                    do
                    {
                        Record record = _db.GetCurrentRecord( null, true );
                        records.Add( record );

                        foreach( string fieldName in record.FieldNames )
                        {
                            Debug.WriteLine( string.Format( "Field: {0}  Value: {1}", fieldName, record[fieldName] ) );
                        }

                        // the index field won't be in the database Fields list, because it is not part of the database (table)
                        foreach( Field field in _db.Fields )
                        {
                            Debug.WriteLine( string.Format( "Field: {0}  Value: {1}", field.Name, record[field.Name] ) );
                        }

                    } while( _db.MoveNext() );

                    displayRecords( records );
                }
            }
            catch( Exception ex )
            {
                MessageBox.Show( ex.Message );
            }
        }
Esempio n. 45
0
        public static void DeSerialisoiXml(string filePath, ref Records records)
        {
            XmlSerializer deserializer = new XmlSerializer(typeof(Records));
            try
            {

                FileStream xmlFile = new FileStream(filePath, FileMode.Open);
                records = (Records)deserializer.Deserialize(xmlFile);
                xmlFile.Close();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {

            }
        }
Esempio n. 46
0
        private void BtnGetRecordByIndex_Click( object sender, RoutedEventArgs e )
        {
            try
            {
                // first find a record and get its index and use it to get just the Record
                // using GetRecordByIndex

                FilterExpression fieldSearchExp = FilterExpression.Parse( "LastName = Buchanan" );
                FileDbNs.Table table = _db.SelectRecords( fieldSearchExp, null, null, true );
                if( table.Count > 0 )
                {
                    int index = (int) table[0]["index"];
                    Record record = _db.GetRecordByIndex( index, null );
                    Records records = new Records( 1 );
                    records.Add( record );
                    displayRecords( records );
                }
            }
            catch( Exception ex )
            {
                MessageBox.Show( ex.Message );
            }
        }
Esempio n. 47
0
 /// <summary>
 /// Default implementation.
 /// </summary>
 public virtual Records AfterSelect(Records pRecords)
 {
     return pRecords;
 }
Esempio n. 48
0
        // Table derives from Records
        //
        void displayRecords( Records records )
        {
            grid.ItemsSource = null;
            grid.Columns.Clear();

            if( records != null && records.Count > 0 )
            {
                // we can get the Fields from any Record in the Table
                foreach( string name in records[0].FieldNames )
                {
                    grid.Columns.Add( CreateColumn( name ) );
                }

                SortableRowCollection sortableColl = new SortableRowCollection( records );
                grid.ItemsSource = sortableColl;

                #if false
                foreach( Record record in table )
                {
                    foreach( Field field in table.Columns )
                    {
                        Debug.WriteLine( string.Format( "Field: {0}  Value: {1}", field.Name, record[field.Name] ) );
                    }
                    
                    foreach( object val in record )
                    {
                        Debug.WriteLine( val.ToString() );
                    }
                }
                #endif
            }
        }
 /// <summary>
 /// Call this before using the singleton.
 /// </summary>
 public void Initialize()
 {
     mRecords = new Records();
 }
Esempio n. 50
0
        /// <summary>
        /// Writes the users records to the glucose records table and attaches them to their userid.
        /// </summary>
        /// <param name="records">Glucose records from the users meter.</param>
        /// <param name="user">User information obtained from validating login with the webservice.</param>
        /// <param name="MeterType">Meter type id that corresponds with the primary key in the MeterTypes database table</param>
        /// <returns>Were the records successfully written to the database.</returns>
        public bool PostGlucoseRecords(Records records, Common user, int MeterType)
        {
            bool result = false;

            if (user.sp_GetLogin == null)
            {
                return result;
            }

            lock (Authenticated)
            {
                if (Authenticated.Count > 0 && Authenticated.Contains(user.sp_GetLogin.FirstOrDefault().sessionid))
                {
                    UpdateLastSync(user);

                    //authenticated session so allow post
                    Common.sp_GetLoginRow userinfo = null;
                    try
                    {
                        userinfo = user.sp_GetLogin.First();
                    }
                    catch(Exception ex)
                    {
                        if (userinfo == null)
                        {
                            throw new FaultException("PostGlucoseRecords-1: Invalid or blank user information detected.");
                        }
                        else
                        {
                            throw new FaultException("PostGlucoseRecords-1: " + ex.Message);
                        }
                    }
                    
                    try
                    {
                        using (CommonTableAdapters.QueriesTableAdapter queries = new CommonTableAdapters.QueriesTableAdapter())
                        {
                            foreach (Records.RecordRow row in records.Record)
                            {
                                //write record to database attaching to user
                                try
                                {
                                    queries.sp_PostGlucoseResult(row.Timestamp, row.Glucose, row.Units, userinfo.user_id, MeterType);
                                }//try
                                catch (Exception ex)
                                {
                                    if (ex.Message.ToLowerInvariant().Contains("violation of unique key constraint"))
                                        continue;
                                    else
                                        throw;
                                }
                            }
                        }
                    }
                    catch(Exception ex)
                    {
                        throw new FaultException("PostGlucoseRecords-2: " + ex.Message);
                    }

                    result = true;
                }
                else
                {
                    //not authenticated
                    throw new FaultException("PostGlucoseRecords-3: Session not authenticated.");
                }
            }

            return result;
        }
Esempio n. 51
0
 public RecordReadEventArgs(Records.RecordRow _row)
 {
     Row = _row;
 }
    /// <summary>
    /// Reads the specified XML.
    /// </summary>
    /// works with url's and local paths(local paths dont work in webplayer).
    /// 
	/// @code
    /// public class Example : MonoBehaviour
    /// {
    /// 
    /// string buildingId = "0080200000490694";
    /// 
	/// ReadXML("www.domainname.com/table_export_adressen_Leeuwarden.xml",typeof(Records));//placed in Database.buildingInfoDict
    /// ReadXML("www.domainname.com/ChatHistory.xml", typeof(ChatHistory));//placed in Database.chatHistory
    /// ReadXML("ChatHistory.xml",typeof(ChatHistory));// points to projectPath\ChatHistory.xml next to projectPath\Assets
    /// 
    /// Info dictionaryElement = Database.FindBuilding(buildingId);
    /// Info dictionaryElementAlternate = Database.buildingInfoDict[buildingId];
    /// 
    /// }
	/// @endcode
	/// <param name="xmlName">Name of the XML to load.</param>
	/// <param name="type">The type of the info in the XML.</param>
    public static IEnumerator ReadXML(string url, System.Type type)
    {
        if (url.StartsWith("http"))
        {
            WWW w = new WWW(url);
            yield return w;

            if (w.isDone)
            {
                if (type == typeof(ChatHistory))
                {
                    Debug.Log("Loading history");
                    XmlSerializer serial = new XmlSerializer(typeof(ChatHistory));
                    StringReader reader = new StringReader(w.text);
                    chatHistory = (ChatHistory)serial.Deserialize(reader);
                }

                if (type == typeof(Records))
                {
                    Debug.Log("Loading Records");
                    XmlSerializer serial = new XmlSerializer(typeof(Records));
                    StringReader reader = new StringReader(w.text);
                    records = (Records)serial.Deserialize(reader);
                    loaded = true;
                    AddToDictionary();
                }
            }
        }
        else
        {
            FileStream file = new FileStream(Application.dataPath+"/"+url, FileMode.Open);
			if (type == typeof(Records))
            {
                XmlSerializer serial = new XmlSerializer(typeof(Records));
                records = (Records)serial.Deserialize(file);
                AddToDictionary();
                loaded = true;
            }
            if (type == typeof(ChatHistory))
            {
                XmlSerializer serial = new XmlSerializer(typeof(ChatHistory));
                chatHistory = (ChatHistory)serial.Deserialize(file);
            }
            Debug.Log("Loading Done!");
        
        }

       
    }
Esempio n. 53
0
 /// <summary>
 /// Constructor
 /// </summary>
 private QueryResult(bool pSuccess)
 {
     Records = new Records();
     _success = pSuccess;
 }
Esempio n. 54
0
        private bool SecondaryExplosion()
        {
            var records = new Records();
            foreach (var block in _afectedBlocks.Values)
            {
                records.Add(block.Coordinates - _centerCoordinates);
            }

            foreach (var block in _afectedBlocks.Values)
            {
                var block1 = block;
                _world.SetBlock(new BlockAir {Coordinates = block1.Coordinates});

                if (block is BlockTnt)
                {
                    new Task(() => SpawnTnt(block1.Coordinates, _world)).Start();
                }
            }

            // Set stuff on fire
            if (_fire)
            {
                var random = new Random();
                foreach (var coord in _afectedBlocks.Keys)
                {
                    var block = _world.GetBlock(new Vector3(coord.X, coord.Y, coord.Z));
                    if (block is BlockAir)
                    {
                        var blockDown = _world.GetBlock(new Vector3(coord.X, coord.Y - 1, coord.Z));
                        if (!(blockDown is BlockAir) && random.Next(3) == 0)
                        {
                            _world.SetBlock(new BlockFire {Coordinates = block.Coordinates});
                        }
                    }
                }
            }

            return true;
        }
 public HttpMockServer(IRecordMatcher matcher)
 {
     instanceCount++;
     this.matcher = matcher;
     this.Records = new Records(matcher);
     
     if (Mode == HttpRecorderMode.Playback)
     {
         Records.EnqueueRange(sessionRecords);
     }
 }
Esempio n. 56
0
 /// <summary>
 /// Constructor
 /// </summary>
 private QueryResult(Records pRecords)
 {
     Records = pRecords;
     _success = true;
 }
Esempio n. 57
0
 private void BtnGetRecordByKey_Click( object sender, RoutedEventArgs e )
 {
     try
     {
         Record record = _db.GetRecordByKey( 1, new string[] { "ID", "Firstname", "LastName" }, false );
         if( record != null )
         {
             Records records = new Records( 1 );
             records.Add( record );
             displayRecords( records );
         }
     }
     catch( Exception ex )
     {
         MessageBox.Show( ex.Message );
     }
 }
 /// <summary>
 /// 创建新的 Records 对象。
 /// </summary>
 /// <param name="id">Id 的初始值。</param>
 /// <param name="account">Account 的初始值。</param>
 /// <param name="type">Type 的初始值。</param>
 /// <param name="remark">Remark 的初始值。</param>
 /// <param name="createDate">CreateDate 的初始值。</param>
 /// <param name="lastModifyDate">LastModifyDate 的初始值。</param>
 public static Records CreateRecords(int id, string account, string type, string remark, global::System.DateTime createDate, global::System.DateTime lastModifyDate)
 {
     Records records = new Records();
     records.Id = id;
     records.Account = account;
     records.Type = type;
     records.Remark = remark;
     records.CreateDate = createDate;
     records.LastModifyDate = lastModifyDate;
     return records;
 }
Esempio n. 59
0
        void before_each()
        {
            seed = new Seed();

            records = new Records();

            seed.PurgeDb();

            seed.CreateTable("Records", new dynamic[] 
            { 
                new { Id = "int" },
                new { Name = "nvarchar(255)" }
            }).ExecuteNonQuery();

            seed.CreateTable("OtherRecords", new dynamic[] 
            { 
                new { Id = "int" },
                new { RecordId = "int" },
                new { Name2 = "nvarchar(255)" }
            }).ExecuteNonQuery();

            new string[] 
            {
                "Record 100", "Record 101",
                "Record 102", "Record 103",
                "Record 104", "Record 105",
                "Record 106", "Record 107",
                "Record 108", "Record 109",
                "Record 201", "Record 202", 
                "Record 203", "Record 204", 
                "Record 205", "Record 206", 
                "Record 207", "Record 208", 
                "Record 209", "Record 200"
            }.ForEach(s => new
            {
                Id = int.Parse(s.Replace("Record ", "")),
                Name = s
            }.InsertInto("Records"));

            new string[] 
            {
                "Record 30100", "Record 30101",
                "Record 30102", "Record 30103",
                "Record 30104", "Record 30105",
                "Record 30106", "Record 30107",
                "Record 30108", "Record 30109",
                "Record 40201", "Record 40202", 
                "Record 40203", "Record 40204", 
                "Record 40205", "Record 40206", 
                "Record 40207", "Record 40208", 
                "Record 40209", "Record 40200"
            }.ForEach(s => new
            {
                Id = int.Parse(s.Replace("Record ","")),
                RecordId = int.Parse(
                    s.Replace("Record ","")
                     .Replace("30", "")
                     .Replace("40","")),
                Name2 = s
            }.InsertInto("OtherRecords"));
        }