예제 #1
0
 private void btn_gravar_Click(object sender, EventArgs e)
 {
     reg_tmp.ID               = txt_ID.Text;
     reg_tmp.NOME             = txt_nome.Text;
     reg_tmp.DATA_ATUALIZACAO = DateTime.Parse(txt_data.Text);
     reg_tmp.RG               = txt_rg.Text;
     reg_tmp.STATUS           = txt_status.Text;
     Console.WriteLine(reg_tmp.ToString());
     Console.WriteLine("---------- GRAVAR------------");
     Console.WriteLine("ID:" + reg_tmp.ID);
     Console.WriteLine("SENHA:" + reg_tmp.SENHA);
     Console.WriteLine("DATA_ATUALIZACAO:" + reg_tmp.DATA_ATUALIZACAO);
     Console.WriteLine("NOME:" + reg_tmp.NOME);
     Console.WriteLine("RG:" + reg_tmp.RG);
     Console.WriteLine("STATUS:" + reg_tmp.STATUS);
     Console.WriteLine("PERFIL:" + reg_tmp.PERFIL);
     Console.WriteLine("-----------------------------");
     try
     {
         if (VA.alteraRegistro(reg_tmp))
         {
             MessageBox.Show("Alteraçoes gravadas com sucesso !!", "Informativo", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
     catch (System.Exception ex)
     {
         MessageBox.Show(ex.Message, "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
     Close();
 }
예제 #2
0
        private void btn_gravar_Click(object sender, EventArgs e)
        {
            user_scmod      reg_tmp = new user_scmod();
            verifica_acesso VA      = new verifica_acesso();

            reg_tmp.ID               = txt_ID.Text;
            reg_tmp.NOME             = txt_nome.Text;
            reg_tmp.DATA_ATUALIZACAO = System.DateTime.Now;
            switch (cmb_inc_perfil.SelectedItem.ToString())
            {
            case "Administrador":
                reg_tmp.PERFIL = "1";
                break;

            case "Gerente":
                reg_tmp.PERFIL = "2";
                break;

            case "Operador":
                reg_tmp.PERFIL = "3";
                break;

            case "Estagiario":
                reg_tmp.PERFIL = "4";
                break;
            }
            reg_tmp.RG = txt_rg.Text;
            if ((sflag == 1) || cb_reset_pass.Checked)
            {
                reg_tmp.SENHA  = "1234";
                reg_tmp.STATUS = "SENHA INICIAL";
            }
            else
            {
                reg_tmp.SENHA = txt_senha.Text;
                if (rb_bloqueado.Checked)
                {
                    reg_tmp.STATUS = "Bloqueado    ";
                }
                else
                {
                    reg_tmp.STATUS = "Desbloqueado ";
                }
            }
            Console.WriteLine(reg_tmp.ToString());
            Console.WriteLine("---------- GRAVAR------------");
            Console.WriteLine("ID:" + reg_tmp.ID);
            Console.WriteLine("SENHA:" + reg_tmp.SENHA);
            Console.WriteLine("DATA_ATUALIZACAO:" + reg_tmp.DATA_ATUALIZACAO);
            Console.WriteLine("NOME:" + reg_tmp.NOME);
            Console.WriteLine("RG:" + reg_tmp.RG);
            Console.WriteLine("STATUS:" + reg_tmp.STATUS);
            Console.WriteLine("PERFIL:" + reg_tmp.PERFIL);
            Console.WriteLine("-----------------------------");

            try
            {
                if (sflag == 1)
                {
                    if (VA.incluiRegistro(reg_tmp))
                    {
                        MessageBox.Show("Incluido com sucesso !!", "Informativo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                else if (sflag == 2)
                {
                    if (VA.alteraRegistro(reg_tmp))
                    {
                        MessageBox.Show("Alterado com sucesso !!", "Informativo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message, "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            ativa_menu();
        }