Beispiel #1
0
        public JsonResult UpdateVoucher(TB_VOUCHERS voucher)
        {
            AjaxResultModel Result = new AjaxResultModel();

            try
            {
                if (Voucher_Service.Update(voucher))
                {
                    Result.Code   = 00;
                    Result.Result = "Thành công";
                }
                else
                {
                    Result.Code   = 1;
                    Result.Result = "Thao tác không thành công";
                }
            }
            catch (Exception Ex)
            {
                Result.Code   = 2000;
                Result.Result = "Có lỗi xảy ra. Vui lòng thử lại sau hoặc liên hệ với người quản trị.";
                CORE.Helpers.IOHelper.WriteLog(StartUpPath, IpAddress, "UpdatePassword :", Ex.Message, Ex.ToString());
            }

            return(Json(Result));
        }
Beispiel #2
0
        public JsonResult GetPrice(int serviceId, int serviceNum, string code = "", int menuId = 0, int num = 0)
        {
            AjaxResultModel Result = new AjaxResultModel();

            Result.Result = 0;

            try
            {
                TB_SERVICES s = Services_Service.GetById(serviceId);
                decimal     p = s.ServicePrice * serviceNum;

                if (!string.IsNullOrEmpty(code))
                {
                    TB_VOUCHERS v = Voucher_Service.GetByCode(code);
                    if (v != null && v.VoucherDateExpired.Date >= DateTime.Now.Date && v.VoucherState == "A")
                    {
                        if (v.VoucherType == "M")//Giảm tiền
                        {
                            p = p - v.VoucherNum;
                        }
                        else if (v.VoucherType == "P")//Giảm phần trăm
                        {
                            p = p * (100 - v.VoucherNum) / 100;
                        }
                    }
                }

                if (num > 0 && menuId > 0)
                {
                    TB_MENUS m = Menu_Service.GetById(menuId);
                    if (m != null)
                    {
                        p += m.MenuPrice * num;
                    }
                }

                Result.Code   = 000;
                Result.Result = string.Format("{0:N0}", p);
            }
            catch (Exception Ex)
            {
                Result.Code   = 2000;
                Result.Result = 0;
                CORE.Helpers.IOHelper.WriteLog(StartUpPath, IpAddress, "UpdatePassword :", Ex.Message, Ex.ToString());
            }

            return(Json(Result));
        }
Beispiel #3
0
        public PartialViewResult _ChiTiet(string voucherId = "")
        {
            List <TB_SERVICES> service = new List <TB_SERVICES>();
            int         height         = (int)(Request.Browser.ScreenPixelsHeight * 0.85);
            TB_VOUCHERS b = new TB_VOUCHERS();

            try
            {
                service = Services_Service.GetAll();
                b       = Voucher_Service.GetById(voucherId);
            }
            catch (Exception ex)
            {
                CORE.Helpers.IOHelper.WriteLog(StartUpPath, IpAddress, "Blogs/_List :", ex.Message, ex.ToString());
            }
            ViewBag.ListService = service;
            ViewBag.Voucher     = b;
            return(PartialView(height));
        }
Beispiel #4
0
 public bool Update(TB_VOUCHERS voucher)
 {
     return(new TB_VOUCHERSSql().Update(voucher));
 }
Beispiel #5
0
 public bool Insert(TB_VOUCHERS voucher)
 {
     return(new TB_VOUCHERSSql().Insert(voucher, true));
 }