public bool AgregarServicio(string plato, int precio, string tipoServicio) { ServiceServicioComedor ssc = new ServiceServicioComedor(); ServiceTipoServicio sts = new ServiceTipoServicio(); try { // Servicio TIPOSERVICIO ts = sts.getEntityDesc(tipoServicio); SERVICIOCOMEDOR sc = new SERVICIOCOMEDOR(); sc.IDSERVICIO = ssc.id(); sc.PLATO = plato; sc.PRECIO = precio; sc.TIPOSERVICIO = ts.IDTIPO; sc.IDADMINISTRADOR = 1; if (sc.PRECIO >= 0) { ssc.addEntity(sc); MessageBox.Show("Servicio Agregado.", "Agregar Servicio", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); return(true); } else { MessageBox.Show("El precio debe ser mayor o igual a 0.", "Agregar Servicio", MessageBoxButtons.OK, MessageBoxIcon.Warning); return(false); } } catch (Exception ex) { MessageBox.Show("No se pudo crear el servicio.", "Crear Servicio", MessageBoxButtons.OK, MessageBoxIcon.Warning); return(false); } }
public bool ModificarServicio(int id, string plato, int precio, string tiposervicio) { ServiceServicioComedor ssc = new ServiceServicioComedor(); ServiceTipoServicio sts = new ServiceTipoServicio(); TIPOSERVICIO ts = sts.getEntityDesc(tiposervicio); SERVICIOCOMEDOR sc = new SERVICIOCOMEDOR(); sc.IDSERVICIO = id; sc.PLATO = plato; sc.PRECIO = precio; sc.TIPOSERVICIO = ts.IDTIPO; if (sc.PRECIO >= 0) { ssc.updEntity(sc); MessageBox.Show("Servicio Modificado.", "Modificar Servicio", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); return(true); } else { MessageBox.Show("El precio debe ser mayor o igual a 0.", "Agregar Servicio", MessageBoxButtons.OK, MessageBoxIcon.Warning); return(false); } }
public void EliminarServicio(int id) { ServiceServicioComedor ssc = new ServiceServicioComedor(); SERVICIOCOMEDOR sc = ssc.getEntity(id); if (MessageBox.Show("Esta seguro de que desea eliminar el servicio: " + sc.PLATO + "?", "Eliminar Servicio", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning) == DialogResult.Yes) { ssc.delEntity(sc.IDSERVICIO); MessageBox.Show("Servicio Eliminado", "Eliminar Servicio", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } }
public void LlenarCampos(int idServicio, TextBox plato, TextBox precio, ComboBox tipoServicio, Label id) { ServiceServicioComedor ssc = new ServiceServicioComedor(); ServiceTipoServicio sts = new ServiceTipoServicio(); SERVICIOCOMEDOR sc = ssc.getEntity(idServicio); this.LlenarComboTipo(tipoServicio); plato.Text = sc.PLATO; precio.Text = sc.PRECIO.ToString(); tipoServicio.SelectedIndex = (int)sc.TIPOSERVICIO - 1; id.Text = sc.IDSERVICIO.ToString(); }
public List <SERVICIOCOMEDOR> ListadoServicios() { ServiceServicioComedor ssc = new ServiceServicioComedor(); return(ssc.getEntities()); }