public Alertas_detalle_EAN Edit(Alertas_detalle_EAN model)
 {
     entities.Alertas_detalle_EAN.Attach(model);
       entities.ObjectStateManager.ChangeObjectState(model, EntityState.Modified);
       this.Commit();
       return model;
 }
Ejemplo n.º 2
0
        public ActionResult Edit_detalle(Alertas_detalle model, FormCollection formCollection)
        {
            try
              {
            if (formCollection["item.unidades.Value"] != null)
            {
              string[] EanIds = formCollection["item.Id_ean"].Split(new Char[] { ',' });
              string[] CantidadEan = formCollection["item.unidades.Value"].Split(new Char[] { ',' });

              decimal totalUnidades = 0;
              for (int i = 0; i < EanIds.Length; i++)
              {
            Alertas_detalle_EAN _Alertas_detalle_EAN = new Alertas_detalle_EANRepository().GetAlertas_detalle_EANByEan(Convert.ToInt32(EanIds[i]));
            Alertas_detalle_EAN _Alertas_detalle_EANEditado = new Alertas_detalle_EAN();
            if (_Alertas_detalle_EAN != null)
            {
              _Alertas_detalle_EANEditado.unidades = Convert.ToDecimal(CantidadEan[i]);
              _Alertas_detalle_EANEditado.Id_alerta_detalle = _Alertas_detalle_EAN.Id_alerta_detalle;
              _Alertas_detalle_EANEditado.Id_ean = _Alertas_detalle_EAN.Id_ean;
              _Alertas_detalle_EANEditado.Id_alerta_detalle_ean = _Alertas_detalle_EAN.Id_alerta_detalle_ean;
              _Alertas_detalle_EANEditado.EntityKey = _Alertas_detalle_EAN.EntityKey;

              totalUnidades += _Alertas_detalle_EANEditado.unidades.Value;
              new Alertas_detalle_EANRepository().Edit(_Alertas_detalle_EANEditado);

            }
              }
              model.Total_cantidad_retirada = totalUnidades;
              new Alertas_detalleRepository().Edit(model);

              return Json(JsonResponseFactory.SuccessResponse(), JsonRequestBehavior.AllowGet);
            }
            else
            {
              new Alertas_detalleRepository().Edit(model);

              return Json(JsonResponseFactory.SuccessResponse(), JsonRequestBehavior.AllowGet);
            }
              }
              catch (Exception ex)
              {
            TempData["ErrorMessage"] = ex.Message;
            return Json(JsonResponseFactory.ErrorResponse(ex.Message), JsonRequestBehavior.AllowGet);

            //return View(model);
              }
        }
Ejemplo n.º 3
0
        public ActionResult Edit_detalle(int id, bool readOnly)
        {
            Alertas_detalle _Alertas_detalle = new Alertas_detalleRepository().GetAlertaById(id);
              ViewBag.ReadOnly = readOnly;
              List<EAN> listEANByDetail = null;

              if (_Alertas_detalle.Alertas_detalle_EAN.Count == 0)
              {
            listEANByDetail = new EANRepository().GetListEANByAlerta(_Alertas_detalle.Id_alerta.Value).ToList();

            foreach (var item in listEANByDetail)
            {
              Alertas_detalle_EAN _Alertas_detalle_EAN = new Alertas_detalle_EAN();
              _Alertas_detalle_EAN.Id_alerta_detalle = id;
              _Alertas_detalle_EAN.Id_ean = item.Id_ean;
              _Alertas_detalle_EAN.unidades = 0;

              new Alertas_detalle_EANRepository().Create(_Alertas_detalle_EAN);
            }

              }

              return PartialView(new Alertas_detalleRepository().GetAlertaById(id));
        }
 public Alertas_detalle_EAN Create(Alertas_detalle_EAN model)
 {
     entities.Alertas_detalle_EAN.AddObject(model);
       this.Commit();
       return model;
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Alertas_detalle_EAN EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToAlertas_detalle_EAN(Alertas_detalle_EAN alertas_detalle_EAN)
 {
     base.AddObject("Alertas_detalle_EAN", alertas_detalle_EAN);
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Create a new Alertas_detalle_EAN object.
 /// </summary>
 /// <param name="id_alerta_detalle_ean">Initial value of the Id_alerta_detalle_ean property.</param>
 public static Alertas_detalle_EAN CreateAlertas_detalle_EAN(global::System.Int32 id_alerta_detalle_ean)
 {
     Alertas_detalle_EAN alertas_detalle_EAN = new Alertas_detalle_EAN();
     alertas_detalle_EAN.Id_alerta_detalle_ean = id_alerta_detalle_ean;
     return alertas_detalle_EAN;
 }