Inheritance: System.Web.UI.Page
コード例 #1
0
ファイル: CsvLogFormat.cs プロジェクト: SmartFire/LogWatch
        public Record DeserializeRecord(ArraySegment<byte> segment) {
            var text = Encoding.UTF8.GetString(segment.Array, segment.Offset, segment.Count);
            var fields = this.GetFields(text);

            var attributes = this.AttributeMappings;

            var record = new Record {
                Logger = SafeGetFieldByIndex(fields, this.LoggerFieldIndex),
                Level = this.GetLevel(fields),
                Message = SafeGetFieldByIndex(fields, this.MessageFieldIndex),
                Exception = SafeGetFieldByIndex(fields, this.ExceptionFieldIndex)
            };

            DateTime timestamp;

            if (DateTime.TryParse(SafeGetFieldByIndex(fields, this.TimestampFieldIndex), out timestamp))
                record.Timestamp = timestamp;

            if (attributes != null)
                record.Attributes = attributes
                    .Select(x => new KeyValuePair<string, string>(x.Item2, SafeGetFieldByIndex(fields, x.Item1)))
                    .ToArray();

            return record;
        }
コード例 #2
0
ファイル: DataRecordTest.cs プロジェクト: ivelten/NBoost
        public void MapToType_Should_Return_Mapped_Instance()
        {
            var expected = new Record
            {
                Prop1 = 5,
                Prop2 = "prop2",
                Prop3 = new DateTime(2000, 4, 2),
                Prop4 = true
            };

            var type = typeof(Record);
            var properties = type.GetProperties();

            var dataRecordMock = new Mock<IDataRecord>();

            var fieldNames = properties.Select(p => p.Name).ToArray();
            var fieldValues = properties.Select(p => p.GetValue(expected)).ToArray();

            dataRecordMock.Setup(r => r.FieldCount).Returns(4);

            for (int i = 0; i < fieldNames.Length; i++)
            {
                dataRecordMock.Setup(r => r.GetName(i)).Returns(fieldNames[i]);
                dataRecordMock.Setup(r => r.GetValue(i)).Returns(fieldValues[i]);
            }

            var dataRecord = dataRecordMock.Object;

            var actual = dataRecord.MapToType<Record>();

            actual.Prop1.Should().Be(expected.Prop1);
            actual.Prop2.Should().Be(expected.Prop2);
            actual.Prop3.Should().Be(expected.Prop3);
            actual.Prop4.Should().Be(expected.Prop4);
        }
コード例 #3
0
ファイル: TableHeader.cs プロジェクト: pwdlugosz/Horse
 public TableHeader(Record R)
     : base(RECORD_LEN)
 {
     if (R.Count != RECORD_LEN) 
         throw new Exception("Header-Record supplied has an invalid length");
     this._data = R.BaseArray;
 }
コード例 #4
0
ファイル: PageInfo.cs プロジェクト: sosokk/YiFen.Library
 public PageInfo()
 {
     Page = 1;
     PageSize = 10;
     RecordCollection a = new RecordCollection();
     Record b = new Record();
 }
コード例 #5
0
 public Record WriteToReceptionDoctor(int id_Doctor, Pacient thePacient)
 {
     AddPacient(thePacient);
     Record theRecord = new Record(id_Doctor, thePacient.Id, GetTimeDoctor(id_Doctor));
     AddRecord(theRecord);
     return theRecord;
 }
コード例 #6
0
ファイル: OpenStudent.cs プロジェクト: sean97140/TutoringApp
        private void button1_Click(object sender, EventArgs e)
        {
            Record entries = new Record();

            #region Database Handling
            list.Clear();
            var id = StudentID.Text;
            // Open a connection to the database...
            MySqlConnection conn = new MySqlConnection("server=localhost;user=root;database=students;port=3306;password=;");
            conn.Open();
            // Perform the first query...
            String sql = "SELECT * FROM students.demographics WHERE id = '" + id + "'";
            MySqlCommand cmd = new MySqlCommand(sql, conn);
            cmd.ExecuteNonQuery();
            MySqlDataReader sqlReader = cmd.ExecuteReader();
            #endregion

            // Parse through results and store in a list...
            while (sqlReader.Read())
            {
                entries.AddRecord(Convert.ToInt32(sqlReader.GetValue(0)), sqlReader.GetValue(1).ToString(), sqlReader.GetValue(2).ToString(), sqlReader.GetValue(3).ToString());
                // Add the record to the list of records...
                list.Add(entries);
            }

            // If we have an empty list, let the user know.
            if (list.Count == 0)
            {
                MessageBox.Show("ID returned no matches", "No results");
            }
            else
            {
                MessageBox.Show("Confirm:\nYour name is: " + entries.FirstName + " " + entries.LastName, "Confirmation", MessageBoxButtons.YesNo);
            }
        }
