public ActionResult Create(FormCollection formData)
        {
            try
            {
                // TODO: Add insert logic here

                if (ModelState.IsValid)
                {
                    aspnet_Acciones newAccion = new aspnet_Acciones();

                    //Asignamos los valores al abojeto
                    newAccion.OrigenID       = Convert.ToInt32(formData["OrigenID"].ToString());
                    newAccion.DepartamentoID = Convert.ToInt32(formData["DepartamentoID"].ToString());
                    newAccion.Delegaciones   = formData["arrDelegaciones"].Replace("false,", "").Replace(",false", "");
                    newAccion.Responsables   = formData["arrResponsables"].Replace("false,", "").Replace(",false", "");
                    if (formData["FechaInicio"].ToString().Length > 0)
                    {
                        newAccion.FechaInicio = Convert.ToDateTime(formData["FechaInicio"].ToString());
                    }
                    if (formData["FechaFinPrev"].ToString().Length > 0)
                    {
                        newAccion.FechaFinPrev = Convert.ToDateTime(formData["FechaFinPrev"].ToString());
                    }
                    if (formData["FechaFinReal"].ToString().Length > 0)
                    {
                        newAccion.FechaFinReal = Convert.ToDateTime(formData["FechaFinReal"].ToString());
                    }
                    if (formData["FechaSeguimiento"].ToString().Length > 0)
                    {
                        newAccion.FechaSeguimiento = Convert.ToDateTime(formData["FechaSeguimiento"].ToString());
                    }
                    newAccion.Accion    = formData["Accion"].ToString();
                    newAccion.Objetivo  = formData["Objetivo"].ToString();
                    newAccion.Resultado = formData["Resultado"].ToString();

                    db.AddToaspnet_Acciones(newAccion);
                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }
                else
                {
                    return(View(formData));
                }
            }
            catch
            {
                return(View(formData));
            }
        }
        public FormasDePagoModel getFormaDePagoById(int id)
        {
            //Cargo los datos de la formas de pago de QS.
            INSFPTableAdapter ta = new INSFPTableAdapter();

            DSas400.INSFPDataTable dt = new DSas400.INSFPDataTable();
            ta.FillByID(dt, id);

            //Cargo los datos adicionales almacenados en SQL-Server
            aspnet_FormasDePago dtFPago = db.aspnet_FormasDePago.FirstOrDefault(f => f.QSID == id);

            if (dtFPago == null)
            {
                //Si la forma de pago no está registrada en el SQL-Server, la creamos
                dtFPago      = new aspnet_FormasDePago();
                dtFPago.QSID = id;
                db.AddToaspnet_FormasDePago(dtFPago);
                db.SaveChanges();
            }


            //Creo un objeto de la clase FormasDePagoModels
            AplicacionesGM_MVC.Areas.Clientes.Models.FormasDePagoModel objFPago = new FormasDePagoModel();

            //Asigno los valores correspondientes
            objFPago.ID      = id;
            objFPago.Nombre  = dt.Rows[0]["FPNBR"].ToString() + " " + dt.Rows[0]["FPNBR2"].ToString();
            objFPago.Visible = dtFPago.Visible;
            objFPago.DisponibleExposicion = dtFPago.DisponibleParaExposicion;
            objFPago.DtoPP             = dtFPago.DtoPP;
            objFPago.RecargoFinanciero = dtFPago.RecargoFinanciero;
            objFPago.EsSEPA            = dtFPago.RequiereDocSEPA;

            return(objFPago);
        }
