Ejemplo n.º 1
0
        public ActionResult AddItems(ProductPriceModels data)
        {
            ProductPriceModels model = new ProductPriceModels();

            model.OffSet         = data.currentItemOffset;
            model.Period         = data.Period;
            model.Price          = data.Price;
            model.IsActive       = data.IsActive;
            model.NamePeriodType = data.NamePeriodType + (data.Period > 1 ? "s" : "");
            model.PeriodType     = data.PeriodType;
            data.currentItemOffset++;
            return(PartialView("_ItemPrice", model));
        }
Ejemplo n.º 2
0
        public JsonResult GetDetailExtendPriceItem(string Id, ProductDetailModels model)
        {
            var _Product = new ProductPriceModels();

            try
            {
                if (model != null && model.ListPriceExtend != null && model.ListPriceExtend.Count > 0)
                {
                    _Product = model.ListPriceExtend.FirstOrDefault(x => x.ID == Id && x.IsExtend);
                }
            }
            catch (Exception ex)
            {
                NSLog.Logger.Error("GetDetailExtendPriceItem : ", ex);
            }
            return(Json(_Product));
        }
Ejemplo n.º 3
0
        public ActionResult AddEditPriceItem(ProductPriceModels ProductPrice, List <ProductPriceModels> ProductDetailModels)
        {
            try
            {
                if (ProductDetailModels == null)
                {
                    ProductDetailModels = new List <ProductPriceModels>();
                }

                var IsEdit = false;
                if (ProductPrice != null && !string.IsNullOrEmpty(ProductPrice.ID) &&
                    ProductDetailModels != null && ProductDetailModels.Count > 0)
                {
                    IsEdit = ProductDetailModels.Any(x => x.ID == ProductPrice.ID && !x.IsExtend);
                }

                if (IsEdit)
                {
                    ProductDetailModels.Where(x => x.ID == ProductPrice.ID && !x.IsExtend)
                    .Select(x => x).ToList()
                    .ForEach(x =>
                    {
                        x.Price      = ProductPrice.Price;
                        x.Period     = ProductPrice.Period;
                        x.PeriodType = ProductPrice.PeriodType;
                    });
                }
                else
                {
                    //ProductPrice.OffSet = model.ListPrice.Max(x => x.OffSet) + 1;
                    ProductPrice.ID       = Guid.NewGuid().ToString();
                    ProductPrice.IsExtend = false;
                    ProductPrice.IsActive = true;
                    ProductPrice.IsNew    = true;
                    ProductDetailModels.Add(ProductPrice);
                }
                ProductDetailModels model = new ProductDetailModels();
                model.ListPrice.AddRange(ProductDetailModels);
                return(PartialView("_ItemModalPriceItems", model));
            }catch (Exception e)
            {
                NSLog.Logger.Error("AddPriceItem :", e);
                return(new HttpStatusCodeResult(400, e.Message));
            }
        }
Ejemplo n.º 4
0
 public ProductApplyAdditionModels()
 {
     ListProduct      = new List <ProductApplyAdditionModels>();
     RecommendedPrice = new ProductPriceModels();
 }