コード例 #7
0
ファイル: TaxiPath.cs プロジェクト: Bia10/meshReader
 public TaxiPath(Record rec)
 {
     Id = rec[0];
     From = rec[1];
     To = rec[2];
     Cost = rec[3];
 }
コード例 #8
0
ファイル: RecordTests.cs プロジェクト: mvbalaw/EtlGate
 public void Given_an_invalid_heading_name__should_throw_an_exception()
 {
     var record = new Record(new string[] { }, new Dictionary<string, int>());
     // ReSharper disable ReturnValueOfPureMethodIsNotUsed
     record.GetField("foo");
     // ReSharper restore ReturnValueOfPureMethodIsNotUsed
 }
コード例 #9
0
        public void Save_a_copy_of_a_record_when_no_history_record_exists()
        {
            var stringDef = new FieldDescriptorRef { ItemType = typeof(string), FieldName = "StringDef" };
            var intDef = new FieldDescriptorRef { ItemType = typeof(int), FieldName = "IntDef" };

            var fieldString = new FieldValue { FieldDescriptorRef = stringDef, Value = "1" };
            var fieldInt = new FieldValue { FieldDescriptorRef = intDef, Value = 2 };

            var record = new Record
            {
                Id = "Record1",
                Fields = new List<FieldValue> { fieldString, fieldInt }
            };

            session.Store(record);
            session.SaveChanges();

            using (var newSession = ds.OpenSession())
            {
                var history = newSession.Load<RecordHistory>("recordHistory/Record1");
                //var recordInner = JsonConvert.DeserializeObject<Record>(history.Record.ToString());

                Assert.IsNotNull(history);
            }
        }
コード例 #10
0
        public NesuiPriceLevel(Record record)
        {
            dynamic self = record;

            this.Id = self.internalId;
            this.Name = self.name;
        }
コード例 #11
0
        public bool Write(Dictionary<Guid,string> source, Adam.Core.Application app)
        {
            Record r = new Record(app);
            Excel.Application EApp;
            Excel.Workbook EWorkbook;
            Excel.Worksheet EWorksheet;
            Excel.Range Rng;
            EApp = new Excel.Application();
            object misValue = System.Reflection.Missing.Value;
            EWorkbook = EApp.Workbooks.Add(misValue);
            EWorksheet = (Excel.Worksheet)EWorkbook.Worksheets.Item[1];                         
            EWorksheet.get_Range("A1", misValue).Formula = "UPC code";
            EWorksheet.get_Range("B1", misValue).Formula = "Link";            
            Rng = EWorksheet.get_Range("A2", misValue).get_Resize(source.Count,misValue);
            Rng.NumberFormat = "00000000000000";
            int row = 2;
            foreach(KeyValuePair<Guid,string> pair in source)
            {              
                EWorksheet.Cells[row,1] = pair.Value;                
                r.Load(pair.Key);
                Rng = EWorksheet.get_Range("B"+row, misValue);
                EWorksheet.Hyperlinks.Add(Rng, r.Fields.GetField<TextField>("Content Url").Value);               
                //myExcelWorksheet.Cells[row, 2] = r.Fields.GetField<TextField>("Content Url").Value;                                
                row++;
            }
            ((Excel.Range)EWorksheet.Cells[2, 1]).EntireColumn.AutoFit();
            ((Excel.Range)EWorksheet.Cells[2, 2]).EntireColumn.AutoFit();
            EWorkbook.SaveAs(_fileName, Excel.XlFileFormat.xlWorkbookNormal, misValue, misValue, misValue, misValue,
                Excel.XlSaveAsAccessMode.xlExclusive,
                misValue, misValue, misValue, misValue, misValue);

            EWorkbook.Close(true, misValue, misValue);
            EApp.Quit();
            return true;
        }
