Example #1
0
File: Main.cs Project: evilOnes/DR
        void GetAbonents()//get other first
        {
            abonents.Clear();
            Abonent a;
            Payment p;
            Tariff  t;
            TariffA tA;
            Phone   ph;

            for (int i = 0; i < pds.Count; i++)
            {
                a = new Abonent();

                //get payments
                p = payments.Find(x => x.idA == pds[i].id);
                if (p == null)
                {
                    p = new Payment();
                }

                //get phone
                ph = phones.Find(x => x.idA == pds[i].id);
                if (ph == null)
                {
                    ph = new Phone();
                }

                //get tariffs of abonent
                tA = tariffsA.Find(x2 => x2.phone == ph.phone);
                if (tA == null)
                {
                    tA = new TariffA();
                }

                //get tariffs
                t = tariffs.Find(x1 => x1.id == tA.idTariff);
                if (t == null)
                {
                    t = new Tariff();
                }

                a.pd_id    = pds[i].id;
                a.pd_name  = pds[i].name;
                a.p_phone  = ph.phone;
                a.t_tariff = t.tariff;
                a.p_summa  = p.summa;
                a.p_zadol  = p.zadol;
                a.p_date   = p.date;

                abonents.Add(a);
            }
        }
Example #2
0
File: Main.cs Project: evilOnes/DR
        void GetTariffsA()
        {
            Open();

            cmd.CommandText = "select * from `Тариф абонента`";
            reader          = cmd.ExecuteReader();

            tariffsA.Clear();
            TariffA pd;

            while (reader.Read())
            {
                pd          = new TariffA();
                pd.id       = (int)reader[0];
                pd.phone    = reader[1].ToString();
                pd.idTariff = (int)reader[2];
                pd.date     = reader[3].ToString();

                tariffsA.Add(pd);
            }
            reader.Close();

            c.Close();
        }