private void P1ClientTbl_CellClick(object sender, DataGridViewCellEventArgs e) { DataGridView table = sender as DataGridView; if (table == null) { MessageBox.Show("Critical error.", "Error"); return; } List <Waybill> waybills = WayBillRepository.GetAllEntities(); int clientID = (int)table.Rows[e.RowIndex > 0 ? e.RowIndex : 0].Cells["ID"].Value; this.UpdateP1WaybillTbl(waybills.Where(wb => wb.ClientID == clientID).ToList()); List <AccumulationRegister> accumulations = AccumRegisterRepository.GetAllEntities().Where(a => a.ClientID == clientID).ToList(); AccumulationRegister lastRecord = accumulations.Where(a => a.DateTime == accumulations.Max(ac => ac.DateTime)).FirstOrDefault(); if (lastRecord == null) { P1TotalWbTxt.Text = "waybills not found."; P1TotalRoamWbTxt.Text = "waybills not found."; return; } P1TotalWbTxt.Text = lastRecord.TotalAmount.ToString(); P1TotalRoamWbTxt.Text = lastRecord.RoamingAmount.ToString(); }
[TestMethod] public void TestAccumulationRegisters() { IMetadataService metadata = new MetadataService(); metadata .UseDatabaseProvider(DatabaseProvider.SQLServer) .UseConnectionString("Data Source=ZHICHKIN;Initial Catalog=accounting_3_0_72_72_demo;Integrated Security=True"); // accounting_3_0_72_72_demo InfoBase infoBase = metadata.LoadInfoBase(); List <string> delete; List <string> insert; using (StreamWriter stream = new StreamWriter(@"C:\temp\TestAccumulationRegisters.txt", false, Encoding.UTF8)) { int count = 0; foreach (var kvp in infoBase.AccumulationRegisters) { count++; AccumulationRegister model = kvp.Value as AccumulationRegister; if (model == null) { stream.WriteLine("{" + kvp.Key.ToString() + "} is not found!"); continue; } bool result = metadata.CompareWithDatabase(model, out delete, out insert); if (!result) { LogResult(stream, model, delete, insert); } } stream.WriteLine("*******************************"); stream.WriteLine(count.ToString() + " objects processed."); } }