/// <summary> /// Lấy về danh Room theo class và type /// </summary> /// <param name="cruise"></param> /// <param name="roomClass"></param> /// <param name="roomType"></param> /// <returns></returns> public IList RoomGetBy_ClassType(Cruise cruise, RoomClass roomClass, RoomTypex roomType) { ICriteria criteria = _session.OpenSession().CreateCriteria(typeof(Room)); criteria.Add(Expression.Eq("RoomType", roomType)) .Add(Expression.Eq("RoomClass", roomClass)); if (cruise != null) { criteria.Add(Expression.Eq("Cruise", cruise)); } return(criteria.List()); }
public ActionResult <Cruise> Create([FromBody] Cruise newCruise) { try { Cruise created = _cservice.Create(newCruise); return(Ok(created)); } catch (System.Exception e) { return(BadRequest(e.Message)); } }
internal Cruise Edit(Cruise editCruise) { Cruise original = Get(editCruise.Id); original.Price = editCruise.Price > 0 ? editCruise.Price : original.Price; original.Destination = editCruise.Destination != null ? editCruise.Destination : original.Destination; original.Occupants = editCruise.Occupants > 0 ? editCruise.Occupants : original.Occupants; original.DepartureDate = editCruise.DepartureDate != null ? editCruise.DepartureDate : original.DepartureDate; original.ReturnDate = editCruise.ReturnDate != null ? editCruise.ReturnDate : original.ReturnDate; return(_repo.Edit(original)); }
public ActionResult <Cruise> Edit([FromBody] Cruise editCruise, int id) { try { editCruise.Id = id; return(Ok(_service.Edit(editCruise))); } catch (Exception e) { return(BadRequest(e.Message)); } }
public ActionResult <Cruise> Edit([FromBody] Cruise editData, int id) { try { editData.Id = id; Cruise editedCruise = _cservice.Edit(editData); return(Ok(editedCruise)); } catch (System.Exception e) { return(BadRequest(e.Message)); } }
internal Cruise Create(Cruise newCruise) { string sql = @" INSERT INTO cruises (price, destination, occupants, departuredate, returndate) VALUE (@Price, @Destination, @Occupants, @DepartureDate, @ReturnDate); SELECT LAST_INSERT_ID();"; int id = _db.ExecuteScalar <int>(sql, newCruise); newCruise.Id = id; return(newCruise); }
public async Task <IHttpActionResult> ActiveSubs() { Cruise cruise = await _cruiseRepository.GetActiveAsync(); if (null == cruise) { return(NotFound()); } SubCruise[] subCruises = await _cruiseRepository.GetSubCruisesAsync(cruise); return(this.OkCacheControl(subCruises, WebConfig.StaticDataMaxAge)); }
internal Cruise Edit(Cruise cruiseToEdit) { string sql = @" UPDATE cruises SET description = @Description, destination = @Destination, price = @Price WHERE id = @Id; SELECT * FROM cruises WHERE id = @Id;"; return(_db.QueryFirstOrDefault <Cruise>(sql, cruiseToEdit)); }
internal Cruise Edit(Cruise updated) { Cruise original = GetById(updated.Id); original.title = updated.title != null ? updated.title : original.title; original.description = updated.description != null ? updated.description : original.description; original.start = updated.start != null ? updated.start : original.start; original.end = updated.end != null ? updated.end : original.end; original.length = updated.length > 0 ? updated.length : original.length; original.price = updated.price > 0 ? updated.price : original.price; return(_repo.Edit(original)); }
internal Cruise Create(Cruise newCruise) { string sql = @" INSERT INTO Cruises (title, description, price) VALUES (@Title, @Description, @Price); SELECT LAST_INSERT_ID();"; int id = _db.ExecuteScalar <int>(sql, newCruise); newCruise.Id = id; return(newCruise); }
public ActionResult Create([Bind(Include = "Id,Name,DepartDate,DepartPort,ReturnDate,Destination,Seats,Price")] Cruise cruise) { ModelState.Clear(); TryValidateModel(cruise); if (ModelState.IsValid) { db.Cruises.Add(cruise); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(cruise)); }
public async Task <IHttpActionResult> Deleted() { Cruise activeCruise = await _cruiseRepository.GetActiveAsync(); if (null == activeCruise) { return(NotFound()); } DeletedBooking[] result = await _deletedBookingRepository.GetAllAsync(activeCruise); return(this.OkNoCache(result)); }
internal Cruise Create(Cruise newCruise) { string sql = @" INSERT INTO cruise (location, price) VALUES (@Location, @Price); SELECT LAST_INSERT_ID();"; int id = _db.ExecuteScalar <int>(sql, newCruise); newCruise.Id = id; return(newCruise); }
public ActionResult bookCruise(int id) { Cruise cruise = db.Cruise.Find(id); List <SelectListItem> s = new StateController().stateRooms_().ToList(); var q = new StateController().getNumPeople(); ViewBag.cruiseName = cruise.cruise_name; ViewBag.cruiseDeparture = cruise.cruise_start_date; ViewBag.stateRooms = s; ViewBag.quantity = q; return(View()); }
public Cruise Edit(Cruise newCruise) { string sql = @" UPDATE cruises SET days = @Days, dailycharge = @DailyCharge, location = @Location WHERE id = @Id; SELECT * FROM cruises WHERE id = @Id"; return(_db.QueryFirstOrDefault <Cruise>(sql, newCruise)); }
internal Cruise Create(Cruise newCruise) { string sql = @" INSERT INTO cruises (ports) VALUES (@Ports); SELECT LAST_INSERT_ID();"; int id = _db.ExecuteScalar <int>(sql, newCruise); newCruise.Id = id; return(newCruise); }
public async Task <IActionResult> Post([FromBody] Models.Request.CreateCruise cruises) { Cruise cru = new Cruise() { nid = cruises.nid, rId = 0, cabinType = cruises.cabinType, shipId = cruises.shipId, departureDate = cruises.departureDate, isFlight = cruises.isFlight }; var response = await _createCruiseUseCase.HandleAsync(new CreateCruiseRequest() { cruise = cru }, _createCruisePresenter); return(Ok(response)); }
public ActionResult PriceList(PriceList model) { Cruise cruise = db.Cruises.Include(c => c.cruiseArrangements).Include(c => c.cruisePlans).FirstOrDefault(c => c.Id == model.CruiseId); CruiseArrangement krstTermini = new CruiseArrangement(); krstTermini.date = model.date; krstTermini.InsideCabin = model.InsideCabins; krstTermini.BalconyCabin = model.BalconyCabins; krstTermini.OceanViewCabin = model.OcenViewCabins; db.SaveChanges(); cruise.cruiseArrangements.Add(krstTermini); db.SaveChanges(); return(RedirectToAction("Details", new { id = model.CruiseId })); }
public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Cruise cruise = db.Cruises.Find(id); if (cruise == null) { return(HttpNotFound()); } return(View(cruise)); }
protected void rptCruises_OnItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.DataItem is Cruise) { Cruise cruise = (Cruise)e.Item.DataItem; HyperLink hplCruise = e.Item.FindControl("hplCruise") as HyperLink; if (hplCruise != null) { hplCruise.Text = cruise.Name; hplCruise.NavigateUrl = string.Format("IvRoleCruiseList.aspx?NodeId={0}&SectionId={1}&cruiseid={2}", Node.Id, Section.Id, cruise.Id); } } }
public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Cruise cruise = db.Cruises.Include(c => c.krstPlan).Include(c => c.krstTermini).FirstOrDefault(c => c.Id == id); if (cruise == null) { return(HttpNotFound()); } return(View(cruise)); }
public ActionResult Cenovnik(Cenovnik model) { Cruise cruise = db.Cruises.Include(c => c.krstTermini).Include(c => c.krstPlan).FirstOrDefault(c => c.Id == model.CruiseId); KrstTermini krstTermini = new KrstTermini(); krstTermini.date = model.date; krstTermini.ProzorkaKabina = model.ProzorskaKabina; krstTermini.VnatresnaKabina = model.VnatresnaKabina; krstTermini.BalkonskaKabina = model.BalkonskaKabina; db.SaveChanges(); cruise.krstTermini.Add(krstTermini); db.SaveChanges(); return(RedirectToAction("Details", new { id = model.CruiseId })); }
protected void Page_Load(object sender, EventArgs e) { if (!PermissionUtil.UserCheckPermission(UserIdentity.Id, (int)PermissionEnum.VIEW_HOME_PLAN)) { ShowErrors("You don't have permission to perform this action"); return; } _cruises = Module.CruiseGetByUser(UserIdentity); var cruiseId = Request["cruiseId"]; if (!string.IsNullOrWhiteSpace(cruiseId)) { _currentCruise = _cruises.FirstOrDefault(c => c.Id == Convert.ToInt32(cruiseId)); } else if (_cruises != null && _cruises.Count > 0) { _currentCruise = _cruises.FirstOrDefault(); } if (!IsPostBack) { var dateStr = Request["date"]; if (!string.IsNullOrWhiteSpace(dateStr)) { txtStartDate.Text = dateStr; } else { txtStartDate.Text = DateTime.Now.ToString("dd/MM/yyyy"); } } _currentDate = DateTime.ParseExact(txtStartDate.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture); if (_currentCruise != null && _currentCruise.Id > 0) { _roomCruises = Module.RoomGetAll2(_currentCruise); _currentDayBookings = Module.GetBookingByDate(_currentDate, _currentCruise); _nextDayBookings = Module.GetBookingByDate(_currentDate.AddDays(1), _currentCruise); _allBooking = _currentDayBookings.Concat(_nextDayBookings).ToList(); ShowEmptyRoomDay(_currentDate, litCurrentRooms, true); } if (!IsPostBack) { GetDataRoomInFloor(); rptCruises.DataSource = _cruises; rptCruises.DataBind(); } }
// GET: Cruises/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Cruise cruise = db.Cruises.Include(m => m.cruisePlans).Include(m => m.cruiseArrangements).FirstOrDefault(m => m.Id == id); if (cruise == null) { return(HttpNotFound()); } return(View(cruise)); }
public IHttpActionResult DeleteCruise(int id) { Cruise cruise = db.Cruises.Find(id); if (cruise == null) { return(NotFound()); } db.Cruises.Remove(cruise); db.SaveChanges(); return(Ok(cruise)); }
internal Cruise Create(Cruise newCruise) { string sql = @" INSERT INTO cruise (title, description, start, end, length, price) VALUES (@Title, @Description, @Start, @End, @Length, @Price); SELECT LAST_INSERT_ID(); "; int id = _cb.ExecuteScalar <int>(sql, newCruise); newCruise.Id = id; return(newCruise); }
internal Cruise Create(Cruise newCruise) { string sql = @" INSERT INTO cruises (id, price, days, startDestination, category) Values (@Id, @Price, @Days, @StartDestination, @Category); SELECT LAST_INSERT_ID(); "; int id = _db.ExecuteScalar <int>(sql, newCruise); newCruise.Id = id; return(newCruise); }
/// <summary> /// Kiểm tra số phòng của tàu với số phòng còn trống của tàu. /// </summary> /// <param name="cruise"></param> /// <param name="roomAvaiable"></param> /// <returns>True tàu còn trống tất cả các phòng False tàu đã có booking</returns> public bool CheckCruiseForCharter(Cruise cruise, int roomAvaiable) { if (cruise != null) { int roomOfCruise = Module.CountObjet <Room>(Expression.And(Expression.Eq("Cruise", cruise), Expression.Eq("Deleted", false))); return(roomOfCruise == roomAvaiable); } else { throw new Exception("cruise = null"); } }
public IQueryOver <Booking, Booking> BookingGetByCriterion(DateTime?date, Cruise cruise) { var query = _session.QueryOver <Booking>().Where(x => x.Deleted == false); if (date != null) { query = query.Where(x => x.StartDate == date); } if (cruise != null) { query = query.Where(x => x.Cruise == cruise); } query = query.Where(x => x.Deleted == false); return(query); }
protected override void Page_Load(object sender, EventArgs e) { //if (!UserIdentity.HasPermission(AccessLevel.Administrator)) //{ // ShowErrors("You don't have permission to view this info, please go away"); // return; //} if (AllCruises.Count == 1 && Request.QueryString["cruiseid"] == null) { Cruise cruise = (Cruise)AllCruises[0]; PageRedirect(string.Format("BookingReportPeriod.aspx?NodeId={0}&SectionId={1}&cruiseid={2}", Node.Id, Section.Id, cruise.Id)); } _util = new RoomUtil(Module); base.Page_Load(sender, e); }
public void AddToCruises(Cruise cruise) { base.AddObject("Cruises", cruise); }
public static Cruise CreateCruise(int cruiseID, global::System.DateTime startDate, bool currentTrip) { Cruise cruise = new Cruise(); cruise.CruiseID = cruiseID; cruise.StartDate = startDate; cruise.CurrentTrip = currentTrip; return cruise; }