/// <summary> Constructor for a new instance of the Actionable_Builder_Source_Folder class </summary>
        /// <param name="ExistingBaseInstance"> An existing base instance used to populate this class with data </param>
        /// <param name="AssemblyClassToModule"> Dictionary to all the built folder builder modules </param>
        /// <remarks> This extends the core class <see cref="Builder_Source_Folder"/> and adds some methods to perform work </remarks>
        public Actionable_Builder_Source_Folder(Builder_Source_Folder ExistingBaseInstance, Dictionary <string, iFolderModule> AssemblyClassToModule)
        {
            Allow_Deletes             = ExistingBaseInstance.Allow_Deletes;
            Allow_Folders_No_Metadata = ExistingBaseInstance.Allow_Folders_No_Metadata;
            Allow_Metadata_Updates    = ExistingBaseInstance.Allow_Metadata_Updates;
            Archive_All_Files         = ExistingBaseInstance.Archive_All_Files;
            Archive_TIFFs             = ExistingBaseInstance.Archive_TIFFs;
            BibID_Roots_Restrictions  = ExistingBaseInstance.BibID_Roots_Restrictions;
            Failures_Folder           = ExistingBaseInstance.Failures_Folder;
            Folder_Name       = ExistingBaseInstance.Folder_Name;
            Inbound_Folder    = ExistingBaseInstance.Inbound_Folder;
            Perform_Checksum  = ExistingBaseInstance.Perform_Checksum;
            Processing_Folder = ExistingBaseInstance.Processing_Folder;

            BuilderModules = new List <iFolderModule>();

            // Copy over the folder modules
            foreach (Builder_Module_Setting settings in ExistingBaseInstance.Builder_Module_Set.Builder_Modules)
            {
                if (AssemblyClassToModule.ContainsKey(settings.Key))
                {
                    iFolderModule module = AssemblyClassToModule[settings.Key];
                    if (module != null)
                    {
                        BuilderModules.Add(module);
                    }
                }
            }
        }
        private static void Set_Builder_Folders(Builder_Settings SettingsObject, DataTable BuilderFoldersTable, Dictionary <int, List <Builder_Source_Folder> > FolderToSetDictionary)
        {
            SettingsObject.IncomingFolders.Clear();
            foreach (DataRow thisRow in BuilderFoldersTable.Rows)
            {
                Builder_Source_Folder newFolder = new Builder_Source_Folder
                {
                    IncomingFolderID          = Convert.ToInt32(thisRow["IncomingFolderId"]),
                    Folder_Name               = thisRow["FolderName"].ToString(),
                    Inbound_Folder            = thisRow["NetworkFolder"].ToString(),
                    Failures_Folder           = thisRow["ErrorFolder"].ToString(),
                    Processing_Folder         = thisRow["ProcessingFolder"].ToString(),
                    Perform_Checksum          = Convert.ToBoolean(thisRow["Perform_Checksum_Validation"]),
                    Archive_TIFFs             = Convert.ToBoolean(thisRow["Archive_TIFF"]),
                    Archive_All_Files         = Convert.ToBoolean(thisRow["Archive_All_Files"]),
                    Allow_Deletes             = Convert.ToBoolean(thisRow["Allow_Deletes"]),
                    Allow_Folders_No_Metadata = Convert.ToBoolean(thisRow["Allow_Folders_No_Metadata"]),
                    Allow_Metadata_Updates    = Convert.ToBoolean(thisRow["Allow_Metadata_Updates"]),
                    BibID_Roots_Restrictions  = thisRow["BibID_Roots_Restrictions"].ToString(),
                    Builder_Module_Set        = { SetID = Convert.ToInt32(thisRow["ModuleSetID"]), SetName = thisRow["SetName"].ToString() }
                };


                if ((thisRow["ModuleSetID"] != null) && (thisRow["ModuleSetID"].ToString().Length > 0))
                {
                    int id = Int32.Parse(thisRow["ModuleSetID"].ToString());
                    if (FolderToSetDictionary.ContainsKey(id))
                    {
                        FolderToSetDictionary[id].Add(newFolder);
                    }
                    else
                    {
                        FolderToSetDictionary[id] = new List <Builder_Source_Folder> {
                            newFolder
                        };
                    }
                }

                SettingsObject.IncomingFolders.Add(newFolder);
            }
        }
        private static void Set_Builder_Folders(Builder_Settings SettingsObject, DataTable BuilderFoldersTable, Dictionary<int, List<Builder_Source_Folder>> FolderToSetDictionary)
        {
            SettingsObject.IncomingFolders.Clear();
            foreach (DataRow thisRow in BuilderFoldersTable.Rows)
            {
                Builder_Source_Folder newFolder = new Builder_Source_Folder
                {
                    IncomingFolderID = Convert.ToInt32(thisRow["IncomingFolderId"]),
                    Folder_Name = thisRow["FolderName"].ToString(),
                    Inbound_Folder = thisRow["NetworkFolder"].ToString(),
                    Failures_Folder = thisRow["ErrorFolder"].ToString(),
                    Processing_Folder = thisRow["ProcessingFolder"].ToString(),
                    Perform_Checksum = Convert.ToBoolean(thisRow["Perform_Checksum_Validation"]),
                    Archive_TIFFs = Convert.ToBoolean(thisRow["Archive_TIFF"]),
                    Archive_All_Files = Convert.ToBoolean(thisRow["Archive_All_Files"]),
                    Allow_Deletes = Convert.ToBoolean(thisRow["Allow_Deletes"]),
                    Allow_Folders_No_Metadata = Convert.ToBoolean(thisRow["Allow_Folders_No_Metadata"]),
                    Allow_Metadata_Updates = Convert.ToBoolean(thisRow["Allow_Metadata_Updates"]),
                    BibID_Roots_Restrictions = thisRow["BibID_Roots_Restrictions"].ToString(),
                    Builder_Module_Set = {SetID = Convert.ToInt32(thisRow["ModuleSetID"]), SetName = thisRow["SetName"].ToString()}
                };

                if (( thisRow["ModuleSetID"] != null) && ( thisRow["ModuleSetID"].ToString().Length > 0 ))
                {
                    int id = Int32.Parse(thisRow["ModuleSetID"].ToString());
                    if (FolderToSetDictionary.ContainsKey(id))
                        FolderToSetDictionary[id].Add(newFolder);
                    else
                    {
                        FolderToSetDictionary[id] = new List<Builder_Source_Folder> {newFolder};
                    }
                }

                SettingsObject.IncomingFolders.Add(newFolder);
            }
        }
        /// <summary> Constructor for a new instance of the Actionable_Builder_Source_Folder class </summary>
        /// <param name="ExistingBaseInstance"> An existing base instance used to populate this class with data </param>
        /// <param name="BuilderModulesConfig"> Builder module configuration to use to process this incoming folder structure </param>
        /// <remarks> This extends the core class <see cref="Builder_Source_Folder"/> and adds some methods to perform work </remarks>
        public Actionable_Builder_Source_Folder(Builder_Source_Folder ExistingBaseInstance, Builder_Modules BuilderModulesConfig )
        {
            Allow_Deletes = ExistingBaseInstance.Allow_Deletes;
            Allow_Folders_No_Metadata = ExistingBaseInstance.Allow_Folders_No_Metadata;
            Allow_Metadata_Updates = ExistingBaseInstance.Allow_Metadata_Updates;
            Archive_All_Files = ExistingBaseInstance.Archive_All_Files;
            Archive_TIFFs = ExistingBaseInstance.Archive_TIFFs;
            BibID_Roots_Restrictions = ExistingBaseInstance.BibID_Roots_Restrictions;
            Failures_Folder = ExistingBaseInstance.Failures_Folder;
            Folder_Name = ExistingBaseInstance.Folder_Name;
            Inbound_Folder = ExistingBaseInstance.Inbound_Folder;
            Perform_Checksum = ExistingBaseInstance.Perform_Checksum;
            Processing_Folder = ExistingBaseInstance.Processing_Folder;

            BuilderModules = new List<iFolderModule>();

            // Copy over the folder modules
            foreach (Builder_Module_Setting settings in ExistingBaseInstance.Builder_Module_Set.Builder_Modules)
            {
                iFolderModule module = BuilderModulesConfig.Get_Folder_Module_By_Key(settings.Key);
                if (module != null)
                    BuilderModules.Add(module);
            }
        }
Ejemplo n.º 5
0
        /// <summary> Gets the information about a single incoming builder folder  </summary>
        /// <param name="Response"></param>
        /// <param name="UrlSegments"></param>
        /// <param name="QueryString"></param>
        /// <param name="Protocol"></param>
        /// <param name="IsDebug"></param>
        public void GetSingleFolder(HttpResponse Response, List <string> UrlSegments, NameValueCollection QueryString, Microservice_Endpoint_Protocol_Enum Protocol, bool IsDebug)
        {
            Custom_Tracer tracer = new Custom_Tracer();

            // Must at least have one URL segment for the BibID
            if (UrlSegments.Count > 0)
            {
                int folderid;
                if (!Int32.TryParse(UrlSegments[0], out folderid))
                {
                    if (IsDebug)
                    {
                        Response.ContentType = "text/plain";
                        Response.Output.WriteLine("Invalid request - folder id must be an integer");
                        Response.Output.WriteLine();
                        Response.Output.WriteLine(tracer.Text_Trace);
                        return;
                    }

                    Response.ContentType = "text/plain";
                    Response.Output.WriteLine("Invalid request - folder id must be an integer");
                    Response.StatusCode = 400;
                    return;
                }

                try
                {
                    tracer.Add_Trace("BuilderServices.GetSingleFolder", "Pulling builder folder information by id " + folderid);

                    // Get the status
                    Builder_Source_Folder builderFolder = Engine_Database.Builder_Get_Incoming_Folder(folderid, tracer);

                    // If the returned value from the database was NULL, there was an error
                    if (builderFolder == null)
                    {
                        Response.ContentType = "text/plain";
                        Response.Output.WriteLine("Error completing request");

                        if (IsDebug)
                        {
                            Response.Output.WriteLine("Builder folder object returned from the database was either NULL or empty");
                            if (Engine_Database.Last_Exception != null)
                            {
                                Response.Output.WriteLine();
                                Response.Output.WriteLine(Engine_Database.Last_Exception.Message);
                                Response.Output.WriteLine();
                                Response.Output.WriteLine(Engine_Database.Last_Exception.StackTrace);
                            }

                            Response.Output.WriteLine();
                            Response.Output.WriteLine(tracer.Text_Trace);
                        }

                        Response.StatusCode = 500;
                        return;
                    }

                    tracer.Add_Trace("BuilderServices.GetSingleFolder", "Successfully built builder folder");

                    // If this was debug mode, then just write the tracer
                    if (IsDebug)
                    {
                        Response.ContentType = "text/plain";
                        Response.Output.WriteLine("DEBUG MODE DETECTED");
                        Response.Output.WriteLine();
                        Response.Output.WriteLine(tracer.Text_Trace);

                        return;
                    }

                    // Get the JSON-P callback function
                    string json_callback = "parseBuilderFolder";
                    if ((Protocol == Microservice_Endpoint_Protocol_Enum.JSON_P) && (!String.IsNullOrEmpty(QueryString["callback"])))
                    {
                        json_callback = QueryString["callback"];
                    }

                    // Use the base class to serialize the object according to request protocol
                    Serialize(builderFolder, Response, Protocol, json_callback);
                }
                catch (Exception ee)
                {
                    if (IsDebug)
                    {
                        Response.ContentType = "text/plain";
                        Response.Output.WriteLine("EXCEPTION CAUGHT!");
                        Response.Output.WriteLine();
                        Response.Output.WriteLine(ee.Message);
                        Response.Output.WriteLine();
                        Response.Output.WriteLine(ee.StackTrace);
                        Response.Output.WriteLine();
                        Response.Output.WriteLine(tracer.Text_Trace);
                        return;
                    }

                    Response.ContentType = "text/plain";
                    Response.Output.WriteLine("Error completing request");
                    Response.StatusCode = 500;
                }
            }
            else
            {
                Response.ContentType = "text/plain";
                Response.Output.WriteLine("Invalid request - folder id must be included");
                Response.StatusCode = 400;
            }
        }
        /// <summary> Constructor for a new instance of the Builder_Folder_Mgmt_AdminViewer class </summary>
        /// <param name="RequestSpecificValues"> All the necessary, non-global data specific to the current request </param>
        public Builder_Folder_Mgmt_AdminViewer(RequestCache RequestSpecificValues) : base(RequestSpecificValues)
        {
            // Verify this user can edit this
            bool allowEdit = (((!UI_ApplicationCache_Gateway.Settings.Servers.isHosted) && (RequestSpecificValues.Current_User.Is_System_Admin)) || (RequestSpecificValues.Current_User.Is_Host_Admin));

            if (!allowEdit)
            {
                RequestSpecificValues.Current_Mode.Mode = Display_Mode_Enum.Aggregation;
                UrlWriterHelper.Redirect(RequestSpecificValues.Current_Mode);
                return;
            }

            // Is there a folder specified?
            folderId = -1;
            if ((RequestSpecificValues.Current_Mode.Remaining_Url_Segments != null) && (RequestSpecificValues.Current_Mode.Remaining_Url_Segments.Length > 0))
            {
                if (String.Compare(RequestSpecificValues.Current_Mode.Remaining_Url_Segments[0], "new", StringComparison.OrdinalIgnoreCase) != 0)
                {
                    if (!Int32.TryParse(RequestSpecificValues.Current_Mode.Remaining_Url_Segments[0], out folderId))
                    {
                        folderId = -1;
                    }
                }
            }

            // Handle any post backs
            saved = false;
            if (RequestSpecificValues.Current_Mode.isPostBack)
            {
                try
                {
                    // Pull the standard values from the form
                    NameValueCollection form = HttpContext.Current.Request.Form;
                    string action_value      = form["admin_builder_folder_action"];

                    // Get the entered values
                    folderName             = form["admin_folder_name"];
                    failuresFolder         = form["admin_folder_error"];
                    inboundFolder          = form["admin_folder_network"];
                    processingFolder       = form["admin_folder_processing"];
                    performChecksum        = (form["admin_folder_checksum"] != null);
                    archiveTiffs           = (form["admin_folder_archive_tiff"] != null);
                    archiveAllFiles        = (form["admin_folder_archive_all"] != null);
                    allowDeletes           = (form["admin_folder_allow_delete"] != null);
                    allowFoldersNoMetadata = (form["admin_folder_no_metadata"] != null);
                    allowMetadataUpdates   = (form["admin_folder_allow_updates"] != null);

                    // Get the hidden values
                    bibIdRestrictions = form["admin_builder_folder_restrictions"];
                    moduleSetId       = Int32.Parse(form["admin_builder_folder_modulesetid"]);

                    // The folders should always end with a slash
                    if ((!String.IsNullOrWhiteSpace(failuresFolder)) && (failuresFolder.Length > 2) && (failuresFolder[failuresFolder.Length - 1] != '\\'))
                    {
                        failuresFolder = failuresFolder + "\\";
                    }
                    if ((!String.IsNullOrWhiteSpace(inboundFolder)) && (inboundFolder.Length > 2) && (inboundFolder[inboundFolder.Length - 1] != '\\'))
                    {
                        inboundFolder = inboundFolder + "\\";
                    }
                    if ((!String.IsNullOrWhiteSpace(processingFolder)) && (processingFolder.Length > 2) && (processingFolder[processingFolder.Length - 1] != '\\'))
                    {
                        processingFolder = processingFolder + "\\";
                    }

                    // Switch, depending on the request
                    if (!String.IsNullOrEmpty(action_value))
                    {
                        // Was this a CANCEL?
                        if (action_value == "cancel")
                        {
                            // Determine URL
                            string returnUrl = RequestSpecificValues.Current_Mode.Base_URL + "l/admin/settings/builder/folders";
                            RequestSpecificValues.Current_Mode.Request_Completed = true;
                            HttpContext.Current.Response.Redirect(returnUrl, false);
                            HttpContext.Current.ApplicationInstance.CompleteRequest();
                            return;
                        }

                        // Was this a DELETE/
                        if (action_value == "delete")
                        {
                            // Try to delete this folder
                            bool result = SobekCM_Database.Builder_Folder_Delete(folderId, RequestSpecificValues.Tracer);
                            if (!result)
                            {
                                actionMessage = "Unknown error encountered while trying to delete this folder";
                            }
                            else
                            {
                                // Clear settings to be pulled again
                                HttpContext.Current.Session["Admin_Settigs"] = null;

                                // Assign this to be used by the system
                                UI_ApplicationCache_Gateway.ResetSettings();

                                // Return to the folder list
                                string returnUrl = RequestSpecificValues.Current_Mode.Base_URL + "l/admin/settings/builder/folders";
                                RequestSpecificValues.Current_Mode.Request_Completed = true;
                                HttpContext.Current.Response.Redirect(returnUrl, false);
                                HttpContext.Current.ApplicationInstance.CompleteRequest();
                                return;
                            }
                        }

                        // Was this a SAVE?
                        if (action_value == "save")
                        {
                            // Perform some validations
                            List <string> errors = new List <string>();
                            if (String.IsNullOrWhiteSpace(folderName))
                            {
                                errors.Add("DESCRIPTIVE NAME is required and missing");
                            }
                            if (String.IsNullOrWhiteSpace(failuresFolder))
                            {
                                errors.Add("FAILURES FOLDER is required and missing");
                            }
                            if (String.IsNullOrWhiteSpace(inboundFolder))
                            {
                                errors.Add("INBOUND FOLDER is required and missing");
                            }
                            if (String.IsNullOrWhiteSpace(processingFolder))
                            {
                                errors.Add("PROCESSING FOLDER is required and missing");
                            }

                            // If there were error, prepare the error message and don't save
                            if (errors.Count > 0)
                            {
                                actionMessage = "ERROR: Some required fields are missing:<br /><br />";
                                foreach (string thisError in errors)
                                {
                                    actionMessage = actionMessage + "&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; " + thisError + "<br />";
                                }
                            }
                            else
                            {
                                // Try to save this folder
                                bool result = SobekCM_Database.Builder_Folder_Edit(folderId, folderName, inboundFolder, failuresFolder, processingFolder, performChecksum, archiveTiffs, archiveAllFiles, allowDeletes, allowFoldersNoMetadata, bibIdRestrictions, moduleSetId, RequestSpecificValues.Tracer);
                                if (!result)
                                {
                                    actionMessage = "Unknown error encountered while saving folder to the database";
                                }
                                else
                                {
                                    // Successfully saved
                                    saved         = true;
                                    actionMessage = "Successfully saved builder folder changes.";

                                    // Clear settings to be pulled again
                                    HttpContext.Current.Session["Admin_Settigs"] = null;

                                    // Assign this to be used by the system
                                    UI_ApplicationCache_Gateway.ResetSettings();

                                    // Also, look to see if a warning might be suitable
                                    List <string> warnings = new List <string>();
                                    try
                                    {
                                        if (!Directory.Exists(failuresFolder))
                                        {
                                            warnings.Add("Can't verify existence of the FAILURES FOLDER");
                                        }
                                        if (!Directory.Exists(inboundFolder))
                                        {
                                            warnings.Add("Can't verify existence of the INBOUND FOLDER");
                                        }
                                        if (!Directory.Exists(processingFolder))
                                        {
                                            warnings.Add("Can't verify existence of the PROCESSING FOLDER");
                                        }
                                    }
                                    catch (Exception)
                                    {
                                        warnings.Clear();
                                        warnings.Add("Exception caught while trying to verify folders.");
                                    }

                                    // Add warnings
                                    if (warnings.Count == 3)
                                    {
                                        // i.e., none of the folders could be verified
                                        actionMessage = actionMessage + "<br /><br />WARNING: Unable to verify existence of any of the folders.  This may be normal since the account under which the web runs does not necessarily need access to the builder folders.";
                                    }
                                    else if (warnings.Count > 0)
                                    {
                                        actionMessage = actionMessage + "<br /><br />WARNING: Unable to verify existence of some of the folders:<br /><br />";
                                        foreach (string thisWarning in warnings)
                                        {
                                            actionMessage = actionMessage + "&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; " + thisWarning + "<br />";
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                catch
                {
                }
            }
            else // NOT A POST BACK
            {
                // Configure the values
                folderName             = String.Empty;
                failuresFolder         = String.Empty;
                inboundFolder          = String.Empty;
                processingFolder       = String.Empty;
                performChecksum        = false;
                archiveTiffs           = false;
                archiveAllFiles        = false;
                allowDeletes           = true;
                allowFoldersNoMetadata = true;
                bibIdRestrictions      = String.Empty;
                moduleSetId            = 10;

                // Is there a folder specified?
                if (folderId > 0)
                {
                    // Try to get this source folder
                    Builder_Source_Folder sourceFolder = SobekEngineClient.Builder.Get_Builder_Folder(folderId, RequestSpecificValues.Tracer);

                    if (sourceFolder != null)
                    {
                        // Set the values from the existing source folder
                        folderName             = sourceFolder.Folder_Name;
                        failuresFolder         = sourceFolder.Failures_Folder;
                        inboundFolder          = sourceFolder.Inbound_Folder;
                        processingFolder       = sourceFolder.Processing_Folder;
                        performChecksum        = sourceFolder.Perform_Checksum;
                        archiveTiffs           = sourceFolder.Archive_TIFFs;
                        archiveAllFiles        = sourceFolder.Archive_All_Files;
                        allowDeletes           = sourceFolder.Allow_Deletes;
                        allowFoldersNoMetadata = sourceFolder.Allow_Folders_No_Metadata;
                        allowMetadataUpdates   = sourceFolder.Allow_Metadata_Updates;
                        bibIdRestrictions      = sourceFolder.BibID_Roots_Restrictions;
                        moduleSetId            = sourceFolder.Builder_Module_Set.SetID;
                    }
                    else
                    {
                        folderId = -1;
                    }
                }
            }
        }
        /// <summary> Gets the latest information about a builder source folder, by primary key </summary>
        /// <param name="FolderID"> Primary key for the builder incoming folder to retrieve </param>
        /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param>
        /// <returns> Fully built information about a single builder source folder </returns>
        /// <remarks> This calls the 'SobekCM_Builder_Get_Incoming_Folder' stored procedure </remarks> 
        public static Builder_Source_Folder Builder_Get_Incoming_Folder(int FolderID, Custom_Tracer Tracer)
        {
            if (Tracer != null)
            {
                Tracer.Add_Trace("Engine_Database.Builder_Get_Incoming_Folder", "Get latest information for a builder incoming folder");
            }

            try
            {
                EalDbParameter[] parameters = new EalDbParameter[1];
                parameters[0] = new EalDbParameter("@FolderId", FolderID);

                DataSet resultSet = EalDbAccess.ExecuteDataset(DatabaseType, Connection_String, CommandType.StoredProcedure, "SobekCM_Builder_Get_Incoming_Folder", parameters);

                if ((resultSet == null) || (resultSet.Tables.Count == 0) || (resultSet.Tables[0].Rows.Count == 0))
                    return null;

                DataRow thisRow = resultSet.Tables[0].Rows[0];
                Builder_Source_Folder newFolder = new Builder_Source_Folder
                {
                    IncomingFolderID = Convert.ToInt32(thisRow["IncomingFolderId"]),
                    Folder_Name = thisRow["FolderName"].ToString(),
                    Inbound_Folder = thisRow["NetworkFolder"].ToString(),
                    Failures_Folder = thisRow["ErrorFolder"].ToString(),
                    Processing_Folder = thisRow["ProcessingFolder"].ToString(),
                    Perform_Checksum = Convert.ToBoolean(thisRow["Perform_Checksum_Validation"]),
                    Archive_TIFFs = Convert.ToBoolean(thisRow["Archive_TIFF"]),
                    Archive_All_Files = Convert.ToBoolean(thisRow["Archive_All_Files"]),
                    Allow_Deletes = Convert.ToBoolean(thisRow["Allow_Deletes"]),
                    Allow_Folders_No_Metadata = Convert.ToBoolean(thisRow["Allow_Folders_No_Metadata"]),
                    Allow_Metadata_Updates = Convert.ToBoolean(thisRow["Allow_Metadata_Updates"]),
                    BibID_Roots_Restrictions = thisRow["BibID_Roots_Restrictions"].ToString(),
                    Builder_Module_Set = { SetID = Convert.ToInt32(thisRow["ModuleSetID"]), SetName = thisRow["SetName"].ToString() }
                };

                return newFolder;

            }
            catch (Exception ee)
            {
                if (Tracer != null)
                {
                    Tracer.Add_Trace("Engine_Database.Builder_Get_Incoming_Folder", "Error during execution: " + ee.Message);
                }
                Last_Exception = ee;
                return null;
            }
        }