当前位置: 首页>>代码示例>>C#>>正文


C# Catalog.GetCurrentVersion方法代码示例

本文整理汇总了C#中Catalog.GetCurrentVersion方法的典型用法代码示例。如果您正苦于以下问题:C# Catalog.GetCurrentVersion方法的具体用法?C# Catalog.GetCurrentVersion怎么用?C# Catalog.GetCurrentVersion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Catalog的用法示例。


在下文中一共展示了Catalog.GetCurrentVersion方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RenderForDisplay

        public string RenderForDisplay(MerchantTribeApplication app, Catalog.Category cat)
        {
            string sizeClass = "flexsize12";
            if (this._Container != null)
            {
                sizeClass = "flexsize";
                sizeClass += ((int)_Container.Size).ToString();
                if (_Container.NoGutter && _Container.Size != ColumnSize.Size12)
                {
                    sizeClass += "w";
                }                
            }            
            string url = System.Web.VirtualPathUtility.ToAbsolute("~/images/system/flexedit/imagePlaceholder.png");
            string alt = "Placeholder Image";
            if (Images.Count > 0)
            {
                ImageDisplayFile img = this.Images[0];
                long versionId = cat.GetCurrentVersion().Id;
                url = Storage.DiskStorage.FlexPageImageUrl(app, cat.Bvin, versionId.ToString(), img.FileName, true);
                alt = img.AltText;                
            }

            return "<img src=\"" + url + "\" alt=\"" + alt + "\" class=\"" + sizeClass + "\" />";
        }
开发者ID:appliedi,项目名称:MerchantTribe,代码行数:24,代码来源:Image.cs

示例2: ProcessJsonRequest

       public PartJsonResult ProcessJsonRequest(System.Collections.Specialized.NameValueCollection form,
                                          MerchantTribeApplication app, Catalog.Category containerCategory)
        {
            PartJsonResult result = new PartJsonResult();

            string action = form["partaction"];
          
            StringBuilder sb = new StringBuilder();          
            switch (action.Trim().ToLowerInvariant())
            {
                case "showeditor":             
                    result.IsFinishedEditing = false;
                    result.Success = true;
                    result.ResultHtml = BuildEditor(containerCategory, string.Empty, app);
                    //result.ScriptFunction = initScript;
                    break;
                case "saveedit":  

                    // Update from Form Here                    
                    string editMessage = string.Empty;

                    if (form["uploadedfilename"] != null)
                    {
                        string uploadedname = form["uploadedfilename"];

                        if (uploadedname.Length > 0)
                        {
                            if (this.Images.Count < 1)
                            {
                                this.Images.Add(new ImageDisplayFile() { AltText = uploadedname, FileName = uploadedname, SortOrder = 0 });
                            }
                            else
                            {
                                this.Images[0].FileName = uploadedname;
                            }
                        }
                    }

                    if (this.Images.Count > 0)
                    {
                        string altText = form["altfield"];
                        this.Images[0].AltText = altText;
                        editMessage = "Changes Saved!";
                    }
                    else
                    {
                        editMessage = "Upload an Image before Saving Changes!";
                    }
                    
                    app.CatalogServices.Categories.Update(containerCategory);
                    result.Success = true;
                    result.IsFinishedEditing = false;
                    result.ResultHtml = BuildEditor(containerCategory, editMessage, app);
                    //result.ScriptFunction = initScript;
                    break;
                case "canceledit":
                    result.Success = true;
                    result.IsFinishedEditing = true;
                    result.ResultHtml = this.RenderForEdit(app, containerCategory);
                    break;
                case "deletepart":
                    containerCategory.GetCurrentVersion().Root.RemovePart(this.Id);
                    app.CatalogServices.Categories.Update(containerCategory);
                    break;
            }

            return result;
        }
开发者ID:appliedi,项目名称:MerchantTribe,代码行数:68,代码来源:Image.cs

