コード例 #1
0
        // PUT api/TipoPlan/5
        public IHttpActionResult PutTipoPlan(int Id, TipoPlan tipoplan)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (Id != tipoplan.TipoPlanId)
            {
                return(BadRequest());
            }

            db.Entry(tipoplan).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!TipoPlanExists(Id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #2
0
 private void TryEditPlan(Etiqueta et, TipoPlan tp, bool emf, double m)
 {
     plan.Etiqueta  = et;
     plan.Tipo      = tp;
     plan.EsMesFijo = emf;
     plan.Meta      = m;
 }
コード例 #3
0
        public void Update(TipoPlan tipoPlan)
        {
            SqlConnection sqlConnection = new SqlConnection(Utilities.GetConnectionString());
            SqlCommand    sqlCommand    = new SqlCommand(SpTipoPlan.RUD, sqlConnection)
            {
                CommandType = System.Data.CommandType.StoredProcedure
            };

            sqlCommand.Parameters.Add(new SqlParameter("@CODIGO", tipoPlan.Codigo));
            sqlCommand.Parameters.Add(new SqlParameter("@TDCCODIGO", tipoPlan.TipoDescuento.Codigo));
            sqlCommand.Parameters.Add(new SqlParameter("@DESCRIPCION", tipoPlan.Descripcion));
            sqlCommand.Parameters.Add(new SqlParameter("@PORCENTAJE", tipoPlan.Porcentaje));
            sqlCommand.Parameters.Add(new SqlParameter("@ESTADO", tipoPlan.Estado));
            sqlCommand.Parameters.Add(new SqlParameter("@SECUENCIA", tipoPlan.Secuencia));
            sqlCommand.Parameters.Add(new SqlParameter("@ACTION", 'U'));
            try
            {
                sqlConnection.Open();
                sqlCommand.ExecuteNonQuery();
            }
            catch (SqlException exc)
            {
                Console.WriteLine(exc.ToString());
            }
            finally
            {
                sqlConnection.Close();
            }
        }
コード例 #4
0
        public ActionResult DeleteConfirmed(int id)
        {
            TipoPlan tipoplan = db.TipoPlan.Get(id);

            db.TipoPlan.Delete(tipoplan);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #5
0
 private void TryAddPlan(Etiqueta et, TipoPlan tp, bool emf, double m)
 {
     if (!planAdded)
     {
         container.PlanDAO.Add(et, tp, emf, m);
         planAdded = true;
     }
 }
コード例 #6
0
        public ActionResult DeleteConfirmed(int id)
        {
            TipoPlan tipoPlan = _UnityOfWork.TipoPlan1.Get(id);

            _UnityOfWork.TipoPlan1.Delete(tipoPlan);
            _UnityOfWork.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #7
0
        public ActionResult DeleteConfirmed(int Id)
        {
            TipoPlan tipoPlan = db.TipoPlan.Find(Id);

            db.TipoPlan.Remove(tipoPlan);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #8
0
        public ActionResult DeleteConfirmed(int id)
        {
            //AdministradorEquipo administradorEquipo = db.AdministradorEquipos.Find(id);
            TipoPlan TipoPlanes = unityOfWork.TipoPlanes.Get(id);

            unityOfWork.TipoPlanes.Delete(TipoPlanes);
            //db.SaveChanges();
            unityOfWork.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #9
0
 public ActionResult Edit([Bind(Include = "TipoPlanID")] TipoPlan tipoplan)
 {
     if (ModelState.IsValid)
     {
         db.StateModified(tipoplan);
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(tipoplan));
 }
コード例 #10
0
ファイル: PlanDAO.cs プロジェクト: jevo160296/JevoGastosCore
 public Plan Add(Etiqueta etiqueta, TipoPlan tipo, bool esMesFijo, double meta)
 {
     return(Add(new Plan()
     {
         Etiqueta = etiqueta,
         Tipo = tipo,
         Meta = meta,
         EsMesFijo = esMesFijo
     }));
 }
コード例 #11
0
 public ActionResult Edit([Bind(Include = "TipoPlanId,NombreTipoPlan")] TipoPlan tipoPlan)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tipoPlan).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(tipoPlan));
 }
コード例 #12
0
 public ActionResult Edit([Bind(Include = "TipoPlan_id,TipoPlan_caracteristica")] TipoPlan tipoPlan)
 {
     if (ModelState.IsValid)
     {
         //  _UnityOfWork.Entry(tipoPlan).State = EntityState.Modified;
         _UnityOfWork.StateModified(tipoPlan);
         _UnityOfWork.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(tipoPlan));
 }
コード例 #13
0
        public ActionResult Create([Bind(Include = "TipoPlan_id,TipoPlan_caracteristica")] TipoPlan tipoPlan)
        {
            if (ModelState.IsValid)
            {
                _UnityOfWork.TipoPlan1.Add(tipoPlan);
                _UnityOfWork.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(tipoPlan));
        }
コード例 #14
0
        public List <TipoPlan> FindByDescription(string description)
        {
            List <TipoPlan> tipoPlans     = new List <TipoPlan>();
            SqlConnection   sqlConnection = new SqlConnection(Utilities.GetConnectionString());
            SqlCommand      sqlCommand    = new SqlCommand(SpTipoPlan.FIND_BY_DESCRIPCION, sqlConnection)
            {
                CommandType = System.Data.CommandType.StoredProcedure
            };

            sqlCommand.Parameters.Add(new SqlParameter("@DESCRIPCION", description));
            try
            {
                sqlConnection.Open();
                SqlDataReader sqlDataReader = sqlCommand.ExecuteReader();
                while (sqlDataReader.Read())
                {
                    TipoId tipoId = new TipoId(
                        sqlDataReader.GetInt32(12),
                        sqlDataReader.GetString(13),
                        sqlDataReader.GetString(14),
                        Convert.ToChar(sqlDataReader.GetString(15))
                        );

                    TipoDescuento tipoDescuento = new TipoDescuento(
                        sqlDataReader.GetInt32(6),
                        sqlDataReader.GetString(7),
                        tipoId,
                        sqlDataReader.GetString(9),
                        sqlDataReader.GetInt32(10),
                        Convert.ToChar(sqlDataReader.GetString(11))
                        );

                    TipoPlan tipoPlan = new TipoPlan(
                        sqlDataReader.GetInt32(0),
                        sqlDataReader.GetString(1),
                        tipoDescuento,
                        sqlDataReader.GetString(3),
                        sqlDataReader.GetInt32(4),
                        Convert.ToChar(sqlDataReader.GetString(5))
                        );

                    tipoPlans.Add(tipoPlan);
                }
            }
            catch (SqlException exc)
            {
                Console.WriteLine(exc.ToString());
            }
            finally
            {
                sqlConnection.Close();
            }
            return(tipoPlans);
        }
コード例 #15
0
        public IHttpActionResult GetTipoPlan(int Id)
        {
            TipoPlan tipoplan = db.TipoPlan.Find(Id);

            if (tipoplan == null)
            {
                return(NotFound());
            }

            return(Ok(tipoplan));
        }
コード例 #16
0
        public ActionResult Create([Bind(Include = "TipoPlanId")] TipoPlan tipoPlan)
        {
            if (ModelState.IsValid)
            {
                db.TipoPlan.Add(tipoPlan);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(tipoPlan));
        }
コード例 #17
0
 public ActionResult Edit([Bind(Include = "TipoPlanId")] TipoPlan TipoPlanes)
 {
     if (ModelState.IsValid)
     {
         //db.Entry(administradorEquipo).State = EntityState.Modified;
         unityOfWork.StateModified(TipoPlanes);
         //db.SaveChanges();
         unityOfWork.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(TipoPlanes));
 }
コード例 #18
0
        public IHttpActionResult PostTipoPlan(TipoPlan tipoplan)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.TipoPlan.Add(tipoplan);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { Id = tipoplan.TipoPlanId }, tipoplan));
        }
