public ICollection <DateProductPriceVm> GenerateProductPrice(ProductPriceParam param)
        {
            List <DateProductPriceVm> Ldp = new List <DateProductPriceVm>();
            var produncts = GetProduct();

            for (DateTime date = param.DatePickerFrom; date <= param.DatePickerTo; date = date.AddDays(1.0))
            {
                foreach (var prd in produncts)
                {
                    DateProductPriceVm dp = new DateProductPriceVm();
                    dp.PricingDate     = date;
                    dp.ProductId       = prd.ProductId;
                    dp.ProductName     = prd.ProductName;
                    dp.FirstSlotPrice  = param.FirstSlotPrice;
                    dp.SecondSlotPrice = param.SecondSlotPrice;

                    Ldp.Add(dp);
                }
            }
            //var dateDiff = (param.DatePickerTo - param.DatePickerFrom);
            //for (int i = 0; i < dateDiff.TotalDays; i++)
            //{
            //


            //}
            return(Ldp);
        }
        public ICollection <DateProductPriceVm> DateProductPriceSearch(ProductPriceParam param)
        {
            var quary = string.Format(@"select ProductPriceTemp.ProductPriceId,ProductPriceTemp.PricingDate,ProductPriceTemp.FirstSlotPrice,ProductPriceTemp.SecondSlotPrice,ProductInformation.ProductName
            from ProductPriceTemp   left join ProductInformation on ProductPriceTemp.ProductId = ProductInformation.ProductId 
        where ProductPriceTemp.PricingDate between '{0}' and  '{1}' order by ProductPriceTemp.PricingDate ", param.DatePickerFrom, param.DatePickerTo);

            return(new Data <DateProductPriceVm>(_connection).DataSource(quary));
        }
示例#3
0
        public string AddDateProductPrice(List <ProductPriceTemp> tmpProd, ProductPriceParam param)
        {
            string res = "";

            try
            {
                var data = _unitOfWork.ProductPriceTemp.GetProductPriceTemp(param);
                if (data != null)
                {
                    foreach (var item in tmpProd)
                    {
                        var tmpPrice = data.Find(s => s.PricingDate.Equals(item.PricingDate));
                        if (tmpPrice != null)
                        {
                            item.ProductPriceId  = tmpPrice.ProductPriceId;
                            item.FirstSlotPrice  = tmpPrice.FirstSlotPrice;
                            item.SecondSlotPrice = tmpPrice.SecondSlotPrice;
                        }
                    }
                    //_repository.Remove(item);
                }

                // _mapper.Map(tmpProd)

                foreach (var tmpPro in tmpProd)
                {
                    if (tmpPro.ProductPriceId == 0)
                    {
                        _unitOfWork.ProductPriceTemp.Add(tmpPro);
                    }
                    else
                    {
                        //var tmp = _mapper.Map<ProductPriceTemp>(tmpPro);

                        _unitOfWork.ProductPriceTemp.Update(tmpPro);
                    }
                }
                _unitOfWork.Commit();

                res = "Success";
            }
            catch (Exception ex)
            {
                res = ex.Message;
            }


            return(res);
        }
 public IActionResult GenerateProductPrice(ProductPriceParam param)
 {
     return(Ok(_dateProductPriceServices.GenerateProductPrice(param)));
 }
 public IActionResult DateProductPriceSearch(ProductPriceParam param)
 {
     return(Ok(_dateProductPriceApproveUnApproveServices.DateProductPriceSearch(param)));
 }
 public List <ProductPriceTemp> GetProductPriceTemp(ProductPriceParam param)
 {
     return(new Data <ProductPriceTemp>(_connection).DataSource(string.Format("Select * from ProductPriceTemp where PricingDate between '{0}' and '{1}' ", param.DatePickerFrom, param.DatePickerTo)));
 }
 public ICollection <DateProductPriceVm> DateProductPriceSearch(ProductPriceParam param)
 {
     return(_repository.DateProductPriceSearch(param));
 }
示例#8
0
 public ICollection <DateProductPriceVm> GenerateProductPrice(ProductPriceParam param)
 {
     return(_repository.GenerateProductPrice(param));
 }