示例3: ProcessJsonRequest

       public PartJsonResult ProcessJsonRequest(System.Collections.Specialized.NameValueCollection form,
                                          MerchantTribeApplication app, Catalog.Category containerCategory)
        {
            PartJsonResult result = new PartJsonResult();

            string action = form["partaction"];            

            StringBuilder sb = new StringBuilder();
          
            switch (action.Trim().ToLowerInvariant())
            {
                case "showeditor":                    
                    sb.Append("<textarea name=\"changedtext\" style=\"height:400px;width:675px;\">");
                    sb.Append(this.RawHtml);
                    sb.Append("</textarea><br />");
                    sb.Append("<input type=\"hidden\" name=\"partaction\" class=\"editactionhidden\" value=\"saveedit\" />");
                    sb.Append("<input type=\"submit\" name=\"canceleditbutton\" value=\"Close\">");
                    sb.Append("<input type=\"submit\" name=\"savechanges\" value=\"Save Changes\">");
                    result.IsFinishedEditing = false;
                    result.Success = true;
                    result.ResultHtml = sb.ToString();
                    break;
                case "saveedit":                    
                    this.RawHtml = form["changedtext"];
                    result.IsFinishedEditing = true;                    
                    result.Success = true;
                    result.ResultHtml = this.RenderForEdit(app, containerCategory);
                    app.CatalogServices.Categories.Update(containerCategory);
                    break;
                case "canceledit":
                    result.Success = true;
                    result.IsFinishedEditing = true;
                    result.ResultHtml = this.RenderForEdit(app, containerCategory);
                    break;
                case "deletepart":
                    containerCategory.GetCurrentVersion().Root.RemovePart(this.Id);
                    app.CatalogServices.Categories.Update(containerCategory);
                    break;
            }

            return result;
        }
开发者ID:appliedi,项目名称:MerchantTribe,代码行数:42,代码来源:Html.cs

示例4: BuildEditor

       private string BuildEditor(Catalog.Category containerCategory, string message, MerchantTribeApplication app){

           MerchantTribe.Commerce.RequestContext context = app.CurrentRequestContext;

           long versionId = containerCategory.GetCurrentVersion().Id;
           ImageDisplayFile img = new ImageDisplayFile();
           if (this.Images.Count > 0) img = this.Images[0];

           string previewUrl = "";
           string alt = string.Empty;

           previewUrl = System.Web.VirtualPathUtility.ToAbsolute("~/images/system/flexedit/imagePlaceholder.png");
           if (this.Images.Count > 0)
           {
               alt = this.Images[0].AltText;
               if (this.Images[0].FileName.Trim().Length > 0)
               {
                   previewUrl = Storage.DiskStorage.FlexPageImageUrl(app, containerCategory.Bvin, versionId.ToString(), img.FileName, false);
               }               
           }
                     
           StringBuilder sb = new StringBuilder();
           sb.Append("<div class=\"flexeditarea\">");
           sb.Append("<div id=\"uploadimagemessage\">" + message + "</div>");
           sb.Append("<table width=\"100%\">");
           
           sb.Append("<tr><td class=\"formlabel\">Image:</td><td class=\"formfield\">");
           sb.Append("<img width=\"200px\" height=\"200px\" src=\"" + previewUrl + "\" id=\"uploadimagepreview\" name=\"uploadimagepreview\" /><br />");

           sb.Append("<div id=\"silverlightControlHost\">");
           sb.Append("<object data=\"data:application/x-silverlight-2,\" type=\"application/x-silverlight-2\" width=\"100\" height=\"55\">");

           string SilverLightUrl = System.Web.VirtualPathUtility.ToAbsolute("~/ClientBin/BVSoftware.SilverlightFileUpload.xap");
	 	   sb.Append("<param name=\"source\" value=\""+ SilverLightUrl + "\"/>");

	 	   sb.Append("<param name=\"background\" value=\"black\" />");
           sb.Append("<param name=\"onError\" value=\"onSilverlightError\" />");
		   sb.Append("<param name=\"minRuntimeVersion\" value=\"4.0.50826.0\" />");
		   sb.Append("<param name=\"autoUpgrade\" value=\"true\" />");

           sb.Append("<param name=\"initParams\" value=\"scriptname=ImageWasUploaded,uploadurl=");

           // We have to pull the host out because the ToAbsolute of the virutal path utility
           // will append sub folder name if the web site is not the root app in IIS
           string currentFullRoot = app.StoreUrl(false, false);
           Uri fullUri = new Uri(currentFullRoot);
           string host = fullUri.DnsSafeHost;
           sb.Append("http://" + host);
           sb.Append(System.Web.VirtualPathUtility.ToAbsolute("~/fileuploadhandler/1/" + containerCategory.Bvin + "/" + versionId.ToString()));
           sb.Append("\"/>");

           sb.Append("<a href=\"http://go.microsoft.com/fwlink/?LinkID=149156&v=4.0.50826.0\" style=\"text-decoration:none\">");
           sb.Append("<img src=\"http://go.microsoft.com/fwlink/?LinkId=161376\" alt=\"Get Microsoft Silverlight\" style=\"border-style:none\"/>");
		   sb.Append("</a>");
	       sb.Append("</object><iframe id=\"_sl_historyFrame\" style=\"visibility:hidden;height:0px;width:0px;border:0px\"></iframe>");
           sb.Append("</div>");

           sb.Append("</td></tr>");

           sb.Append("<tr><td class=\"formlabel\">Alt. Text:</td><td class=\"formfield\">");
           sb.Append("<input type=\"text\" id=\"altfield\" name=\"altfield\" value=\"" + System.Web.HttpUtility.HtmlEncode(alt) + "\" />");
           sb.Append("</td></tr>");
         
           sb.Append("</table>");           


           sb.Append("</div>");
           sb.Append("<div class=\"flexeditbuttonarea\">");
           sb.Append("<input type=\"hidden\" name=\"uploadedfilename\" id=\"uploadedfilename\" value=\"\" />");
           sb.Append("<input type=\"hidden\" name=\"partaction\" class=\"editactionhidden\" value=\"saveedit\" />");
           sb.Append("<input type=\"submit\" name=\"canceleditbutton\" value=\"Close\">");
           sb.Append("<input type=\"submit\" name=\"savechanges\" value=\"Save Changes\">");
           sb.Append("</div>");
                 
           return sb.ToString();
       }
