private void Cmd_Modificar_Click(object sender, EventArgs e)
 {
     if (Convert.ToInt32(TUsuario[6]) < 4)
     {
         DateTime now = Util.GetDate();
         ASID = FunASID.Buscar(ASID.codasd);
         if (ASID.fecasd.Date == now.Date)
         {
             Evento = "Modificar";
             Desbloqueos();
             MenulistView(true);
             Txt_CedPer.Enabled   = true;
             Txt_CedPer.BackColor = Color.Turquoise;
             Txt_CedPer.Focus();
         }
         else
         {
             MessageBox.Show("Debe de realizar una inasistencia el día de hoy.", "Atención", MessageBoxButtons.OK, MessageBoxIcon.Stop);
         }
     }
     else
     {
         MessageBox.Show("No tiene el permiso para acceder.", "Atención", MessageBoxButtons.OK, MessageBoxIcon.Stop);
     }
 }
 private void Cmd_Nuevo_Click(object sender, EventArgs e)
 {
     if (Convert.ToInt32(TUsuario[6]) < 5)
     {
         DateTime now = Util.GetDate();
         if (!(FunASID.RealizarNuevo(Util.GetDate().Date)))
         {
             Evento = "Nuevo";
             Desbloqueos();
             Lb_CodAsd.Text = FunASID.Correlativo().PadLeft(8, '0');
             MenulistView(true);
             Txt_CedPer.Enabled   = true;
             Txt_CedPer.BackColor = Color.Turquoise;
             Txt_CedPer.Focus();
             Che_StaAsd.Checked = true;
         }
         else
         {
             MessageBox.Show("Ya realizo un documento de inasistencia con fecha " + now.ToShortDateString() + " tendrá que modificarlo.", "Atención", MessageBoxButtons.OK, MessageBoxIcon.Stop);
         }
     }
     else
     {
         MessageBox.Show("No tiene el permiso para acceder.", "Atención", MessageBoxButtons.OK, MessageBoxIcon.Stop);
     }
 }
        private void Txt_CedPer_KeyDown(object sender, KeyEventArgs e)
        {
            switch (e.KeyCode)
            {
            case Keys.Enter:
                e.SuppressKeyPress = true;
                if (Txt_CedPer.Text.Trim() != "")
                {
                    if (!(FunPER.Existe(Convert.ToInt32(Txt_CedPer.Text))))
                    {
                        Util.CambiarTxt(Txt_CedPer, Txt_NomPer);
                    }
                    else
                    {
                        MessageBox.Show("La cedula del trabajador existe.", "Atención", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                        Txt_CedPer.SelectAll();
                    }
                }
                else
                {
                    MessageBox.Show("El campo de cedula está vacío.", "Atención", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                }
                break;

            case Keys.Escape:
                e.SuppressKeyPress = true;
                Cmd_Cancelar.PerformClick();
                break;
            }
        }
        private void MenulistViewReset()
        {
            Txt_CedPer.Clear();
            Txt_CedPer.Enabled   = false;
            Txt_CedPer.BackColor = Color.White;

            Txt_ComAsd.Clear();
            Txt_ComAsd.Enabled   = false;
            Txt_ComAsd.BackColor = Color.White;
        }
 private void Cmd_Nuevo_Click(object sender, EventArgs e)
 {
     if (Convert.ToInt32(TUsuario[6]) < 5)
     {
         Evento = "Nuevo";
         Desbloqueos();
         Txt_CedPer.Enabled   = true;
         Txt_CedPer.BackColor = Color.Turquoise;
         Txt_CedPer.Focus();
     }
     else
     {
         MessageBox.Show("No tiene el permiso para acceder.", "Atención", MessageBoxButtons.OK, MessageBoxIcon.Stop);
     }
 }
        private void Txt_CedPer_KeyDown(object sender, KeyEventArgs e)
        {
            switch (e.KeyCode)
            {
            case Keys.Enter:
                e.SuppressKeyPress = true;
                if (Txt_CedPer.Text.Trim() != "")
                {
                    if (FunPER.Existe(Convert.ToInt32(Txt_CedPer.Text)))
                    {
                        if (FunPER.StatudAI(Convert.ToInt32(Txt_CedPer.Text)))
                        {
                            Llenar_Lb_NomPer(Convert.ToInt32(Txt_CedPer.Text));
                            Util.CambiarTxt(Txt_CedPer, Txt_ComAsd);
                        }
                        else
                        {
                            MessageBox.Show("El trabajador se encuentra egresado", "Atención", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                            Txt_CedPer.SelectAll();
                        }
                    }
                    else
                    {
                        MessageBox.Show("El trabajador no extiste.", "Atención", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                        Txt_CedPer.SelectAll();
                    }
                }
                else
                {
                    FormBUSQUEDAS f = new FormBUSQUEDAS();
                    f.ListaPersonalAI();
                    f.ShowDialog();
                    if (f._CedPer != "")
                    {
                        Txt_CedPer.Text = f._CedPer;
                        Llenar_Lb_NomPer(Convert.ToInt32(Txt_CedPer.Text));
                        Util.CambiarTxt(Txt_CedPer, Txt_ComAsd);
                    }
                }
                break;

            case Keys.Escape:
                e.SuppressKeyPress = true;
                Cmd_Cancelar.PerformClick();
                Txt_ComAsd.Text = "";
                break;
            }
        }
예제 #7
0
 private void Cmd_Nuevo_Click(object sender, EventArgs e)
 {
     if (Convert.ToInt32(TUsuario[6]) < 5)
     {
         Evento = "Nuevo";
         //isPresent = false;
         Desbloqueos();
         Lb_CodMov.Text       = FunVOD.Correlativo().PadLeft(8, '0');
         Txt_CedPer.Enabled   = true;
         Txt_CedPer.BackColor = Color.Turquoise;
         Txt_CedPer.Focus();
     }
     else
     {
         MessageBox.Show("No tiene el permiso para acceder.", "Atención", MessageBoxButtons.OK, MessageBoxIcon.Stop);
     }
 }
        private void AcOpcion()
        {
            FormOPCIONES F = new FormOPCIONES();

            F.Lb_Titulo1.Text = "Opciones";
            F.Lb_Titulo2.Text = "ESC - Salir";
            F.Opc             = new string[] { "Nuevo", "Modificar", "Eliminar" };
            //this.Hide();
            F.ShowDialog();
            this.Show();
            // MessageBox.Show(F.Returno);
            switch (F.Returno)
            {
            case "1":
                Evento2 = "Nuevo";
                MenulistView(true);
                MenulistViewReset();

                Txt_CedPer.Clear();
                Txt_CedPer.Enabled = true;
                Txt_CedPer.Focus();
                Txt_CedPer.SelectAll();
                Txt_CedPer.BackColor = Color.Turquoise;
                break;

            case "2":
                if (listView1.SelectedItems.Count > 0)
                {
                    Evento2 = "Modificar";
                    MenulistView(true);
                    MenulistViewReset();

                    Txt_CedPer.Text = listView1.SelectedItems[0].SubItems[0].Text;
                    Lb_NomPer.Text  = listView1.SelectedItems[0].SubItems[1].Text;
                    Txt_ComAsd.Text = listView1.SelectedItems[0].SubItems[2].Text;

                    Txt_ComAsd.Enabled = true;
                    Txt_ComAsd.Focus();
                    Txt_ComAsd.SelectAll();
                    Txt_ComAsd.BackColor = Color.Turquoise;
                }
                break;

            case "3":
                foreach (ListViewItem item in listView1.SelectedItems)
                {
                    listView1.Items.Remove(item);
                }
                if (listView1.Items.Count == 0)
                {
                    Evento2 = "Nuevo";
                    MenulistView(true);
                    MenulistViewReset();

                    Txt_CedPer.Clear();
                    Txt_CedPer.Enabled = true;
                    Txt_CedPer.Focus();
                    Txt_CedPer.SelectAll();
                    Txt_CedPer.BackColor = Color.Turquoise;
                }
                break;

            default:
                //MessageBox.Show("ESCAPE");
                break;
            }
        }
        private void Txt_ComAsd_KeyDown(object sender, KeyEventArgs e)
        {
            switch (e.KeyCode)
            {
            case Keys.Return:
                if (Evento.CompareTo("Nuevo") == 0)
                {
                    ListViewItem itmx = listView1.FindItemWithText(Txt_CedPer.Text);
                    if (itmx == null)
                    {
                        string[]     Arra = { Txt_CedPer.Text.Trim(), Lb_NomPer.Text.Trim(), Txt_ComAsd.Text.Trim() };
                        ListViewItem itm  = new ListViewItem(Arra);
                        listView1.Items.Add(itm);
                        MenulistViewLimpial();
                        Util.CambiarTxt(Txt_ComAsd, Txt_CedPer);
                    }
                    else
                    {
                        if (Evento2.CompareTo("Modificar") == 0)
                        {
                            listView1.SelectedItems[0].SubItems[2].Text = Txt_ComAsd.Text;
                            MenulistViewLimpial();
                            Util.CambiarTxt(Txt_ComAsd, Txt_CedPer);
                        }
                        else
                        {
                            MessageBox.Show("El trabajador ya existe en la lista.", "Atención", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                            //itmx.Remove();
                        }
                    }
                }
                else
                {
                    if (Evento.CompareTo("Modificar") == 0)
                    {
                        if (Evento2.CompareTo("Modificar") == 0)
                        {
                            MenulistViewLimpial();
                            MenulistViewReset();
                            listView1.SelectedItems[0].SubItems[2].Text = Txt_ComAsd.Text;
                            Util.CambiarTxt(Txt_ComAsd, Txt_CedPer);
                        }
                        else
                        {
                            if (Evento2.CompareTo("Nuevo") == 0)
                            {
                                ListViewItem itmx = listView1.FindItemWithText(Txt_CedPer.Text);
                                if (itmx == null)
                                {
                                    string[]     Arra = { Txt_CedPer.Text.Trim(), Lb_NomPer.Text.Trim(), Txt_ComAsd.Text.Trim() };
                                    ListViewItem itm  = new ListViewItem(Arra);
                                    listView1.Items.Add(itm);
                                    MenulistViewLimpial();
                                    Util.CambiarTxt(Txt_ComAsd, Txt_CedPer);
                                }
                                else
                                {
                                    MessageBox.Show("El trabajador ya existe en la lista.", "Atención", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                                }
                            }
                            else
                            {
                                ListViewItem itmx = listView1.FindItemWithText(Txt_CedPer.Text);
                                if (itmx == null)
                                {
                                    string[]     Arra = { Txt_CedPer.Text.Trim(), Lb_NomPer.Text.Trim(), Txt_ComAsd.Text.Trim() };
                                    ListViewItem itm  = new ListViewItem(Arra);
                                    listView1.Items.Add(itm);
                                    MenulistViewLimpial();
                                    Util.CambiarTxt(Txt_ComAsd, Txt_CedPer);
                                }
                                else
                                {
                                    MessageBox.Show("El trabajador ya existe en la lista.", "Atención", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                                    //itmx.Remove();
                                }
                            }
                        }
                    }
                }
                break;

            case Keys.Escape:
                e.SuppressKeyPress = true;
                Util.CambiarTxt(Txt_ComAsd, Txt_CedPer);
                Txt_CedPer.Clear();
                break;
            }
        }