Example #1
0
        public static string gravaAcessoRapidoUsuario(cadModulo cadmodulo)
        {
            String vret = "";

            try
            {
                String vsql = " insert into usuarioprogmenu(cd_usuario, cd_modulo, cd_programa, dt_registro) " +
                              " values (@cdusuario, @cdmodulo, @cdprograma, current_timestamp);";

                Conexao.getInstance().startTransaction();
                List <ParametroPGSQL> plist = new List <ParametroPGSQL>();
                plist.Add(new ParametroPGSQL("cdusuario", cadmodulo.cd_usuario, DbType.String));
                plist.Add(new ParametroPGSQL("cdmodulo", cadmodulo.cd_modulo, DbType.String));
                plist.Add(new ParametroPGSQL("cdprograma", cadmodulo.cd_programa, DbType.Int32));

                vret = Conexao.getInstance().gravar(vsql, plist);
                if (vret.Equals(string.Empty))
                {
                    Conexao.getInstance().commit();
                    Alert.informacao("Registro Salvo com Sucesso!");
                }
                else
                {
                    Conexao.getInstance().rollback();
                    Alert.erro("Erro ao Gravar Registro! \n" + vret);
                }
            }
            catch (Exception erro)
            {
                Alert.erro(String.Format("Erro ao inserir o registro {0}", erro.Message));
            }
            return(vret);
        }
Example #2
0
        public static string gravaPrograma(cadModulo cadmodulo)
        {
            String vret = "", vsql = "";

            try
            {
                vsql = "insert into public.programa(cd_modulo, cd_programa, cd_submenu, ds_programa, dt_registro) " +
                       "    values (@cdmodulo, @cdprograma, @cdsubmenu, @dsprograma, current_timestamp);";

                if (cadProgramaDAO.existePrograma(cadmodulo.cd_modulo, cadmodulo.cd_programa))
                {
                    vsql = "update public.programa " +
                           " set cd_submenu = @cdsubmenu, ds_programa = @dsprograma " +
                           " where cd_modulo = @cdmodulo and cd_programa = @cdprograma ";
                }

                Conexao.getInstance().startTransaction();
                List <ParametroPGSQL> plist = new List <ParametroPGSQL>();
                plist.Add(new ParametroPGSQL("cdmodulo", cadmodulo.cd_modulo, DbType.String));
                plist.Add(new ParametroPGSQL("cdprograma", cadmodulo.cd_programa, DbType.Int32));
                plist.Add(new ParametroPGSQL("cdsubmenu", cadmodulo.cd_submenu, DbType.Int32));
                plist.Add(new ParametroPGSQL("dsprograma", cadmodulo.ds_programa, DbType.String));
                vret = Conexao.getInstance().gravar(vsql, plist);
                if (vret.Equals(string.Empty))
                {
                    Conexao.getInstance().commit();
                    Alert.informacao("Registro Salvo com Sucesso!");
                }
                else
                {
                    Conexao.getInstance().rollback();
                    Alert.erro("Erro ao Gravar Registro! \n" + vret);
                }
            }
            catch (Exception erro)
            {
                Alert.erro(String.Format("Erro ao inserir o registro {0}", erro.Message));
            }
            return(vret);
        }