Beispiel #1
0
        public void AltaServicio( string Id, string nombre, string desc, int precio, int dto, int impuesto)
        {
            bool ok = true;
            if (existeId(Id))
            {
                ok = false;
            }
            if (Id.Length == 4)
            {
                try
                {
                    int check = Int32.Parse(Id);
                    //todo ok
                }
                catch (Exception e)
                {
                    ok = false;
                }
            }
            else
            {
                ok = false;
            }
            nombre.TrimEnd();
            nombre.TrimStart();
            if (nombre.Length <= 10 && !string.IsNullOrEmpty(nombre))
            {
                //todo ok
            }
            else
            {
                ok = false;
            }

            if (desc.Length > 250)
            {
                ok = false;
            }

            if (precio < 0 || precio >99999)
            {
                ok = false;
            }

            if (dto < 0 ||  dto > 100)
            {
                ok = false;
            }

            if (impuesto < 0 || impuesto > 999)
            {
                ok = false;
            }

            if (ok)
            {

                Servicio s = new Servicio();
                s.id = Id;
                s.nombre = nombre;
                s.precio = precio.ToString();
                s.impuesto = impuesto.ToString();
                s.descuento = dto.ToString();
                s.descripcion = desc;
                BD.ServicioEstablecer.AddObject(s);
                BD.SaveChanges();

            }
        }
Beispiel #2
0
        public void AltaServicio(string Id, string nombre, string desc, int precio, int dto, int impuesto)
        {
            bool ok = true;

            if (existeId(Id))
            {
                ok = false;
            }
            if (Id.Length == 4)
            {
                try
                {
                    int check = Int32.Parse(Id);
                    //todo ok
                }
                catch (Exception e)
                {
                    ok = false;
                }
            }
            else
            {
                ok = false;
            }
            nombre.TrimEnd();
            nombre.TrimStart();
            if (nombre.Length <= 10 && !string.IsNullOrEmpty(nombre))
            {
                //todo ok
            }
            else
            {
                ok = false;
            }

            if (desc.Length > 250)
            {
                ok = false;
            }

            if (precio < 0 || precio > 99999)
            {
                ok = false;
            }

            if (dto < 0 || dto > 100)
            {
                ok = false;
            }

            if (impuesto < 0 || impuesto > 999)
            {
                ok = false;
            }

            if (ok)
            {
                Servicio s = new Servicio();
                s.id          = Id;
                s.nombre      = nombre;
                s.precio      = precio.ToString();
                s.impuesto    = impuesto.ToString();
                s.descuento   = dto.ToString();
                s.descripcion = desc;
                BD.ServicioEstablecer.AddObject(s);
                BD.SaveChanges();
            }
        }
Beispiel #3
0
 /// <summary>
 /// Crear un nuevo objeto Servicio.
 /// </summary>
 /// <param name="id">Valor inicial de la propiedad id.</param>
 /// <param name="nombre">Valor inicial de la propiedad nombre.</param>
 /// <param name="descripcion">Valor inicial de la propiedad descripcion.</param>
 /// <param name="precio">Valor inicial de la propiedad precio.</param>
 /// <param name="descuento">Valor inicial de la propiedad descuento.</param>
 /// <param name="impuesto">Valor inicial de la propiedad impuesto.</param>
 /// <param name="oid">Valor inicial de la propiedad oid.</param>
 public static Servicio CreateServicio(global::System.String id, global::System.String nombre, global::System.String descripcion, global::System.String precio, global::System.String descuento, global::System.String impuesto, global::System.Int32 oid)
 {
     Servicio servicio = new Servicio();
     servicio.id = id;
     servicio.nombre = nombre;
     servicio.descripcion = descripcion;
     servicio.precio = precio;
     servicio.descuento = descuento;
     servicio.impuesto = impuesto;
     servicio.oid = oid;
     return servicio;
 }
Beispiel #4
0
 /// <summary>
 /// Método desusado para agregar un nuevo objeto al EntitySet ServicioEstablecer. Considere la posibilidad de usar el método .Add de la propiedad ObjectSet&lt;T&gt; asociada.
 /// </summary>
 public void AddToServicioEstablecer(Servicio servicio)
 {
     base.AddObject("ServicioEstablecer", servicio);
 }
Beispiel #5
0
 /// <summary>
 /// Método desusado para agregar un nuevo objeto al EntitySet ServicioEstablecer. Considere la posibilidad de usar el método .Add de la propiedad ObjectSet&lt;T&gt; asociada.
 /// </summary>
 public void AddToServicioEstablecer(Servicio servicio)
 {
     base.AddObject("ServicioEstablecer", servicio);
 }