private void LicSchet_Load(object sender, EventArgs e) { licSchetAdapter.FillByActiveAudit(ds.LicSchet, ActiveAudit.ID, ActiveAudit.ID_Company); grdLicSchet.DataSource = licSchetAdapter.GetDataByActiveAudit(ActiveAudit.ID, ActiveAudit.ID_Company); grdLicSchet.Columns[0].Visible = false; grdLicSchet.Columns[1].Visible = false; grdLicSchet.Columns[2].Visible = false; grdLicSchet.Columns[3].Width = grdLicSchet.Width / 7; grdLicSchet.Columns[4].Width = grdLicSchet.Width / 7; grdLicSchet.Columns[5].Width = grdLicSchet.Width / 7; grdLicSchet.Columns[6].Width = grdLicSchet.Width / 7; grdLicSchet.Columns[7].Width = grdLicSchet.Width / 8; grdLicSchet.Columns[8].Width = grdLicSchet.Width / 8; grdLicSchet.Columns[9].Width = grdLicSchet.Width / 8; }
//ОТЧЕТ private void btnReport_Click(object sender, EventArgs e) { Cursor.Current = Cursors.WaitCursor; try { ds.AcceptChanges(); licenseAdapter.FillByActiveAudit(ds.License, ActiveAudit.ID, ActiveAudit.ID_Company); elHouseAdapter.FillByActiveAudit(ds.ElHouse, ActiveAudit.ID, ActiveAudit.ID_Company); elHouseParamAdapter.Fill(ds.ElHouseParams); gfObjectsAdapter.FillByActiveAudit(ds.GilFondObject, ActiveAudit.ID, ActiveAudit.ID_Company); porchAdapter.Fill(ds.PorchGilFondОbjects); pomeschAdapter.Fill(ds.PomeschGilFondОbs); qrLSPlatDocsAdapter.Fill(ds.qrLicSchet_PlatDocs, ActiveAudit.ID, ActiveAudit.ID_Company); //query LS -> PlatDocs lichouseAdapter.FillByActiveAudit(ds.LicenseHouses, ActiveAudit.ID, ActiveAudit.ID_Company); DataSet1.LicenseHousesRow[] licHouseArr = ds.LicenseHouses.ToArray(); //Дома по лицензии dogUprAdapter.FillByActiveAudit(ds.DogUpravl, ActiveAudit.ID, ActiveAudit.ID_Company); //договоры упр DataSet1.DogUpravlRow[] doguprArr = ds.DogUpravl.ToArray(); //Дома по договорам companiesAdapter.Fill(ds.Companies); //Сравниваем дома в договорах управления и лицензиях - ОТЛОЖЕНО /* * /// повтор вызов приводит к ошибке dogUprAdapter.FillByActiveAudit(ds.DogUpravl, ActiveAudit.ID, ActiveAudit.ID_Company); //договоры упр * string[] dogupr_Arr = ds.DogUpravl.Select(d => d.Управляемые_объекты).ToArray(); * /// повтор вызов приводит к ошибке lichouseAdapter.FillByActiveAudit(ds.LicenseHouses, ActiveAudit.ID, ActiveAudit.ID_Company); * string[] licHouse_Arr = ds.LicenseHouses.Select(d => d.Адрес).ToArray(); */ priborAdapter.FillByActiveAudit(ds.Pribor, ActiveAudit.ID, ActiveAudit.ID_Company); DataSet1.PriborRow[] priborArr = ds.Pribor.ToArray(); ///////////////// repGFObj.Clear(); DataSet1.LicenseRow LicenseCompany = null; if (ds.License.Rows.Count > 0) { LicenseCompany = (DataSet1.LicenseRow)ds.License.Rows[0]; } //для случая с ТСЖ DataSet1.CompaniesRow ActiveCompany = ds.Companies.Where(c => c.ID == ActiveAudit.ID_Company).FirstOrDefault(); foreach (DataSet1.GilFondObjectRow gfoRow in ds.GilFondObject.Rows) { repGFObj.Add(new repGilFondObj { ID_GilFondObject = gfoRow.ID_GilFondObject, ID_Audit = ActiveAudit.ID, ID_Company = ActiveAudit.ID_Company, CompanyName = LicenseCompany != null ? LicenseCompany.Лицензиат : ActiveAudit.Company, CompanyAddress = LicenseCompany != null ? LicenseCompany.Адрес : "???", CompanyINN = LicenseCompany != null ? LicenseCompany.ИНН : ActiveCompany.INN, CompanyLicense = LicenseCompany != null ? LicenseCompany.Лицензия : "????", Address = gfoRow.Адрес, quantGilPom = gfoRow._Кол_во_помещений.Split('/')[0] == "-" ? 0 : Convert.ToInt32(gfoRow._Кол_во_помещений.Split('/')[0]), quantNoGilPom = gfoRow._Кол_во_помещений.Split('/')[1] == "- " ? 0 : Convert.ToInt32(gfoRow._Кол_во_помещений.Split('/')[1]) }); DataSet1.PorchGilFondОbjectsRow[] arr = (DataSet1.PorchGilFondОbjectsRow[])gfoRow.GetChildRows("GilFondObjectPorchGilFondОbjects"); foreach (DataSet1.PorchGilFondОbjectsRow porch in arr) { DataSet1.PomeschGilFondОbsRow[] pomscharr = (DataSet1.PomeschGilFondОbsRow[])porch.GetChildRows("PorchGilFondОbjectsPomeschGilFondОbs"); // Console.WriteLine(pomscharr); } } //Лицевые счета licSchetAdapter.FillByActiveAudit(ds.LicSchet, ActiveAudit.ID, ActiveAudit.ID_Company); DataSet1.LicSchetRow[] lsArr = ds.LicSchet.ToArray(); int quantLS = lsArr.Count(); //общее кол-во ЛС //???? DateTime tls = Convert.ToDateTime(lsArr.Max(l => Convert.ToDateTime(l.Дата_события))); //Макс дата выгрузки ЛС //Перечень работ и услуг pereschRabUslAdapter.FillByActiveAudit(ds.PerechRabUslug, ActiveAudit.ID, ActiveAudit.ID_Company); DataSet1.PerechRabUslugRow[] perArr = ds.PerechRabUslug.ToArray(); //Голосования votingAdapter.FillByActiveAudit(ds.Voting, ActiveAudit.ID, ActiveAudit.ID_Company); DataSet1.VotingRow[] votingArr = ds.Voting.ToArray(); DataSet1.qrLicSchet_PlatDocsRow[] qrLSDocsArr = ds.qrLicSchet_PlatDocs.ToArray(); foreach (repGilFondObj gfo in repGFObj) { gfo.quantPribor = QuantPriborByHouse(priborArr, gfo.Address); if (!ActiveAudit.Company.StartsWith("ТСЖ") && !ActiveAudit.Company.StartsWith("ЖСК") && !ActiveAudit.Company.StartsWith("ТСН")) { Tuple <string, string> dates = DatesByLicensyAndDogUpr(licHouseArr, doguprArr, gfo.Address); gfo.BeginDateByLic = dates.Item1; gfo.BeginDateByDogUpr = dates.Item2; } if (ActiveAudit.Company.StartsWith("ТСЖ") || ActiveAudit.Company.StartsWith("ЖСК") || ActiveAudit.Company.StartsWith("ТСН")) { ustavHouseAdapter.FillByCurrentAudit(ds.UstavHouse, ActiveAudit.ID); DataSet1.UstavHouseRow[] ustavHousesArr = ds.UstavHouse.ToArray(); DataSet1.UstavHouseRow uhrow = ustavHousesArr.Where(h => h.Адрес == gfo.Address).FirstOrDefault(); gfo.BeginDateByLic = "отсутствует"; if (uhrow != null) { gfo.BeginDateByDogUpr = uhrow.Период; } else { gfo.BeginDateByDogUpr = "-"; } } DataSet1.PerechRabUslugRow x = perArr.Where(p => p.Адрес == gfo.Address).FirstOrDefault(); if (x != null) { gfo.perechRabUsl = x.Перечень; } else { gfo.perechRabUsl = "отсутствует"; } Tuple <int, DateTime?> ls = LS_Quant_Date(lsArr, gfo.Address); //Кол-во и дата ЛС по объекту gfo.quantLS = ls.Item1; gfo.maxDateLS = ls.Item2; Tuple <int, DateTime?> vot = Voting_Qiant_Date(votingArr, gfo.Address); gfo.quantVoting = vot.Item1; gfo.maxDateVoting = vot.Item2; //////// Платежные док-ты со статусами Размещен и Проект gfo.quantPlatDocsRazm = qrLSDocsArr .Where(d => !d.IsСтатус_документаNull()) .Where(d => d.Адрес.Contains(gfo.Address)) .Where(s => s.Статус_документа == "Размещен") .Count(); gfo.quantPlatDocsNoRazm = qrLSDocsArr .Where(d => !d.IsСтатус_документаNull()) .Where(d => d.Адрес.Contains(gfo.Address)) .Where(s => s.Статус_документа == "Проект") .Count(); } frmReport ft = new frmReport(repGFObj); ft.Show(); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { Cursor.Current = Cursors.Default; } }