Пример #1
0
        public static bool registrarPerfilDefault(string codigo, string descripcion)
        {
            var res = true;

            //Cuando se registra un nuevo perfil, añadir por defecto los permisos de menu
            SAPbobsCOM.Recordset mRS = null;

            try
            {
                mRS = Conexion.company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
                var mLines = MenuAppDAO.listar();

                foreach (var l in mLines)
                {
                    mRS.DoQuery("insert into " + BdMobile.BD_NAME + "." + BdMobile.TB_PERMISOS +
                                " values (" + obtenerUltimoId() + ", " + EmpresaDAO.obtenerIdInterno() +
                                ", " + l.docEntry + ", '" + codigo + "', 'N', 'N', 'N', 'N', 'N', 'N')");
                }
            }
            catch (Exception e)
            {
                res = false;
                StatusMessageError("PermisoDAO > registrarPerfilDefault() > " + e.Message);
            }
            finally
            {
                if (mRS != null)
                {
                    LiberarObjetoGenerico(mRS);
                }
            }

            return(res);
        }
Пример #2
0
        public static bool registrarMenuDetalleDefault(string codMenu, string descripcion)
        {
            var res = true;

            SAPbobsCOM.Recordset mRS       = null;
            SAPbobsCOM.Recordset mRSInsert = null;

            try
            {
                mRS       = Conexion.company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
                mRSInsert = Conexion.company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
                mRS.DoQuery("select distinct \"idPerfil\", \"idEmpresa\" from " + BdMobile.BD_NAME + "." + BdMobile.TB_PERMISOS);

                string idMenu = MenuAppDAO.obtenerIdxCodigo(codMenu);

                if (mRS.RecordCount > 0)
                {
                    while (!mRS.EoF)
                    {
                        string idPerfil  = mRS.Fields.Item("idPerfil").Value.ToString().Trim();
                        string idEmpresa = mRS.Fields.Item("idEmpresa").Value.ToString().Trim();

                        mRSInsert.DoQuery("insert into " + BdMobile.BD_NAME + "." + BdMobile.TB_PERMISOS +
                                          " values (" + obtenerUltimoId() + ", " + idEmpresa +
                                          ", " + idMenu + ", '" + idPerfil + "', 'N', 'N', 'N', 'N', 'N', 'N')");

                        mRS.MoveNext();
                    }
                }
            }
            catch (Exception ex)
            {
                res = false;
                StatusMessageError("PermisoDAO > registrarDetalleDefault() > " + ex.Message);
            }
            finally
            {
                if (mRS != null)
                {
                    LiberarObjetoGenerico(mRS);
                }

                if (mRSInsert != null)
                {
                    LiberarObjetoGenerico(mRSInsert);
                }
            }

            return(res);
        }