Beispiel #1
0
        public void Desarquivar(Int32 _IdDocumento)
        {
            using (SqlConnection objConn = new SqlConnection(ConfigurationManager.ConnectionStrings["DBGesDoc"].ConnectionString))
            {
                try
                {
                    objConn.Open();

                    UsuarioDAL uDAL = new UsuarioDAL();

                    SqlCommand cmd_1 = new SqlCommand("DELETE FROM tbArquivamentosInternos WHERE idDocumento = " + _IdDocumento, objConn);
                    SqlCommand cmd_2 = new SqlCommand("DELETE FROM tbArquivamentosExternos WHERE idDocumento = " + _IdDocumento, objConn);
                    SqlCommand cmd_3 = new SqlCommand("UPDATE tbDocumentos SET arquivado = '0' WHERE idDocumento = " + _IdDocumento, objConn);
                    cmd_1.ExecuteNonQuery();
                    cmd_2.ExecuteNonQuery();
                    cmd_3.ExecuteNonQuery();
                }
                catch (Exception)
                {
                    throw;
                }
                finally
                {
                    objConn.Close();
                }
            }
        }
Beispiel #2
0
        public void Autenticar(string _Email, string _Senha)
        {
            using (SqlConnection objConn = new SqlConnection(ConfigurationManager.ConnectionStrings["DBGesDoc"].ConnectionString))
            {
                try
                {
                    objConn.Open();

                    SqlCommand cmd = new SqlCommand("SELECT IDUsuario,IDProcesso,DSEmail,DSNivelAcesso FROM TB_Usuario WHERE DSEmail = @DSEmail AND DSSenha = @DSSenha AND BTAtivo = 1", objConn);
                    cmd.Parameters.Add("@DSEmail", SqlDbType.VarChar, 60).Value = _Email;
                    cmd.Parameters.Add("@DSSenha", SqlDbType.VarChar, 15).Value = _Senha;
                    SqlDataReader dr = cmd.ExecuteReader();

                    if (dr.Read())
                    {
                        UsuarioDAL uDAL = new UsuarioDAL();

                        HttpContext.Current.Session["sesIdUsuario"]   = dr["IDUsuario"];
                        HttpContext.Current.Session["sesIdProcesso"]  = dr["IDProcesso"];
                        HttpContext.Current.Session["sesEmail"]       = dr["DSEmail"];
                        HttpContext.Current.Session["sesNivelAcesso"] = dr["DSNivelAcesso"];

                        HttpContext.Current.Response.Redirect("Home/Default.aspx");
                    }
                    else
                    {
                        HttpContext.Current.Response.Write("<script language='JavaScript'>alert('E-mail ou senha incorretos');history.go(-1);</script>");
                    }
                }
                catch (Exception)
                { throw; }
                finally
                { objConn.Close(); }
            }
        }
Beispiel #3
0
        public void Receber(Int32 _IdDocumento)
        {
            using (SqlConnection objConn = new SqlConnection(ConfigurationManager.ConnectionStrings["DBGesDoc"].ConnectionString))
            {
                try
                {
                    objConn.Open();

                    UsuarioDAL uDAL = new UsuarioDAL();

                    SqlCommand cmd = new SqlCommand("UPDATE tbMovimentacoes Set recebido='Sim',recebidoPor='" + uDAL.ObterDadosPorId(Convert.ToInt32(HttpContext.Current.Session["sesIdUsuario"])).DSNome + "',dataHoraRecebimento='" + DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString() + "' WHERE idDocumento = " + _IdDocumento + " And recebido = 'Não'", objConn);
                    cmd.ExecuteNonQuery();
                }
                catch (Exception)
                {
                    throw;
                }
                finally
                {
                    objConn.Close();
                }
            }
        }