コード例 #19
0
        public ActionResult Create([Bind(Include = "TipoPlanId")] TipoPlan TipoPlanes)
        {
            if (ModelState.IsValid)
            {
                //db.AdministradorEquipos.Add(administradorEquipo);
                unityOfWork.TipoPlanes.Add(TipoPlanes);
                unityOfWork.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(TipoPlanes));
        }
コード例 #20
0
        /// <summary>
        /// actualiza un registro
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void ASPxGridView1_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e)
        {
            try
            {
                using (var conexion = new DataModelFE())
                {
                    // se declara el objeto a insertar
                    TipoPlan dato = new TipoPlan();
                    //llena el objeto con los valores de la pantalla
                    dato.codigo = e.NewValues["codigo"] != null ? e.NewValues["codigo"].ToString().ToUpper() : null;

                    //busca el objeto
                    dato                     = conexion.TipoPlan.Find(dato.codigo);
                    dato.cantidad            = int.Parse(e.NewValues["cantidad"].ToString());
                    dato.descripcion         = e.NewValues["descripcion"] != null ? e.NewValues["descripcion"].ToString().ToUpper() : null;
                    dato.estado              = e.NewValues["estado"].ToString();
                    dato.usuarioModificacion = Session["usuario"].ToString();
                    dato.fechaModificacion   = Date.DateTimeNow();

                    //modifica objeto
                    conexion.Entry(dato).State = EntityState.Modified;
                    conexion.SaveChanges();

                    //esto es para el manero del devexpress
                    e.Cancel = true;
                    this.ASPxGridView1.CancelEdit();
                }
            }
            catch (DbEntityValidationException ex)
            {
                // Retrieve the error messages as a list of strings.
                var errorMessages = ex.EntityValidationErrors
                                    .SelectMany(x => x.ValidationErrors)
                                    .Select(x => x.ErrorMessage);

                // Join the list to a single string.
                var fullErrorMessage = string.Join("; ", errorMessages);

                // Throw a new DbEntityValidationException with the improved exception message.
                throw new DbEntityValidationException(fullErrorMessage, ex.EntityValidationErrors);
            }
            catch (Exception ex)
            {
                throw new Exception(Utilidades.validarExepcionSQL(ex), ex.InnerException);
            }
            finally
            {
                //refescar los datos
                this.refreshData();
            }
        }
