private void handlePay() { if (lista.Rows.Count == 0) { return; } pagar.Enabled = false; foreach (DataGridViewRow row in lista.Rows) { int id = int.Parse(row.Cells["ID"].Value.ToString()); string product = row.Cells["Productos"].Value.ToString(); int cantidad = int.Parse(row.Cells["Cantidad"].Value.ToString()); decimal precio = decimal.Parse(row.Cells["Import"].Value.ToString()); int stock = 0; int.TryParse(row.Cells["Inv"].Value.ToString(), out stock); bool isService = bool.Parse(row.Cells["Servicio"].Value.ToString()); string observation = ""; if (row.Cells["Observacion"].Value != null) { observation = row.Cells["Observacion"].Value.ToString(); } string shamppo = ""; int knife = 0; if (row.Cells["Navaja"].Value != null) { if (!int.TryParse(row.Cells["Navaja"].Value.ToString(), out knife)) { shamppo = row.Cells["Navaja"].Value.ToString(); } } if (!isService) { ProductItem productItem = new ProductItem(id, product, precio, cantidad, stock, isService, isService); products.Add(productItem); } else { Service service = new Service(id, product, CurrentPet.GetID().HasValue ? CurrentPet.GetID().Value : 0, CurrentClient.GetID(), precio); if (observation.Length > 0) { if (knife > 0) { var hairCut = new HairCut(knife, observation); service.SetHairCutInformation(hairCut); } else if (shamppo.Length > 0) { var hairCut = new HairCut(0, observation); service.SetHairCutInformation(hairCut); service.setShampoo(shamppo); } } services.Add(service); } } printTicket(); }
public void schedule_service_using_interface() { IService facial = new Facial("abc", "A1BeautySalon", "4:30 PM"); IService hairCut = new HairCut("def", "A2HairSalon", "6:30 PM"); IService massage = new Massage("ghi", "A3MassageCenter", "5:40 PM"); facial.ScheduleService().ShouldBe($"scheduled {facial.ServiceType} at {facial.Place} for {facial.Name} at {facial.Time}"); hairCut.ScheduleService().ShouldBe($"scheduled {hairCut.ServiceType} at {hairCut.Place} for {hairCut.Name} at {hairCut.Time}"); massage.ScheduleService().ShouldBe($"scheduled {massage.ServiceType} at {massage.Place} for {massage.Name} at {massage.Time}"); }
public void Put(int id, [FromBody] HairCut hairCut) { }
public IActionResult Post([FromBody] HairCut hairCut) { _context.HairCut.Add(hairCut); _context.SaveChanges(); return(Ok(hairCut)); }