コード例 #12
0
ファイル: Exchange.cs プロジェクト: pwdlugosz/Horse
        public static Bitmap RecordToMonoChromeBitmap(int X, int Y, double Threshold, Record Datum)
        {

            if (Datum.Count != X * Y)
                throw new Exception(string.Format("Bitmap dimensions are invalid for record lenght"));

            Bitmap map = new Bitmap(X, Y);

            int index = 0;

            for (int x = 0; x < X; x++)
            {

                for (int y = 0; y < Y; y++)
                {

                    if (Datum[index].DOUBLE >= Threshold)
                    {
                        map.SetPixel(x, y, Color.Black);
                    }

                    index++;

                }

            }

            return map;

        }
コード例 #13
0
ファイル: SerializationContext.cs プロジェクト: jdom/orleans
 /// <summary>
 /// Record an object-to-copy mapping into the current serialization context.
 /// Used for maintaining the .NET object graph during serialization operations.
 /// Used in generated code.
 /// </summary>
 /// <param name="original">Original object.</param>
 /// <param name="copy">Copy object that will be the serialized form of the original.</param>
 public void RecordObject(object original, object copy)
 {
     if (!processedObjects.ContainsKey(original))
     {
         processedObjects[original] = new Record(copy);                
     }
 }
コード例 #14
0
        /// <summary>
        /// Saves content to UGC (new and existing) and return RecordID
        /// </summary>
        /// <param name="record"></param>
        public static int SaveUGCContentToAgility(Record record)
        {
            int recordID = -1;

            using (Agility_UGC_API_WCFClient client = UGCAPIUtil.APIClient)
            {
                DataServiceAuthorization auth = UGCAPIUtil.GetDataServiceAuthorization(-1);

                try
                {
                    recordID = client.SaveRecord(auth, record);

                    if (record.State == RecordState.Published)
                        client.SetRecordState(auth, recordID, 1, "");

                    Utilities.LogEvent(string.Format("Saved - {0}", recordID));
                }
                catch (Exception e)
                {
                    Utilities.LogEvent(string.Format("{0}:{1} - {2}", record.RecordTypeName, record.ID, e.Message));
                }
            }

            return recordID;
        }
コード例 #15
0
ファイル: TestReplic.cs プロジェクト: kjk/tenderbase
    public static void Master(int port, bool async, bool ack)
    {
        ReplicationMasterStorage db = StorageFactory.Instance.CreateReplicationMasterStorage(new string[] { "localhost:" + port }, async ? asyncBufSize : 0);
        db.SetProperty("perst.file.noflush", true);
        db.SetProperty("perst.replication.ack", ack);
        db.Open("master.dbs", pagePoolSize);

        FieldIndex root = (FieldIndex)db.GetRoot();
        if (root == null)
        {
            root = db.CreateFieldIndex(typeof(Record), "key", true);
            db.SetRoot(root);
        }

        long start = (DateTime.Now.Ticks - 621355968000000000) / 10000;
        for (int i = 0; i < nIterations; i++)
        {
            if (i >= nRecords)
                root.Remove(new Key(i - nRecords));

            Record rec = new Record();
            rec.key = i;
            root.Put(rec);
            if (i >= nRecords && i % transSize == 0)
                db.Commit();
        }

        db.Close();
        Console.Out.WriteLine("Elapsed time for " + nIterations + " iterations: " + ((DateTime.Now.Ticks - 621355968000000000) / 10000 - start) + " milliseconds");
    }
