コード例 #1
0
        public void GetTRICDebtsByPeriodFactory_Make()
        {
            int i_owner = 1032; // код поставщика, выдается администратором системы

            var xmlRoot = new XmlBuilder("Accounts");

            var accountElement = new XmlBuilder("Account");

            accountElement.AddAttribute("accountID", 11816105);
            string b_period = new DateTime(2004, 12, 1).ToString("dd.MM.yyyy");
            string e_period = new DateTime(2016, 10, 1).ToString("dd.MM.yyyy");

            accountElement.AddAttribute("b_period", b_period);
            accountElement.AddAttribute("e_period", e_period);

            xmlRoot.AddElement(accountElement.Build());

            string xmlAccounts = xmlRoot.Build().ToString();

            /* ИЛИ так:
             * string xmlAccounts = @"<Accounts>
             *          <Account accountID=""11816105"" b_period=""01.12.2014"" e_period=""01.10.2016"" />
             *  </Accounts>";
             */

            var response = this.factory.Make(new object[] { i_owner, xmlAccounts }, ticket);

            Assert.IsInstanceOfType(response, typeof(DataSet));
            Assert.AreEqual(1, response.Tables.Count);
            Assert.AreEqual(7, response.Tables[0].Columns.Count);
            Assert.IsTrue(response.Tables[0].Rows.Count > 0);

            int colNum = 0;

            string[] columns = columnNamesInResponse.Replace("[", "").Replace("]", "").Split(new char[] { ',' });

            response.Tables[0].Columns.Cast <DataColumn>().ToList()
            .ForEach(x =>
            {
                Assert.AreEqual(columns[colNum], x.ColumnName);
                colNum++;
            });

            IEnumerable <DataRow> rowsTop10 = response.Tables[0].Rows.Cast <DataRow>().Take(10);

            foreach (DataRow row in rowsTop10)
            {
                Assert.IsTrue((int)row["cod_pl"] > 0, "Лицевой счет не обнаружен");
                Assert.IsTrue((int)row["for_period"] > 0, "Код периода не обнаружен");

                decimal sumSaldo;
                bool    isDecimal = Decimal.TryParse(row["s_money"].ToString(), out sumSaldo);
                Assert.IsTrue(isDecimal, "Сумма задолженности не обнаружена");

                Assert.IsTrue(row["address"].ToString() != "", "Адрес не обнаружена");
                Assert.IsTrue(row["FIO"].ToString() != "", "Фамилия не обнаружена");
                Assert.IsTrue((int)row["i_house"] > 0, "Код дома не обнаружен");
                Assert.IsTrue(row["d_born"].ToString() != "", "Дата рождения не обнаружена");
            }
        }
コード例 #2
0
    public static IEnumerable GetDebtsByPeriod(string accountID, DateTime b_period, DateTime e_period)
    {
        int i_owner = 1032; // код поставщика, выдаетс¤ администратором системы

        var    client = new ServiceIntegratorClient(new ServiceIntegrator(ServiceUrl.Url));
        string ticket = client.GetAuthorizationTicket(IdentityCredential.User, IdentityCredential.Password);

        var factory = new GetTRICDebtsByPeriodFactory(client);

        var xmlRoot = new XmlBuilder("Accounts");

        var accountElement = new XmlBuilder("Account");

        accountElement.AddAttribute("accountID", accountID);
        string b_period_str = b_period.ToString("dd.MM.yyyy");
        string e_period_str = e_period.ToString("dd.MM.yyyy");

        accountElement.AddAttribute("b_period", b_period_str);
        accountElement.AddAttribute("e_period", e_period_str);

        xmlRoot.AddElement(accountElement.Build());

        string xmlAccounts = xmlRoot.Build().ToString();

        var response = factory.Make(new object[] { i_owner, xmlAccounts }, ticket);

        return(response.Tables[0].Rows);
    }
