public ActionResult Index() { var xmlpackage = new XmlPackage("page.recentadditions.xml.config"); var customer = ControllerContext.HttpContext.GetCustomer(); var packageOutput = AppLogic.RunXmlPackage(xmlpackage, null, customer, customer.SkinID, true, false); var pageTitle = "New Products"; if (!String.IsNullOrEmpty(xmlpackage.SectionTitle)) { pageTitle = xmlpackage.SectionTitle; } var simplePageViewModel = new SimplePageViewModel { MetaTitle = xmlpackage.SETitle, MetaDescription = xmlpackage.SEDescription, MetaKeywords = xmlpackage.SEKeywords, PageTitle = pageTitle, PageContent = packageOutput, }; return(View(ViewNames.SimplePage, simplePageViewModel)); }
protected override void ReadContent(XmlPackage xmlPackage) { if (null == xmlPackage) { throw new ArgumentNullException(nameof(xmlPackage)); } var wmXmlPackage = new WmXmlPackage(xmlPackage); _xml = wmXmlPackage.OuterXml; try { Inspect(wmXmlPackage); Fill(wmXmlPackage); } catch (Exception exception) { if (exception is WmException) { Logger.Debug(exception.Message, exception); Logger.Debug(string.Format(CultureInfo.InvariantCulture, "RESPONSE:\r\n\r\n{0}", SelectXml())); } else { Logger.Error(exception.Message, exception); Logger.Error(string.Format(CultureInfo.InvariantCulture, "RESPONSE:\r\n\r\n{0}", SelectXml())); } throw; } }
public HierarchicalTableMgr(String TableName, String NodeName, String IDColumnName, String GUIDColumnName, String NameColumnName, String XmlPackageName, int CacheMinutes, int SetInitialContextToNodeID, bool OnlyPublishedEntitiesAndObjects, int StoreID) { m_NodeName = NodeName; m_IDColumnName = IDColumnName; m_GUIDColumnName = GUIDColumnName; m_NameColumnName = NameColumnName; m_XmlPackageName = XmlPackageName; m_OnlyPublishedEntitiesAndObjects = OnlyPublishedEntitiesAndObjects; if (m_XmlDoc == null) { String RTParams = "EntityName=" + TableName + "&PublishedOnly=" + CommonLogic.IIF(m_OnlyPublishedEntitiesAndObjects, "1", "0"); if (StoreID > 0) { RTParams += "&FilterByStore=true&CurrentStoreID=" + StoreID.ToString(); } var package = new XmlPackage( packageName: m_XmlPackageName, additionalRuntimeParms: RTParams); m_FinalXml = package.TransformString(); m_XmlDoc = new XmlDocument(); if (m_FinalXml.Length != 0) { using (StringReader sr = new StringReader(m_FinalXml)) { using (XmlReader xr = XmlReader.Create(sr)) { m_XmlDoc.Load(xr); } } } } }
void SendTestNewOrderNotification(Int32 storeId) { var xmlPackageName = AppLogic.AppConfig("XmlPackage.NewOrderAdminNotification"); var xmlPackage = new XmlPackage( packageName: xmlPackageName, skinId: SkinID, additionalRuntimeParms: "ordernumber=999999"); var subject = String.Format(AppLogic.GetString("common.cs.5", SkinID, LocaleSetting), AppLogic.AppConfig("StoreName", storeId, true)); var body = xmlPackage.TransformString(); var SendToList = AppLogic.AppConfig("GotOrderEMailTo").ToString().Replace(",", ";"); if (SendToList.IndexOf(';') != -1) { foreach (String s in SendToList.Split(';')) { AppLogic.SendMail(subject: subject, body: body + AppLogic.AppConfig("MailFooter", storeId, true), useHtml: true, fromAddress: AppLogic.AppConfig("GotOrderEMailFrom", storeId, true), fromName: AppLogic.AppConfig("GotOrderEMailFromName", storeId, true), toAddress: s.Trim(), toName: s.Trim(), bccAddresses: String.Empty, server: AppLogic.MailServer()); } } else { AppLogic.SendMail(subject: subject, body: body + AppLogic.AppConfig("MailFooter", storeId, true), useHtml: true, fromAddress: AppLogic.AppConfig("GotOrderEMailFrom", storeId, true), fromName: AppLogic.AppConfig("GotOrderEMailFromName", storeId, true), toAddress: SendToList, toName: SendToList, bccAddresses: String.Empty, server: AppLogic.MailServer()); } }
protected override void Inspect(XmlPackage xmlPackage) { if (null == xmlPackage) { throw new ArgumentNullException(nameof(xmlPackage)); } }
/// <summary> /// /// </summary> /// <param name="package"></param> /// <returns></returns> public static PgDatParameters ToParameters(this XmlPackage package) { var _result = new PgDatParameters(); _result.PutXmlPackage(package); return(_result); }
string GetXmlPackageDisplayName(string packageName) { var xmlpackage = new XmlPackage( packageName: packageName, customer: HttpContext.Current.GetCustomer(), onlyRunNamedQuery: "QueryThatDoesNotExistSoThisNewsUpFaster"); return(xmlpackage.DisplayName); }
public void PutXmlString(XmlPackage package) { MsDatCommands _dbcs = Serialization.SNG.ReadPackage <MsDatCommands>(package); foreach (MsDatCommand _dc in _dbcs) { Add(_dc.Name, _dc.Text, _dc.Value); } }
protected void Page_Load(object sender, EventArgs e) { try { int SkinID = 1; if (ThisCustomer != null) { SkinID = ThisCustomer.SkinID; } m_P = new XmlPackage( packageName: PackageName, customer: ThisCustomer, additionalRuntimeParms: RuntimeParams); Contents.Text = m_P.TransformString(); m_SectionTitle = m_P.SectionTitle; m_SETitle = m_P.SETitle; m_SEKeywords = m_P.SEKeywords; m_SEDescription = m_P.SEDescription; } catch (Exception ex) { Contents.Text = CommonLogic.GetExceptionDetail(ex, "<br/>"); } if (Page != null) { if (m_SectionTitle.Length != 0) { Page.SectionTitle = m_SectionTitle; } if (m_SETitle.Length != 0) { Page.SETitle = m_SETitle; } if (m_SEKeywords.Length != 0) { Page.SEKeywords = m_SEKeywords; } if (m_SEDescription.Length != 0) { Page.SEDescription = m_SEDescription; } } if (m_P != null && (AppLogic.AppConfigBool("XmlPackage.DumpTransform") || m_P.IsDebug)) { Panel1.Visible = true; Debug1.Text = "<br/><div><b>" + m_P.PackageUrl + "</b><br/><textarea READONLY style=\"width: 100%\" rows=\"50\">" + XmlCommon.PrettyPrintXml(m_P.PackageDocument.InnerXml) + "</textarea></div>"; Debug2.Text = "<div><b>" + PackageName + "_store.runtime.xml</b><br/><textarea READONLY cols=\"80\" rows=\"50\">" + CommonLogic.ReadFile(CommonLogic.IIF(AppLogic.IsAdminSite, "../", "") + "images/" + PackageName + "_" + CommonLogic.IIF(AppLogic.IsAdminSite, "admin", "store") + ".runtime.xml", true) + "</textarea></div>"; Debug3.Text = "<div><b>" + PackageName + "_store.xfrm.xml</b><br/><textarea READONLY cols=\"80\" rows=\"50\">" + CommonLogic.ReadFile(CommonLogic.IIF(AppLogic.IsAdminSite, "../", "") + "images/" + PackageName + "_" + CommonLogic.IIF(AppLogic.IsAdminSite, "admin", "store") + ".xfrm.xml", true) + "</textarea></div>"; } else { Panel1.Visible = false; } }
protected override void Inspect(XmlPackage xmlPackage) { if (null == xmlPackage) { throw new ArgumentNullException(nameof(xmlPackage)); } int errorNumber = xmlPackage.SelectInt32("retval"); if (0 != errorNumber) { throw new OriginalTransferException(errorNumber, xmlPackage.SelectString("retdesc")); } }
void SendTestShippedEmail(Int32 storeId) { var xmlPackageName = AppLogic.AppConfig("XmlPackage.OrderShipped"); var xmlPackage = new XmlPackage( packageName: xmlPackageName, skinId: SkinID, additionalRuntimeParms: "ordernumber=999999"); var subject = String.Format(AppLogic.GetString("common.cs.2", SkinID, LocaleSetting), AppLogic.AppConfig("StoreName", storeId, true)); var body = xmlPackage.TransformString(); AppLogic.SendMail(subject: subject, body: body + AppLogic.AppConfig("MailFooter"), useHtml: true, fromAddress: AppLogic.AppConfig("ReceiptEMailFrom", storeId, true), fromName: AppLogic.AppConfig("ReceiptEMailFromName", storeId, true), toAddress: ThisCustomer.EMail, toName: String.Empty, bccAddresses: String.Empty, server: AppLogic.MailServer()); }
protected virtual void Inspect(XmlPackage xmlPackage) { if (null == xmlPackage) { throw new ArgumentNullException(nameof(xmlPackage)); } int errorNumber = xmlPackage.SelectInt32("retval"); if (0 != errorNumber) { throw new WmException(errorNumber, xmlPackage.SelectString("retdesc")); } }
protected override void Inspect(XmlPackage xmlPackage) { if (null == xmlPackage) { throw new ArgumentNullException(nameof(xmlPackage)); } // Проверка ответа int errorNumber = xmlPackage.SelectInt32("@retval"); if (0 != errorNumber) { throw new WmException(errorNumber, xmlPackage.SelectString("@retdesc")); } }
public ActionResult Index(string channel) { if (string.IsNullOrEmpty(channel) || !CommonLogic.FileExists(string.Format("xmlpackages/rss.{0}.xml.config", channel))) { channel = "unknown"; } var xmlPackage = new XmlPackage(string.Format("rss.{0}", channel)); var customer = HttpContext.GetCustomer(); var packageOutput = AppLogic.RunXmlPackage(xmlPackage, null, customer, customer.SkinID, true, false); Response.ContentType = "text/xml"; return(Content(packageOutput)); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="reader"></param> /// <param name="exception"></param> /// <param name="command"></param> /// <param name="label"></param> /// <param name="package"></param> /// <param name="app_secific"></param> /// <param name="priority"></param> /// <returns></returns> public bool WritePacket( QAgency sender, QAgency reader, string exception, string command, string label, XmlPackage package, int app_secific = 5, System.Messaging.MessagePriority priority = System.Messaging.MessagePriority.Normal ) { using (QMessage _qmessage = new QMessage(sender) { Command = command, Package = package, UsePackage = false }) { return(WritePacket(_qmessage, reader, exception, label, app_secific, priority)); } }
public static MvcHtmlString XmlPackage(this HtmlHelper helper, string packageName, object runtimeParameters = null) { var customer = HttpContext.Current.GetCustomer(); var parser = new Parser(); var runtimeParameterString = BuildRuntimeParameterString(runtimeParameters); var xmlpackage = new XmlPackage( packageName: packageName, customer: customer, additionalRuntimeParms: runtimeParameterString, htmlHelper: helper); var xmlpackageOutput = AppLogic.RunXmlPackage(xmlpackage, parser, customer, customer.SkinID, true, true); var htmlOutput = String.Format("<!--Xmlpackage '{0}' -->\n{1}\n<!--End of xmlpackage '{0}' -->", packageName, xmlpackageOutput); return(MvcHtmlString.Create(htmlOutput)); }
protected override void Inspect(XmlPackage xmlPackage) { if (null == xmlPackage) { throw new ArgumentNullException(nameof(xmlPackage)); } var wmXmlPackage = (WmXmlPackage)xmlPackage; int errorNumber = wmXmlPackage.SelectInt32("retval"); if (0 != errorNumber) { MerchantOperationObtainerException.ErrorExtendedInfo errorExtendedInfo = null; if (wmXmlPackage.Exists("errorlog/err_code")) { string extendedErrorNumberValue = wmXmlPackage.SelectString("errorlog/err_code"); if (!string.IsNullOrEmpty(extendedErrorNumberValue)) { // TODO [L] Расшифровать errorlog/siteid // TODO [L] Расшифровать errorlog/att errorExtendedInfo = new MerchantOperationObtainerException.ErrorExtendedInfo { ExtendedErrorNumber = int.Parse(extendedErrorNumberValue, CultureInfo.InvariantCulture.NumberFormat), StorePurse = wmXmlPackage.SelectPurse("errorlog/@lmi_payee_purse"), OrderId = wmXmlPackage.SelectInt32("errorlog/@lmi_payment_no"), PaymentInfoCreateTime = wmXmlPackage.SelectWmDateTime("errorlog/datecrt"), PaymentInfoUpdateTime = wmXmlPackage.SelectWmDateTime("errorlog/dateupd"), EnterTime = wmXmlPackage.SelectWmDateTimeIfExists("errorlog/date_s"), AuthorizationTime = wmXmlPackage.SelectWmDateTimeIfExists("errorlog/date_pc"), ConfirmationTime = wmXmlPackage.SelectWmDateTimeIfExists("errorlog/date_pd"), SiteId = wmXmlPackage.SelectInt32("errorlog/siteid"), PaymentMethod = wmXmlPackage.SelectString("errorlog/att") }; } } throw new MerchantOperationObtainerException(errorNumber, xmlPackage.SelectString("retdesc")) { ExtendedInfo = errorExtendedInfo }; } }
/// <summary> /// XmlPackage형식을 DatParametes 형식으로 변환 합니다. /// </summary> /// <param name="package"></param> public void PutXmlPackage(XmlPackage package) { var _dbps = Serialization.SNG.ReadPackage <PgDatParameters>(package); foreach (PgDatParameter _p in _dbps) { Add(_p.Name, _p.FieldType, _p.Type, _p.Direction, _p.Value); } foreach (PgDatParameter _p in this) { Type _type = Type.GetType(_p.FieldType); if (_type.IsSealed == false || _type.BaseType == typeof(Array)) { _p.Value = Serialization.SNG.StringToClass(_type, (string)_p.Value); } } }
public ActionResult Detail(string name, bool?disableTemplate = null) { if (string.IsNullOrEmpty(name)) { throw new HttpException(404, null); } var customer = HttpContext.GetCustomer(); var xmlPackage = new XmlPackage( packageName: name, customer: customer, htmlHelper: ControllerContext.GetHtmlHelper()); // Make sure the engine is allowed to render this package if (!xmlPackage.AllowEngine) { throw new Exception("This XmlPackage is not allowed to be run from the engine. Set the package element's allowengine attribute to true to enable this package to run."); } var packageOutput = AppLogic.RunXmlPackage(xmlPackage, null, customer, customer.SkinID, true, false); if (disableTemplate ?? false) { return(Content( packageOutput, string.IsNullOrEmpty(xmlPackage.ContentType) ? "text/html" : xmlPackage.ContentType)); } else { return(View(new XmlPackageViewModel { Name = xmlPackage.PackageName, MetaTitle = xmlPackage.SETitle, MetaDescription = xmlPackage.SEDescription, MetaKeywords = xmlPackage.SEKeywords, PageTitle = xmlPackage.SectionTitle, PageContent = packageOutput, })); } }
private void InitPatchInformation() { //Load version xmlpackages ArrayList xmlPackages = LocalReadAdminXmlPackages("versioninfo"); StringBuilder sb = new StringBuilder(); bool VersionFileFound = false; foreach (String s in xmlPackages) { VersionFileFound = true; var package = new XmlPackage( packageName: s, skinId: SkinID); sb.Append(package.TransformString()); } if (VersionFileFound) { litPatchInfo.Text = sb.ToString(); pnlPatchInfo.Visible = true; } }
static public void GetLiveRates() { String PN = AppLogic.AppConfig("Localization.CurrencyFeedXmlPackage"); if (PN.Length != 0) { try { var package = new XmlPackage(PN); m_LastRatesResponseXml = package.XmlDataDocument.InnerXml; m_LastRatesTransformedXml = package.TransformString(); if (m_LastRatesTransformedXml.Length != 0) { // update master db table: XmlDocument d = new XmlDocument(); d.LoadXml(m_LastRatesTransformedXml); foreach (XmlNode n in d.SelectNodes("//currency")) { String CurrencyCode = XmlCommon.XmlAttribute(n, "code"); String rate = XmlCommon.XmlAttribute(n, "rate"); DB.ExecuteSQL("update Currency set ExchangeRate=" + rate + ", WasLiveRate=1, LastUpdated=getdate() where CurrencyCode=" + DB.SQuote(CurrencyCode)); } } FlushCache(); // flush anyway for safety } catch (Exception ex) { try { AppLogic.SendMail(subject: AppLogic.AppConfig("StoreName") + " Currency.GetLiveRates Failure", body: "Occurred at: " + Localization.ToNativeDateTimeString(System.DateTime.Now) + CommonLogic.GetExceptionDetail(ex, ""), useHtml: false, fromAddress: AppLogic.AppConfig("MailMe_FromAddress"), fromName: AppLogic.AppConfig("MailMe_FromName"), toAddress: AppLogic.AppConfig("MailMe_ToAddress"), toName: AppLogic.AppConfig("MailMe_ToName"), bccAddresses: String.Empty, server: AppLogic.MailServer()); } catch { } } } }
public ActionResult Index(string entityType) { var normalizedEntityType = AppLogic.ro_SupportedEntities .Intersect(new[] { entityType }, StringComparer.OrdinalIgnoreCase) .FirstOrDefault(); if (normalizedEntityType == null) { throw new HttpException(404, string.Format("Unsupported entity type: {0}", entityType)); } var customer = ControllerContext.HttpContext.GetCustomer(); var runtimeParameters = string.Format("entity={0}", normalizedEntityType); var xmlpackage = new XmlPackage("entitygridpage.xml.config", customer, customer.SkinID, string.Empty, runtimeParameters, string.Empty, true); var packageOutput = AppLogic.RunXmlPackage(xmlpackage, null, customer, customer.SkinID, true, false); var pageTitle = AppLogic.GetString(string.Format("AppConfig.{0}PromptPlural", normalizedEntityType), customer.SkinID, customer.LocaleSetting); if (!string.IsNullOrEmpty(xmlpackage.SectionTitle)) { pageTitle = xmlpackage.SectionTitle; } var simplePageViewModel = new SimplePageViewModel { MetaTitle = pageTitle, MetaDescription = xmlpackage.SEDescription, MetaKeywords = xmlpackage.SEKeywords, PageTitle = pageTitle, PageContent = packageOutput, }; return(View(ViewNames.SimplePage, simplePageViewModel)); }
protected void Page_Load(object sender, EventArgs e) { Response.CacheControl = "private"; Response.Expires = 0; Response.AddHeader("pragma", "no-cache"); giftCardId = CommonLogic.QueryStringNativeInt("giftcardid"); if (giftCardId == 0) { lblGiftCardUsage.Visible = false; lnkGiftCardUsage.Visible = false; OrderNumberRow.Visible = false; RemainingBalanceRow.Visible = false; ltAmount.Visible = false; PurchasedByCustomerIDLiteralRow.Visible = false; GiftCardTypeDisplayRow.Visible = false; InitialAmountLiteralRow.Visible = false; PurchasedByCustomerIDTextRow.Visible = true; reqCustEmail.Enabled = true; } else { lnkGiftCardUsage.NavigateUrl = string.Format("{0}?giftcardid={1}", AppLogic.AdminLinkUrl("giftcardusage.aspx"), giftCardId); txtAmount.Visible = false; // cannot change after first created PurchasedByCustomerIDTextRow.Visible = false; reqCustEmail.Enabled = false; GiftCardTypeSelectRow.Visible = false; InitialAmountTextRow.Visible = false; } if (!IsPostBack) { txtDate.Culture = Thread.CurrentThread.CurrentUICulture; trEmail.Visible = giftCardId == 0; if (giftCardId > 0) { ltSerialNumber.Text = DB.GetSqlS(string.Format("SELECT SerialNumber AS S FROM GiftCard WHERE GiftCardID = {0}", giftCardId)); LoadData(); if (etsMapper.ObjectID != giftCardId) { etsMapper.ObjectID = giftCardId; etsMapper.DataBind(); } } else { lblAction.Visible = false; rblAction.Visible = false; ltCurrentBalance.Text = "NA"; ltSerialNumber.Text = "admin.editgiftcard.NewGiftCard".StringResource(); rblAction.SelectedIndex = 0; var giftCardAssignmentXml = new XmlPackage("giftcardassignment.xml.config"); System.Xml.XmlDocument xmlDoc = giftCardAssignmentXml.XmlDataDocument; txtSerial.Text = xmlDoc.SelectSingleNode("/root/GiftCardAssignment/row/CardNumber").InnerText; txtDate.SelectedDate = DateTime.Now.AddYears(1); } } var mapToStores = AppLogic.GlobalConfigBool("AllowGiftCardFiltering"); storeMapperRow.Visible = mapToStores; }
/// <summary> /// /// </summary> /// <param name="protocol">통신 프로토콜(tcp, http)</param> /// <param name="category_id">분류 명칭(corptool, back-office, fron-office)</param> /// <param name="product_name">제품명칭</param> /// <param name="product_id">제품 식별자(identification)</param> /// <param name="product_version">제품의 버전</param> /// <param name="command"></param> /// <param name="exception"></param> /// <param name="package"></param> public QMessage(string protocol, string category_id, string product_name, string product_id, string product_version, string command, XmlPackage package, string exception) : base(protocol, category_id, product_name, product_id, product_version) { this.Command = command; this.Exception = exception; this.Package = package; InitializeClass(); }
public ActionResult Detail(int id, string searchEngineName, int?cartRecordId = null) { var product = new Product(id); // Make sure we should show the product if (product.ProductID == 0 || !product.Published || !product.IsMappedToStore()) { throw new HttpException(404, null); } var outOfStockLevel = AppLogic.AppConfigNativeInt("HideProductsWithLessThanThisInventoryLevel"); if (AppLogic.AppConfigBool("ProductPageOutOfStockRedirect") && outOfStockLevel != -1) { if (AppLogic.DeterminePurchasableQuantity(product.ProductID, AppLogic.GetProductsDefaultVariantID(product.ProductID), AppLogic.ProductTracksInventoryBySizeAndColor(product.ProductID), "Product") < outOfStockLevel) { throw new HttpException(404, null); } } // 301 Redirect to the correct search engine name in the url if it is wrong if (!string.IsNullOrEmpty(product.SEName) && !StringComparer.OrdinalIgnoreCase.Equals(searchEngineName, product.SEName)) { return(RedirectPermanent(Url.BuildProductLink(id, product.SEName))); } else { SysLog.LogMessage( message: "Invalid product se name.", details: string.Format("Product {0} does not have an SE Name set.", product.ProductID), messageType: MessageTypeEnum.Informational, messageSeverity: MessageSeverityEnum.Alert); } // Set the xmlpackage var xmlpackageName = !string.IsNullOrEmpty(product.XmlPackage) ? product.XmlPackage : AppLogic.ro_DefaultProductXmlPackage; // Kits always get the default kit xmlpackage if (product.IsAKit) { xmlpackageName = "page.kitheader.xml.config"; } var customer = HttpContext.GetCustomer(); // Get the context of where we've come from var sourceEntityInfo = GetSourceEntityInfo(product.ProductID, customer.LocaleSetting); // Save source entity info to the profile Profile["LastViewedEntityName"] = sourceEntityInfo.Type; Profile["LastViewedEntityInstanceID"] = sourceEntityInfo.Id.ToString(); Profile["LastViewedEntityInstanceName"] = sourceEntityInfo.Name; if (!product.RequiresRegistration || customer.IsRegistered) { //Log views to generate dynamic related product results if (AppLogic.AppConfigBool("DynamicRelatedProducts.Enabled") && !AppLogic.UserAgentIsKnownBot()) { customer.LogProductView(product.ProductID); } //Fire an event AppLogic.eventHandler("ViewProductPage").CallEvent("&ViewProductPage=true"); //Update Product looks(views count) DB.ExecuteSQL("update product set Looks=Looks+1 where ProductID = @ProductId", new SqlParameter[] { new SqlParameter("ProductId", product.ProductID) }); } // Additional runtime parameters var runtimeParameters = string.Format("EntityName={0}&EntityID={1}", sourceEntityInfo.Type, sourceEntityInfo.Id); if (Request.Url.Query.Contains("cartrecid")) { runtimeParameters += string.Format("&cartrecid={0}", CommonLogic.QueryStringUSInt("cartrecid")); } // Add a showproduct runtime node runtimeParameters += "&showproduct=1"; // Breadcrumb and meta tags var pageTitle = Breadcrumb.GetProductBreadcrumb(product.ProductID, product.LocaleName, sourceEntityInfo.Type, sourceEntityInfo.Id, customer); var pageContent = string.Empty; var metaTitle = XmlCommon.GetLocaleEntry(product.SETitle, customer.LocaleSetting, true); if (string.IsNullOrEmpty(metaTitle)) { metaTitle = Server.HtmlEncode(string.Format("{0} - {1}", AppLogic.AppConfig("StoreName"), product.LocaleName)); } var metaDescription = XmlCommon.GetLocaleEntry(product.SEDescription, customer.LocaleSetting, true); if (string.IsNullOrEmpty(metaDescription)) { metaDescription = Server.HtmlEncode(product.LocaleName); } var metaKeywords = XmlCommon.GetLocaleEntry(product.SEKeywords, customer.LocaleSetting, true); if (string.IsNullOrEmpty(metaKeywords)) { metaKeywords = Server.HtmlEncode(product.LocaleName); } var parser = new Parser(); var xmlpackage = new XmlPackage( packageName: xmlpackageName, customer: customer, additionalRuntimeParms: runtimeParameters, htmlHelper: ControllerContext.GetHtmlHelper()); pageContent = AppLogic.RunXmlPackage(xmlpackage, parser, customer, customer.SkinID, true, true); if (!string.IsNullOrEmpty(xmlpackage.SectionTitle)) { pageTitle = xmlpackage.SectionTitle; } if (!string.IsNullOrEmpty(xmlpackage.SETitle)) { metaTitle = xmlpackage.SETitle; } if (!string.IsNullOrEmpty(xmlpackage.SEDescription)) { metaDescription = xmlpackage.SEDescription; } if (xmlpackage.SEKeywords != string.Empty) { metaKeywords = xmlpackage.SEKeywords; } // Build the view model var productViewModel = new ProductViewModel { Id = product.ProductID, Name = XmlCommon.GetLocaleEntry(product.LocaleName, customer.LocaleSetting, true), MetaTitle = metaTitle, MetaDescription = metaDescription, MetaKeywords = metaKeywords, PageTitle = pageTitle, PageContent = pageContent, LoginRequired = product.RequiresRegistration && !customer.IsRegistered, IsAKit = product.IsAKit, XmlPackageName = xmlpackageName, CartRecordId = cartRecordId, SchemaProductUrl = string.Format("{0}://schema.org/Product", Request.Url.Scheme) }; // Override the layout var layoutName = string.Empty; if (AppLogic.AppConfigBool("TemplateSwitching.Enabled")) { layoutName = AppLogic.GetCurrentEntityTemplateName(sourceEntityInfo.Type, sourceEntityInfo.Id); } // Kits use a separate view var viewName = product.IsAKit ? ViewNames.KitDetail : ViewNames.Detail; return(!string.IsNullOrEmpty(layoutName) ? View(viewName, layoutName, productViewModel) : View(viewName, productViewModel)); }
public WmXmlPackage(XmlPackage xmlPackage) : base(xmlPackage) { }
protected override void Inspect(XmlPackage xmlPackage) { }
/// <summary> /// /// </summary> /// <param name="package"></param> public PgDatParameters(XmlPackage package) { PutXmlPackage(package); }
public ActionResult Detail(int id, string entityType, string searchEngineName, int?productTypeFilterId) { var normalizedEntityType = AppLogic.ro_SupportedEntities .Intersect(new[] { entityType }, StringComparer.OrdinalIgnoreCase) .FirstOrDefault(); if (normalizedEntityType == null) { throw new HttpException(404, string.Format("Unsupported entity type: {0}", entityType)); } var entity = new Entity(id, normalizedEntityType); var customer = ControllerContext.HttpContext.GetCustomer(); //Make sure we've got a valid entity if (entity == null || entity.ID == 0 || entity.Published == false || entity.Deleted == true) { throw new HttpException(404, null); } //Make sure that this entity is mapped to this store var store = new CachelessStore(); store.StoreID = AppLogic.StoreID(); var storeMapping = store.GetMapping(entity.EntityType, entity.ID); if (AppLogic.GlobalConfigBool("AllowEntityFiltering") == true && !storeMapping.IsMapped) { throw new HttpException(404, null); } //301 Redirect to the correct search engine name in the url if it is wrong if (!StringComparer.OrdinalIgnoreCase.Equals(searchEngineName, entity.SEName)) { return(RedirectPermanent(Url.BuildEntityLink(normalizedEntityType, id, entity.SEName))); } //Set last seen values on the profile HttpContext.Profile.SetPropertyValue("LastViewedEntityName", entity.EntityType); HttpContext.Profile.SetPropertyValue("LastViewedEntityInstanceID", entity.ID.ToString()); HttpContext.Profile.SetPropertyValue("LastViewedEntityInstanceName", XmlCommon.GetLocaleEntry(entity.Name, customer.LocaleSetting, true)); //Build up the runtime parameters for the xmlpackage var runtimeParameters = string.Format("EntityName={0}&EntityID={1}&ProductTypeFilterID={2}", entity.EntityType, entity.ID, productTypeFilterId ?? 0); var entityTypeSpecificRuntimeParamName = "CatID"; if (entity.EntityType.Equals("manufacturer", StringComparison.InvariantCultureIgnoreCase)) { entityTypeSpecificRuntimeParamName = "ManID"; } else if (entity.EntityType.Equals("section", StringComparison.InvariantCultureIgnoreCase)) { entityTypeSpecificRuntimeParamName = "SecID"; } else if (entity.EntityType.Equals("distributor", StringComparison.InvariantCultureIgnoreCase)) { entityTypeSpecificRuntimeParamName = "DistID"; } else if (entity.EntityType.Equals("genre", StringComparison.InvariantCultureIgnoreCase)) { entityTypeSpecificRuntimeParamName = "GenreID"; } else if (entity.EntityType.Equals("vector", StringComparison.InvariantCultureIgnoreCase)) { entityTypeSpecificRuntimeParamName = "VectorID"; } else if (entity.EntityType.Equals("section", StringComparison.InvariantCultureIgnoreCase)) { entityTypeSpecificRuntimeParamName = "DistID"; } runtimeParameters += string.Format("&{0}={1}", entityTypeSpecificRuntimeParamName, entity.ID); //Get a default xmlpackage if we don't have one specified in the database var xmlPackageName = string.IsNullOrEmpty(entity.XmlPackage) ? AppLogic.ro_DefaultEntityXmlPackage : entity.XmlPackage; //Setup Meta tags var metaTitle = XmlCommon.GetLocaleEntry(entity.SETitle, customer.LocaleSetting, true); if (string.IsNullOrEmpty(metaTitle)) { metaTitle = string.Format("{0} - {1}", AppLogic.AppConfig("StoreName"), entity.LocaleName); } var metaDescription = XmlCommon.GetLocaleEntry(entity.SEDescription, customer.LocaleSetting, true); if (string.IsNullOrEmpty(metaDescription)) { metaDescription = entity.LocaleName; } var metaKeywords = XmlCommon.GetLocaleEntry(entity.SEKeywords, customer.LocaleSetting, true); if (string.IsNullOrEmpty(metaKeywords)) { metaKeywords = entity.LocaleName; } //Setup the breadcrumb var pageTitle = Breadcrumb.GetEntityBreadcrumb(entity.ID, entity.LocaleName, entity.EntityType, customer); //Get the page content from the xmlpackage var pageContent = string.Empty; var xmlPackage = new XmlPackage( packageName: xmlPackageName, customer: customer, additionalRuntimeParms: runtimeParameters, htmlHelper: ControllerContext.GetHtmlHelper()); var parser = new Parser(); pageContent = AppLogic.RunXmlPackage(xmlPackage, parser, customer, customer.SkinID, true, true); //override the meta tags from the xmlpackage if (xmlPackage.SETitle != string.Empty) { metaTitle = xmlPackage.SETitle; } if (xmlPackage.SEDescription != string.Empty) { metaDescription = xmlPackage.SEDescription; } if (xmlPackage.SEKeywords != string.Empty) { metaKeywords = xmlPackage.SEKeywords; } if (xmlPackage.SectionTitle != string.Empty) { pageTitle = xmlPackage.SectionTitle; } var payPalAd = new PayPalAd(PayPalAd.TargetPage.Entity); //Build the view model var entityViewModel = new EntityViewModel { Name = XmlCommon.GetLocaleEntry(entity.Name, customer.LocaleSetting, true), MetaTitle = metaTitle, MetaDescription = metaDescription, MetaKeywords = metaKeywords, PageTitle = pageTitle, PageContent = pageContent, PayPalAd = payPalAd.ImageMarkup, XmlPackageName = xmlPackageName }; AppLogic.eventHandler("ViewEntityPage").CallEvent("&ViewEntityPage=true"); //Override the layout var layoutName = string.Empty; if (AppLogic.AppConfigBool("TemplateSwitching.Enabled")) { layoutName = AppLogic.GetCurrentEntityTemplateName(entity.EntityType, entity.ID); } if (!string.IsNullOrEmpty(layoutName)) { return(View(ActionNames.Detail, layoutName, entityViewModel)); } else { return(View(entityViewModel)); } }
public MsDatCommands(XmlPackage package) { PutXmlString(package); }