public int SaveHotelRoom(string HotelRoomID, int HotelID, string RoomType, string RoomCount, string RoomSize, string RoomMaxPeopleCount, string RoomMaxChildrenCount, string BabyCotCount, string ExtraBedCount, string SmokingStatus, string ViewType, string Culture, string Description, Controller ctrl) { DBEntities insertentity = new DBEntities(); TB_HotelRoom hotelRoom = new TB_HotelRoom(); string culturecode = ""; if (HotelRoomID != string.Empty) { int HotelRoomIdValue = Convert.ToInt32(HotelRoomID); hotelRoom = db.TB_HotelRoom.Where(x => x.ID == HotelRoomIdValue).FirstOrDefault(); // hotelRoom = db.TB_HotelRoom.Where(x => x.ID == Convert.ToInt32(HotelRoomID)).FirstOrDefault(); // hotelRoom = (from room in DataContext.TB_HotelRoomswhere room.ID == HotelRoomID).Single; } hotelRoom.HotelID = Convert.ToInt32(HotelID); hotelRoom.RoomTypeID = Convert.ToInt32(RoomType); hotelRoom.RoomCount = Convert.ToInt32(RoomCount); hotelRoom.RoomSize = Convert.ToInt32(RoomSize); hotelRoom.MaxPeopleCount = Convert.ToInt16(RoomMaxPeopleCount); hotelRoom.MaxChildrenCount = Convert.ToInt16(RoomMaxChildrenCount); hotelRoom.BabyCotCount = Convert.ToInt16(CheckEmptyStringDBParameter(BabyCotCount, true)); hotelRoom.ExtraBedCount = Convert.ToInt16(CheckEmptyStringDBParameter(ExtraBedCount, true)); hotelRoom.ViewTypeID = (Nullable<int>)CheckEmptyStringDBParameter(ViewType, true); hotelRoom.SmokingTypeID = (Nullable<int>)CheckEmptyStringDBParameter(SmokingStatus, true); if (Description != string.Empty) { if(Culture == "1") { culturecode ="en"; } else if (Culture == "3") { culturecode = "de"; } else if (Culture == "4") { culturecode = "fr"; } else if (Culture == "10") { culturecode = "ar"; } else if (Culture == "6") { culturecode = "ru"; } else if (Culture == "8") { culturecode = "tr"; } SetColumn(hotelRoom, "Description_" + culturecode, Description); } hotelRoom.Active = true; hotelRoom.OpDateTime = DateTime.Now; hotelRoom.OpUserID = Convert.ToInt64(ctrl.Session["UserID"]); if (HotelRoomID == string.Empty) { hotelRoom.CreateDateTime = DateTime.Now; hotelRoom.CreateUserID = Convert.ToInt64(ctrl.Session["UserID"]); db.TB_HotelRoom.Add(hotelRoom); // db.SaveChanges(); // DataContext.TB_HotelRooms.InsertOnSubmit(hotelRoom); } db.SaveChanges(); // DataContext.SubmitChanges(); return hotelRoom.ID; }
public string GetdescriptionbyCulture(string Culture, string HotelRoomID) { TB_HotelRoom hotelRooms = new TB_HotelRoom(); string result=""; //string HotelRoomID = "7225"; //int HotelRoomIdValue = Convert.ToInt32(HotelRoomID); // result = db.TB_HotelRoom.Select("HotelRoomID=" + hotelRoomID + " AND DateID=" + dateID + "AND PricePolicyTypeID=" + PricePolicy)[0]; try { int HotelRoomIdValue = Convert.ToInt32(HotelRoomID); hotelRooms = db.TB_HotelRoom.Where(x => x.ID == HotelRoomIdValue).FirstOrDefault(); // hotelRooms."Description_" + Culture = result; if (Culture == "1") { result = hotelRooms.Description_en; } else if (Culture == "3") { result = hotelRooms.Description_de; } else if (Culture == "4") { result = hotelRooms.Description_fr; } else if (Culture == "10") { result = hotelRooms.Description_ar; } else if (Culture == "6") { result = hotelRooms.Description_ru; } else if (Culture == "8") { result = hotelRooms.Description_tr; } } catch { } return result; }