コード例 #16
0
 public void TestClickDataGridView()
 {
     EZMoneyModel ezMoneyModel = new EZMoneyModel(); // TODO: 初始化為適當值
     StatisticPresentationModel statisticPModel = new StatisticPresentationModel(ezMoneyModel); // TODO: 初始化為適當值
     CategoryModel categoryModel = ezMoneyModel.CategoryModel;
     RecordModel recordModel = ezMoneyModel.RecordModel;
     Category category1 = new Category(CATEGORY_NAME_WORK);
     Category category2 = new Category(CATEGORY_NAME_MOVIE);
     categoryModel.AddCategory(category1);
     categoryModel.AddCategory(category2);
     DateTime date = DateTime.Now;
     Record record1 = new Record(date, category1, 100);
     Record record2 = new Record(date, category1, 200);
     Record record3 = new Record(date, category1, 300);
     Record record4 = new Record(date, category1, 400);
     Record record5 = new Record(date, category2, -100);
     Record record6 = new Record(date, category2, -200);
     Record record7 = new Record(date, category2, -300);
     recordModel.AddRecord(record1);
     recordModel.AddRecord(record2);
     recordModel.AddRecord(record3);
     recordModel.AddRecord(record4);
     recordModel.AddRecord(record5);
     recordModel.AddRecord(record6);
     recordModel.AddRecord(record7);
     statisticPModel.InitializeState();
     BindingList<Record> records = statisticPModel.ClickDataGridView(category1);
     Assert.AreEqual(4, statisticPModel.RecordList.Count);
     Assert.AreEqual(records, statisticPModel.RecordList);
     statisticPModel.ChangeRadioButton(false);
     statisticPModel.ClickDataGridView(category2);
     Assert.AreEqual(3, statisticPModel.RecordList.Count);
 }
コード例 #17
0
ファイル: Default.aspx.cs プロジェクト: MooDevTeam/MooOJ
 void CollectEntityByID(MooDB db, int id)
 {
     record = (from r in db.Records
             where r.ID == id
             select r).SingleOrDefault<Record>();
     info = record == null ? null : record.JudgeInfo;
 }
コード例 #18
0
        public NesuiLocation(Record record)
        {
            dynamic self = record;

            this.Id = self.internalId;
            this.Name = self.name;
        }
コード例 #19
0
        public Account Parse(Record record)
        {
            DashPipeDigitParser dashPipeNumberExtractor = new DashPipeDigitParser();

            char[] line1, line2, line3;
            int initialPosition = 0;
            string recordContent = record.Content;
            int lineLength = record.LineLength;
            
            string accountNumber = "";
            for (int currentDigit = 0; currentDigit < 9; currentDigit++)
            {
                initialPosition = currentDigit * DigitWidth;
                line1 = recordContent.Substring(initialPosition, DigitWidth).ToCharArray();
                line2 = recordContent.Substring(initialPosition + lineLength, DigitWidth).ToCharArray();
                line3 = recordContent.Substring(initialPosition + (2 * lineLength), DigitWidth).ToCharArray();

                accountNumber += dashPipeNumberExtractor.Parse(line1, line2, line3);
            }

            return new Account
            {
                Number = accountNumber,
                OriginalPreParsed = recordContent
            };
        }
コード例 #20
0
ファイル: Explosion.cs プロジェクト: mctraveler/MineSharp
 public Explosion(CoordDouble pos)
 {
     Position = pos;
     Radius = 2;
     Records = new Record[0];
     PlayerMotion = new float[3];
 }
コード例 #21
0
ファイル: XmlContext.cs プロジェクト: ringill/Calculator_01
 public void Add(Record record)
 {
     XElement element = new XElement("Record");
     element.Add(new XAttribute("When",record.When));
     element.Add(new XAttribute("What", record.What));
     Document.Root.Add(element);
 }
コード例 #22
0
ファイル: ParserTest.cs プロジェクト: mezashi184/LTSV
 public void create_line()
 {
     Record record = new Record();
     record["test"] = "sample";
     record["foo"] = "bar";
     Assert.That(record.ToString(), Is.EqualTo("test:sample\tfoo:bar"));
 }
