// Set up detail parms based on QueryString
        public void SetUpDetailParms()
        {
            bool bValidDetail = false;
            string sDetailTblVar = "";

            // Get the keys for master table
            if (HttpContext.Current.Request.QueryString[EW_TABLE_SHOW_DETAIL] != null) {
            sDetailTblVar = ew_Get(EW_TABLE_SHOW_DETAIL);
            Personas.CurrentDetailTable = sDetailTblVar;
            } else {
            sDetailTblVar = Personas.CurrentDetailTable;
            }
            if (ew_NotEmpty(sDetailTblVar)) {
            if (sDetailTblVar == "VehiculosAutorizados") {
                if (VehiculosAutorizados == null)
                    VehiculosAutorizados = new cVehiculosAutorizados(this);
                if (VehiculosAutorizados.DetailAdd) {
                    if (CopyRecord)
                        VehiculosAutorizados.CurrentMode = "copy";
                    else
                        VehiculosAutorizados.CurrentMode = "add";
                    VehiculosAutorizados.CurrentAction = "gridadd";

                    // Save current master table to detail table
                    VehiculosAutorizados.CurrentMasterTable = Personas.TableVar;
                    VehiculosAutorizados.StartRecordNumber = 1;
                    VehiculosAutorizados.IdPersona.FldIsDetailKey = true;
                    VehiculosAutorizados.IdPersona.CurrentValue = Personas.IdPersona.CurrentValue;
                    VehiculosAutorizados.IdPersona.SessionValue = VehiculosAutorizados.IdPersona.CurrentValue;
                }
            }
            }
        }
        //
        //  Page class constructor
        //
        public cPersonas_add(AspNetMaker9_ControlVehicular APage)
        {
            m_ParentPage = APage;
            m_Page = this;
            m_PageID = "add";
            m_PageObjName = "Personas_add";
            m_PageObjTypeName = "cPersonas_add";

            // Initialize language object
            if (Language == null)
                Language = new cLanguage(this);

            // Initialize table object
            if (Personas == null)
                Personas = new cPersonas(this);
            if (Areas == null)
                Areas = new cAreas(this);
            if (Usuarios == null)
                Usuarios = new cUsuarios(this);
            if (VehiculosAutorizados_grid == null)
                VehiculosAutorizados_grid = new cVehiculosAutorizados_grid(ParentPage);
            if (VehiculosAutorizados == null)
                VehiculosAutorizados = new cVehiculosAutorizados(this);

            // Table
            m_TableName = "Personas";
            m_Table = Personas;
            CurrentTable = Personas;

            //CurrentTableType = Personas.GetType();
            // Initialize URLs
            // Connect to database

            if (Conn == null)
                Conn = new cConnection();
        }
        //
        // Page main processing
        //
        public void Page_Main()
        {
            // Open connection to the database
            Conn = new cConnection();

            // Initialize table object
            if (VehiculosAutorizados == null)
                VehiculosAutorizados = new cVehiculosAutorizados(this);
            if (Personas == null)
                Personas = new cPersonas(this);
            if (Usuarios == null)
                Usuarios = new cUsuarios(this);
            if (Security == null) Security = new cAdvancedSecurity(this);
            if (!Security.IsLoggedIn()) Security.AutoLogin();
            if (!Security.IsLoggedIn()) {
                ew_Write(Language.Phrase("NoPermission"));
                ew_End();
            }

            // Table Permission loading event
            Security.TablePermission_Loading();
            Security.LoadCurrentUserLevel("VehiculosAutorizados");

            // Table Permission loaded event
            Security.TablePermission_Loaded();
            if (!Security.IsLoggedIn()) {
                Security.SaveLastUrl();
                ew_Write(Language.Phrase("NoPermission"));
                ew_End();
            }
            if (!Security.CanList) {
                ew_Write(Language.Phrase("NoPermission"));
                ew_End();
            }

            // UserID_Loading event
            Security.UserID_Loading();
            if (Security.IsLoggedIn()) Security.LoadUserID();

            // UserID_Loaded event
            Security.UserID_Loaded();
        }
        //
        //  Page class constructor
        //
        public cVehiculosPicoYPlacaHoras_grid(AspNetMaker9_ControlVehicular APage)
        {
            m_ParentPage = APage;
            m_Page = this;
            m_PageID = "grid";
            m_PageObjName = "VehiculosPicoYPlacaHoras_grid";
            m_PageObjTypeName = "cVehiculosPicoYPlacaHoras_grid";

            // Initialize language object
            if (Language == null)
                Language = new cLanguage(this);

            // Initialize table object
            if (VehiculosPicoYPlacaHoras == null)
                VehiculosPicoYPlacaHoras = new cVehiculosPicoYPlacaHoras(this);
            if (Usuarios == null)
                Usuarios = new cUsuarios(this);
            if (VehiculosAutorizados == null)
                VehiculosAutorizados = new cVehiculosAutorizados(this);

            // Table
            m_TableName = "VehiculosPicoYPlacaHoras";
            m_Table = VehiculosPicoYPlacaHoras;
            MasterTable = CurrentTable;

            //MasterTableType = CurrentTableType;
            CurrentTable = VehiculosPicoYPlacaHoras;

            //CurrentTableType = VehiculosPicoYPlacaHoras.GetType();
            VehiculosPicoYPlacaHoras.LoadDetailParms();
            if (ew_NotEmpty(ew_Get("confirmpage")))
                ConfirmPage = ew_ConvertToBool(ew_Get("confirmpage"));
            if (VehiculosPicoYPlacaHoras.CurrentMasterTable == "VehiculosAutorizados") {
                VehiculosPicoYPlacaHoras.IdVehiculoAutorizado.FldIsDetailKey = true;
                if (ew_NotEmpty(ew_Get("IdVehiculoAutorizado"))) {
                    VehiculosPicoYPlacaHoras.IdVehiculoAutorizado.CurrentValue = ew_Get("IdVehiculoAutorizado");
                    VehiculosPicoYPlacaHoras.IdVehiculoAutorizado.SessionValue = VehiculosPicoYPlacaHoras.IdVehiculoAutorizado.CurrentValue;
                }
            }

            // Initialize URLs
            // Connect to database

            if (Conn == null)
                Conn = new cConnection();

            // Initialize list options
            ListOptions = new cListOptions();
        }
        //
        //  Page class constructor
        //
        public cVehiculosAutorizados_view(AspNetMaker9_ControlVehicular APage)
        {
            m_ParentPage = APage;
            m_Page = this;
            m_PageID = "view";
            m_PageObjName = "VehiculosAutorizados_view";
            m_PageObjTypeName = "cVehiculosAutorizados_view";

            // Initialize language object
            if (Language == null)
                Language = new cLanguage(this);

            // Initialize table object
            if (VehiculosAutorizados == null)
                VehiculosAutorizados = new cVehiculosAutorizados(this);
            if (Personas == null)
                Personas = new cPersonas(this);
            if (Usuarios == null)
                Usuarios = new cUsuarios(this);

            // Table
            m_TableName = "VehiculosAutorizados";
            m_Table = VehiculosAutorizados;
            CurrentTable = VehiculosAutorizados;

            //CurrentTableType = VehiculosAutorizados.GetType();
            // Initialize URLs

            string KeyUrl = "";
            if (ew_NotEmpty(ew_Get("IdVehiculoAutorizado"))) {
                RecKey["IdVehiculoAutorizado"] = ew_Get("IdVehiculoAutorizado");
                KeyUrl += "&IdVehiculoAutorizado=" + ew_UrlEncode(RecKey["IdVehiculoAutorizado"]);
            }
            ExportPrintUrl = PageUrl + "export=print" + KeyUrl;
            ExportHtmlUrl = PageUrl + "export=html" + KeyUrl;
            ExportExcelUrl = PageUrl + "export=excel" + KeyUrl;
            ExportWordUrl = PageUrl + "export=word" + KeyUrl;
            ExportXmlUrl = PageUrl + "export=xml" + KeyUrl;
            ExportCsvUrl = PageUrl + "export=csv" + KeyUrl;
            ExportPdfUrl = PageUrl + "export=pdf" + KeyUrl;

            // Connect to database
            if (Conn == null)
                Conn = new cConnection();

            // Export options
            ExportOptions = new cListOptions();
            ExportOptions.Tag = "span";
            ExportOptions.Separator = "  ";
        }
        //
        //  Page class constructor
        //
        public cPersonas_list(AspNetMaker9_ControlVehicular APage)
        {
            m_ParentPage = APage;
            m_Page = this;
            m_PageID = "list";
            m_PageObjName = "Personas_list";
            m_PageObjTypeName = "cPersonas_list";

            // Initialize language object
            if (Language == null)
                Language = new cLanguage(this);

            // Initialize table object
            if (Personas == null)
                Personas = new cPersonas(this);
            if (Areas == null)
                Areas = new cAreas(this);
            if (Usuarios == null)
                Usuarios = new cUsuarios(this);
            if (VehiculosAutorizados == null)
                VehiculosAutorizados = new cVehiculosAutorizados(this);

            // Table
            m_TableName = "Personas";
            m_Table = Personas;
            CurrentTable = Personas;

            //CurrentTableType = Personas.GetType();
            // Initialize URLs

            ExportPrintUrl = PageUrl + "export=print";
            ExportExcelUrl = PageUrl + "export=excel";
            ExportWordUrl = PageUrl + "export=word";
            ExportHtmlUrl = PageUrl + "export=html";
            ExportXmlUrl = PageUrl + "export=xml";
            ExportCsvUrl = PageUrl + "export=csv";
            ExportPdfUrl = PageUrl + "export=pdf";
            AddUrl = "Personasadd.aspx?" + EW_TABLE_SHOW_DETAIL + "=";
            InlineAddUrl = PageUrl + "a=add";
            GridAddUrl = PageUrl + "a=gridadd";
            GridEditUrl = PageUrl + "a=gridedit";
            MultiDeleteUrl = "Personasdelete.aspx";
            MultiUpdateUrl = "Personasupdate.aspx";

            // Connect to database
            if (Conn == null)
                Conn = new cConnection();

            // Initialize list options
            ListOptions = new cListOptions();

            // Export options
            ExportOptions = new cListOptions();
            ExportOptions.Tag = "span";
            ExportOptions.Separator = "  ";
        }