Beispiel #3
0
        public ActionResult Edit(FormasDePagoModel modified)
        {
            try
            {
                // TODO: Add update logic here
                if (ModelState.IsValid)
                {
                    //Traspasamos los datos de la clase intermedia al objeto de SQL-Server
                    aspnet_FormasDePago dtFPago = new aspnet_FormasDePago();

                    dtFPago.QSID    = modified.ID;
                    dtFPago.Visible = modified.Visible;
                    dtFPago.DisponibleParaExposicion = modified.DisponibleExposicion;
                    dtFPago.RequiereDocSEPA          = modified.EsSEPA;
                    dtFPago.DtoPP             = Convert.ToDecimal(modified.DtoPP);
                    dtFPago.RecargoFinanciero = Convert.ToDecimal(modified.RecargoFinanciero);

                    db.aspnet_FormasDePago.Attach(dtFPago);
                    db.ObjectStateManager.ChangeObjectState(dtFPago, System.Data.EntityState.Modified);
                    db.SaveChanges();

                    return(RedirectToAction("Index"));
                }

                return(View(modified));
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("", ex.Message + " " + ex.InnerException.ToString());
                return(View(modified));
            }
        }
Beispiel #4
0
 public ActionResult Create(aspnet_TiposDeVehiculo newTipoDeVehiculo)
 {
     try
     {
         // TODO: Add insert logic here
         if (ModelState.IsValid)
         {
             db.AddToaspnet_TiposDeVehiculo(newTipoDeVehiculo);
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
         else
         {
             return(View(newTipoDeVehiculo));
         }
     }
     catch
     {
         return(View(newTipoDeVehiculo));
     }
 }
Beispiel #5
0
 public ActionResult Create(aspnet_MediosDeDescarga newMedioDeDescarga)
 {
     try
     {
         // TODO: Add insert logic here
         if (ModelState.IsValid)
         {
             db.AddToaspnet_MediosDeDescarga(newMedioDeDescarga);
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
         else
         {
             return(View(newMedioDeDescarga));
         }
     }
     catch
     {
         return(View(newMedioDeDescarga));
     }
 }
 public ActionResult Create(aspnet_Departamentos newDpto)
 {
     try
     {
         // TODO: Add insert logic here
         if (ModelState.IsValid)
         {
             db.AddToaspnet_Departamentos(newDpto);
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
         else
         {
             return(View(newDpto));
         }
     }
     catch
     {
         return(View());
     }
 }
Beispiel #7
0
 public ActionResult Create(aspnet_InstrumentosDePesaje newInstrumentosDePesaje)
 {
     try
     {
         // TODO: Add insert logic here
         if (ModelState.IsValid)
         {
             db.AddToaspnet_InstrumentosDePesaje(newInstrumentosDePesaje);
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
         else
         {
             return(View(newInstrumentosDePesaje));
         }
     }
     catch
     {
         return(View(newInstrumentosDePesaje));
     }
 }
 public ActionResult Create(aspnet_Aseguradoras newAseguradora)
 {
     try
     {
         // TODO: Add insert logic here
         if (ModelState.IsValid)
         {
             db.AddToaspnet_Aseguradoras(newAseguradora);
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
         else
         {
             return(View(newAseguradora));
         }
     }
     catch
     {
         return(View(newAseguradora));
     }
 }
Beispiel #9
0
 public ActionResult Create(aspnet_MaterialesEmpresa newMaterial)
 {
     try
     {
         // TODO: Add insert logic here
         if (ModelState.IsValid)
         {
             db.AddToaspnet_MaterialesEmpresa(newMaterial);
             db.SaveChanges();
             return(RedirectToAction("Index", new { idEmpresa = newMaterial.QSIDEmpresa }));
         }
         else
         {
             return(View(newMaterial));
         }
     }
     catch
     {
         return(View());
     }
 }
Beispiel #10
0
 public ActionResult Create(aspnet_RequerimientosDeCalidad newRequerimiento)
 {
     try
     {
         // TODO: Add insert logic here
         if (ModelState.IsValid)
         {
             db.AddToaspnet_RequerimientosDeCalidad(newRequerimiento);
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
         else
         {
             return(View(newRequerimiento));
         }
     }
     catch
     {
         return(View(newRequerimiento));
     }
 }