Esempio n. 1
0
        public static string TinhToanGiaTienSauKhiGiam(shSetSize first, shSetSize last)
        {
            string price = string.Empty;

            decimal _price = default(decimal);

            if (first != null)
            {
                if (first.PriceCurrent == null)
                {
                    first.PriceCurrent = 0;
                }
                else
                {
                    shSaleService _sale = new shSaleService();
                    shSale        sale  = _sale.ChuongTrinhKhuyenMaiHienTai(DateTime.Now);

                    _price = _sale.TinhToanSoTienKhuyenMaiCuaSanPham(DateTime.Now, first.ProductGuid, first.SizeGuid);
                }
            }
            if (_price > 0)
            {
                return(_price.ToString());
            }
            else
            {
                return(string.Empty);
            }
        }
Esempio n. 2
0
        public ActionResult Create(string id)
        {
            shSaleService _sale = new shSaleService();
            shSale        sale  = _sale.FindByKey(id);

            if (sale != null)
            {
            }
            else
            {
                sale = new shSale();
            }

            ViewBag.Status    = new SelectList(SaleHelper.DanhsachTrangThaiKhuyenMai(), "Value", "Text", sale.SaleStatus);
            ViewBag.KhuyenMai = new SelectList(SaleHelper.DanhsachCachTinhGiaTriKhuyenMai(), "Value", "Text", sale.CachTinhGiaTriKhuyenMai);

            return(View(new shSale()));
        }
Esempio n. 3
0
        public ActionResult Create(string SaleGuid, string SaleName,
                                   string SaleCode, int?SaleStatus, string Description,
                                   string StartTime, string EndTime, int?CachTinhGiaTriKhuyenMai,
                                   decimal?Percent, double?USD, int?DieuKienApDung,
                                   string[] CagegoryChild,
                                   string[] ProductGuid1)
        {
            using (var context = new ShopOnlineDb())
            {
                using (var dbContextTransaction = context.Database.BeginTransaction())
                {
                    try
                    {
                        shSaleService _sale = new shSaleService();
                        shSale        sale  = _sale.ThemMoi_CapNhatKhuyenMai(
                            SaleGuid,
                            SaleName,
                            SaleCode,
                            SaleStatus,
                            Description,
                            StartTime,
                            EndTime,
                            CachTinhGiaTriKhuyenMai,
                            Percent,
                            USD,
                            DieuKienApDung,
                            CagegoryChild,
                            ProductGuid1,
                            User.Identity.GetUserLogin().Userid,
                            true,
                            DateTime.Now);

                        dbContextTransaction.Commit();
                    }
                    catch (Exception ex)
                    {
                        dbContextTransaction.Rollback();
                    }
                }
            }

            return(RedirectToAction("Index"));
        }