Beispiel #1
0
        private bool Guardar()
        {
            try
            {
                if (!Valida())
                {
                    return(false);
                }

                AreaLogica area = new AreaLogica();
                area.Area     = cbbArea.Text.ToString().ToUpper();
                area.Planta   = cbbPlanta.SelectedValue.ToString();
                area.Estacion = txtNombre.Text.ToString();
                if (chbGlobal.Checked)
                {
                    area.Global = "1";
                }
                else
                {
                    area.Global = "0";
                }

                if (AreaLogica.Guardar(area) == 0)
                {
                    MessageBox.Show("Error al intentar guardar el Area", Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(false);
                }



                return(true);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Favor de notificar al Administrador" + Environment.NewLine + "EstacionLogica.Guardar(mod)" + Environment.NewLine + ex.ToString(), Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
        }
Beispiel #2
0
 public ActionResult Nuevo(Area model)
 {
     try
     {
         Validar(model);
         if (ModelState.IsValid)
         {
             _areaLogica = new AreaLogica();
             _areaLogica.Guardar(model);
             return(Content(model.Id.ToString()));
         }
         else
         {
             Response.StatusCode = (int)HttpStatusCode.BadRequest;
             return(PartialView("_Error"));
         }
     }
     catch (Exception ex)
     {
         Response.StatusCode = (int)HttpStatusCode.BadRequest;
         ViewBag.Message     = ex.Message;
         return(PartialView("_Error"));
     }
 }