コード例 #3
0
        public void GetTRICLivingsFactory_Make()
        {
            // 1 - по регистрации, 2 - по владельцу, 3 - совмещенный
            int typeSolidarityReg = 3;

            var xmlRoot = new XmlBuilder("Accounts");

            var accountElement = new XmlBuilder("Account");

            accountElement.AddAttribute("accountID", 1191582);
            int b_period = new DateTime(2004, 1, 1).DateToMonth();
            int e_period = new DateTime(2017, 12, 1).DateToMonth();

            accountElement.AddAttribute("b_period", b_period);
            accountElement.AddAttribute("e_period", e_period);

            xmlRoot.AddElement(accountElement.Build());

            string xmlAccounts = xmlRoot.Build().ToString();

            var response = this.factory.Make(new object[] { xmlAccounts, typeSolidarityReg }, ticket);

            Assert.IsInstanceOfType(response, typeof(DataSet));
            Assert.AreEqual(1, response.Tables.Count);
            Assert.AreEqual(9, response.Tables[0].Columns.Count);
            Assert.IsTrue(response.Tables[0].Rows.Count > 0);

            int colNum = 0;

            string[] columns = columnNamesInResponse.Replace("[", "").Replace("]", "").Split(new char[] { ',' });

            response.Tables[0].Columns.Cast <DataColumn>().ToList()
            .ForEach(x =>
            {
                Assert.AreEqual(columns[colNum], x.ColumnName);
                colNum++;
            });

            IEnumerable <DataRow> rowsTop10 = response.Tables[0].Rows.Cast <DataRow>().Take(10);

            foreach (DataRow row in rowsTop10)
            {
                Assert.IsTrue((int)row["cod_pl"] > 0, "Лицевой счет не обнаружен");
                Assert.IsTrue((int)row["i_people"] > 0, "Код жильца не обнаружен");
                Assert.IsTrue(row["FIO"].ToString() != "", "Фамилия не обнаружена");
                Assert.IsTrue(row["d_born"].ToString() != "", "Дата рождения не обнаружена");
                Assert.IsTrue(row["isMain"].ToString() != "", "Ответственный квартиросъемщик указан");
                Assert.IsTrue(row["PlaceBorn"].ToString() != "", "Место рождения не указано");
                Assert.IsTrue(row["b_period"].ToString() != "", "Дата начала не указана");
                Assert.IsFalse(row["e_period"].ToString() != "", "Дата окончания не пуста");
            }
        }
コード例 #4
0
        public StatusTemplate(Int64 nextId, bool success)
        {
            // <PollinatorResponse />
            //
            var document = XmlBuilder.CreateDocument("PollinatorResponse");

            // <next-id />
            XmlBuilder.AddElement(document, "next-id", $"{nextId}");
            // <Status />
            XmlBuilder.AddElement(document, "Status", success ? "Success" : "Failed");

            // save xml
            _xml = document.OuterXml;
        }
コード例 #5
0
        public void Build_with_AddElement()
        {
            string xml = @"<Accounts>
  <Account account=""1"" />
</Accounts>";

            builder = new XmlBuilder("Accounts");

            builder2 = new XmlBuilder("Account");
            builder2.AddAttribute("account", 1);

            builder.AddElement(builder2.Build());

            Assert.AreEqual(xml, builder.Build().ToString());
        }
コード例 #6
0
    public static IEnumerable GetLivings(string accountID, int b_period, int e_period)
    {
        var    client = new ServiceIntegratorClient(new ServiceIntegrator(ServiceUrl.Url));
        string ticket = client.GetAuthorizationTicket(IdentityCredential.User, IdentityCredential.Password);

        var factory = new GetTRICLivingsFactory(client);

        var xmlRoot = new XmlBuilder("Accounts");

        var accountElement = new XmlBuilder("Account");

        accountElement.AddAttribute("accountID", accountID);
        accountElement.AddAttribute("b_period", b_period);
        accountElement.AddAttribute("e_period", e_period);

        xmlRoot.AddElement(accountElement.Build());

        string xmlAccounts = xmlRoot.Build().ToString();

        var response = factory.Make(new object[] { xmlAccounts, 3 }, ticket);

        return(response.Tables[0].Rows);
    }