コード例 #23
0
 public void Approve(int MLJRecordID, int userID)
 {
     using (MLJRecordAccessClient _MLJAccessClient = new MLJRecordAccessClient(EndpointName.MLJRecordAccess))
     {
         //First get all JournalCollection in this period
         MLJRecord _MLJ = new MLJRecordCollection(_MLJAccessClient.QueryByRecordID(MLJRecordID))[0];
         //New Record
         Record _re = new Record();
         _re.Period = _MLJ.Period;
         _re.RecordStatus = RecordStatus.Normal;
         _re.Type = RecordType.WinAndLoss;
         foreach (MLJJournal _MLJjur in _MLJ.MLJJournalCollection)
         {
             Journal _jur = new Journal();
             decimal _baseamount = _MLJjur.Mon + _MLJjur.Tue + _MLJjur.Wed + _MLJjur.Thu + _MLJjur.Fri + _MLJjur.Sat + _MLJjur.Sun;
             _jur.BaseAmount = _baseamount;
             _jur.BaseCurrency = _MLJjur.BaseCurrency;
             _jur.ExchangeRate = _MLJjur.ExchangeRate;
             _jur.SGDAmount = _baseamount * _MLJjur.ExchangeRate;
             _jur.EntityID = _MLJjur.EntityID;
             _jur.EntryUser.UserID = userID;
             _re.JournalCollection.Add(_jur);
         }
         //Second insert Record
         using (RecordAccessClient _RecordClient = new RecordAccessClient(EndpointName.RecordAccess))
         {
             _RecordClient.Insert(_re, _re.JournalCollection.ToArray());
         }
         //Third Change MLJ_Record Status
         _MLJAccessClient.ChangeStatus(MLJRecordID, RecordStatus.Confirm, userID);
     }
 }
コード例 #24
0
ファイル: TaskListControl.cs プロジェクト: Znoey/TimeAssist
 private void buttonNewTask_Click(object sender, EventArgs e)
 {
     var r = new Record();
     r.Start = DateTime.Now;
     panelListView.Controls.Add(RecordViewer(r));
     panelListView.AutoScroll = true;
 }
コード例 #25
0
 //This function is called by the recorder in order to store data for rewind.
 public Record getRecord()
 {
     Record record = new Record ();
     record.position = transform.position;
     record.time = GlobalTime.GameTime;
     return record;
 }
コード例 #26
0
 public void TestGetAmounts()
 {
     CategoryModel categoryModel = new CategoryModel(); // TODO: 初始化為適當值
     Category categoryMovie = new Category(CATEGORY_NAME_MOVIE);
     Category categoryWork = new Category(CATEGORY_NAME_WORK);
     categoryModel.AddCategory(categoryMovie);
     categoryModel.AddCategory(categoryWork);
     RecordModel recordModel = new RecordModel(categoryModel); // TODO: 初始化為適當值
     DateTime now = DateTime.Now;
     DateTime date = new DateTime(now.Year, now.Month, now.Day);
     Record movieRecord = new Record(date, categoryMovie, -1000);
     recordModel.AddRecord(movieRecord);
     movieRecord = new Record(date, categoryMovie, -2000);
     recordModel.AddRecord(movieRecord);
     movieRecord = new Record(date, categoryMovie, -3000);
     recordModel.AddRecord(movieRecord);
     Record workRecord = new Record(date, categoryWork, 1000);
     recordModel.AddRecord(workRecord);
     workRecord = new Record(date, categoryWork, 2000);
     recordModel.AddRecord(workRecord);
     workRecord = new Record(date, categoryWork, 3000);
     recordModel.AddRecord(workRecord);
     workRecord = new Record(date, categoryWork, 4000);
     recordModel.AddRecord(workRecord);
     StatisticModel statisticModel = new StatisticModel(categoryModel, recordModel); // TODO: 初始化為適當值
     int income = statisticModel.GetAmounts(recordModel.Records, true);
     Assert.AreEqual(10000, income);
     int expense = statisticModel.GetAmounts(recordModel.Records, false);
     Assert.AreEqual(-6000, expense);
 }