开发者ID:appliedi,项目名称:MerchantTribe,代码行数:76,代码来源:Image.cs

示例5: ProcessJsonRequest

        public PartJsonResult ProcessJsonRequest(System.Collections.Specialized.NameValueCollection form,
                                                MerchantTribeApplication app, Catalog.Category containerCategory)
        {
            PartJsonResult result = new PartJsonResult();

            string action = form["partaction"];
            switch (action.ToLowerInvariant())
            {          
                case "showeditor":
                    result.IsFinishedEditing = false;
                    result.Success = true;
                    result.ResultHtml = BuildEditor();                                        
                    break;
                case "saveedit":

                    string colsRequestedString = form["totalColumnsRequested"];
                    int columnsRequested = this.Columns.Count;
                    if (int.TryParse(colsRequestedString, out columnsRequested))
                    {
                        this.SetNumberOfColumns(columnsRequested);
                    }
                    ParseColumnChanges(form);
                    if (form["spacerabove"] == "on")
                    {
                        this.SpacerAbove = true;
                    }
                    else
                    {
                        this.SpacerAbove = false;
                    }
                    app.CatalogServices.Categories.Update(containerCategory);
                    result.Success = true;
                    result.IsFinishedEditing = false;
                    result.ResultHtml = BuildEditor();
                    break;
                case "canceledit":
                    result.Success = true;
                    result.IsFinishedEditing = true;
                    result.ResultHtml = this.RenderForEdit(app, containerCategory);
                    break;
                case "deletepart":
                    containerCategory.GetCurrentVersion().Root.RemovePart(this.Id);                    
                    app.CatalogServices.Categories.Update(containerCategory);
                    result.Success = true;
                    break;

            }
            return result;
        }
开发者ID:appliedi,项目名称:MerchantTribe,代码行数:49,代码来源:ColumnContainer.cs


注:本文中的Catalog.GetCurrentVersion方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。