コード例 #7
0
        public void GetTRICDebtsByServicesFactory_Make()
        {
            int i_owner = 1032; // код поставщика, выдается администратором системы

            var xmlRoot = new XmlBuilder("Accounts");

            var accountElement = new XmlBuilder("Account");

            accountElement.AddAttribute("i_lschet", 11789150);
            string b_period = new DateTime(2012, 10, 1).ToString("dd.MM.yyyy");
            string e_period = new DateTime(2017, 1, 31).ToString("dd.MM.yyyy");

            accountElement.AddAttribute("b_period", b_period);
            accountElement.AddAttribute("e_period", e_period);

            xmlRoot.AddElement(accountElement.Build());

            string xmlAccounts = xmlRoot.Build().ToString();

            /* ИЛИ так:
             * string xmlAccounts = @"<Accounts>
             *          <Account accountID=""11816105"" b_period=""01.12.2014"" e_period=""01.10.2016"" />
             *  </Accounts>";
             */

            var response = this.factory.Make(new object[] { i_owner, xmlAccounts }, ticket);

            Assert.IsInstanceOfType(response, typeof(DataSet));
            Assert.AreEqual(1, response.Tables.Count);
            Assert.AreEqual(18, response.Tables[0].Columns.Count);
            Assert.IsTrue(response.Tables[0].Rows.Count > 0);

            int colNum = 0;

            string[] columns = columnNamesInResponse.Replace("[", "").Replace("]", "").Split(new char[] { ',' });

            response.Tables[0].Columns.Cast <DataColumn>().ToList()
            .ForEach(x =>
            {
                Assert.AreEqual(columns[colNum], x.ColumnName);
                colNum++;
            });

            IEnumerable <DataRow> rowsTop10 = response.Tables[0].Rows.Cast <DataRow>().Take(10);

            foreach (DataRow row in rowsTop10)
            {
                Assert.IsTrue((int)row["i_lschet"] > 0, "Лицевой счет не обнаружен");
                Assert.IsTrue(row["period"].ToString() != "", "Период не обнаружен");

                Assert.IsTrue(IsDecimal(row, "sum_nach_11"), "Сумма начислено за отопление не обнаружена");
                Assert.IsTrue(IsDecimal(row, "sum_odn_11"), "Сумма начислено отопление на ОДН не обнаружена");
                Assert.IsTrue(IsDecimal(row, "sum_opl_11"), "Сумма оплат за отопление не обнаружена");

                Assert.IsTrue(IsDecimal(row, "sum_nach_8"), "Сумма начислено за ГВС не обнаружена");
                Assert.IsTrue(IsDecimal(row, "sum_odn_8"), "Сумма начислено ГВС на ОДН не обнаружена");
                Assert.IsTrue(IsDecimal(row, "sum_opl_8"), "Сумма оплат за ГВС не обнаружена");

                Assert.IsTrue(IsDecimal(row, "sum_nach_10"), "Сумма начислено за ХВС не обнаружена");
                Assert.IsTrue(IsDecimal(row, "sum_odn_10"), "Сумма начислено ХВС на ОДН не обнаружена");
                Assert.IsTrue(IsDecimal(row, "sum_opl_10"), "Сумма оплат за ХВС не обнаружена");

                Assert.IsTrue(IsDecimal(row, "sum_nach_9"), "Сумма начислено за канализование не обнаружена");
                Assert.IsTrue(IsDecimal(row, "sum_odn_9"), "Сумма начислено канализование на ОДН не обнаружена");
                Assert.IsTrue(IsDecimal(row, "sum_opl_9"), "Сумма оплат за канализование не обнаружена");

                Assert.IsTrue(IsDecimal(row, "sum_total_nach"), "Сумма итого начислено не обнаружена");
                Assert.IsTrue(IsDecimal(row, "sum_total_opl"), "Сумма итого оплачено не обнаружена");
                Assert.IsTrue(IsDecimal(row, "sum_total"), "Сумма итого задолженность не обнаружена");
            }
        }