コード例 #27
0
ファイル: BatchElement.cs プロジェクト: rxantos/tesv-snip
 public override bool Evaluate(Record r, SubRecord sr)
 {
     if (this.Type == BatchCondRecordType.Create)
     {
         if (sr == null)
         {
             // guess the best insert location
             int idx = -1;
             RecordStructure rs;
             if ( RecordStructure.Records.TryGetValue(r.Name, out rs) )
             {
                 for ( int i = Array.FindIndex(rs.subrecords, structure => structure.name == this.Record.name) - 1; i >= 0; --i)
                 {
                     var srsname = rs.subrecords[i].name;
                     idx = r.SubRecords.IndexOf(r.SubRecords.FirstOrDefault(x => x.Name == srsname));
                 }
             }
             sr = new SubRecord(this.Record);
             if (idx < 0) r.SubRecords.Add(sr); 
             else r.SubRecords.Insert(idx+1, sr); 
         }
     }
     else if (this.Type == BatchCondRecordType.Delete)
     {
         while (sr != null)
         {
             r.SubRecords.Remove(sr);
             sr = r.SubRecords.FirstOrDefault(x => x.Name == this.Record.name);
         }
     }
     return true;
 }
コード例 #28
0
 public void TestGetBalance()
 {
     CategoryModel categoryModel = new CategoryModel(); // TODO: 初始化為適當值
     Category categoryMovie = new Category(CATEGORY_NAME_MOVIE);
     Category categoryWork = new Category(CATEGORY_NAME_WORK);
     categoryModel.AddCategory(categoryMovie);
     categoryModel.AddCategory(categoryWork);
     RecordModel recordModel = new RecordModel(categoryModel); // TODO: 初始化為適當值
     DateTime now = DateTime.Now;
     DateTime date = new DateTime(now.Year, now.Month, now.Day);
     Record movieRecord = new Record(date, categoryMovie, -1000);
     recordModel.AddRecord(movieRecord);
     movieRecord = new Record(date, categoryMovie, -2000);
     recordModel.AddRecord(movieRecord);
     movieRecord = new Record(date, categoryMovie, -3000);
     recordModel.AddRecord(movieRecord);
     Record workRecord = new Record(date, categoryWork, 1000);
     recordModel.AddRecord(workRecord);
     workRecord = new Record(date, categoryWork, 2000);
     recordModel.AddRecord(workRecord);
     workRecord = new Record(date, categoryWork, 3000);
     recordModel.AddRecord(workRecord);
     workRecord = new Record(date, categoryWork, 4000);
     recordModel.AddRecord(workRecord);
     StatisticModel statisticModel = new StatisticModel(categoryModel, recordModel); // TODO: 初始化為適當值
     int balance = statisticModel.GetBalance(recordModel.Records);
     Assert.AreEqual(4000, balance);
 }
コード例 #29
0
    protected void onAddRecord(object sender, EventArgs e)
    {
        Record record = new Record
        {
            number = 1,
            firstName = firstNameInput.Text,
            lastName = lastNameInput.Text,
            sport = sportInput.Text,
            era = playingEraInput.Text,
            primaryTeam = primaryTeamInput.Text,
            professionalisation = professionalisationInput.Text,
            birthPlace = placeOfBirthInput.Text,
            lifeStatus = LifeStatus.Alive,
            timePeriod = timePeriodInput.Text,
            position = positionInput.Text,
            recordType = itemTypeInput.Text,
            condition = Condition.Average,
            dedication = Dedication.Inscription,
            cost = decimal.Parse(costInput.Text.Equals("") ? "0" : costInput.Text),
            estimatedValue = decimal.Parse(valueInput.Text.Equals("") ? "0" : valueInput.Text)
        };

        Storage.storeRecord(record);
        List<Record> records = Storage.grabRecords();
    }
コード例 #30
0
ファイル: Database.cs プロジェクト: Kozitsin/DatabaseLab
        public bool AddRecord(string tableName, Record record)
        {
            try
            {
                string pathTable = databasePath + '/' + tableName + ".dat";
                string pathHash = databasePath + '/' + tableName + "_hash.dat";
                string pathFreeSpace = databasePath + '/' + tableName + "_freespace.dat";

                if (File.Exists(pathTable) && File.Exists(pathHash) && File.Exists(pathFreeSpace))
                {
                    long position = SeekEmptySpace(pathFreeSpace);

                    WriteData(tableName, ref position, record);
                    WriteHash(tableName, position, record.data[0].ToString());

                    return true;
                }
                return false;
            }
            catch (Exception ex)
            {
                Logger.Write(ex);
                return false;
            }
        }