public ArticlePricePartnersResponse Delete(ArticlePricePartners request)
        {
            Bm2s.Data.Common.BLL.Article.ArticlePricePartner item = Datas.Instance.DataStorage.ArticlePricePartners[request.ArticlePriceParner.Id];
              item.EndingDate = DateTime.Now;
              Datas.Instance.DataStorage.ArticlePricePartners[item.Id] = item;

              ArticlePricePartnersResponse response = new ArticlePricePartnersResponse();
              response.ArticlePricePartners.Add(request.ArticlePriceParner);
              return response;
        }
        public ArticlePricePartnersResponse Get(ArticlePricePartners request)
        {
            ArticlePricePartnersResponse response = new ArticlePricePartnersResponse();
              List<Bm2s.Data.Common.BLL.Article.ArticlePricePartner> items = new List<Data.Common.BLL.Article.ArticlePricePartner>();
              if (!request.Ids.Any())
              {
            items.AddRange(Datas.Instance.DataStorage.ArticlePricePartners.Where(item =>
              (request.PartnerId == 0 || item.PartnerId == request.PartnerId) &&
              (request.ArticleId == 0 || item.ArticleId == request.ArticleId) &&
              (!request.Date.HasValue || (request.Date >= item.StartingDate && (!item.EndingDate.HasValue || request.Date < item.EndingDate.Value)))
              ));
              }
              else
              {
            items.AddRange(Datas.Instance.DataStorage.ArticlePricePartners.Where(item => request.Ids.Contains(item.Id)));
              }

              var collection = (from item in items
                        select new Bm2s.Poco.Common.Article.ArticlePricePartner()
                        {
                          AddPrice = item.AddPrice,
                          Article = new ArticlesService().Get(new Articles() { Ids = new List<int>() { item.ArticleId } }).Articles.FirstOrDefault(),
                          EndingDate = item.EndingDate,
                          Id = item.Id,
                          Multiplier = Convert.ToDecimal(item.Multiplier),
                          Partner = new PartnersService().Get(new Partners() { Ids = new List<int>() { item.PartnerId } }).Partners.FirstOrDefault(),
                          Price = Convert.ToDecimal(item.Price),
                          StartingDate = item.StartingDate
                        }).AsQueryable().OrderBy(request.Order, !request.DescendingOrder);

              response.ItemsCount = collection.Count();
              if (request.PageSize > 0)
              {
            response.ArticlePricePartners.AddRange(collection.Skip((request.CurrentPage - 1) * request.PageSize).Take(request.PageSize));
              }
              else
              {
            response.ArticlePricePartners.AddRange(collection);
              }

              try
              {
            response.PagesCount = collection.Count() / response.ArticlePricePartners.Count + (collection.Count() % response.ArticlePricePartners.Count > 0 ? 1 : 0);
              }
              catch
              {
            response.PagesCount = 1;
              }

              return response;
        }
 public void Post()
 {
     this.Response = this.ConnectorHelper.Post(this.Request);
       this.IsFilled = true;
 }
 public void Delete()
 {
     this.Response = this.ConnectorHelper.Delete(this.Request);
       this.IsFilled = true;
 }
        public ArticlePricePartnersResponse Post(ArticlePricePartners request)
        {
            if (request.ArticlePriceParner.Id > 0)
              {
            Bm2s.Data.Common.BLL.Article.ArticlePricePartner item = Datas.Instance.DataStorage.ArticlePricePartners[request.ArticlePriceParner.Id];
            item.AddPrice = request.ArticlePriceParner.AddPrice;
            item.ArticleId = request.ArticlePriceParner.Article.Id;
            item.EndingDate = request.ArticlePriceParner.EndingDate;
            item.Multiplier = Convert.ToDouble(request.ArticlePriceParner.Multiplier);
            item.PartnerId = request.ArticlePriceParner.Partner.Id;
            item.Price = Convert.ToDouble(request.ArticlePriceParner.Price);
            item.StartingDate = request.ArticlePriceParner.StartingDate;
            Datas.Instance.DataStorage.ArticlePricePartners[request.ArticlePriceParner.Id] = item;
              }
              else
              {
            Bm2s.Data.Common.BLL.Article.ArticlePricePartner item = new Data.Common.BLL.Article.ArticlePricePartner()
            {
              AddPrice = request.ArticlePriceParner.AddPrice,
              ArticleId = request.ArticlePriceParner.Article.Id,
              EndingDate = request.ArticlePriceParner.EndingDate,
              Multiplier = Convert.ToDouble(request.ArticlePriceParner.Multiplier),
              PartnerId = request.ArticlePriceParner.Partner.Id,
              Price = Convert.ToDouble(request.ArticlePriceParner.Price),
              StartingDate = request.ArticlePriceParner.StartingDate
            };

            Datas.Instance.DataStorage.ArticlePricePartners.Add(item);
            request.ArticlePriceParner.Id = item.Id;
              }

              ArticlePricePartnersResponse response = new ArticlePricePartnersResponse();
              response.ArticlePricePartners.Add(request.ArticlePriceParner);
              return response;
        }