예제 #1
0
        public ActionResult Cotizar(string username, string token, Abonado model, string pcs, string notebooks, string servers, string printers, bool network)
        {
            if (ModelState.IsValid)
            {
                //mando mail
                Mail mail = new Mail();
                mail.Subject = "Solicitud de cotización";
                mail.Body    = "Nombre: " + model.Name + "\n" + "Tel: " + model.Phone + "\n" + "Email: " + model.Email + "\n" + "Dirección: "
                               + model.Address + "\n" + "Pcs: " + pcs + ", Notebooks: " + notebooks + ", Servers: " + servers + ", Impresoras: " + printers
                               + ", En red? " + (network ? "Si" : "No");

                var result = mailService.Send(mail);
                if (!String.IsNullOrEmpty(result.Error))
                {
                    ModelState.AddModelError("", "No se pudo enviar la solicitud");
                    ViewBag.Result = "error";
                    return(View(model));
                }

                ViewBag.Result = "ok";
                return(View(model));
            }
            else
            {
                ViewBag.Result = "error";
                return(View(model));
            }
        }
예제 #2
0
        static void Main(string[] args)
        {
            Obra      obra1 = new Obra("Romeo Y Julieta", 10);
            Abonado   esp1  = new Abonado("Steven Rúa");
            Abonado   esp2  = new Abonado("Shara Montoya");
            Abonado   esp3  = new Abonado("Celeste Rúa");
            Ocasional esp4  = new Ocasional("Fabiola Jaramillo");
            Ocasional esp5  = new Ocasional("Gustavo Rúa");
            Ocasional esp6  = new Ocasional("Lucia Jaramillo");
            Ocasional esp7  = new Ocasional("Johny Rúa");

            Teatro t = new Teatro("Teatro Junin");

            Console.WriteLine(t.venderBoleta(obra1, esp1));
            Console.WriteLine(t.venderBoleta(obra1, esp2));
            Console.WriteLine(t.venderBoleta(obra1, esp3));
            Console.WriteLine(t.venderBoleta(obra1, esp4));
            Console.WriteLine(t.venderBoleta(obra1, esp5));
            Console.WriteLine(t.venderBoleta(obra1, esp6));
            Console.WriteLine(t.venderBoleta(obra1, esp7));
            Console.WriteLine(t.Cupos);

            obra1.mostrarAbonados();
            obra1.mostrarOcasionales();

            Console.ReadKey();
        }
        public async Task <IActionResult> PutAbonado([FromRoute] int id, [FromBody] Abonado abonado)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != abonado.Id)
            {
                return(BadRequest());
            }

            _context.Entry(abonado).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!AbonadoExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
