Beispiel #1
0
        private void AgregarPerfilesbtn_Click(object sender, EventArgs e)
        {
            try
            {
                //errorProvider1.Clear(); //limpia es errorProvider
                if (nombrePerfiltxt.Text.Trim().Length > 0)
                {
                    Perfil p = new Perfil();
                    p.nombrePerfil = nombrePerfiltxt.Text.Trim();

                    if (!this.ValidarDatosPerfil())
                    {
                        LN.agregarPerfil(p);

                        MessageBox.Show(" agregado", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        this.CargarDataGridPerfiles();
                        LimpiarPerfiles();
                    }
                    else
                    {
                        MessageBox.Show("perfil ya existe en base de datos", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }



                //else MessageBox.Show("Dede indicar usuario", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Beispiel #2
0
 public PitchSave(Pitch pitch)
 {
     letterName = pitch.LetterName.LN;
     degree     = pitch.Degree;
     inversion  = pitch.Inversion;
     octave     = pitch.Octave;
 }
        private void buscarEstadoUsbtn_Click(object sender, EventArgs e)
        {
            int a = 0;

            try
            {
                LN.ConsultaUsuarioYPerfilPorEstado(1);

                this.UsuariosActivodataGridView1.DataSource = null;
                this.UsuariosActivodataGridView1.Refresh();

                if (estadoUsuarioscbo.SelectedValue.ToString() == "Activo")
                {
                    a = 1;
                }
                else
                {
                    a = 0;
                }
                this.UsuariosActivodataGridView1.DataSource = LN.ConsultaUsuarioYPerfilPorEstado(a);
                this.UsuariosActivodataGridView1.Refresh();
                //this.CargarDataGridUsPer();
            }
            catch (Exception)
            {
                throw;
            }


            //ip = Int32.Parse(perfilUsuarioscbo.SelectedValue.ToString());
        }
        private void Deletebtn_Click(object sender, EventArgs e)
        {
            try
            {
                if (nombreUsuariotextBox.Text.Trim().Length > 0)
                {
                    Usuario u = new Usuario();

                    u.nombreUsuario = nombreUsuariotextBox.Text.Trim();

                    LN.Eliminar_Usuario(u);
                    MessageBox.Show("Usuario eliminado");
                    CargarDataGridUsuarios();
                    LimpiarUsuarios();
                }
                else
                {
                    MessageBox.Show("Debe indicar usuario", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Beispiel #5
0
        private void eliminarPerfilesbtn_Click_1(object sender, EventArgs e)
        {
            try
            {
                if (nombrePerfiltxt.Text.Trim().Length > 0)
                {
                    Perfil p = new Perfil();

                    p.nombrePerfil = nombrePerfiltxt.Text.Trim();

                    LN.EliminarPerfil(p);
                    MessageBox.Show("Perfil eliminado");
                    CargarDataGridPerfiles();
                    LimpiarPerfiles();
                }
                else
                {
                    MessageBox.Show("Debe indicar usuario", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Beispiel #6
0
 protected void btnLogin_Click(object sender, EventArgs e)
 {
     try
     {
         Usuarios usuarios = new Usuarios();
         usuarios.nombreUsuario = this.Usuario.Text.Trim();
         usuarios.pass          = this.pass.Text.Trim();
         usuarios.activo        = true;
         if (LN.VerificarUsuarios(usuarios))
         {
             Session["usuario"] = this.Usuario.Text.Trim();
             Response.Redirect(@"~\Bienvenida.aspx");
             intentos = 3;
         }
         else
         {
             if (intentos == 0)
             {
                 error.Text      = "Usuario Bloqueado";
                 usuarios.activo = false;
                 S01_02LogicaNegocio.LN.ModificarUsuarios(usuarios);
             }
             else
             {
                 inx();
                 error.Text = "Error en Contrasena o Usuario";
             }
         }
     }
     catch (Exception ex)
     {
         error.Text = "Error " + ex;
     }
 }
        private void AddUsuariobtn_Click(object sender, EventArgs e)
        {
            int iu, ip = 0;


            try
            {
                //errorProvider1.Clear(); //limpia es errorProvider
                if (nombreUsuariotextBox.Text.Trim().Length > 0)
                {
                    if (claveUsuariotxt.Text.Trim().Length > 0)
                    {
                        if (estadoUsuariotxt.Text.Trim().Length > 0)
                        {
                            Usuario u = new Usuario();
                            u.nombreUsuario = nombreUsuariotextBox.Text.Trim();
                            u.estadoUsuario = estadoUsuariotxt.Text.Trim().Equals("Activo") ? true : false;
                            u.pass          = claveUsuariotxt.Text.Trim();

                            if (!ValidarDatosUsuario())
                            {
                                LN.agregarUsuario(u);
                                iu = this.consultarIdUsuario();
                                ip = Int32.Parse(perfilUsuarioscbo.SelectedValue.ToString());
                                LN.agregarUsuarioPorPerfiles(iu, ip);

                                MessageBox.Show("Usuario agregado", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                CargarDataGridUsuarios();
                                LimpiarUsuarios();
                            }
                            else
                            {
                                MessageBox.Show("usuario ya existe en base de datos", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            }
                        }
                        else
                        {
                            // errorProvider1.SetError(txtEstado, "Debe indicar Estado");
                        }
                    }
                    else
                    {
                        // errorProvider1.SetError(txtClave, "Debe indicar clave");
                    }
                }
                else
                {
                    //errorProvider1.SetError(txtUsuario, "Debe indicar usuario");
                }


                //else MessageBox.Show("Dede indicar usuario", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        private void CargarCombos()
        {
            List <Perfil> lstresultado = LN.ListarPerfiles();

            this.perfilUsuarioscbo.DataSource = lstresultado;
            perfilUsuarioscbo.ValueMember     = "idPerfil";
            perfilUsuarioscbo.DisplayMember   = "nombrePerfil";
            perfilUsuarioscbo.Refresh();
        }
 public void SetLnList(LN l2, LN l3, LN l4, LN l5, LN l6, LN l7)
 {
     lns[1] = l2;
     lns[2] = l3;
     lns[3] = l4;
     lns[4] = l5;
     lns[5] = l6;
     lns[6] = l7;
 }
Beispiel #10
0
 private void selected_button_Click(object sender, EventArgs e)        //снятие выделение со строки в dgv о очищение tb
 {
     button_off();
     foreach (DataGridViewRow row in Data_Person.SelectedRows)
     {
         row.Selected = false;
     }
     LN.Clear(); N.Clear(); MN.Clear(); DOB.Clear(); Act.Checked = false;
     Pasp.Clear(); DOE.Clear(); pos.Clear(); DOD.Clear(); Reas.Clear();
 }
Beispiel #11
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            Grua grua = new Grua();

            grua.idChofer   = Convert.ToInt32(cbIdChofer.Text.Substring(0, 1));
            grua.ubicacion  = tbUbicacion.Text.Trim();
            grua.estadoGrua = cbEstadogGrua.Text.Trim();
            LN.agregarGrua(grua);
            MessageBox.Show("Grua Agregada");
            CargarDataGridGruas();
            cargarBoxChoferes();
        }
 public void Init(LN ln, LN naturalLN, LN sharp, LN flat,
                  KeySigType kst, int noteDistanceFromC, int freqIndexFromC, LN nextSemi1, LN nextSemi2)
 {
     this.Ln                = ln;
     this.Natural           = naturalLN;
     this.Sharp             = sharp;
     this.Flat              = flat;
     this.Kst               = kst;
     this.NoteDistanceFromC = noteDistanceFromC;
     this.FreqIndexFromC    = freqIndexFromC;
     this.NextSemi1         = nextSemi1;
     this.NextSemi2         = nextSemi2;
 }
Beispiel #13
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     if (validarCampos(2))
     {
         Chofer chofer = new Chofer();
         chofer.nombreChofer = texbNombre.Text.Trim();
         chofer.estadoChofer = cboxEstado.SelectedItem.ToString().Equals("Activo") ? true : false;
         LN.agregarChofer(chofer);
         MessageBox.Show("Chofer Agregado");
         limpiarDatos();
         CargarDataGridChoferes();
     }
 }
Beispiel #14
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            Grua grua = new Grua();

            grua.idGrua     = Convert.ToInt32(tbIdGrua.Text.Trim());
            grua.idChofer   = Convert.ToInt32(cbIdChofer.Text.Substring(0, 1));
            grua.ubicacion  = tbUbicacion.Text.Trim();
            grua.estadoGrua = cbEstadogGrua.Text.Trim();
            LN.modificarGrua(grua);
            this.limpiarformulario();
            this.CargarDataGridGruas();
            this.cargarBoxChoferes();
        }
Beispiel #15
0
        private void Update_Click(object sender, EventArgs e)
        {
            if (Fname.Text == "" || Lname.Text == "" || ID.Text == "" || (string)Type.SelectedItem == "" || Type.SelectedItem == null || OwnID.SelectedItem == null || (MgrID.SelectedItem == null && HasMGR.Checked == true))
            {
                MessageBox.Show("Please enter all fields.");
                return;
            }

            string FN, LN;

            FN = Fname.Text;
            LN = Lname.Text;

            if (FN.Any(char.IsDigit))
            {
                MessageBox.Show("No digits are allowed in first name field!");
                return;
            }
            if (LN.Any(char.IsDigit))
            {
                MessageBox.Show("No digits are allowed in last name field!");
                return;
            }
            int x;

            if (!(Int32.TryParse(ID.Text, out x)))
            {
                MessageBox.Show("Please enter a number in the ID number field.");
                return;
            }
            int?MGR = null;

            if (HasMGR.Checked == true)
            {
                MGR = (int)MgrID.SelectedItem;
            }
            int r = contobj.UpdateEmployee(Convert.ToInt32(ID.Text), Fname.Text, Lname.Text, (int)SSN.Value, (float)OSSalary.Value, (float)Salary.Value, Hdate.Value, (string)Type.SelectedItem, (int?)MGR, (int)OwnID.SelectedItem, (int)ContID.SelectedItem);

            if (r > 0)
            {
                MessageBox.Show("The Employee is Updated successfully! :) ");
            }
            else
            {
                MessageBox.Show("Employee Not Updated, Check your input again. ");
            }
            dataGridView1.Refresh();
            SH_ALL_Click(sender, e);
            return;
        }
Beispiel #16
0
        private string nombreChofer(int id)
        {
            string        nombre = "";
            List <Chofer> listaChoferesRelacionados = LN.ConsultaChoferRelacionados();

            foreach (Chofer item in listaChoferesRelacionados)
            {
                if (item.idChofer == id)
                {
                    nombre = item.nombreChofer;
                }
            }
            return(nombre);
        }
Beispiel #17
0
        public void Init(MusicKey key, LN ln1, string name, Mode mode, int flatNum, int sharpNum)
        {
            this.relatedKeys         = new MusicKey[7];
            this.parallelRelatedKeys = new MusicKey[7];
            this.lns = new LN[7];

            this.key      = key;
            this.lns[0]   = ln1;
            this.name     = name;
            this.mode     = mode;
            this.flatNum  = flatNum;
            this.sharpNum = sharpNum;

            this.relatedKeys[0] = key;
        }
        public void CargarMenu()
        {
            tsslUsuarioConectado.Text = Usuario;
            int op1 = 0;


            int AccesoMenu = LN.VerificarAcceso(new Usuario {
                nombreUsuario = Usuario
            });

            consultasToolStripMenuItem.Visible = false;
            catalogosToolStripMenuItem.Visible = false;
            sistemaToolStripMenuItem.Visible   = false;
            switch (AccesoMenu)
            {
            case 1:
            {
                consultasToolStripMenuItem.Visible      = false;
                catalogosToolStripMenuItem.Visible      = true;
                sistemaToolStripMenuItem.Visible        = true;
                cerrarSistemaToolStripMenuItem1.Visible = true;
            }
            break;

            case 2:
            {
                consultasToolStripMenuItem.Visible      = true;
                catalogosToolStripMenuItem.Visible      = false;
                sistemaToolStripMenuItem.Visible        = true;
                cerrarSistemaToolStripMenuItem.Visible  = false;
                perfilToolStripMenuItem.Visible         = false;
                choferesToolStripMenuItem1.Visible      = false;
                gruasToolStripMenuItem1.Visible         = false;
                cerrarSistemaToolStripMenuItem1.Visible = true;
            }
            break;

            case 5:
            {
                consultasToolStripMenuItem.Visible = true;
                catalogosToolStripMenuItem.Visible = true;
                sistemaToolStripMenuItem.Visible   = true;
            }

            break;
            }
        }
Beispiel #19
0
        private void UpdateUsuariobtn_Click(object sender, EventArgs e)
        {
            try {
                Usuario us = new Usuario();
                us.nombreUsuario = nombreUsuariotextBox.Text.Trim();
                us.pass          = claveUsuariotxt.Text.Trim();
                us.estadoUsuario = estadoUsuariotxt.Text.Trim().Equals("Activo")? true:false;

                LN.modificarUsuario(us);
                MessageBox.Show("Usuario modificado");
                this.CargarDataGridUsuarios();
                this.LimpiarUsuarios();
            }
            catch (Exception exc) {
                exc.ToString();
            }
        }
Beispiel #20
0
        private bool ValidarDatosPerfil()
        {
            List <Perfil> lstresultado = LN.ConsultaPerfil(new Perfil {
                nombrePerfil = string.Empty
            });
            bool encontrado = false;

            foreach (Perfil item in lstresultado)
            {
                if (item.nombrePerfil.ToUpper().Equals(nombrePerfiltxt.Text.ToUpper()))
                {
                    encontrado = true;
                    break;
                }
            }

            return(encontrado);
        }
Beispiel #21
0
        private void ActualizarPerfilesbtn_Click_1(object sender, EventArgs e)
        {
            try
            {
                Perfil pe = new Perfil();

                pe.nombrePerfil = nombrePerfiltxt.Text.Trim();

                LN.modificarPerfil(pe);
                MessageBox.Show("Perfil modificado");
                this.CargarDataGridPerfiles();
                this.LimpiarPerfiles();
            }
            catch (Exception exc)
            {
                exc.ToString();
            }
        }
Beispiel #22
0
        private bool ValidarDatosUsuario()
        {
            List <Usuario> lstresultado = LN.ConsultaUsuario(new Usuario {
                nombreUsuario = string.Empty
            });
            bool encontrado = false;

            foreach (Usuario item in lstresultado)
            {
                if (item.nombreUsuario.ToUpper().Equals(nombreUsuariotextBox.Text.ToUpper()))
                {
                    encontrado = true;
                    break;
                }
            }

            return(encontrado);
        }
Beispiel #23
0
        private void Iniciar()
        {
            Usuario usuario = new Usuario();

            usuario.nombreUsuario = txtUsuario.Text.Trim();
            usuario.pass          = txtContrasena.Text.Trim();
            if (LN.ConsultarAutenticacion(usuario))
            {
                frmMenuPrincipal frm = new frmMenuPrincipal();

                frm.Usuario = txtUsuario.Text.Trim();
                frm.CargarMenu();

                frm.Show();

                this.Hide();
            }

            else
            {
                if (LN.VerificarIntento(usuario) == 2)
                {
                    frmLogin frm = new frmLogin();
                    LN.RestIntento(usuario); //reseta el intento a  0
                    MessageBox.Show("Excedio el limite de intentos", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Warning);

                    Application.Exit();
                }
                else
                {
                    Intento += 1;
                    LN.ActulizarUsuario(usuario);
                    if (Intento == 3)
                    {
                        MessageBox.Show("Excedio el limite de intentos", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        Application.Exit();
                    }
                    else
                    {
                        MessageBox.Show("Usuarios y/o contraseña erroneos", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
            }
        }
Beispiel #24
0
        private void BuscarUsuariobtn_Click(object sender, EventArgs e)
        {
            try
            {
                Usuario u = new Usuario();
                u.nombreUsuario = busacarUsuariotxt.Text.Trim();

                List <Usuario> lstusuarios = LN.ConsultaUsuario(u);

                this.UsuariosdataGridView.DataSource = null;
                this.UsuariosdataGridView.Refresh();
                this.UsuariosdataGridView.DataSource = lstusuarios;
                this.UsuariosdataGridView.Refresh();
            }
            catch (Exception)
            {
                throw;
            }
        }
Beispiel #25
0
        private void buscarPerfil_Click(object sender, EventArgs e)
        {
            try
            {
                Perfil p = new Perfil();
                p.nombrePerfil = this.buscarPerfiltxt.Text.Trim();

                List <Perfil> lstusuarios = LN.ConsultaPerfil(p);

                this.PerfilesdataGridView.DataSource = null;
                this.PerfilesdataGridView.Refresh();
                this.PerfilesdataGridView.DataSource = lstusuarios;
                this.PerfilesdataGridView.Refresh();
            }
            catch (Exception)
            {
                throw;
            }
        }
Beispiel #26
0
        private void CargarDataGridPerfiles()
        {
            try
            {
                //hacer un inner join porque ocupo perfil ya lo hice en data
                List <Perfil> lstusuarios = LN.ConsultaPerfil(new Perfil {
                    nombrePerfil = string.Empty
                });

                this.PerfilesdataGridView.DataSource = null;
                this.PerfilesdataGridView.Refresh();
                this.PerfilesdataGridView.DataSource = lstusuarios;
                this.PerfilesdataGridView.Refresh();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #27
0
 private bool validarChoferInactivo(int id)
 {
     try
     {
         bool          validar = false;
         List <Chofer> listaId = new List <Chofer>();
         listaId = LN.ConsultaChoferRelacionados();
         foreach (Chofer item in listaId)
         {
             if (item.idChofer == id)
             {
                 validar = true;
             }
         }
         return(validar);
     }
     catch (Exception)
     {
         throw;
     }
 }
Beispiel #28
0
 private void btnUpdate_Click(object sender, EventArgs e)
 {
     if (validarCampos(1))
     {
         Chofer chofer = new Chofer();
         chofer.idChofer     = Int32.Parse(texboxId.Text.Trim());
         chofer.nombreChofer = texbNombre.Text.Trim();
         chofer.estadoChofer = cboxEstado.SelectedItem.ToString().Equals("Activo") ? true : false;
         if (validarChoferInactivo(chofer.idChofer))
         {
             MessageBox.Show("El chofer tiene una grua asignada");
         }
         else
         {
             LN.modificarChofer(chofer);
             MessageBox.Show("Chofer Modificado");
             limpiarDatos();
             CargarDataGridChoferes();
         }
     }
 }
Beispiel #29
0
        private int consultarIdUsuario()
        {
            int            a            = 0;
            List <Usuario> lstresultado = LN.ConsultaUsuario(new Usuario {
                nombreUsuario = string.Empty
            });

            // bool encontrado = false;
            foreach (Usuario item in lstresultado)
            {
                if (item.nombreUsuario == nombreUsuariotextBox.Text)
                {
                    a = item.idUsuario;
                    //           pruebatxt.Text = a.ToString();

                    break;
                }
            }

            return(a);
        }
Beispiel #30
0
 private void add_button_Click(object sender, EventArgs e)        //добавление записи
 {
     if (LN.Text != "" &&
         N.Text != "" &&
         MN.Text != "" &&
         DOB.Text != "" &&
         pos.Text != "" &&
         Pasp.Text != "" &&
         DOE.Text != "")
     {
         DialogResult dr = MessageBox.Show("Добавить запись?",
                                           "Добавление",
                                           MessageBoxButtons.OKCancel,
                                           MessageBoxIcon.Question,
                                           MessageBoxDefaultButton.Button2);
         if (dr == DialogResult.OK)
         {
             bool flag = false;
             for (int i = 0; i < Objects.Count; i++)
             {
                 if (LN.Text == Objects[i].Lastname &&
                     N.Text == Objects[i].Name &&
                     MN.Text == Objects[i].Midname &&
                     Pasp.Text == Objects[i].passport)
                 {
                     flag = true;
                 }
             }
             if (!flag)
             {
                 DataRow nRow = course_workDataSet.Tables[0].NewRow();
                 Base.add(List_Text_Box, Act, nRow);
                 course_workDataSet.Tables[0].Rows.Add(nRow);
                 info1TableAdapter.Update(course_workDataSet.Info1);
                 course_workDataSet.Tables[0].AcceptChanges();
                 Data_Person.Refresh();
                 Base.data_update(this.Data_Person, this.Objects);
                 MessageBox.Show("Запись добавлена!");
                 LN.Clear();
                 N.Clear();
                 MN.Clear();
                 Pasp.Clear();
                 pos.Clear();
                 Reas.Clear();
             }
             if (flag)
             {
                 MessageBox.Show("Такая запись уже существует!",
                                 "Добавление",
                                 MessageBoxButtons.OK,
                                 MessageBoxIcon.Warning,
                                 MessageBoxDefaultButton.Button1);
             }
         }
     }
     else
     {
         MessageBox.Show("Некорректный ввод! Поля пусты.",
                         "Добавление",
                         MessageBoxButtons.OK,
                         MessageBoxIcon.Information,
                         MessageBoxDefaultButton.Button1);
     }
 }