コード例 #1
0
ファイル: ServicioController.cs プロジェクト: deapede/SISGHO
        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);
            }
        }
コード例 #2
0
ファイル: ServicioController.cs プロジェクト: deapede/SISGHO
        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);
            }
        }
コード例 #3
0
        public ActionResult DeleteConfirmed(int id)
        {
            TIPOSERVICIO tIPOSERVICIO = db.TIPOSERVICIOS.Find(id);

            db.TIPOSERVICIOS.Remove(tIPOSERVICIO);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #4
0
        public async Task <ActionResult> DeleteConfirmed(decimal id)
        {
            TIPOSERVICIO tIPOSERVICIO = await db.TIPOSERVICIO.FindAsync(id);

            db.TIPOSERVICIO.Remove(tIPOSERVICIO);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
コード例 #5
0
 public ActionResult Edit([Bind(Include = "id,acronimo,descripcion")] TIPOSERVICIO tIPOSERVICIO)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tIPOSERVICIO).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(tIPOSERVICIO));
 }
コード例 #6
0
        public async Task <ActionResult> Edit([Bind(Include = "ID,DESCRIPCION")] TIPOSERVICIO tIPOSERVICIO)
        {
            if (ModelState.IsValid)
            {
                db.Entry(tIPOSERVICIO).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(tIPOSERVICIO));
        }
コード例 #7
0
        public ActionResult Create([Bind(Include = "id,acronimo,descripcion")] TIPOSERVICIO tIPOSERVICIO)
        {
            if (ModelState.IsValid)
            {
                db.TIPOSERVICIOS.Add(tIPOSERVICIO);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(tIPOSERVICIO));
        }
コード例 #8
0
        public async Task <ActionResult> Create([Bind(Include = "ID,DESCRIPCION")] TIPOSERVICIO tIPOSERVICIO)
        {
            if (ModelState.IsValid)
            {
                db.TIPOSERVICIO.Add(tIPOSERVICIO);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(tIPOSERVICIO));
        }
コード例 #9
0
        // GET: AreaConfiguracion/TIPOSERVICIO/Delete/5
        public async Task <ActionResult> Delete(decimal id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TIPOSERVICIO tIPOSERVICIO = await db.TIPOSERVICIO.FindAsync(id);

            if (tIPOSERVICIO == null)
            {
                return(HttpNotFound());
            }
            return(View(tIPOSERVICIO));
        }
コード例 #10
0
        // GET: TipoServicios/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TIPOSERVICIO tIPOSERVICIO = db.TIPOSERVICIOS.Find(id);

            if (tIPOSERVICIO == null)
            {
                return(HttpNotFound());
            }
            return(View(tIPOSERVICIO));
        }