예제 #4
0
        private void btnSaveUpdate_Click(object sender, EventArgs e)
        {
            btnSaveOption = btnSaveUpdate.Text;
            aboDao        = new AbonadoDAO(this.usu);
            if (TxtName.Text.Trim() == "" || TxtFirstN.Text.Trim() == "" || TxtLastN.Text.Trim() == "" || MtxtPhone.Text.Trim() == "" || TxtAddress.Text == "")
            {
                MessageBox.Show(this, "Campos en blanco detectados, verifique!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            else
            {
                switch (btnSaveOption)
                {
                case "Guardar":
                    if (!aboDao.InsertNew((abo = GetInfo())))
                    {
                        MessageBox.Show(this, "El número de identificación ya existe!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    else
                    {
                        MessageBox.Show(this, "Usuario agregado correctamente!", "Información", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        this.ReseTextBox();
                    }
                    break;

                case "Editar":
                    aboDao.Update((abo = GetInfo()));
                    MessageBox.Show(this, "Datos actualizados correctamente!", "Información", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    abo = new Abonado();
                    this.ReseTextBox();
                    break;
                }
            }
        }
예제 #5
0
 private void OutAction()
 {
     abo    = new Abonado();
     frmAbo = (frmAbonados)this.Owner;
     frmAbo.Abo_Load(abo, usu);
     frmAbo.Show();
 }
예제 #6
0
 public frmAbonados(Usuario us, Abonado ab)
 {
     InitializeComponent();
     this.usu = us;
     this.abo = ab;
     this.Abo_Load(abo, usu);
 }
예제 #7
0
        public ActionResult Cotizar(string username, string token)
        {
            var abonado = new Abonado();

            ViewBag.Result = "";
            return(View(abonado));
        }
        /*
         *  Función para insertar un abonado en la junta de agua.
         */
        public static int insertarAbonado(Abonado abonado)
        {
            ctx.Abonado.Add(abonado);
            ctx.SaveChanges();

            return(abonado.IdAbonado);
        }
예제 #9
0
        private void ClasificarEspectadores(int accion)
        {
            string nombresAbonados    = "----- Lista de Abonados ----- \n";
            string nombresOcacionales = "----- Lista de Ocacionales ----- \n";

            foreach (var espectador in Espectadores)
            {
                if (typeof(Abonado).IsInstanceOfType(espectador))
                {
                    Abonado abonado = (Abonado)espectador;
                    nombresAbonados += "nombre :" + $"{abonado.Nombre}" + "\n";
                }
                else if (typeof(Ocacional).IsInstanceOfType(espectador))
                {
                    Ocacional ocacional = (Ocacional)espectador;
                    nombresOcacionales += "nombre :" + $"{ocacional.Nombre}" + "\n";
                }
            }
            switch (accion)
            {
            case Constantes.Ocasional:
                Console.WriteLine(nombresOcacionales);
                break;

            case Constantes.Abonado:
                Console.WriteLine(nombresAbonados);
                break;

            default:
                break;
            }
        }
예제 #10
0
 public Abonado SerchOneAbonado(string id)
 {
     try
     {
         using (MySqlConnection cn = new MySqlConnection((clsCon = new Connection(this.user)).Parameters()))
         {
             cn.Open();
             sql = "select * from asada.abonados where ID_ABONADO=@Identification";
             cmd = new MySqlCommand(sql, cn);
             cmd.Parameters.Add(new MySqlParameter("@Identification", id));
             reader = cmd.ExecuteReader();
             while (reader.Read())
             {
                 abo = new Abonado();
                 abo.Identification = reader.GetString(0);
                 abo.Name           = reader.GetString(1);
                 abo.Firstname      = reader.GetString(2);
                 abo.Lastname       = reader.GetString(3);
                 abo.Movil          = reader.GetString(4);
                 abo.Phonenum       = reader.GetString(5);
                 abo.Email          = reader.GetString(6);
                 abo.Dateregister   = reader.GetString(7);
                 abo.Address        = reader.GetString(8);
             }
             reader.Close();
             return(abo);
         }
     }
     catch (Exception e)
     {
         Asada.DAO.Logs lg = new Asada.DAO.Logs();
         lg.Log(DateTime.Now.ToString("dd-MM-yyyy HH:mm:ss") + ", " + e.Message.ToString());
         throw;
     }
 }
예제 #11
0
 public List <Abonado> LoadAbonado1()
 {
     try
     {
         using (MySqlConnection cn = new MySqlConnection((clsCon = new Connection(this.user)).Parameters()))
         {
             listAbo = new List <Abonado>();
             cn.Open();
             sql    = "select * from asada.vw_abonados";
             cmd    = new MySqlCommand(sql, cn);
             reader = cmd.ExecuteReader();
             while (reader.Read())
             {
                 abo = new Abonado();
                 abo.Identification = reader.GetString(0);
                 abo.Name           = reader.GetString(1);
                 listAbo.Add(abo);
             }
             reader.Close();
             return(listAbo);
         }
     }
     catch (Exception e)
     {
         Logs lg = new Logs();
         lg.Log(DateTime.Now.ToString("dd-MM-yyyy HH:mm:ss") + ", " + e.Message.ToString());
         throw;
     }
 }
예제 #12
0
 public Abonado crearAbonado()
 {
     Abonado unAbonado = new Abonado();
     unAbonado.nombre = "Pepe";
     unAbonado.sector = "D0120";
     unAbonado.terminal = "TYO";
     return unAbonado;
 }
예제 #13
0
 private void BtnAccept_Click(object sender, EventArgs e)
 {
     abo = GetInfo();
     this.Hide();
     frmAbo = (frmAbonados)this.Owner;
     frmAbo.Abo_Load(abo, usu);
     frmAbo.Show();
 }
예제 #14
0
 private void dataGridView1_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
 {
     abo = GetInfo();
     this.Hide();
     frmAbo = (frmAbonados)this.Owner;
     frmAbo.Abo_Load(abo, usu);
     frmAbo.Show();
 }
예제 #15
0
        public Result Add(Abonado abonado)
        {
            var result = repositorio.Add <Abonado>(abonado);

            repositorio.SaveChanges();
            return(new Result {
                Object = result
            });
        }
예제 #16
0
        public ActionResult Modify(string username, string token, int id)
        {
            if (!ValidateCredentials())
            {
                return(RedirectToAction("Index", "Login", new { redirect = "Abonado/Modify?id=" + id }));
            }

            Abonado abonado = service.Get(id);

            return(View(abonado));
        }
예제 #17
0
        public ActionResult Create(string username, string token)
        {
            if (!ValidateCredentials())
            {
                return(RedirectToAction("Index", "Login", new { redirect = "Abonado/Create" }));
            }

            var abonado = new Abonado();

            return(View(abonado));
        }
        public async Task <IActionResult> PostAbonado([FromBody] Abonado abonado)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.Abonado.Add(abonado);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetAbonado", new { id = abonado.Id }, abonado));
        }
예제 #19
0
 private void SerchAbonado_Load(object sender, EventArgs e)
 {
     aboDao = new AbonadoDAO(usu);
     abo    = new Abonado();
     dt     = new DataTable();
     dts    = new DataSet();
     // Con la información del adaptador, desde el metodo cargaAbonado se rellena el DataTable
     aboDao.LoadAbonado().Fill(dt);
     dts.Tables.Add(dt);
     // Se asigna el DataTable como origen de datos del DataGridView
     dataGridView1.DataSource = dts.Tables[0];
 }
예제 #20
0
 private Abonado GetInfo()
 {
     abo = new Abonado();
     abo.Identification = MtxtIdentification.Text;
     abo.Name           = TxtName.Text;
     abo.Firstname      = TxtFirstN.Text;
     abo.Lastname       = TxtLastN.Text;
     abo.Movil          = MtxtMovil.Text;
     abo.Phonenum       = MtxtPhone.Text;
     abo.Email          = TxtEmail.Text;
     abo.Address        = TxtAddress.Text;
     abo.Dateregister   = dateTimePicker1.Value.ToString("yyyy/MM/dd");
     return(abo);
 }
예제 #21
0
        public Result Remove(Abonado abonado)
        {
            var result = repositorio.Remove <Abonado>(abonado);

            if (result != null)
            {
                repositorio.SaveChanges();
                return(new Result {
                    Object = result
                });
            }
            return(new Result {
                Error = "No se pudo eliminar el abonado"
            });
        }
예제 #22
0
        public void ejecutar()
        {
            this.Abonado = new Abonado {
                Nombre          = "AbonadoY",
                PrimerApellido  = "Apellido1",
                SegundoApellido = "Apellido2",
                Cedula          = "CedulaY",
                Telefono        = "TelefonoY",
                Direccion       = "DireccionY",
                NumeroAbonado   = "NumeroAbonadoY",
                Afiliado        = true
            };
            this.contexto.Abonados.Add(this.Abonado);

            this.Tarifa = new Tarifa {
                Descripcion = "Descripcion Tarifa Y",
                Precio      = 0
            };
            this.contexto.Tarifas.Add(this.Tarifa);

            this.Sector = new Sector {
                Descripcion = "Descripcion Sector Y"
            };
            this.contexto.Sectores.Add(this.Sector);

            this.contexto.SaveChanges();

            this.agregar();
            this.listar();
            this.encontrarPorId();
            this.actualizar();
            this.borrar();

            this.contexto.Abonados.Remove(this.Abonado);
            this.contexto.Tarifas.Remove(this.Tarifa);
            this.contexto.Sectores.Remove(this.Sector);

            try
            {
                this.contexto.SaveChanges();
            }
            catch (DbUpdateConcurrencyException ex)
            {
                // Update the values of the entity that failed to save from the store
                ex.Entries.Single().Reload();
                this.contexto.SaveChanges();
            }
        }
예제 #23
0
        //Metodo de actualizar un abonado
        public void actualizar(int Id, string Nombre, string PrimerApellido, string SegundoApellido, string Cedula, string Telefono, string Celular, string Direccion, string Correo, string NumberoAbonado, bool Afiliado)
        {
            Abonado abonado = this.encontrarPorId(Id);

            abonado.Nombre          = Nombre;
            abonado.PrimerApellido  = PrimerApellido;
            abonado.SegundoApellido = SegundoApellido;
            abonado.Cedula          = Cedula;
            abonado.Telefono        = Telefono;
            abonado.Celular         = Celular;
            abonado.Direccion       = Direccion;
            abonado.Correo          = Correo;
            abonado.NumeroAbonado   = NumberoAbonado;
            abonado.Afiliado        = Afiliado;
            this.contexto.SaveChanges();
        }
예제 #24
0
        private Abonado GetInfo()
        {
            //abo.Identification = dataGridView1.CurrentRow.Cells[0].Value.ToString();
            //abo.Name = dataGridView1.CurrentRow.Cells[1].Value.ToString();
            //abo.Firstname = dataGridView1.CurrentRow.Cells[2].Value.ToString();
            //abo.Lastname = dataGridView1.CurrentRow.Cells[3].Value.ToString();
            //abo.Movil = dataGridView1.CurrentRow.Cells[4].Value.ToString();
            //abo.Phonenum = dataGridView1.CurrentRow.Cells[5].Value.ToString();
            //abo.Email = dataGridView1.CurrentRow.Cells[6].Value.ToString();
            //abo.Dateregister = dataGridView1.CurrentRow.Cells[7].Value.ToString();
            //abo.Address = dataGridView1.CurrentRow.Cells[8].Value.ToString();
            //forma anterior de buscar, no permitia filtrar columna por ambos apellidos

            abo = aboDao.SerchOneAbonado(dataGridView1.CurrentRow.Cells[0].Value.ToString());
            return(abo);
        }
예제 #25
0
        public Result Update(int id, Abonado abonado)
        {
            var oldAbonado = repositorio.Get <Abonado>(id);

            if (oldAbonado != null)
            {
                oldAbonado = abonado;
                repositorio.SaveChanges();
                return(new Result {
                    Object = abonado
                });
            }
            return(new Result {
                Error = "No se encontro el abonado"
            });
        }
예제 #26
0
        static void Main(string[] args)
        {
            var p1     = new Abonado("Diego");
            var p2     = new Ocacional("Alejo");
            var obra   = new Obra("El Señor de los Anillos", 10);
            var teatro = new Teatro("Teatro Mayor");

            teatro.VenderBoleta(obra, p1);
            teatro.VenderBoleta(obra, p2);
            teatro.VenderBoleta(obra, p2);
            teatro.VenderBoleta(obra, p2);

            obra.MostrarAbonados();
            obra.MostrarOcasional();
            Console.WriteLine($"obra.Recaudo {obra.Recaudo}");
            Console.Read();
        }
예제 #27
0
        /*
         * Funcion que registra los abonados
         */
        private int guardarAbonado(
            string numeroIdentidad,
            string nombres,
            string apellidos
            )
        {
            Abonado a = new Abonado
            {
                NumIdentidad = numeroIdentidad,
                Nombres      = nombres,
                Apellidos    = apellidos
            };

            int idAbonado = DataAbonadoAccess.insertarAbonado(a);

            lblTituloAbonados.Text = "Abonado ingresado";
            return(idAbonado);
        }
예제 #28
0
        public async Task <List <Espectador> > GetEspectadors()
        {
            List <Espectador> espectadors   = new List <Espectador>();
            SqlConnection     sqlConnection = new SqlConnection(connectionString);

            try
            {
                await sqlConnection.OpenAsync();

                string     query   = "SELECT * FROM Persona";
                SqlCommand command = new SqlCommand(query, sqlConnection);
                var        reader  = await command.ExecuteReaderAsync();

                while (reader.Read())
                {
                    var personaModel = new PersonaModel
                    {
                        IdPersona     = Convert.ToInt16(reader["IdPersona"]),
                        Nombre        = Convert.ToString(reader["Nombre"]),
                        IdClasificado = Convert.ToInt16(reader["IdClasificado"])
                    };
                    if (personaModel.IdClasificado == 2)
                    {
                        var abonado = new Abonado(personaModel.Nombre)
                        {
                            IdPersona = personaModel.IdPersona
                        };
                        espectadors.Add(abonado);
                    }
                }
                await command.Connection.CloseAsync();
            }
            catch (Exception ex)
            {
                Console.Write("Exception Message: " + ex.Message);
            }
            finally
            {
                await sqlConnection.CloseAsync();
            }

            return(espectadors);
        }
        /*
         * funcion para actualizar el abonado
         */
        public static void actualizarAbonado(
            int IdAbonado,
            string nombres,
            string apellidos,
            string numeroIdentidad = ""
            )
        {
            Abonado abonado = (
                from a in ctx.Abonado
                where a.IdAbonado == IdAbonado
                select a
                ).SingleOrDefault();

            abonado.Nombres      = nombres;
            abonado.Apellidos    = apellidos;
            abonado.NumIdentidad = numeroIdentidad;

            ctx.SaveChanges();
        }
예제 #30
0
 //Evento del datagrid para seleccionar un abonado
 private void dgAbonados_MouseDoubleClick(object sender, MouseButtonEventArgs e)
 {
     this.abonadoActual = this.dgAbonados.CurrentItem as Abonado;
     if (null == this.abonadoActual)
     {
         return;
     }
     this.txtNombre.Text           = this.abonadoActual.Nombre;
     this.txtPrimerApellido.Text   = this.abonadoActual.PrimerApellido;
     this.txtSegundoApellido.Text  = this.abonadoActual.SegundoApellido;
     this.txtCedula.Text           = this.abonadoActual.Cedula;
     this.txtTelefono.Text         = this.abonadoActual.Telefono;
     this.txtCelular.Text          = this.abonadoActual.Celular;
     this.txtDireccion.Text        = this.abonadoActual.Direccion;
     this.txtCorreo.Text           = this.abonadoActual.Correo;
     this.txtNumeroAbonado.Text    = this.abonadoActual.NumeroAbonado;
     this.chbAfiliado.IsChecked    = this.abonadoActual.Afiliado;
     this.lblCantidadValor.Content = (new AccionesPrevistas()).cantidadPrevistasPorIdAbonado(this.abonadoActual.Id);
     this.habilitarCampos(false);
 }
예제 #31
0
        public bool InsertNew(Abonado abo)
        {
            try
            {
                using (MySqlConnection cn = new MySqlConnection((clsCon = new Connection(this.user)).Parameters()))
                {
                    cn.Open();

                    if (!Exist(abo))
                    {
                        sql = "insert into asada.abonados (ID_ABONADO, NOMBRE, APELLIDO1, APELLIDO2, MOVIL, TELEFONO, EMAIL, FECHA_REGISTRO, DIRECCION)" +
                              "values (@Identification, @Name, @Firstname, @Lastname, @Movil, @Phonenum, @Email, @Dateregister, @Address)";
                        cmd = new MySqlCommand(sql, cn);
                        cmd.Parameters.Add(new MySqlParameter("@Identification", abo.Identification));
                        cmd.Parameters.Add(new MySqlParameter("@Name", abo.Name));
                        cmd.Parameters.Add(new MySqlParameter("@Firstname", abo.Firstname));
                        cmd.Parameters.Add(new MySqlParameter("@Lastname", abo.Lastname));
                        cmd.Parameters.Add(new MySqlParameter("@Movil", abo.Movil));
                        cmd.Parameters.Add(new MySqlParameter("@Phonenum", abo.Phonenum));
                        cmd.Parameters.Add(new MySqlParameter("@Email", abo.Email));
                        cmd.Parameters.Add(new MySqlParameter("@Dateregister", abo.Dateregister));
                        cmd.Parameters.Add(new MySqlParameter("@Addres", abo.Address));
                        result = cmd.ExecuteNonQuery();
                        return(result > 0);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
            catch (Exception e)
            {
                Logs lg = new Logs();
                lg.Log(DateTime.Now.ToString("dd-MM-yyyy HH:mm:ss") + ", " + e.Message.ToString());

                return(false);

                throw;
            }
        }
예제 #32
0
 public void mostrarAbonado(Abonado unAbonado)
 {
     Console.WriteLine(unAbonado.nombre);
     Console.ReadLine();
 }
예제 #33
0
 /// 
 /// <param name="item"></param>
 public void agregarItem(Abonado item)
 {
 }