//protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
 //{
 //    this.Calendar1.Visible = true;
 //}
 //protected void Calendar1_SelectionChanged(object sender, EventArgs e)
 //{
 //    this.txbfecha_nacimiento.Text = this.Calendar1.SelectedDate.ToShortDateString();
 //    this.Calendar1.Visible = false;
 //}
 protected void btnGuardar_Click(object sender, EventArgs e)
 {
     long idcliente = (from r in context.cliente select r.idcliente).Max() + 1;
     this.Control_ID1.texto = idcliente.ToString();
     cliente objcliente = new cliente();
     natural objnatural = new natural();
     if (this.cargar_objetocliente(ref objcliente) & this.cargar_objetoNatural(ref objnatural)) {
         if (this.guardar_clientenatural( objcliente,  objnatural)) {
             this.Label11.Text = "Cliente Natural registrado.";
         }
         else{
             this.Label11.Text = "Error en el registro de cliente natural!!!.";
         }
     }
 }
 protected void btnGuardar_Click(object sender, EventArgs e)
 {
     natural objcliente = new natural();
     if (this.cargarobjetocliente(ref objcliente))
     {
         if (this.actulizarcliente())
         {
             this.Label11.Text = "Modificacion Correcta";
         }
         else
         {
             this.Label11.Text = "Error en la modificacion";
         }
     }
 }
        private bool cargarobjetocliente(ref natural objcliente)
        {
            bool controlesOK = true;
            long idcliente;

            if (long.TryParse(txbidcliente.Text, out idcliente) == true)
            {
                long id = long.Parse(this.txbidcliente.Text);
                objcliente = context.natural.FirstOrDefault(a => a.idcliente == id);
            }
            else
            {
                this.Label11.Text = "Error el el codigo del cliente";
                controlesOK = false;
            }

            if (this.txbnombre_cliente.Text.Trim() != String.Empty)
            {
                objcliente.nombre_cliente = this.txbnombre_cliente.Text;
            }
            else
            {
                this.Label11.Text = "Introduzca un nombre de cliente";
                controlesOK = false;
            }

            if (this.txbapp.Text.Trim() != String.Empty)
            {
                objcliente.app = this.txbapp.Text;
            }
            else
            {
                this.Label11.Text = "Introduzca un Apellido Paterno";
                controlesOK = false;
            }

            if (this.txbapm.Text.Trim() != String.Empty)
            {
                objcliente.apm = this.txbapm.Text;
            }
            else
            {
                this.Label11.Text = "Introduzca un Apellido Materno";
                controlesOK = false;
            }

            return controlesOK;
        }
Esempio n. 4
0
 /// <summary>
 /// Método desusado para agregar un nuevo objeto al EntitySet natural. Considere la posibilidad de usar el método .Add de la propiedad ObjectSet&lt;T&gt; asociada.
 /// </summary>
 public void AddTonatural(natural natural)
 {
     base.AddObject("natural", natural);
 }
Esempio n. 5
0
 /// <summary>
 /// Crear un nuevo objeto natural.
 /// </summary>
 /// <param name="idcliente">Valor inicial de la propiedad idcliente.</param>
 /// <param name="nombre_cliente">Valor inicial de la propiedad nombre_cliente.</param>
 /// <param name="app">Valor inicial de la propiedad app.</param>
 /// <param name="apm">Valor inicial de la propiedad apm.</param>
 public static natural Createnatural(global::System.Int64 idcliente, global::System.String nombre_cliente, global::System.String app, global::System.String apm)
 {
     natural natural = new natural();
     natural.idcliente = idcliente;
     natural.nombre_cliente = nombre_cliente;
     natural.app = app;
     natural.apm = apm;
     return natural;
 }
 private bool guardar_clientenatural( cliente objcliente,  natural objnatural)
 {
     context.AddTocliente(objcliente);
     context.AddTonatural(objnatural);
     return context.SaveChanges() >= 2;
 }
 private bool cargar_objetoNatural(ref natural objnatural)
 {
     bool controlesOK = true;
     objnatural.idcliente = long.Parse(this.Control_ID1.texto);
     objnatural.nombre_cliente = this.Control_String1.texto;
     objnatural.app = this.Control_String2.texto;
     objnatural.apm = this.Control_String3.texto;
     objnatural.fecha_nacimiento = DateTime.Parse(this.Control_Fecha1.texto);
     return controlesOK ;
 }