• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Microservice_Endpoint_Protocol_Enum类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Microservice_Endpoint_Protocol_Enum的典型用法代码示例。如果您正苦于以下问题:C# Microservice_Endpoint_Protocol_Enum类的具体用法?C# Microservice_Endpoint_Protocol_Enum怎么用?C# Microservice_Endpoint_Protocol_Enum使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Microservice_Endpoint_Protocol_Enum类属于命名空间,在下文中一共展示了Microservice_Endpoint_Protocol_Enum类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Engine_VerbMapping

 /// <summary> Constructor for a new instance of the Engine_VerbMapping class </summary>
 /// <param name="Method"> Method within the class specified by the component that should be called to fulfil the request </param>
 /// <param name="Enabled"> Flag indicates if this endpoint is enabled or disabled </param>
 /// <param name="Protocol"> Protocol which this endpoint utilizes ( JSON or Protocol Buffer ) </param>
 /// <param name="RequestType"> Request type expected for this endpoint ( either a GET or a POST ) </param>
 public Engine_VerbMapping(string Method, bool Enabled, Microservice_Endpoint_Protocol_Enum Protocol, Microservice_Endpoint_RequestType_Enum RequestType)
 {
     this.Method = Method;
     this.Enabled = Enabled;
     this.Protocol = Protocol;
     this.RequestType = RequestType;
 }
开发者ID:MarkVSullivan,项目名称:SobekCM-Web-Application,代码行数:12,代码来源:Engine_VerbMapping.cs


示例2: Serialize

        /// <summary> Serialize the return object, according to the protocol requested </summary>
        /// <param name="ReturnValue"> Return object to serialize </param>
        /// <param name="Response"> HTTP Response to write result to </param>
        /// <param name="Protocol"> Requested protocol type </param>
        /// <param name="CallbackJsonP"> Callback function for JSON-P </param>
        protected void Serialize(object ReturnValue, HttpResponse Response, Microservice_Endpoint_Protocol_Enum Protocol, string CallbackJsonP)
        {
            if (ReturnValue == null)
                return;

            switch (Protocol)
            {
                case Microservice_Endpoint_Protocol_Enum.JSON:
                    JSON.Serialize(ReturnValue, Response.Output, Options.ISO8601ExcludeNulls);
                    break;

                case Microservice_Endpoint_Protocol_Enum.PROTOBUF:
                    Serializer.Serialize(Response.OutputStream, ReturnValue);
                    break;

                case Microservice_Endpoint_Protocol_Enum.JSON_P:
                    Response.Output.Write(CallbackJsonP + "(");
                    JSON.Serialize(ReturnValue, Response.Output, Options.ISO8601ExcludeNullsJSONP);
                    Response.Output.Write(");");
                    break;

                case Microservice_Endpoint_Protocol_Enum.XML:
                    XmlSerializer x = new XmlSerializer(ReturnValue.GetType());
                    x.Serialize(Response.Output, ReturnValue);
                    break;

                case Microservice_Endpoint_Protocol_Enum.BINARY:
                    IFormatter binary = new BinaryFormatter();
                    binary.Serialize(Response.OutputStream, ReturnValue);
                    break;
            }
        }
开发者ID:Elkolt,项目名称:SobekCM-Web-Application,代码行数:37,代码来源:EndpointBase.cs


示例3: GetConfigurationLog

        /// <summary> Gets the log from reading all of the configuration files </summary>
        /// <param name="Response"></param>
        /// <param name="UrlSegments"></param>
        /// <param name="QueryString"></param>
        /// <param name="Protocol"></param>
        /// <param name="IsDebug"></param>
        public void GetConfigurationLog(HttpResponse Response, List<string> UrlSegments, NameValueCollection QueryString, Microservice_Endpoint_Protocol_Enum Protocol, bool IsDebug)
        {
            if (Protocol == Microservice_Endpoint_Protocol_Enum.TEXT)
            {
                Response.ContentType = "text/plain";
                foreach (string thisLine in Engine_ApplicationCache_Gateway.Configuration.Source.ReadingLog)
                    Response.Output.WriteLine(thisLine);
                return;
            }

            // Get the JSON-P callback function
            string json_callback = "parseConfigLog";
            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(Engine_ApplicationCache_Gateway.Configuration.Source.ReadingLog, Response, Protocol, json_callback);
        }
