Ejemplo n.º 1
0
        private void DogUpravl_Load(object sender, EventArgs e)
        {
            dogUpravlAdapter.FillByActiveAudit(ds.DogUpravl, ActiveAudit.ID, ActiveAudit.ID_Company); //??
            dogUprUslAdapter.FillByDogovor(ds.DogUprUslugi, ActiveAudit.ID, ActiveAudit.ID_Company, this.currDogID);

            grdDogUpravl.DataSource = dogUpravlAdapter.GetDataByActiveAudit(ActiveAudit.ID, ActiveAudit.ID_Company);
            grdUslugi.DataSource    = dogUprUslAdapter.GetDataByDogovor(ActiveAudit.ID, ActiveAudit.ID_Company, this.currDogID);
            grdFiles.DataSource     = dogUprFilesAdapter.GetDataByActiveDog(ActiveAudit.ID, ActiveAudit.ID_Company, this.currDogID);

            ActiveAudit.CheckGrid(grdDogUpravl);
            ActiveAudit.CheckGrid(grdUslugi);
            ActiveAudit.CheckGrid(grdFiles);



            lblCurrDogovor.Text = this.currDogID.ToString();

            grdDogUpravl.Columns[0].Visible = false;
            grdDogUpravl.Columns[1].Visible = false;
            grdDogUpravl.Columns[2].Visible = false;

            grdDogUpravl.Columns[3].Width = grdDogUpravl.Width / 12;
            grdDogUpravl.Columns[4].Width = grdDogUpravl.Width / 12;
            grdDogUpravl.Columns[5].Width = grdDogUpravl.Width / 11;
            grdDogUpravl.Columns[6].Width = grdDogUpravl.Width / 11;
            grdDogUpravl.Columns[7].Width = grdDogUpravl.Width / 11;

            grdDogUpravl.Columns[8].Width  = grdDogUpravl.Width / 12;
            grdDogUpravl.Columns[9].Width  = grdDogUpravl.Width / 12;
            grdDogUpravl.Columns[10].Width = grdDogUpravl.Width / 11;
            grdDogUpravl.Columns[11].Width = grdDogUpravl.Width / 11;
            grdDogUpravl.Columns[12].Width = grdDogUpravl.Width / 11;
            grdDogUpravl.Columns[13].Width = grdDogUpravl.Width / 11;

            grdUslugi.Columns[0].Visible = false;
            grdUslugi.Columns[1].Visible = false;
            grdUslugi.Columns[2].Visible = false;
            grdUslugi.Columns[3].Visible = false;

            grdUslugi.Columns[4].Width = grdUslugi.Width / 3;
            grdUslugi.Columns[5].Width = grdUslugi.Width / 4;
            grdUslugi.Columns[6].Width = grdUslugi.Width / 3;


            grdFiles.Columns[0].Visible = false;
            grdFiles.Columns[1].Visible = false;
            grdFiles.Columns[2].Visible = false;
            grdFiles.Columns[3].Visible = false;

            grdFiles.Columns[4].Width = grdFiles.Width / 2;
            grdFiles.Columns[5].Width = grdFiles.Width / 2;
        }
Ejemplo n.º 2
0
        //ОТЧЕТ
        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;
            }
        }