コード例 #21
0
        // GET: TipoPlans/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TipoPlan tipoPlan = _UnityOfWork.TipoPlan1.Get(id);

            if (tipoPlan == null)
            {
                return(HttpNotFound());
            }
            return(View(tipoPlan));
        }
コード例 #22
0
        public IHttpActionResult DeleteTipoPlan(int Id)
        {
            TipoPlan tipoplan = db.TipoPlan.Find(Id);

            if (tipoplan == null)
            {
                return(NotFound());
            }

            db.TipoPlan.Remove(tipoplan);
            db.SaveChanges();

            return(Ok(tipoplan));
        }
コード例 #23
0
        // GET: /TipoPlan/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TipoPlan tipoplan = db.TipoPlan.Get(id);

            if (tipoplan == null)
            {
                return(HttpNotFound());
            }
            return(View(tipoplan));
        }
コード例 #24
0
        // GET: TipoPlans/Delete/5
        public ActionResult Delete(int?Id)
        {
            if (Id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TipoPlan tipoPlan = db.TipoPlan.Find(Id);

            if (tipoPlan == null)
            {
                return(HttpNotFound());
            }
            return(View(tipoPlan));
        }
コード例 #25
0
        // GET: AdministradorEquipoes/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TipoPlan TipoPlanes = unityOfWork.TipoPlanes.Get(id.Value);

            if (TipoPlanes == null)
            {
                return(HttpNotFound());
            }
            return(View(TipoPlanes));
        }
コード例 #26
0
        // GET: AdministradorEquipoes/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            //AdministradorEquipo administradorEquipo = db.AdministradorEquipos.Find(id);
            TipoPlan TipoPlanes = unityOfWork.TipoPlanes.Get(id.Value);

            if (TipoPlanes == null)
            {
                return(HttpNotFound());
            }
            return(View(TipoPlanes));
        }
コード例 #27
0
        private void CB_TipoPlan_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            CheckSePuedeAnadir();
            TipoPlan selected = (TipoPlan)CB_TipoPlan.SelectedIndex;

            switch (selected)
            {
            case TipoPlan.Diario:
                TS_EsMesFijo.Visibility = Windows.UI.Xaml.Visibility.Visible;
                break;

            case TipoPlan.Mensual:
                TS_EsMesFijo.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                break;

            default:
                TS_EsMesFijo.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                break;
            }
        }
コード例 #28
0
 private void TryProcessTransaction()
 {
     if (CheckSePuedeAnadir())
     {
         Etiqueta et  = CB_Etiqueta.SelectedItem as Etiqueta;
         TipoPlan tp  = (TipoPlan)CB_TipoPlan.SelectedIndex;
         bool     emf = TS_EsMesFijo.IsOn;
         double   m   = NB_Meta.Value is double.NaN ? 0 : NB_Meta.Value;
         if (parameters.IsEditMode)
         {
             TryEditPlan(et, tp, emf, m);
         }
         else
         {
             TryAddPlan(et, tp, emf, m);
         }
         if (((this.Parent as Frame)?.Parent as FlyoutPresenter)?.Parent is Popup)
         {
             (((this.Parent as Frame)?.Parent as FlyoutPresenter)?.Parent as Popup).IsOpen = false;
         }
     }
 }
コード例 #29
0
        public void Delete(TipoPlan tipoPlan)
        {
            SqlConnection sqlConnection = new SqlConnection(Utilities.GetConnectionString());
            SqlCommand    sqlCommand    = new SqlCommand(SpTipoPlan.RUD, sqlConnection)
            {
                CommandType = System.Data.CommandType.StoredProcedure
            };

            sqlCommand.Parameters.Add(new SqlParameter("@SECUENCIA", tipoPlan.Secuencia));
            sqlCommand.Parameters.Add(new SqlParameter("@ACTION", 'D'));
            try
            {
                sqlConnection.Open();
                sqlCommand.ExecuteNonQuery();
            }
            catch (SqlException exc)
            {
                Console.WriteLine(exc.ToString());
            }
            finally
            {
                sqlConnection.Close();
            }
        }
コード例 #30
0
ファイル: Plan.cs プロジェクト: sebasPareja/2009104490
 public Plan(TipoPlan tipoplan, String restricciones)
 {
     this.tipoplan      = tipoplan;
     this.restricciones = restricciones;
 }