开发者ID:MarkVSullivan,项目名称:SobekCM-Web-Application,代码行数:26,代码来源:AdministrativeServices.cs


示例4: GetAdminSettings

        /// <summary> Gets the administrative setting values, which includes display information
        /// along with the current value and key </summary>
        /// <param name="Response"></param>
        /// <param name="UrlSegments"></param>
        /// <param name="QueryString"></param>
        /// <param name="Protocol"></param>
        /// <param name="IsDebug"></param>
        public void GetAdminSettings(HttpResponse Response, List<string> UrlSegments, NameValueCollection QueryString, Microservice_Endpoint_Protocol_Enum Protocol, bool IsDebug)
        {
            Custom_Tracer tracer = new Custom_Tracer();

            try
            {
                tracer.Add_Trace("AdministrativeServices.GetAdminSettings", "Pulling dataset from the database");

                // Get the complete aggregation
                DataSet adminSet = Engine_Database.Get_Settings_Complete(true, tracer);

                // If the returned value from the database was NULL, there was an error
                if ((adminSet == null) || (adminSet.Tables.Count == 0) || ( adminSet.Tables[0].Rows.Count == 0))
                {
                    Response.ContentType = "text/plain";
                    Response.Output.WriteLine("Error completing request");

                    if (IsDebug)
                    {
                        Response.Output.WriteLine("DataSet 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("AdministrativeServices.GetAdminSettings", "Build the list of return objects");
                Admin_Setting_Collection returnValue = new Admin_Setting_Collection();

                try
                {
                    DataColumn keyColumn = adminSet.Tables[0].Columns["Setting_Key"];
                    DataColumn valueColumn = adminSet.Tables[0].Columns["Setting_Value"];
                    DataColumn tabPageColumn = adminSet.Tables[0].Columns["TabPage"];
                    DataColumn headingColumn = adminSet.Tables[0].Columns["Heading"];
                    DataColumn hiddenColumn = adminSet.Tables[0].Columns["Hidden"];
                    DataColumn reservedColumn = adminSet.Tables[0].Columns["Reserved"];
                    DataColumn helpColumn = adminSet.Tables[0].Columns["Help"];
                    DataColumn optionsColumn = adminSet.Tables[0].Columns["Options"];
                    DataColumn idColumn = adminSet.Tables[0].Columns["SettingID"];
                    DataColumn dimensionsColumn = adminSet.Tables[0].Columns["Dimensions"];

                    //Setting_Key, Setting_Value, TabPage, Heading, Hidden, Reserved, Help, Options

                    // Build the return values
                    foreach (DataRow thisRow in adminSet.Tables[0].Rows)
                    {
                        // Build the value object
                        Admin_Setting_Value thisValue = new Admin_Setting_Value
                        {
                            Key = thisRow[keyColumn].ToString(),
                            Value = thisRow[valueColumn] == DBNull.Value ? null : thisRow[valueColumn].ToString(),
                            TabPage = thisRow[tabPageColumn] == DBNull.Value ? null : thisRow[tabPageColumn].ToString(),
                            Heading = thisRow[headingColumn] == DBNull.Value ? null : thisRow[headingColumn].ToString(),
                            Hidden = bool.Parse(thisRow[hiddenColumn].ToString()),
                            Reserved = short.Parse(thisRow[reservedColumn].ToString()),
                            Help = thisRow[helpColumn] == DBNull.Value ? null : thisRow[helpColumn].ToString(),
                            SettingID = short.Parse(thisRow[idColumn].ToString())
                        };

                        // Get dimensions, if some were provided
                        if (thisRow[dimensionsColumn] != DBNull.Value)
                        {
                            string dimensions = thisRow[dimensionsColumn].ToString();
                            if (!String.IsNullOrWhiteSpace(dimensions))
                            {
                                short testWidth;
                                short testHeight;

                                // Does this include width AND height?
                                if (dimensions.IndexOf("|") >= 0)
                                {
                                    string[] splitter = dimensions.Split("|".ToCharArray());
                                    if ((splitter[0].Length > 0) && ( short.TryParse(splitter[0], out testWidth )))
                                    {
                                        thisValue.Width = testWidth;
                                        if ((splitter[1].Length > 0) && (short.TryParse(splitter[1], out testHeight)))
                                        {
                                            thisValue.Height = testHeight;

                                        }
                                    }
                                }
//.........这里部分代码省略.........
开发者ID:MarkVSullivan,项目名称:SobekCM-Web-Application,代码行数:101,代码来源:AdministrativeServices.cs


示例5: ResolveUrl

        /// <summary> Resolve the URL to a Navigation_Object </summary>
        /// <param name="Response"></param>
        /// <param name="UrlSegments"></param>
        /// <param name="QueryString"></param>
        /// <param name="Protocol"></param>
        /// <param name="IsDebug"></param>
        public void ResolveUrl(HttpResponse Response, List<string> UrlSegments, NameValueCollection QueryString, Microservice_Endpoint_Protocol_Enum Protocol, bool IsDebug )
        {
            Custom_Tracer tracer = new Custom_Tracer();
            tracer.Add_Trace("NavigationServices.ResolveUrl", "Parse request and return navigation object");

            try
            {

                // Pull out the http request
                tracer.Add_Trace("NavigationServices.ResolveUrl", "Get the current request HttpRequest object");
                HttpRequest request = HttpContext.Current.Request;

                // Get the base url
                string base_url = request.Url.AbsoluteUri.ToLower().Replace("sobekcm.aspx", "").Replace("sobekcm.svc", "");
                if (base_url.IndexOf("?") > 0)
                    base_url = base_url.Substring(0, base_url.IndexOf("?"));

                tracer.Add_Trace("NavigationServices.ResolveUrl", "Get the navigation object");
                Navigation_Object returnValue = get_navigation_object(QueryString, base_url, request.UserLanguages, tracer);

                tracer.Add_Trace("NavigationServices.ResolveUrl", "Set base url and browser type (may not be useful)");
                returnValue.Base_URL = base_url;
                returnValue.Browser_Type = request.Browser.Type.ToUpper();

                tracer.Add_Trace("NavigationServices.ResolveUrl", "Determine if the user host address was a robot request");
                returnValue.Set_Robot_Flag(request.UserAgent, request.UserHostAddress);

                // 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 = "parseUrlResolver";
                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(returnValue, 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;
            }
        }
开发者ID:Elkolt,项目名称:SobekCM-Web-Application,代码行数:74,代码来源:NavigationServices.cs


示例6: Get_Search_Results_Page

        /// <summary> Get just the search statistics information for a search or browse </summary>
        /// <param name="Response"></param>
        /// <param name="UrlSegments"></param>
        /// <param name="QueryString"></param>
        /// <param name="Protocol"></param>
        /// <param name="IsDebug"></param>
        public void Get_Search_Results_Page(HttpResponse Response, List<string> UrlSegments, NameValueCollection QueryString, Microservice_Endpoint_Protocol_Enum Protocol, bool IsDebug )
        {
            Custom_Tracer tracer = new Custom_Tracer();
            tracer.Add_Trace("ResultsServices.Get_Search_Results_Set", "Parse request to determine search requested");

            // Get all the searh field necessary from the query string
            Results_Arguments args = new Results_Arguments(QueryString);

            // Was a collection indicated?
            if (UrlSegments.Count > 0)
                args.Aggregation = UrlSegments[0];

            // Get the aggregation object (we need to know which facets to use, etc.. )
            tracer.Add_Trace("ResultsServices.Get_Search_Results_Set", "Get the '" + args.Aggregation + "' item aggregation (for facets, etc..)");
            Complete_Item_Aggregation aggr = AggregationServices.get_complete_aggregation(args.Aggregation, true, tracer);

            // If no aggregation was returned, that is an error
            if (aggr == null)
            {
                tracer.Add_Trace("ResultsServices.Get_Search_Results_Set", "Returned aggregation was NULL... aggregation code may not be valid");

                if ( IsDebug )
                {
                    Response.ContentType = "text/plain";
                    Response.Output.WriteLine("DEBUG MODE DETECTED");
                    Response.Output.WriteLine();
                    Response.Output.WriteLine(tracer.Text_Trace);
                    return;
                }

                Response.ContentType = "text/plain";
                Response.Output.WriteLine("Error occurred or aggregation '" + args.Aggregation + "' not valid");
                Response.StatusCode = 500;
                return;
            }

            // Perform the search
            tracer.Add_Trace("ResultsServices.Get_Search_Results_Set", "Perform the search");
            Search_Results_Statistics resultsStats;
            List<iSearch_Title_Result> resultsPage;
            ResultsEndpointErrorEnum error = Get_Search_Results(args, aggr, tracer, out resultsStats, out resultsPage);

            // Map to the results object title / item
            tracer.Add_Trace("ResultsServices.Get_Search_Results_Set", "Map to the results object title / item");
            List<ResultTitleInfo> results = new List<ResultTitleInfo>();
            foreach (iSearch_Title_Result thisResult in resultsPage)
            {
                // Create the new rest title object
                ResultTitleInfo restTitle = new ResultTitleInfo
                {
                    BibID = thisResult.BibID,
                    MainThumbnail = thisResult.GroupThumbnail,
                    Title = thisResult.GroupTitle
                };

                // add each descriptive field over
                int field_index = 0;
                foreach (string metadataTerm in resultsStats.Metadata_Labels)
                {
                    if ( !String.IsNullOrWhiteSpace(thisResult.Metadata_Display_Values[field_index]))
                    {
                        string termString = thisResult.Metadata_Display_Values[field_index];
                        ResultTitle_DescriptiveTerm termObj = new ResultTitle_DescriptiveTerm(metadataTerm);
                        if (termString.IndexOf("|") > 0)
                        {
                            string[] splitter = termString.Split("|".ToCharArray());
                            foreach (string thisSplit in splitter)
                            {
                                if ( !String.IsNullOrWhiteSpace(thisSplit))
                                    termObj.Add_Value(thisSplit.Trim());
                            }
                        }
                        else
                        {
                            termObj.Add_Value(termString.Trim());
                        }
                        restTitle.Description.Add(termObj);
                    }
                    field_index++;
                }

                // Add each item
                for (int i = 0; i < thisResult.Item_Count; i++)
                {
                    iSearch_Item_Result itemResults = thisResult.Get_Item(i);

                    ResultItemInfo newItem = new ResultItemInfo
                    {
                        VID = itemResults.VID,
                        Title = itemResults.Title,
                        Link = itemResults.Link,
                        MainThumbnail = itemResults.MainThumbnail
                    };

//.........这里部分代码省略.........
开发者ID:Elkolt,项目名称:SobekCM-Web-Application,代码行数:101,代码来源:ResultsServices.cs


示例7: GetWebSkin

        /// <summary> Gets the language-specific web skin, by web skin code and language code </summary>
        /// <param name="Response"></param>
        /// <param name="UrlSegments"></param>
        /// <param name="QueryString"></param>
        /// <param name="Protocol"></param>
        /// <param name="IsDebug"></param>
        public void GetWebSkin(HttpResponse Response, List<string> UrlSegments, NameValueCollection QueryString, Microservice_Endpoint_Protocol_Enum Protocol, bool IsDebug )
        {
            if (UrlSegments.Count > 1)
            {
                Custom_Tracer tracer = new Custom_Tracer();
                Web_Skin_Object returnValue;
                try
                {
                    // Get the code and language from the URL
                    string skinCode = UrlSegments[0];
                    tracer.Add_Trace("WebSkinServices.GetWebSkin", "Getting skin for '" + skinCode + "'");

                    string language = UrlSegments[1];
                    Web_Language_Enum languageEnum = Web_Language_Enum_Converter.Code_To_Enum(language);
                    tracer.Add_Trace("WebSkinServices.GetWebSkin", "Getting skin for language '" + Web_Language_Enum_Converter.Enum_To_Name(languageEnum) + "'");

                    returnValue = get_web_skin(skinCode, languageEnum, Engine_ApplicationCache_Gateway.Settings.System.Default_UI_Language, tracer);

                    // 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;
                    }
                }
                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;
                    return;
                }

                // Get the JSON-P callback function
                string json_callback = "parseWebSkin";
                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(returnValue, Response, Protocol, json_callback);
            }
        }
开发者ID:MarkVSullivan,项目名称:SobekCM-Web-Application,代码行数:68,代码来源:WebSkinServices.cs


示例8: GetItemFiles

        /// <summary> Gets the list of all files related to an item </summary>
        /// <param name="Response"></param>
        /// <param name="UrlSegments"></param>
        /// <param name="QueryString"></param>
        /// <param name="Protocol"></param>
        /// <param name="IsDebug"></param>
        public void GetItemFiles(HttpResponse Response, List<string> UrlSegments, NameValueCollection QueryString, Microservice_Endpoint_Protocol_Enum Protocol, bool IsDebug)
        {
            // Must at least have one URL segment for the BibID
            if (UrlSegments.Count > 1)
            {
                Custom_Tracer tracer = new Custom_Tracer();

                try
                {
                    // Get the BibID and VID
                    string bibid = UrlSegments[0];
                    string vid = UrlSegments[1];

                    tracer.Add_Trace("ItemServices.GetItemFiles", "Requested file list for " + bibid + ":" + vid);

                    // Build the brief item
                    tracer.Add_Trace("ItemServices.GetItemFiles", "Building the brief item");
                    BriefItemInfo briefItem = GetBriefItem(bibid, vid, null, tracer);

                    // Was the item null?
                    if (briefItem == null)
                    {
                        // If this was debug mode, then just write the tracer
                        if (IsDebug)
                        {
                            tracer.Add_Trace("ItemServices.GetItemFiles", "NULL value returned from getBriefItem method");

                            Response.ContentType = "text/plain";
                            Response.Output.WriteLine("DEBUG MODE DETECTED");
                            Response.Output.WriteLine();
                            Response.Output.WriteLine(tracer.Text_Trace);
                        }
                        return;
                    }

                    // Look in the cache
                    tracer.Add_Trace("ItemServices.GetItemFiles", "Requesting files from SobekFileSystem");
                    List<SobekFileSystem_FileInfo> files = SobekFileSystem.GetFiles(briefItem);

                    // 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 = "parseItemFiles";
                    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(files, 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;
                }
            }
        }
开发者ID:MarkVSullivan,项目名称:SobekCM-Web-Application,代码行数:87,代码来源:ItemServices.cs


示例9: Bookshelf_HTTP_Snippet

        /// <summary> Writes the small snippet of HTML to pop-up when the user selects the ADD TO BOOKSHELF button </summary>
        /// <param name="Response"></param>
        /// <param name="UrlSegments"></param>
        /// <param name="QueryString"></param>
        /// <param name="Protocol"></param>
        /// <param name="IsDebug"></param>
        public void Bookshelf_HTTP_Snippet(HttpResponse Response, List<string> UrlSegments, NameValueCollection QueryString, Microservice_Endpoint_Protocol_Enum Protocol, bool IsDebug)
        {
            if (UrlSegments.Count > 0)
            {
                Custom_Tracer tracer = new Custom_Tracer();

                // Try to get the user id
                int userid;
                if (!Int32.TryParse(UrlSegments[0], out userid))
                {
                    tracer.Add_Trace("ItemServices.Bookshelf_HTTP_Snippet", "UserID is not a valid integer");

                    Response.ContentType = "text/plain";
                    Response.StatusCode = 400;
                    Response.Output.WriteLine("UserID is not a valid integer");
                    Response.Output.WriteLine();

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

                // Try to get the user information
                tracer.Add_Trace("ItemServices.Bookshelf_HTTP_Snippet", "Requested bookshelf HTML snippet for userid " + userid );
                User_Object thisUser = Engine_Database.Get_User(userid, tracer);

                // If null, respond
                if (thisUser == null)
                {
                    tracer.Add_Trace("ItemServices.Bookshelf_HTTP_Snippet", "User object returned was NULL.. Invalid UserID");

                    Response.ContentType = "text/plain";
                    Response.StatusCode = 400;
                    Response.Output.WriteLine("User object returned was NULL.. Invalid UserID");
                    Response.Output.WriteLine();

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

                tracer.Add_Trace("ItemServices.Bookshelf_HTTP_Snippet", "Building the HTML response");

                // Build the response
                StringBuilder responseBuilder = new StringBuilder();

                // Determine the number of columns for text areas, depending on browser
                int actual_cols = 50;
                //if ((!String.IsNullOrEmpty(CurrentMode.Browser_Type)) && (CurrentMode.Browser_Type.ToUpper().IndexOf("FIREFOX") >= 0))
                //    actual_cols = 45;

                responseBuilder.AppendLine("<!-- Add to bookshelf form -->");
                responseBuilder.AppendLine("<div id=\"addform_content\" class=\"sbk_PopupForm\" style=\"width:530px;\">");
                responseBuilder.AppendLine("  <div class=\"sbk_PopupTitle\"><table style=\"width:100%\"><tr><td style=\"text-align:left;\">Add this item to your Bookshelf</td><td style=\"text-align:right\"> <a href=\"#template\" alt=\"CLOSE\" onclick=\"add_item_form_close()\">X</a> &nbsp; </td></tr></table></div>");
                responseBuilder.AppendLine("  <br />");
                responseBuilder.AppendLine("  <fieldset><legend>Enter notes for this item in your bookshelf &nbsp; </legend>");
                responseBuilder.AppendLine("    <br />");
                responseBuilder.AppendLine("    <table class=\"sbk_PopupTable\">");

                // Add bookshelf choices
                responseBuilder.Append("      <tr><td style=\"width:80px\"><label for=\"add_bookshelf\">Bookshelf:</label></td>");
                responseBuilder.Append("<td><select class=\"email_bookshelf_input\" name=\"add_bookshelf\" id=\"add_bookshelf\">");

                foreach (User_Folder folder in thisUser.All_Folders)
                {
                    if (folder.Folder_Name.Length > 80)
                    {
                        responseBuilder.Append("<option value=\"" + HttpUtility.HtmlEncode(folder.Folder_Name) + "\">" + HttpUtility.HtmlEncode(folder.Folder_Name.Substring(0, 75)) + "...</option>");
                    }
                    else
                    {
                        if (folder.Folder_Name != "Submitted Items")
                        {
                            if (folder.Folder_Name == "My Bookshelf")
                                responseBuilder.Append("<option value=\"" + HttpUtility.HtmlEncode(folder.Folder_Name) + "\" selected=\"selected\" >" + HttpUtility.HtmlEncode(folder.Folder_Name) + "</option>");
                            else
                                responseBuilder.Append("<option value=\"" + HttpUtility.HtmlEncode(folder.Folder_Name) + "\">" + HttpUtility.HtmlEncode(folder.Folder_Name) + "</option>");
                        }
                    }
                }
                responseBuilder.AppendLine("</select></td></tr>");

                // Add comments area
                responseBuilder.Append("      <tr style=\"vertical-align:top\"><td><br /><label for=\"add_notes\">Notes:</label></td>");
//.........这里部分代码省略.........
开发者ID:MarkVSullivan,项目名称:SobekCM-Web-Application,代码行数:101,代码来源:ItemServices.cs


示例10: GetItemEAD

        /// <summary> Gets any EAD information related to an item </summary>
        /// <param name="Response"></param>
        /// <param name="UrlSegments"></param>
        /// <param name="QueryString"></param>
        /// <param name="Protocol"></param>
        /// <param name="IsDebug"></param>
        public void GetItemEAD(HttpResponse Response, List<string> UrlSegments, NameValueCollection QueryString, Microservice_Endpoint_Protocol_Enum Protocol, bool IsDebug)
        {
            // Must at least have one URL segment for the BibID
            if (UrlSegments.Count > 0)
            {
                Custom_Tracer tracer = new Custom_Tracer();

                try
                {
                    // Get the BibID and VID
                    string bibid = UrlSegments[0];
                    string vid = (UrlSegments.Count > 1) ? UrlSegments[1] : "00001";

                    tracer.Add_Trace("ItemServices.GetItemEAD", "Requested ead info for " + bibid + ":" + vid);

                    // Is it a valid BibID/VID, at least in appearance?
                    if ((vid.Length > 0) && (vid != "00000"))
                    {
                        // Get the JSON-P callback function
                        string json_callback = "parseItemEAD";
                        if ((Protocol == Microservice_Endpoint_Protocol_Enum.JSON_P) && (!String.IsNullOrEmpty(QueryString["callback"])))
                        {
                            json_callback = QueryString["callback"];
                        }

                        // Just look in the cache for the EAD information
                        EAD_Transfer_Object eadTransferInfo = CachedDataManager.Items.Retrieve_EAD_Info(bibid, vid, tracer);
                        if (eadTransferInfo != null)
                        {
                            tracer.Add_Trace("ItemServices.GetItemEAD", "Found pre-built EAD transfer object in the cache");

                            // 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;
                            }

                            // Use the base class to serialize the object according to request protocol
                            Serialize(eadTransferInfo, Response, Protocol, json_callback);
                        }

                        // Get the full SOobekCM_Item object for the provided BibID / VID
                        tracer.Add_Trace("ItemServices.GetItemEAD", "Get the full SobekCM_Item object for this BibID / VID");
                        SobekCM_Item currentItem = getSobekItem(bibid, vid, tracer);
                        if (currentItem == null)
                        {
                            // If this was debug mode, then just write the tracer
                            if (IsDebug)
                            {
                                tracer.Add_Trace("ItemServices.GetItemEAD", "Could not retrieve the full SobekCM_Item object");

                                Response.ContentType = "text/plain";
                                Response.Output.WriteLine("DEBUG MODE DETECTED");
                                Response.Output.WriteLine();
                                Response.Output.WriteLine(tracer.Text_Trace);
                            }
                            return;
                        }

                        // Create the wrapper to return only basic citation-type information
                        tracer.Add_Trace("ItemServices.GetItemEAD", "Create wrapper class to return only the ead info");
                        EAD_Transfer_Object responder = new EAD_Transfer_Object();

                        // Transfer all the data over to the EAD transfer object
                        EAD_Info eadInfo = currentItem.Get_Metadata_Module(GlobalVar.PALMM_RIGHTSMD_METADATA_MODULE_KEY) as EAD_Info;
                        if (eadInfo != null)
                        {
                            tracer.Add_Trace("ItemServices.GetItemEAD", "Copy all the source EAD information into the transfer EAD object");

                            // Copy over the full description
                            responder.Full_Description = eadInfo.Full_Description;

                            // Add all the ead TOC sections
                            if (eadInfo.TOC_Included_Sections != null)
                            {
                                foreach (EAD_TOC_Included_Section tocSection in eadInfo.TOC_Included_Sections)
                                {
                                    responder.Add_TOC_Included_Section(tocSection.Internal_Link_Name, tocSection.Section_Title);
                                }
                            }

                            // Copy over all the container portions as well
                            if (eadInfo.Container_Hierarchy != null)
                            {
                                responder.Container_Hierarchy.Type = eadInfo.Container_Hierarchy.Type;
                                responder.Container_Hierarchy.Head = eadInfo.Container_Hierarchy.Head;
                                responder.Container_Hierarchy.Did = ead_copy_did_to_transfer(eadInfo.Container_Hierarchy.Did);

                                if (eadInfo.Container_Hierarchy.Containers != null)
//.........这里部分代码省略.........
开发者ID:MarkVSullivan,项目名称:SobekCM-Web-Application,代码行数:101,代码来源:ItemServices.cs


示例11: GetItemCitation

        /// <summary> Gets the citation information for a digital resource </summary>
        /// <param name="Response"></param>
        /// <param name="UrlSegments"></param>
        /// <param name="QueryString"></param>
        /// <param name="Protocol"></param>
        /// <param name="IsDebug"></param>
        public void GetItemCitation(HttpResponse Response, List<string> UrlSegments, NameValueCollection QueryString, Microservice_Endpoint_Protocol_Enum Protocol, bool IsDebug)
        {
            // Must at least have one URL segment for the BibID
            if (UrlSegments.Count > 0)
            {
                Custom_Tracer tracer = new Custom_Tracer();

                try
                {
                    // Get the BibID and VID
                    string bibid = UrlSegments[0];
                    string vid = (UrlSegments.Count > 1) ? UrlSegments[1] : "00001";

                    tracer.Add_Trace("ItemServices.GetItemCitation", "Requested citation for " + bibid + ":" + vid);

                    if ((vid.Length > 0) && (vid != "00000"))
                    {
                        // Get the brief item
                        tracer.Add_Trace("ItemServices.GetItemCitation", "Build full brief item");
                        BriefItemInfo returnValue = GetBriefItem(bibid, vid, null, tracer);

                        // Was the item null?
                        if (returnValue == null)
                        {
                            // If this was debug mode, then just write the tracer
                            if (IsDebug)
                            {
                                tracer.Add_Trace("ItemServices.GetItemCitation", "NULL value returned from getBriefItem method");

                                Response.ContentType = "text/plain";
                                Response.Output.WriteLine("DEBUG MODE DETECTED");
                                Response.Output.WriteLine();
                                Response.Output.WriteLine(tracer.Text_Trace);
                            }
                            return;
                        }

                        // Create the wrapper to return only basic citation-type information
                        tracer.Add_Trace("ItemServices.GetItemCitation", "Create wrapper class to return only the citation info");
                        BriefItem_CitationResponse responder = new BriefItem_CitationResponse(returnValue);

                        // 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 = "parseItemCitation";
                        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(responder, Response, Protocol, json_callback);
                    }
                    else
                    {
                        tracer.Add_Trace("ItemServices.GetItemCitation", "Requested VID 00000  - will pull the item group / title");

                        // Get the brief item
                        tracer.Add_Trace("ItemServices.GetItemCitation", "Build full brief item");
                        BriefItemInfo returnValue = GetBriefTitle(bibid, null, tracer);

                        // Was the item null?
                        if (returnValue == null)
                        {
                            // If this was debug mode, then just write the tracer
                            if (IsDebug)
                            {
                                tracer.Add_Trace("ItemServices.GetItemCitation", "NULL value returned from getBriefItem method");

                                Response.ContentType = "text/plain";
                                Response.Output.WriteLine("DEBUG MODE DETECTED");
                                Response.Output.WriteLine();
                                Response.Output.WriteLine(tracer.Text_Trace);
                            }
                            return;
                        }

                        // Create the wrapper to return only basic citation-type information
                        tracer.Add_Trace("ItemServices.GetItemCitation", "Create wrapper class to return only the citation info");
                        BriefItem_CitationResponse responder = new BriefItem_CitationResponse(returnValue);

                        // If this was debug mode, then just write the tracer
                        if (IsDebug)
                        {
                            Response.ContentType = "text/plain";
//.........这里部分代码省略.........
开发者ID:MarkVSullivan,项目名称:SobekCM-Web-Application,代码行数:101,代码来源:ItemServices.cs


示例12: GetItemBriefStandard

 /// <summary> Gets the information about a single digital resource, using the STANDARD mapping set </summary>
 /// <param name="Response"></param>
 /// <param name="UrlSegments"></param>
 /// <param name="QueryString"></param>
 /// <param name="Protocol"></param>
 /// <param name="IsDebug"></param>
 public void GetItemBriefStandard(HttpResponse Response, List<string> UrlSegments, NameValueCollection QueryString, Microservice_Endpoint_Protocol_Enum Protocol, bool IsDebug)
 {
     brief_item_response("standard", Response, UrlSegm 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Microsoft类代码示例发布时间:2022-05-24
下一篇:
C# Microblog类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap