Example #1
0
        public async Task <DataProviderModel <List <DealObject> > > GetDealObjects(int dealId)
        {
            List <Query> listQuery = new List <Query>();

            string q_guid    = Guid.NewGuid().ToString();
            Query  query     = new Query(q_guid, "GetDealObjects");
            var    parametrs = new List <QueryParameter> {
                new QueryParameter("in", "Deal_Id", dealId.ToString())
            };

            query.Parameters = parametrs;

            listQuery.Add(query);

            var result = await _sessionQueryExecutor.Execute(listQuery).ConfigureAwait(false);

            var dealObjectsQuery = result.Queries.FirstOrDefault(q => q.Name == "GetDealObjects");

            var objects = new List <DealObject>();

            if (dealObjectsQuery != null)
            {
                var dataTable = dealObjectsQuery.RetTable;

                foreach (DataRow objectRow in dataTable.Rows)
                {
                    objects.Add(new DealObject(
                                    objectRow["DealObject_Id"].GetInt(),
                                    objectRow["Deal_Id"].GetInt(),
                                    objectRow["Object_Id"].GetInt(),
                                    objectRow["ObjectName"].ToString(),
                                    objectRow["Description"].ToString(),
                                    objectRow["User_Id"].GetInt(),
                                    objectRow["CheckList_Id"].GetInt(),
                                    _soapParser.BoolParse(objectRow["IsApprovedByPartner"].ToString()),
                                    _soapParser.BoolParse(objectRow["IsApprovedByMe"].ToString()),
                                    objectRow["CreateDate"].GetDateTime(),
                                    objectRow["ChangeDate"].GetDateTime(),
                                    objectRow["CheckStatus_Id"].GetInt(),
                                    _soapParser.BoolParse(objectRow["Blocked"].ToString()),
                                    objectRow["ObjectCategory_Id"].GetInt(),
                                    objectRow["ObjectStatus_Id"].GetInt()
                                    ));
                }
            }

            return(new DataProviderModel <List <DealObject> >(result.ResultMessage, objects));
        }
Example #2
0
        private async Task <DataProviderModel <List <DealModel> > > GetDealsList(int?dealId = null)
        {
            var queryIdentifier1 = Guid.NewGuid().ToString();
            var query1           = new Query(queryIdentifier1, "GetDeals");

            if (dealId.HasValue)
            {
                query1.Parameters = new List <QueryParameter>
                {
                    new QueryParameter("in", "Deal_Id", dealId.ToString())
                };
            }

            var listQuery = new List <Query> {
                query1
            };

            var result = await _sessionQueryExecutor.Execute(listQuery).ConfigureAwait(false);

            var getDealsQuery = result.Queries.FirstOrDefault(q => q.Name == "GetDeals");

            var deals = new List <DealModel>();

            if (getDealsQuery != null)
            {
                var dataTable = getDealsQuery.RetTable;

                foreach (DataRow objectRow in dataTable.Rows)
                {
                    deals.Add(new DealModel(
                                  objectRow["Deal_Id"].GetInt(),
                                  objectRow["SellerUser_Id"].GetNullableInt(),
                                  objectRow["BuyerUser_Id"].GetNullableInt(),
                                  objectRow["HostUser_Id"].GetInt(),
                                  objectRow["CheckedByUser_Id"].GetNullableInt(),
                                  objectRow["CheckStatus_Name"].ToString(),
                                  objectRow["CheckComment"].ToString(),
                                  objectRow["DealCurrency_Id"].GetInt(),
                                  _soapParser.BoolParse(objectRow["IsApprovedBySeller"]),
                                  _soapParser.BoolParse(objectRow["IsApprovedByBuyer"]),
                                  _soapParser.BoolParse(objectRow["IsApprovedByMe"]),
                                  _soapParser.BoolParse(objectRow["IsApprovedByPartner"]),
                                  _soapParser.BoolParse(objectRow["IsAccepted"]),
                                  objectRow["Price"].GetDouble(),
                                  objectRow["LiveTimeInHours"].GetInt(),
                                  objectRow["PaymentTimeInMinutes"].GetInt(),
                                  objectRow["Comment"].ToString(),
                                  objectRow["CloseDate"].GetNullableDateTime(),
                                  objectRow["CreateDate"].GetDateTime(),
                                  objectRow["ChangeDate"].GetDateTime(),
                                  objectRow["BuySell"].ToString() == "S" ? DealType.Sell : DealType.Buy,
                                  _soapParser.BoolParse(objectRow["IsMyDeal"]),
                                  _soapParser.BoolParse(objectRow["Blocked"]),
                                  objectRow["Pin"].GetInt(),
                                  objectRow["Account_Id"].GetNullableInt(),
                                  objectRow["Objects"].ToString()));
                }
            }

            return(new DataProviderModel <List <DealModel> >(result.ResultMessage, deals));
        }