Example #1
0
        //
        // GET: /Guarantee/Details/5

        //public ActionResult Details(int id = 0)
        //{
        //    GuaranteeRule guaranteerule = db.hotel.Find(id);
        //    if (guaranteerule == null)
        //    {
        //        return HttpNotFound();
        //    }
        //    return View(guaranteerule);
        //}

        //
        // GET: /Guarantee/Create

        public ActionResult MyGuarantee(string id)
        {
            GetData(id);
            setName();
            GuaranteeRule guaranteeRule = new GuaranteeRule();
            guaranteeRule.ChangeRule = 1;
            guaranteeRule.GuaranteeType = "FirstNightCost";
            return View(guaranteeRule);
        }
Example #2
0
        public void GetData(string id)
        {
            string u_id = "test1";
            int hotel_id;
            int.TryParse(id, out hotel_id);
            var hotels = new HotelInfoHelp().getHotlList(u_id);
            if(id==null &&hotels.Count>0)
                hotel_id = hotels[0].hotel_id;
         
            ViewData["hotels"] = hotels;
            //所有酒店列表
            ViewData["rooms"] = help.HotelInfoHelp.getRooms(hotel_id);

            //所有酒店对应的房型列表

            ViewData["Gurarantees"] = new GuaranteeRule().GuraranteeList(hotel_id);
            ViewBag.Id = hotel_id;
        }
Example #3
0
 public ActionResult Edit(GuaranteeRule guaranteerule)
 {
     if (ModelState.IsValid)
     {
         db.Entry(guaranteerule).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(guaranteerule);
 }
Example #4
0
        public ActionResult Create(GuaranteeRule guaranteerule)
        {

            setName();
            using (db = new HotelDBContent())
            {
                if (guaranteerule.id > 0)
                {

                    db.Entry(guaranteerule).State = EntityState.Modified;
                }
                else
                {
                    Hotel_room_RP_info ratePlan = new Hotel_room_RP_info();
                    ratePlan.hotel_id = guaranteerule.hotel_id;
                    ratePlan.h_room_rp_name_cn = "标准价";
                    int ratePlanId = help.HotelInfoHelp.getRatePlanId(ratePlan);
                    // var rp=(from r in db.rps where r.hotel_id==guaranteerule.hotel_id && r.h_room_rp_state==true && r.h_room_rp_name_cn=="标准价"select r.h_room_rp_id).SingleOrDefault();

                    guaranteerule.h_room_rp_id = ratePlanId;
                    if (ModelState.IsValid)
                    {
                        db.gu.Add(guaranteerule);


                    }
                    db.SaveChanges();
                }
               
            }
            GetData(guaranteerule.hotel_id.ToString());
          
            return View("MyGuarantee", new GuaranteeRule() { GuaranteeType = "FirstNightCost",ChangeRule=1 });
        }