protected object GetBOFacilities(bool update = false) { IBusinessObjects BOFacilities = (IBusinessObjects)this.Session["Facilities"]; if (BOFacilities == null || !(BOFacilities is Facilities) || update) { Session["Facilities"] = null; BOFacilities = (IBusinessObjects)Facilities.GetFacilities(); this.Session["Facilities"] = BOFacilities; } if (BOFacilities == null || BOFacilities.Count == 0) BOFacilities = new Facilities(); return BOFacilities; }
public IOrderedEnumerable<string> FacAdminFacilityLoad() { IBusinessObjects BOFacilities = (IBusinessObjects)this.Session["Facilities"]; if (BOFacilities == null || !(BOFacilities is Facilities)) { Session["Facilities"] = null; BOFacilities = (IBusinessObjects)Facilities.GetFacilities(); this.Session["Facilities"] = BOFacilities; } if (BOFacilities == null || BOFacilities.Count == 0) BOFacilities = new Facilities(); var facilityList = (from c in (Facilities)Session["Facilities"] where !c.Facility_Name.Contains(".ALL ") select c.Facility_Name + "|" + c.DMPK_Facility).Distinct().OrderBy(name => name); return facilityList; }
protected void FacilitySearch(DropDownList ddl, Facilities BOFacilties, bool where = false) { if (where) { var dataSource = (from c in BOFacilties where !c.Facility_Name.Contains(".ALL") select c); ddl.DataSource = dataSource; } else { var dataSource = (from c in BOFacilties where !c.Facility_Name.Contains(".ALL") select new { c.Facility_Name, c.DMPK_Facility }); ddl.DataSource = dataSource; } ddl.DataTextField = "Facility_Name"; ddl.DataValueField = "DMPK_Facility"; ddl.DataBind(); }
static void Main(string[] args) { FacilitiesController controller = new FacilitiesController(); string menuString = "++++++++++++++++++Hotel Rest Service+++++++++++++++++\n" + "1. Create \n" + "2. Read \n" + "3. Update\n" + "4. Delete \n" + "0. Exit \n" + "Choose a number: "; Console.WriteLine(menuString); int input = int.Parse(Console.ReadLine()); while (input != 0) { switch (input) { case 1: Facilities facilities = new Facilities(); Console.WriteLine("Please assign a Hotel number"); facilities.Hotel_No = Convert.ToInt32(Console.ReadLine()); Console.WriteLine( "Is there a Swimming Pool? true/false"); facilities.SwimmingPool = Convert.ToBoolean(Console.ReadLine()); Console.WriteLine( "Is there a Table Tennis table? true/false"); facilities.TableTennis = Convert.ToBoolean(Console.ReadLine()); Console.WriteLine("Is there a Pool Table? true/false"); facilities.PoolTable = Convert.ToBoolean(Console.ReadLine()); Console.WriteLine("Is there a Bar? true/false"); facilities.Bar = Convert.ToBoolean(Console.ReadLine()); controller.Post(facilities); controller.Get(facilities.Hotel_No); break; case 2: controller.Get().ForEach(Console.WriteLine); break; case 3: Facilities u = new Facilities(); Console.WriteLine("Please assign a Hotel number"); u.Hotel_No = Convert.ToInt32(Console.ReadLine()); Console.WriteLine( "Is there a Swimming Pool? true/false"); u.SwimmingPool = Convert.ToBoolean(Console.ReadLine()); Console.WriteLine( "Is there a Table Tennis table? true/false"); u.TableTennis = Convert.ToBoolean(Console.ReadLine()); Console.WriteLine("Is there a Pool Table? true/false"); u.PoolTable = Convert.ToBoolean(Console.ReadLine()); Console.WriteLine("Is there a Bar? true/false"); u.Bar = Convert.ToBoolean(Console.ReadLine()); controller.Put(u.Hotel_No, u); controller.Get(u.Hotel_No); break; case 4: Console.WriteLine("Please Choose a Hotel number to Delete"); int deleteInput = int.Parse(Console.ReadLine()); controller.Delete(deleteInput); controller.Get(); break; default: Console.WriteLine("Try again!"); break; } Console.WriteLine(menuString); input = int.Parse(Console.ReadLine()); Console.Clear(); } }
public IActionResult AddFacilities([FromBody] Facilities facilities) { _context.Facilities.Add(facilities); _context.SaveChanges(); return(Ok(facilities)); }
// PUT: api/Guests/5 public bool Put(int id, [FromBody] Facilities facility) { return(manager.Put(id, facility)); }
// POST: api/Guests public bool Post([FromBody] Facilities facility) { return(manager.Post(facility)); }
public async Task <string> Handle(SubmitInvoiceCommand request, CancellationToken cancellationToken) { InvoiceRequestDTO dto = request.Request; try { dto.ValidateObject("La request no puede ser null"); LocalValidations(dto); } catch (Exception ex) { throw new Exception(ex.Message); } Facilities buyer = new Facilities(); if (dto.BuyerEU.Value == 1) { var res = _facilityService.GetFacilityById(dto.BuyerID); if (res.Result != null) { buyer = res.Result; } else { throw new Exception("No existe este FID europeo"); } } else { var res = _facilityService.GetFacilityByFacility(dto.BuyerName, dto.BuyerCountry, dto.BuyerCity, dto.BuyerAddress, dto.BuyerZipCode); if (res.Result != null) { buyer = res.Result; } else { throw new Exception("No existe este Facility"); } } if (buyer.Id != null) { List <SerialsDB> serials = new List <SerialsDB>(); foreach (var s in dto.Serials) { if (s != "" && s != null && s != "[]") { serials.Add(new SerialsDB { Serial = s }); } } var invoice = new InvoicesDB { Id = Int32.Parse(dto.Id), InvoiceDate = dto.InvoiceDate.DateTime, Price = Convert.ToDouble(dto.Price), Currency = dto.Currency, BuyerId = buyer.Id, BuyerEU = Convert.ToBoolean(dto.BuyerEU.Value) }; try { var added = _invoicesRepository.Add(invoice, serials).Result; return(added.Id.ToString()); } catch (Exception ex) { throw new Exception(ex.Message); } } else { throw new Exception("Error al crer la factura"); } }
protected override void Seed(MirasolContext context) { Address address1 = context.Addresses.Add(new Address() { Id = 1, City = "Marbella", HouseNr = 1, StreetName = "Imginary street", ZipCode = 56000 }); Address address2 = context.Addresses.Add(new Address() { Id = 2, City = "Torrox", HouseNr = 1, StreetName = "Imginary street", ZipCode = 56000 }); Address addressKlaus = context.Addresses.Add(new Address() { Id = 3, City = "Esbjerg", Country = "Denmark", HouseNr = 46, Floor = 3, StreetName = "Strandbygade", ZipCode = 6700, }); Prices pricePuntaDelFaro = context.Prices.Add(new Prices() { Id = 1, BeachTowels = 5, FinalCleaning = 80, LinenAndTowels = 12, LowSeason = 530, MidSeason = 695, HighSeason = 895 }); Prices priceCalaceite = context.Prices.Add(new Prices() { Id = 2, FinalCleaning = 85, LowSeason = 395, MidSeason = 495, HighSeason = 595 }); Facilities facility1 = context.Facilities.Add(new Facilities() { Id = 1, Inside = "Wi-Fi, air conditioning, heating, tv, intercom, iron, ironing board", Kitchen = "Dishwasher, freezer, refridgerator, coffee machine, washing machine, dryer, hob, microwave, oven, kettle, toaster", Bathroom = "Shower, bath tub, hair dryer", Beds = "1 Double bed", Views = "Sea views, mountain views, pool views", SuitableFor = "Suitable for the elderly, pets not allowed, no smoking inside, car necessary", }); Facilities facility2 = context.Facilities.Add(new Facilities() { Id = 2, Inside = "Wi-fi, air conditioning, heating, tv, intercom, iron, ironing board", Kitchen = "Dishwasher, freezer, refridgerator, coffee machine, washing machine, dryer, hob, oven, kettle, toaster", Bathroom = "Shower, bath tub, hair dryer", Beds = "2 double beds (1 extra mattress)", Views = "Sea views, mountan views, pool views", SuitableFor = "Suitable for the elderly, pets not allowed, no smoking inside, car necessary" }); Facilities facility3 = context.Facilities.Add(new Facilities() { Id = 3, Inside = "Wi-fi, air conditioning, heating, washing machine, tv, intercom, iron, ironing board", Kitchen = "Dishwasher, freezer, refridgerator, coffee machine, hob, oven, kettle, toaster", Bathroom = "Jacuzzi, shower, bath tub, hair dryer", Beds = "2 double beds", Views = "Sea views, mountain views, pool views", SuitableFor = "Wheelchair accessible, suitable for the elderly, pets not allowed, no smoking inside, car not neccessary", Notes = "There is sleeping accomodation for 2 extra people on air mattress in the living room" }); Facilities facility4 = context.Facilities.Add(new Facilities() { Id = 4, General = "Linen provided, towels provided", Outside = "Shared pool, outside jacuzzi, garden, terrace, terrace furniture, sunbeds, barbeque, parking, private parking, garage, lift", Inside = "Wi-fi, sattelite, air conditioning, heating, washing machine, tv, iron, ironing board, children's high chair, cradle", Kitchen = "Dishwasher, freezer, refridgerator, coffee machine, hob, oven, kettle, toaster", Bathroom = "Shower, bath tub, hair dryer", Beds = "2 double beds", Views = "Sea views, mountain views, pool views", SuitableFor = "pets not allowed, no smoking inside, car not ncessary" }); Facilities facility5 = context.Facilities.Add(new Facilities() { Id = 5, General = "Linen provided, towels included", Outside = "Shared pool, private pool, roof terrace, garden, terrace, terrace furniture, parking, private parking, garage, lift", Inside = "Wi-Fi, air conditioning, heatin, washing machine, tv, tumble dryer, ceiling fan, intercom, iron, ironing board, children's high chair, cradle", Kitchen = "Dishwasher, freezer, refridgerator, coffee machine, hob, microwave, oven, toaster", Bathroom = "Shower, bath tub, hair dryer", Beds = "1 double bed, 4 single beds", SuitableFor = "Pets not allowed, no smoking inside, car not necessary" }); Facilities facility6 = context.Facilities.Add(new Facilities() { Id = 6, General = "Linen provided, towels provided", Outside = "Shared pool, outside jacuzzi, roof terrace, terrace, terrace furniture, sunbeds, barbeque, parking, private parking, garage, lift", Inside = "Wi-Fi, sattelite, air conditioning, heating, dvd player, washing machine, tv, intercom, iron, ironing board, children's high chair, cradle", Kitchen = "Dishwasher, freezer, refridgerator, coffee machine, hob, microwave, oven, blender, toaster", Bathroom = "Jacuzzi, shower, bath tub, hair dryer", Beds = "4 single beds, 2 sofa beds", Views = "Sea views, mountain views, pool views", SuitableFor = "Pets not allowed, no smoking inside, car not necessary" }); User user1 = context.Users.Add(new User() { Id = 1, Address = addressKlaus, Email = "*****@*****.**", Name = "Klaus Gaarde", Password = "******" }); Apartment apartment1 = context.Apartments.Add(new Apartment() { Address = address2, Bedrooms = 1, Sleeps = 2, Bathrooms = 1, LivingArea = 70, Terrace = 55, WiFi = true, Balcony = true, Garden = true, TerraceFurniture = true, AirCondition = true, Heating = true, Prices = priceCalaceite, Facilities = facility1, Name = "1202" }); Apartment apartment2 = context.Apartments.Add(new Apartment() { Address = address2, Bedrooms = 2, Bathrooms = 2, Sleeps = 5, LivingArea = 90, Terrace = 24, SharedPool = true, WiFi = true, Balcony = true, Garden = true, TerraceFurniture = true, AirCondition = true, Heating = true, Facilities = facility2, Prices = priceCalaceite, Name = "5332" }); Apartment apartment3 = context.Apartments.Add(new Apartment() { Address = address1, Bedrooms = 2, Sleeps = 4, Bathrooms = 2, LivingArea = 90, Terrace = 30, SharedPool = true, WiFi = true, Balcony = true, Garden = true, TerraceFurniture = true, AirCondition = true, Heating = true, Facilities = facility3, Prices = pricePuntaDelFaro, Name = "13436" }); Apartment apartment4 = context.Apartments.Add(new Apartment() { Address = address1, Bedrooms = 2, Sleeps = 4, Bathrooms = 2, LivingArea = 80, Terrace = 72, SharedPool = true, OutsideJacuzzi = true, WiFi = true, Garden = true, TerraceFurniture = true, Satellite = true, AirCondition = true, Facilities = facility4, Prices = pricePuntaDelFaro, Name = "19946" }); Apartment apartment5 = context.Apartments.Add(new Apartment() { Address = address1, Bedrooms = 3, Sleeps = 7, Bathrooms = 2, Toilets = 1, LivingArea = 120, Terrace = 40, SharedPool = true, PrivatePool = true, WiFi = true, RoofTerrace = true, Garden = true, TerraceFurniture = true, Facilities = facility5, Prices = pricePuntaDelFaro, Name = "22176" }); Apartment apartment6 = context.Apartments.Add(new Apartment() { Address = address1, Bedrooms = 3, Sleeps = 6, Bathrooms = 2, LivingArea = 80, Terrace = 72, SharedPool = true, OutsideJacuzzi = true, WiFi = true, RoofTerrace = true, Garden = true, TerraceFurniture = true, Satellite = true, Facilities = facility6, Prices = pricePuntaDelFaro, Name = "17576" }); Apartment apartment7 = context.Apartments.Add(new Apartment() { Address = address1, Bedrooms = 2, Sleeps = 6, Bathrooms = 2, LivingArea = 80, Terrace = 72, SharedPool = true, OutsideJacuzzi = true, WiFi = true, RoofTerrace = true, Garden = true, TerraceFurniture = true, Satellite = true, Prices = pricePuntaDelFaro, Name = "22711" }); Bookings booking1 = context.Bookings.Add(new Bookings() { Id = 1, Apartment = apartment1, EndDate = new DateTime(2015, 10, 10), StartDate = new DateTime(2015, 10, 17), User = user1, }); base.Seed(context); }
/// <summary> /// 添加租房信息 /// </summary> /// <param name="lease"></param> /// <param name="facilities"></param> /// <returns></returns> public ActionResult AddLease(Lease lease, string[] list) { Facilities fcs = new Facilities() { FacilitiesWashing = 0, Facilitiesairconditioner = 0, Facilitieswardrobe = 0, FacilitiesTV = 0, FacilitiesRefrigerator = 0, FacilitiesBed = 0, FacilitiesWIFI = 0, FacilitiesNaturalgas = 0, FacilitiesHeater = 0, FacilitiesHeating = 0 }; foreach (var item in list) { if (item == "FacilitiesWashing") { fcs.FacilitiesWashing = 1; } if (item == "Facilitiesairconditioner") { fcs.Facilitiesairconditioner = 1; } if (item == "Facilitieswardrobe") { fcs.Facilitieswardrobe = 1; } if (item == "FacilitiesTV") { fcs.FacilitiesTV = 1; } if (item == "FacilitiesRefrigerator") { fcs.FacilitiesRefrigerator = 1; } if (item == "FacilitiesBed") { fcs.FacilitiesBed = 1; } if (item == "FacilitiesWIFI") { fcs.FacilitiesWIFI = 1; } if (item == "FacilitiesNaturalgas") { fcs.FacilitiesNaturalgas = 1; } if (item == "FacilitiesHeater") { fcs.FacilitiesHeater = 1; } if (item == "FacilitiesHeating") { fcs.FacilitiesHeating = 1; } } int id = 0; int a = bLL.LeaseAdd(lease); if (a == 1) { id = bLL.Last2()[0].LeaseID; Session["int"] = id; } else { return(Content("<script>alert('该房屋已经上传');history.go(-1)</script>")); } //添加商品图片 if (Request.Files.Count > 0) { string[] fileTypeStr = { "image/gif", "image/png", "image/jpeg", "image/jpg", "image/bmp" }; List <string> strlist = new List <string>(); for (int i = 0; i < Request.Files.Count; i++) { if (fileTypeStr.Contains(Request.Files[i].ContentType)) { string fileName = Path.GetFileName(Request.Files[i].FileName); strlist.Add(fileName); } } if (bLL.AddLImg(id, strlist)) { //保存文件 //应用程序需要有服务器UploadFile文件夹的读写权限 for (int i = 0; i < Request.Files.Count; i++) { Request.Files[i].SaveAs(Server.MapPath("~/Content/Selling/" + Request.Files[i].FileName)); } } } //添加配套设施 int b = bLL.FacilitiesAdd(fcs, id); if (b == 1) { return(Content("<script>alert('添加成功');history.go(-1)</script>")); } else { return(Content("<script>alert('添加失败');history.go(-1)</script>")); } }
public Facilities PostFacilities(Facilities facilities) { var response = Request.CreateResponse<Facilities>(HttpStatusCode.Created, facilities); new Facade().GetFacilitiesRepository().Add(facilities); return facilities; }
public int FacilitiesAdd(Facilities facilities, int id) { facilities.LeaseID = id; return(dal.FacilitiesAdd(facilities)); }
public SysLogMessage(string msg) { string headerstr; string structuredDatastr; string messagestr; if (formatregexp.IsMatch(msg)) { GroupCollection mg = formatregexp.Match(msg).Groups; headerstr = mg["head"].Value; structuredDatastr = mg["sd"].Value; messagestr = mg["msg"].Success ? mg["msg"].Value : ""; received = DateTimeOffset.Now; prival = byte.Parse(mg["pri"].Value); facility = (Facilities)(prival / 8); severity = (Severities)(prival % 8); version = short.Parse("0" + mg["ver"].Value); if (mg["ed"].Success) { string dto = mg["ed"].Value; string fmt = @"yyyy\-MM\-dd\THH\:mm\:ss"; if (dto.IndexOf("Z") > -1) { dto = dto.Substring(0, dto.Length - 1) + "+00:00"; } if (dto.IndexOf(".") > -1) { int nof = dto.Length - dto.IndexOf(".") - 7; fmt += "."; for (int i = 0; i < nof; i++) { fmt += "F"; } } fmt += "zzz"; timestamp = DateTimeOffset.ParseExact(dto, fmt, System.Globalization.CultureInfo.InvariantCulture); if (timestamp < DateTimeOffset.Parse("1900.01.01")) { timestamp = DateTimeOffset.Parse("1900.01.01"); } } else if (mg["ld"].Success) { string dto = received.Year.ToString() + " " + mg["ld"].Value; string fmt = @"yyyy\ MMM\ d\ H\:m\:s"; timestamp = DateTimeOffset.ParseExact(dto, fmt, System.Globalization.CultureInfo.InvariantCulture); } else { timestamp = DateTimeOffset.Now; } hostname = mg["hn"].Value; appName = mg["an"].Value; procID = mg["pr"].Value; msgID = mg["msgid"].Value; SD = structuredDatastr; Msg = messagestr; } else if (bSDRE.IsMatch(msg)) { GroupCollection mg = bSDRE.Match(msg).Groups; Msg = mg["cnt"].Success ? mg["cnt"].Value : ""; SD = "-"; prival = byte.Parse(mg["pri"].Success ? mg["pri"].Value : "13"); facility = (Facilities)(prival / 8); severity = (Severities)(prival % 8); version = 0; Sender = mg["hn"].Value; hostname = mg["hn"].Value; appName = mg["tag"].Success ? (mg["tag"].Value == "" ? "BSD" : mg["tag"].Value) : "BSD"; procID = "0"; msgID = "BSD"; timestamp = DateTimeOffset.ParseExact(DateTimeOffset.Now.Year.ToString() + " " + mg["bsdts"].Value.Replace(" ", " "), "yyyy MMM d HH:mm:ss", System.Globalization.CultureInfo.InvariantCulture); received = DateTimeOffset.Now; } else { Header = "<13>1 - - - - -"; SD = "-"; Msg = msg; } }
public bool HasFacility(int id) => Facilities.Any(uf => uf.Facility.Id == id);
public async Task <string> Handle(SubmitDispatchCommand request, CancellationToken cancellationToken) { DispatchRequestDTO dto = request.Request; try { dto.ValidateObject("La request no puede ser null"); LocalValidations(dto); } catch (Exception ex) { throw new Exception(ex.Message); } if (dto.Serials.Count == 0) { throw new Exception("No hay seriales que registrar. Se ha cancelado la operacion."); } var origin = await _facilityService.GetFacilityById(dto.FID); if (origin == null) { throw new Exception("No existe el FID de origen"); } Facilities destination = new Facilities(); if (dto.DestinationEU == 1) { var res = _facilityService.GetFacilityById(dto.DestinationFID); if (res.Result != null) { destination = res.Result; } else { throw new Exception("No existe este FID europeo"); } } else { var res = _facilityService.GetFacilityByFacility(dto.DestinationName, dto.DestinationCountry, dto.DestinationCity, dto.DestinationAddress, dto.DestinationZipCode); if (res.Result != null) { destination = res.Result; } else { throw new Exception("No existe este Facility"); } } if (dto.FID == destination.Id) { throw new Exception("El destino no puede ser el mismo que el origen"); } if (destination.Id != null) { List <SerialsDB> serials = new List <SerialsDB>(); foreach (var s in dto.Serials) { if (s != "" && s != null && s != "[]") { serials.Add(new SerialsDB { Serial = s }); } } var newId = _dispatchService.GetLastIdDispatch().Result; var dispatch = new DispatchesDB { Id = newId + 1, FID = dto.FID, DispatchDate = dto.DispatchDate.DateTime, TransportMode = dto.TransportMode, Vehicle = dto.Vehicle, DestinationFID = destination.Id, DestinationEU = Convert.ToBoolean(dto.DestinationEU) }; try { var added = _dispatchesRepository.Add(dispatch, serials).Result; return(added.Id.ToString()); } catch (Exception ex) { throw new Exception(ex.Message); } } else { throw new Exception("Error al registrar el envio"); } }