public ActionResult DeletePricingDetails(string ProductPricingId) { if (User.Identity.IsAuthenticated) { if (isAdminUser()) { StringBuilder ErrorMessages = new StringBuilder(); StringBuilder SuccessMessages = new StringBuilder(); try { PricingData pricingData = new PricingData(); if (!string.IsNullOrEmpty(ProductPricingId)) { pricingData.ProductPricingId = ProductPricingId; bool InsertResult = false; InsertResult = PricingDetailsProxy.CUDPricingDetails(pricingData, "Delete"); DataSet PricingDataSet = new DataSet(); DataTable PricingDataTable = new DataTable(); PricingDataSet = PricingDetailsProxy.FetchPricingDetails(); PricingDataTable = PricingDataSet.Tables[0]; managePricing_IndexViewModel.PricingDataTable = PricingDataTable; if (InsertResult == false) { ErrorMessages.Append(CUDConstants.DeleteError); } else { SuccessMessages.Append(CUDConstants.DeleteSuccess); } } else { ErrorMessages.Append(CUDConstants.DeleteError); } } catch (Exception e) { ErrorMessages.Append(CUDConstants.DeleteError); } if (!String.IsNullOrEmpty(SuccessMessages.ToString())) { managePricing_IndexViewModel.SuccessMessage = SuccessMessages.ToString(); } if (!String.IsNullOrEmpty(ErrorMessages.ToString())) { managePricing_IndexViewModel.ErrorMessage = ErrorMessages.ToString(); } return(PartialView("PricingDataTable", managePricing_IndexViewModel)); } else { return(RedirectToAction("Index", "Home")); } } else { return(RedirectToAction("Index", "Home")); } }
public ActionResult UpdatePricingDetails(PricingData pricingData) { if (User.Identity.IsAuthenticated) { if (isAdminUser()) { StringBuilder ErrorMessages = new StringBuilder(); StringBuilder SuccessMessages = new StringBuilder(); try { bool UpdateResult = false; UpdateResult = PricingDetailsProxy.CUDPricingDetails(pricingData, "Update"); DataSet PricingDataSet = new DataSet(); DataTable PricingDataTable = new DataTable(); PricingDataSet = PricingDetailsProxy.FetchPricingDetails(); PricingDataTable = PricingDataSet.Tables[0]; PricingDataTable = DataTablePhotoMapping(PricingDataTable); managePricing_IndexViewModel.PricingDataTable = PricingDataTable; if (UpdateResult == false) { ErrorMessages.Append(CUDConstants.UpdateError); } else { SuccessMessages.Append(CUDConstants.UpdateSuccess); } } catch (Exception e) { ErrorMessages.Append(CUDConstants.UpdateError); } if (!String.IsNullOrEmpty(SuccessMessages.ToString())) { managePricing_IndexViewModel.SuccessMessage = SuccessMessages.ToString(); } if (!String.IsNullOrEmpty(ErrorMessages.ToString())) { managePricing_IndexViewModel.ErrorMessage = ErrorMessages.ToString(); } return(PartialView("PricingDataTable", managePricing_IndexViewModel)); } else { return(RedirectToAction("Index", "Home")); } } else { return(RedirectToAction("Index", "Home")); } }
public bool CUDPricingDetails(PricingData pricingData, string QuerySelector) { try { IPricingDetailsDAL pricingDetailsDAL = new PricingDetailsDAL(); pricingDetailsDAL.CUDPricingDetails(pricingData, QuerySelector); return(true); } catch (Exception e) { return(false); } }
public bool CUDPricingDetails(PricingData pricingData, string QuerySelector) { using (SqlConnection connection = new SqlConnection(ConnectionString)) { SqlCommand sqlCommand = new SqlCommand("dbo.USP_CUDPricingDetails", connection); sqlCommand.CommandType = CommandType.StoredProcedure; sqlCommand.Parameters.Add("@QuerySelector", SqlDbType.VarChar).Value = QuerySelector; sqlCommand.Parameters.Add("@ProductPricingId", SqlDbType.UniqueIdentifier).Value = Guid.Parse(pricingData.ProductPricingId); if (!string.IsNullOrEmpty(pricingData.ProductId)) { sqlCommand.Parameters.Add("@ProductId", SqlDbType.VarChar).Value = pricingData.ProductId; } if (!string.IsNullOrEmpty(pricingData.ProductName)) { sqlCommand.Parameters.Add("@ProductName", SqlDbType.VarChar).Value = pricingData.ProductName; } if (!string.IsNullOrEmpty(pricingData.BuyPrice.ToString())) { sqlCommand.Parameters.Add("@BuyPrice", SqlDbType.Float).Value = pricingData.BuyPrice; } if (!string.IsNullOrEmpty(pricingData.SellPrice.ToString())) { sqlCommand.Parameters.Add("@SellPrice", SqlDbType.Float).Value = pricingData.SellPrice; } if (!string.IsNullOrEmpty(pricingData.Profit.ToString())) { sqlCommand.Parameters.Add("@Profit", SqlDbType.Float).Value = pricingData.Profit; } if (!string.IsNullOrEmpty(pricingData.MRP.ToString())) { sqlCommand.Parameters.Add("@MRP", SqlDbType.Float).Value = pricingData.MRP; } sqlCommand.Parameters.Add("@Status", SqlDbType.Bit).Value = 1; connection.Open(); sqlCommand.CommandTimeout = 120; sqlCommand.ExecuteNonQuery(); connection.Close(); } return(true); }
public ActionResult PricingList(BranchJsonViewModel viewModel) { viewModel.branchName = viewModel.branchName.GetEfficientString(); viewModel.unit = viewModel.unit ?? 60; ViewBag.ViewModel = viewModel; PricingData model = null; String jsonFile = Startup.MapPath($"~/MainActivity/Pricing/{viewModel.branchName}.json"); if (System.IO.File.Exists(jsonFile)) { var jsonData = System.IO.File.ReadAllText(jsonFile); model = JsonConvert.DeserializeObject <PricingData>(jsonData); } if (model == null) { return(Index()); } else { return(View(model)); } }
public string Create() { _currentContext = new SQLAzureDataContext(); var elementId = _currentRequestManager.RootElements.FirstOrDefault(kvp => kvp.Key == "elementId").Value; var baseTime = DateTimeOffset.Parse(_currentRequestManager.RootElements.FirstOrDefault(kvp => kvp.Key == "baseTime").Value); var creationTime = DateTimeOffset.Parse(_currentRequestManager.RootElements.FirstOrDefault(kvp => kvp.Key == "creationTime").Value); var generatedBy = _currentRequestManager.RootElements.FirstOrDefault(kvp => kvp.Key == "generatedBy").Value; var comment = _currentRequestManager.RootElements.FirstOrDefault(kvp => kvp.Key == "comment").Value; foreach (var thisRecord in _currentRequestManager.Records) { var fromDateTime = DateTimeOffset.Parse(thisRecord.FirstOrDefault(kvp => kvp.Key == "start").Value); var toDateTime = DateTimeOffset.Parse(thisRecord.FirstOrDefault(kvp => kvp.Key == "end").Value); var price = decimal.Parse(thisRecord.FirstOrDefault(kvp => kvp.Key == "price_value").Value); var application = _currentContext.Applications.FirstOrDefault(x => x.Identifier == generatedBy); var pricingData = new PricingData { DMA = _currentContext.DMAs.FirstOrDefault(x => x.Identifier == elementId), From = fromDateTime, To = toDateTime, CreationTime = creationTime, Application = application, Comment = comment, BaseTime = baseTime, Price = price }; _currentContext.PricingDatas.InsertOnSubmit(pricingData); } _currentContext.SubmitChanges(); return(elementId); }
public string GetPricingMarkup(PricingData pricing, List<CurrencyData> currencyList, List<ExchangeRateData> exchangeRateList, Common.EkEnumeration.CatalogEntryType entryType, bool showPricingTier, ModeType Mode) { StringBuilder sbPricing = new StringBuilder(); bool showRemoveForDefault = false; string defaultCurrencyName = ""; int defaultCurrencyId = 0; Ektron.Cms.Commerce.CurrencyData defaultCurrency = null; for (int i = 0; i <= (currencyList.Count - 1); i++) { if (currencyList[i].Id == m_CommerceSettings.DefaultCurrencyId) { defaultCurrencyName = (string)(currencyList[i].Name); defaultCurrencyId = System.Convert.ToInt32(currencyList[i].Id); defaultCurrency = currencyList[i]; break; } } sbPricing.Append(" <table width=\"100%\" border=\"1\" bordercolor=\"#d8e6ff\"> ").Append(Environment.NewLine); sbPricing.Append(" <tr> ").Append(Environment.NewLine); sbPricing.Append(" <td width=\"100%\"> ").Append(Environment.NewLine); sbPricing.Append(" <div class=\"ektron ektron_PricingWrapper\"> ").Append(Environment.NewLine); sbPricing.Append(" <h3> ").Append(Environment.NewLine); sbPricing.Append(" <span class=\"currencyLabel\">").Append(m_CommerceSettings.ISOCurrencySymbol).Append(m_CommerceSettings.CurrencySymbol).Append(" ").Append(defaultCurrencyName).Append("</span> ").Append(Environment.NewLine); sbPricing.Append(" <select onchange=\"Ektron.Commerce.Pricing.selectCurrency(this.options[this.selectedIndex].value, " + defaultCurrencyId + ");return false;\"> ").Append(Environment.NewLine); for (int i = 0; i <= (currencyList.Count - 1); i++) { sbPricing.Append(" <option value=\"id:ektron_Pricing_").Append(currencyList[i].Id).Append(";label:").Append(currencyList[i].Name).Append(";symbol:").Append(currencyList[i].ISOCurrencySymbol).Append(currencyList[i].CurrencySymbol).Append("\" " + ((currencyList[i].Id == m_CommerceSettings.DefaultCurrencyId) ? "selected=\"selected\"" : "") + ">").Append(currencyList[i].AlphaIsoCode).Append("</option> ").Append(Environment.NewLine); } sbPricing.Append(" </select> ").Append(Environment.NewLine); sbPricing.Append(" </h3> ").Append(Environment.NewLine); sbPricing.Append(" <div class=\"ektron_Pricing_InnerWrapper\"> ").Append(Environment.NewLine); for (int i = 0; i <= (currencyList.Count - 1); i++) { bool IsDefaultCurrency = System.Convert.ToBoolean(m_CommerceSettings.DefaultCurrencyId == currencyList[i].Id); //decimal actualCost = (decimal)0.0; decimal listPrice = (decimal)0.0; decimal currentPrice = (decimal)0.0; Ektron.Cms.Commerce.CurrencyPricingData currencyPricing = pricing.GetCurrencyById(currencyList[i].Id); List<Ektron.Cms.Commerce.TierPriceData> tierPrices = new List<Ektron.Cms.Commerce.TierPriceData>(); int tierCount = 0; long tierId = 0; bool IsFloated = false; decimal exchangeRate = 1; if (currencyPricing != null) { //actualCost = currencyPricing.ActualCost listPrice = currencyPricing.ListPrice; currentPrice = currencyPricing.GetSalePrice(1); tierPrices = currencyPricing.TierPrices; tierCount = System.Convert.ToInt32(tierPrices.Count); IsFloated = System.Convert.ToBoolean(currencyPricing.PricingType == Ektron.Cms.Common.EkEnumeration.PricingType.Floating); if (Mode == ModeType.Add && !IsDefaultCurrency) { IsFloated = true; } if (tierPrices.Count > 0) { tierId = tierPrices[0].Id; } if (tierPrices.Count == 0 || (tierPrices.Count == 1 && tierPrices[0].Quantity == 1)) { tierCount = 1; } if (currencyPricing.CurrencyId == m_CommerceSettings.DefaultCurrencyId && tierPrices.Count > 0) { showRemoveForDefault = true; } } else { IsFloated = true; tierCount = 1; } for (int k = 0; k <= (exchangeRateList.Count - 1); k++) { if (exchangeRateList[k].ExchangeCurrencyId == currencyList[i].Id) { exchangeRate = System.Convert.ToDecimal(exchangeRateList[k].Rate); break; } } sbPricing.Append(" <div id=\"ektron_Pricing_").Append(currencyList[i].Id).Append("\" class=\"ektron_Pricing_CurrencyWrapper ektron_Pricing_").Append(currencyList[i].AlphaIsoCode).Append("" + ((currencyList[i].Id == m_CommerceSettings.DefaultCurrencyId) ? " ektron_Pricing_CurrencyWrapper_Active" : "") + "\"> ").Append(Environment.NewLine); sbPricing.Append(" <table class=\"ektron_UnitPricing_Table\" summary=\"").Append(m_WorkAreaBase.GetMessage("lbl unit pricing data")).Append("\"> ").Append(Environment.NewLine); sbPricing.Append(" <colgroup> ").Append(Environment.NewLine); sbPricing.Append(" <col class=\"narrowCol\"/> ").Append(Environment.NewLine); sbPricing.Append(" <col class=\"wideCol\" /> ").Append(Environment.NewLine); sbPricing.Append(" </colgroup> ").Append(Environment.NewLine); sbPricing.Append(" <thead> ").Append(Environment.NewLine); sbPricing.Append(" <tr> ").Append(Environment.NewLine); sbPricing.Append(" <th colspan=\"2\" class=\"alignLeft noBorderRight\"> ").Append(Environment.NewLine); sbPricing.Append(" ").Append(m_WorkAreaBase.GetMessage("lbl unit pricing")).Append(" ").Append(Environment.NewLine); sbPricing.Append(" </th> ").Append(Environment.NewLine); sbPricing.Append(" </tr> ").Append(Environment.NewLine); sbPricing.Append(" </thead> ").Append(Environment.NewLine); sbPricing.Append(" <tbody> ").Append(Environment.NewLine); if (!(currencyList[i].Id == m_CommerceSettings.DefaultCurrencyId)) { sbPricing.Append(" <tr> ").Append(Environment.NewLine); sbPricing.Append(" <th class=\"noBorderRight\"> ").Append(Environment.NewLine); sbPricing.Append(" <img src=\"").Append(m_WorkAreaBase.AppImgPath).Append("commerce/about.gif\" alt=\"").Append(m_WorkAreaBase.GetMessage("lbl price float exchange")).Append("\" title=\"").Append(m_WorkAreaBase.GetMessage("lbl price float exchange")).Append("\" class=\"moreInfo\" /> ").Append(Environment.NewLine); sbPricing.Append(" <label for=\"ektron_UnitPricing_Float_").Append(currencyList[i].Id).Append("\">").Append(m_WorkAreaBase.GetMessage("lbl price float")).Append(":</label> ").Append(Environment.NewLine); sbPricing.Append(" </th> ").Append(Environment.NewLine); sbPricing.Append(" <td class=\"noBorderLeft\"> ").Append(Environment.NewLine); sbPricing.Append(" <span class=\"currencySymbol\">").Append(Environment.NewLine); sbPricing.Append("<input onclick=\"Ektron.Commerce.Pricing.floatToggle(this);\" id=\"ektron_UnitPricing_Float_").Append(currencyList[i].Id).Append("\" name=\"ektron_UnitPricing_Float_").Append(currencyList[i].Id).Append("\" class=\"actualPrice\" type=\"checkbox\" ").Append(IsFloated ? "checked=\"checked\" " : "").Append(" ").Append((!(Mode == ModeType.View)) ? "" : "disabled=\"disabled\" ").Append("/> ").Append(Environment.NewLine); sbPricing.Append("</span> ").Append(Environment.NewLine); sbPricing.Append(" ").Append(m_WorkAreaBase.GetMessage("lbl price current rate")).Append(": ").Append(defaultCurrency.ISOCurrencySymbol).Append(defaultCurrency.CurrencySymbol).Append("1 = ").Append(currencyList[i].ISOCurrencySymbol).Append(currencyList[i].CurrencySymbol).Append(m_WorkAreaBase.FormatCurrency(exchangeRate, "")).Append(Environment.NewLine); sbPricing.Append(" </td> ").Append(Environment.NewLine); sbPricing.Append(" </tr> ").Append(Environment.NewLine); } if (!(Mode == ModeType.View)) { //sbPricing.Append(" <input maxlength=""8"" id=""ektron_UnitPricing_ActualPrice_").Append(currencyList[i].Id).Append(""" onchange=""UpdateActualPrice(this);"" name=""ektron_UnitPricing_ActualPrice_").Append(currencyList[i].Id).Append(""" class=""actualPrice"" type=""text"" value=""" & m_WorkAreaBase.FormatCurrency(actualCost, "") & """ " + IIf(IsFloated, "disabled=""disabled"" ", "") + " /> ").Append(Environment.NewLine) } else { //sbPricing.Append(" ").Append(m_WorkAreaBase.FormatCurrency(actualCost, "")).Append(Environment.NewLine) } //sbPricing.Append("  ").Append(m_WorkAreaBase.GetMessage("lbl per unit")).Append(" ").Append(Environment.NewLine) //sbPricing.Append(" </td> ").Append(Environment.NewLine) //sbPricing.Append(" </tr> ").Append(Environment.NewLine) sbPricing.Append(" <tr class=\"stripe\"> ").Append(Environment.NewLine); sbPricing.Append(" <th class=\"noBorderRight\"> ").Append(Environment.NewLine); sbPricing.Append(" <img src=\"").Append(m_WorkAreaBase.AppImgPath).Append("commerce/about.gif\" alt=\"").Append(m_WorkAreaBase.GetMessage("lbl list price")).Append("\" title=\"").Append(m_WorkAreaBase.GetMessage("lbl list price desc")).Append("\" class=\"moreInfo\" /> ").Append(Environment.NewLine); sbPricing.Append(" <label for=\"ektron_UnitPricing_ListPrice_").Append(currencyList[i].Id).Append("\" class=\"listPrice\">").Append(m_WorkAreaBase.GetMessage("lbl list price")).Append(":</label> ").Append(Environment.NewLine); sbPricing.Append(" </th> ").Append(Environment.NewLine); sbPricing.Append(" <td class=\"noBorderLeft\"> ").Append(Environment.NewLine); sbPricing.Append(" <span class=\"currencySymbol\">").Append(currencyList[i].ISOCurrencySymbol).Append(currencyList[i].CurrencySymbol).Append("</span> ").Append(Environment.NewLine); if (!(Mode == ModeType.View)) { sbPricing.Append(" <input maxlength=\"8\" id=\"ektron_UnitPricing_ListPrice_").Append(currencyList[i].Id).Append(IsDefaultCurrency ? "\" onchange=\"UpdateListPrice(this);\" " : "\" ").Append(" name=\"ektron_UnitPricing_ListPrice_").Append(currencyList[i].Id).Append("\" type=\"text\" value=\"" + m_WorkAreaBase.FormatCurrency(listPrice, "") + ("\" " + (IsFloated ? "disabled=\"disabled\" " : "") + " /> ")).Append(Environment.NewLine); } else { sbPricing.Append(" ").Append(m_WorkAreaBase.FormatCurrency(listPrice, "")).Append(Environment.NewLine); } sbPricing.Append("  ").Append(m_WorkAreaBase.GetMessage("lbl per unit")).Append(" ").Append(Environment.NewLine); sbPricing.Append(" </td> ").Append(Environment.NewLine); sbPricing.Append(" </tr> ").Append(Environment.NewLine); sbPricing.Append(" <tr> ").Append(Environment.NewLine); sbPricing.Append(" <th class=\"noBorderRight\"> ").Append(Environment.NewLine); sbPricing.Append(" <img src=\"").Append(m_WorkAreaBase.AppImgPath).Append("commerce/about.gif\" alt=\"").Append(m_WorkAreaBase.GetMessage("lbl our sales price")).Append("\" title=\"").Append(m_WorkAreaBase.GetMessage("lbl our sales price desc")).Append("\" class=\"moreInfo\" /> ").Append(Environment.NewLine); sbPricing.Append(" <label for=\"ektron_UnitPricing_SalesPrice_").Append(currencyList[i].Id).Append("\">").Append(m_WorkAreaBase.GetMessage("lbl our sales price")).Append(":</label> ").Append(Environment.NewLine); sbPricing.Append(" </th> ").Append(Environment.NewLine); sbPricing.Append(" <td class=\"noBorderLeft\"> ").Append(Environment.NewLine); sbPricing.Append(" <span class=\"currencySymbol\">").Append(currencyList[i].ISOCurrencySymbol).Append(currencyList[i].CurrencySymbol).Append("</span> ").Append(Environment.NewLine); if (!(Mode == ModeType.View)) { sbPricing.Append(" <input maxlength=\"8\" id=\"ektron_UnitPricing_SalesPrice_").Append(currencyList[i].Id).Append(IsDefaultCurrency ? "\" onchange=\"UpdateSalesPrice(this);\" " : "\" ").Append(" name=\"ektron_UnitPricing_SalesPrice_").Append(currencyList[i].Id).Append("\" type=\"text\" value=\"" + m_WorkAreaBase.FormatCurrency(currentPrice, "") + ("\" " + (IsFloated ? "disabled=\"disabled\" " : "") + " /> ")).Append(Environment.NewLine); } else { sbPricing.Append(" ").Append(m_WorkAreaBase.FormatCurrency(currentPrice, "")).Append(Environment.NewLine); } sbPricing.Append(" <input id=\"hdn_ektron_UnitPricing_DefaultTier_").Append(currencyList[i].Id).Append("\" name=\"hdn_ektron_UnitPricing_DefaultTier_").Append(currencyList[i].Id).Append("\" class=\"noFloat\" type=\"hidden\" "); sbPricing.Append("value=\"").Append(tierId).Append("\""); sbPricing.Append("/> ").Append(Environment.NewLine); sbPricing.Append("  ").Append(m_WorkAreaBase.GetMessage("lbl per unit")).Append(" ").Append(Environment.NewLine); sbPricing.Append(" </td> ").Append(Environment.NewLine); sbPricing.Append(" </tr> ").Append(Environment.NewLine); sbPricing.Append(" </tbody> ").Append(Environment.NewLine); sbPricing.Append(" </table> ").Append(Environment.NewLine); sbPricing.Append(" <div class=\"ektron_TierPricing_Wrapper\" ").Append(tierCount > 1 ? "style=\"display:block;\"" : "").Append("> ").Append(Environment.NewLine); sbPricing.Append(" <table class=\"ektron_TierPricing_Table\" summary=\"").Append(m_WorkAreaBase.GetMessage("lbl tier pricing data")).Append("\"> ").Append(Environment.NewLine); sbPricing.Append(" <colgroup> ").Append(Environment.NewLine); sbPricing.Append(" <col class=\"ektron_TierPricing_TierRemove\" /> ").Append(Environment.NewLine); sbPricing.Append(" <col class=\"ektron_TierPricing_TierQuantity\" /> ").Append(Environment.NewLine); sbPricing.Append(" <col class=\"ektron_TierPricing_TierPrice\" /> ").Append(Environment.NewLine); sbPricing.Append(" </colgroup> ").Append(Environment.NewLine); sbPricing.Append(" <thead> ").Append(Environment.NewLine); sbPricing.Append(" <tr> ").Append(Environment.NewLine); sbPricing.Append(" <th colspan=\"3\" class=\"alignLeft\"> ").Append(Environment.NewLine); sbPricing.Append(" ").Append(m_WorkAreaBase.GetMessage("lbl tier pricing")).Append(" ").Append(Environment.NewLine); sbPricing.Append(" </th> ").Append(Environment.NewLine); sbPricing.Append(" </tr> ").Append(Environment.NewLine); sbPricing.Append(" <tr class=\"ektron_TierPricing_HeaderLabels\"> ").Append(Environment.NewLine); sbPricing.Append(" <th><img class=\"ektron_TierPricing_HeaderRemoveImage\" src=\"").Append(m_WorkAreaBase.AppImgPath).Append("commerce/delete.gif\" alt=\"").Append(m_WorkAreaBase.GetMessage("lbl remove pricing tier")).Append("\" title=\"").Append(m_WorkAreaBase.GetMessage("lbl remove pricing tier")).Append("\" /></th> ").Append(Environment.NewLine); sbPricing.Append(" <th>").Append(m_WorkAreaBase.GetMessage("lbl if num units greater or equal")).Append("</th> ").Append(Environment.NewLine); sbPricing.Append(" <th>").Append(m_WorkAreaBase.GetMessage("lbl then tier price is")).Append("</th> ").Append(Environment.NewLine); sbPricing.Append(" </tr> ").Append(Environment.NewLine); sbPricing.Append(" </thead> ").Append(Environment.NewLine); sbPricing.Append(" <tbody> ").Append(Environment.NewLine); int jModifier = 0; for (int j = 0; j <= (tierCount - 1); j++) { int tierQuantity = 0; long tierQId = 0; decimal tierSalePrice = (decimal)0.0; bool bShow = true; if (j == 0 && tierPrices.Count == 0) // old way { // do nothing } else if (j == 0 && tierPrices.Count == 1 && tierPrices[0].Quantity == 1) //no tier pricing { //do nothing } else if (j == 0 && tierPrices.Count > 0 && tierPrices[0].Quantity == 1) // first is quantity 1 so skip { jModifier = -1; if (tierPrices.Count > 1) { bShow = false; } } else { tierQuantity = System.Convert.ToInt32(tierPrices[j].Quantity); tierSalePrice = System.Convert.ToDecimal(tierPrices[j].SalePrice); tierQId = tierPrices[j].Id; } if (bShow) { sbPricing.Append(" <tr class=\"tier stripe\" id=\"tier_").Append(j + jModifier).Append("\"> ").Append(Environment.NewLine); sbPricing.Append(" <td class=\"tierRemove\"> ").Append(Environment.NewLine); if (!(Mode == ModeType.View)) { sbPricing.Append(" <input type=\"checkbox\" title=\"").Append(m_WorkAreaBase.GetMessage("lbl remove tier")).Append("\" class=\"ektron_RemoveTier_Checkbox\" onclick=\"Ektron.Commerce.Pricing.Tier.toggleRemove();\"/> ").Append(Environment.NewLine); } sbPricing.Append(" </td> ").Append(Environment.NewLine); sbPricing.Append(" <td class=\"tierQuantity\"> ").Append(Environment.NewLine); if (!((Mode == ModeType.View) == true) && !IsFloated) { sbPricing.Append(" <input maxlength=\"9\" id=\"ektron_TierPricing_TierQuantity_").Append(currencyList[i].Id).Append("_").Append(j + jModifier).Append("\" name=\"ektron_TierPricing_TierQuantity_").Append(currencyList[i].Id).Append("_").Append(j + jModifier).Append("\" type=\"text\" "); sbPricing.Append("value=\"" + tierQuantity + "\""); sbPricing.Append("/> ").Append(Environment.NewLine); } else { sbPricing.Append(" <input maxlength=\"9\" id=\"ektron_TierPricing_TierQuantity_").Append(currencyList[i].Id).Append("_").Append(j + jModifier).Append("\" name=\"ektron_TierPricing_TierQuantity_").Append(currencyList[i].Id).Append("_").Append(j + jModifier).Append("\" type=\"text\" disabled=\"disabled\" "); sbPricing.Append("value=\"" + tierQuantity + "\""); sbPricing.Append("/> ").Append(Environment.NewLine); } sbPricing.Append(" <input id=\"hdn_ektron_TierPricing_TierId_").Append(currencyList[i].Id).Append("_").Append(j + jModifier).Append("\" name=\"hdn_ektron_TierPricing_TierId_").Append(currencyList[i].Id).Append("_").Append(j + jModifier).Append("\" type=\"hidden\" "); sbPricing.Append("value=\"" + tierQId + "\""); sbPricing.Append("/> ").Append(Environment.NewLine); sbPricing.Append(" </td> ").Append(Environment.NewLine); sbPricing.Append(" <td class=\"tierPrice\"> ").Append(Environment.NewLine); sbPricing.Append(" <span class=\"currencySymbol noFloat\">").Append(currencyList[i].ISOCurrencySymbol).Append(currencyList[i].CurrencySymbol).Append("</span> ").Append(Environment.NewLine); if (!((Mode == ModeType.View) == true) && !IsFloated) { sbPricing.Append(" <input maxlength=\"12\" id=\"ektron_TierPricing_TierPrice_").Append(currencyList[i].Id).Append("_").Append(j + jModifier).Append("\" name=\"ektron_TierPricing_TierPrice_").Append(currencyList[i].Id).Append("_").Append(j + jModifier).Append("\" class=\"noFloat\" type=\"text\" "); sbPricing.Append("value=\"" + m_WorkAreaBase.FormatCurrency(tierSalePrice, "") + "\""); sbPricing.Append("/> ").Append(Environment.NewLine); } else { sbPricing.Append(" <input maxlength=\"12\" id=\"ektron_TierPricing_TierPrice_").Append(currencyList[i].Id).Append("_").Append(j + jModifier).Append("\" name=\"ektron_TierPricing_TierPrice_").Append(currencyList[i].Id).Append("_").Append(j + jModifier).Append("\" class=\"noFloat\" type=\"text\" disabled=\"disabled\" "); sbPricing.Append("value=\"" + m_WorkAreaBase.FormatCurrency(tierSalePrice, "") + "\""); sbPricing.Append("/> ").Append(Environment.NewLine); } sbPricing.Append(" </td> ").Append(Environment.NewLine); sbPricing.Append(" </tr> ").Append(Environment.NewLine); } } sbPricing.Append(" </tbody> ").Append(Environment.NewLine); sbPricing.Append(" </table> ").Append(Environment.NewLine); sbPricing.Append(" </div> ").Append(Environment.NewLine); sbPricing.Append(" </div> ").Append(Environment.NewLine); } if (Mode != ModeType.View && showPricingTier == true) { sbPricing.Append(" <p class=\"ektron_TierPricing_Commands clearfix\"> ").Append(Environment.NewLine); sbPricing.Append(" <a href=\"#AddPricingTier\" class=\"button buttonRight greenHover marginLeft\" title=\"").Append(m_WorkAreaBase.GetMessage("lbl add pricing tier")).Append("\" onclick=\"Ektron.Commerce.Pricing.Tier.addTier(this);return false;\"> ").Append(Environment.NewLine); sbPricing.Append(" <img src=\"").Append(m_WorkAreaBase.AppImgPath).Append("commerce/coins_add.gif\" alt=\"").Append(m_WorkAreaBase.GetMessage("lbl add pricing tier")).Append("\" /> ").Append(Environment.NewLine); sbPricing.Append(" ").Append(m_WorkAreaBase.GetMessage("lbl add pricing tier")).Append(" ").Append(Environment.NewLine); sbPricing.Append(" </a> ").Append(Environment.NewLine); sbPricing.Append(" <a href=\"#RemovePricingTier\" class=\"button buttonRight ektron_RemovePricingTier_Button disabled\" title=\"").Append(m_WorkAreaBase.GetMessage("lbl remove pricing tier")).Append("\" onclick=\"Ektron.Commerce.Pricing.Tier.removeTier();return false;\" ").Append(showRemoveForDefault ? "style=\"display:block;\"" : "").Append("> ").Append(Environment.NewLine); sbPricing.Append(" <img src=\"").Append(m_WorkAreaBase.AppImgPath).Append("commerce/coins_delete.gif\" alt=\"").Append(m_WorkAreaBase.GetMessage("lbl remove pricing tier")).Append("\" /> ").Append(Environment.NewLine); sbPricing.Append(" ").Append(m_WorkAreaBase.GetMessage("lbl remove pricing tier")).Append(" ").Append(Environment.NewLine); sbPricing.Append(" </a> ").Append(Environment.NewLine); sbPricing.Append(" </p> ").Append(Environment.NewLine); } sbPricing.Append(" </div> ").Append(Environment.NewLine); sbPricing.Append(" <div id=\"ektron_Pricing_Modal\" class=\"ektronWindow\"> ").Append(Environment.NewLine); sbPricing.Append(" <h4 id=\"ektron_Pricing_Modal_Header\"> ").Append(Environment.NewLine); sbPricing.Append(" <img src=\"").Append(m_WorkAreaBase.AppImgPath).Append("commerce/closeButton.gif\" alt=\"").Append(m_WorkAreaBase.GetMessage("lbl cancel and close window")).Append("\" class=\"ektronModalClose\" /> ").Append(Environment.NewLine); sbPricing.Append(" </h4> ").Append(Environment.NewLine); sbPricing.Append(" <div class=\"ektron_Pricing_Modal_InnerWrapper\"> ").Append(Environment.NewLine); sbPricing.Append(" <p>").Append(m_WorkAreaBase.GetMessage("js confirm remove selected pricing tiers")).Append("</p> ").Append(Environment.NewLine); sbPricing.Append(" <p class=\"buttons clearfix\"> ").Append(Environment.NewLine); sbPricing.Append(" <a href=\"#Ok\" class=\"button buttonRight greenHover marginLeft ektronModalClose\" title=\"").Append(m_WorkAreaBase.GetMessage("lbl ok")).Append("\" onclick=\"Ektron.Commerce.Pricing.Tier.removeTier();return false;\"> ").Append(Environment.NewLine); sbPricing.Append(" <img src=\"").Append(m_WorkAreaBase.AppImgPath).Append("commerce/accept.gif\" alt=\"").Append(m_WorkAreaBase.GetMessage("lbl ok")).Append("\" /> ").Append(Environment.NewLine); sbPricing.Append(" ").Append(m_WorkAreaBase.GetMessage("lbl ok")).Append(" ").Append(Environment.NewLine); sbPricing.Append(" </a> ").Append(Environment.NewLine); sbPricing.Append(" <a href=\"#Cancel\" class=\"button buttonRight redHover ektronModalClose\" title=\"").Append(m_WorkAreaBase.GetMessage("generic cancel")).Append("\" onclick=\"return false;\"> ").Append(Environment.NewLine); sbPricing.Append(" <img src=\"").Append(m_WorkAreaBase.AppImgPath).Append("commerce/cancel.gif\" alt=\"").Append(m_WorkAreaBase.GetMessage("generic cancel")).Append("\" /> ").Append(Environment.NewLine); sbPricing.Append(" ").Append(m_WorkAreaBase.GetMessage("generic cancel")).Append(" ").Append(Environment.NewLine); sbPricing.Append(" </a> ").Append(Environment.NewLine); sbPricing.Append(" </p> ").Append(Environment.NewLine); sbPricing.Append(" </div> ").Append(Environment.NewLine); sbPricing.Append(" </div> ").Append(Environment.NewLine); sbPricing.Append(" </div> ").Append(Environment.NewLine); sbPricing.Append(" ").Append(Environment.NewLine); sbPricing.Append(" </td> ").Append(Environment.NewLine); sbPricing.Append(" </tr> ").Append(Environment.NewLine); sbPricing.Append(" </table> ").Append(Environment.NewLine); if (entryType == Ektron.Cms.Common.EkEnumeration.CatalogEntryType.SubscriptionProduct) { Ektron.Cms.Common.RecurrenceType recurrenceType = Ektron.Cms.Common.RecurrenceType.MonthlyByDay; int recurrenceInterval = 1; if (pricing.IsRecurringPrice) { recurrenceType = pricing.Recurrence.RecurrenceType; recurrenceInterval = pricing.Recurrence.Intervals; } sbPricing.Append(" <input class=\"EktronRecurringPricingEditStatus\" type=\"hidden\" value=\"").Append(pricing.IsRecurringPrice ? "true" : "false").Append("\" />").Append(Environment.NewLine); sbPricing.Append(" <input class=\"EktronRecurringPricingMode\" type=\"hidden\" value=\"").Append(Mode.ToString()).Append("\" />").Append(Environment.NewLine); sbPricing.Append(" <table class=\"ektron_RecurringPricing_Table\" summary=\"").Append(m_WorkAreaBase.GetMessage("lbl recurring billing data")).Append("\"> ").Append(Environment.NewLine); sbPricing.Append(" <colgroup> ").Append(Environment.NewLine); sbPricing.Append(" <col class=\"narrowCol\"/> ").Append(Environment.NewLine); sbPricing.Append(" <col class=\"wideCol\" /> ").Append(Environment.NewLine); sbPricing.Append(" </colgroup> ").Append(Environment.NewLine); sbPricing.Append(" <thead> ").Append(Environment.NewLine); sbPricing.Append(" <tr> ").Append(Environment.NewLine); sbPricing.Append(" <th colspan=\"2\" class=\"alignLeft noBorderRight\"> ").Append(Environment.NewLine); sbPricing.Append(" ").Append(m_WorkAreaBase.GetMessage("lbl recurring billing")).Append(" ").Append(Environment.NewLine); sbPricing.Append(" </th> ").Append(Environment.NewLine); sbPricing.Append(" </tr> ").Append(Environment.NewLine); sbPricing.Append(" </thead> ").Append(Environment.NewLine); sbPricing.Append(" <tbody> ").Append(Environment.NewLine); ///'''''''''''''''''''''''''''''''''''''''' //Row: Use Recurrent Billing sbPricing.Append(" <tr>").Append(Environment.NewLine); sbPricing.Append(" <th> ").Append(Environment.NewLine); sbPricing.Append(" <img src=\"").Append(m_WorkAreaBase.AppImgPath).Append("commerce/about.gif\" alt=\"").Append(m_WorkAreaBase.GetMessage("lbl use recurrent billing")).Append("\" title=\"").Append(m_WorkAreaBase.GetMessage("lbl use recurrent billing")).Append("\" class=\"moreInfo\" /> ").Append(Environment.NewLine); sbPricing.Append(" <label for=\"PricingTabRecurringBillingUseRecurrentBilling").Append("\">").Append(m_WorkAreaBase.GetMessage("lbl use recurrent billing")).Append(":</label> ").Append(Environment.NewLine); sbPricing.Append(" </th> ").Append(Environment.NewLine); sbPricing.Append(" <td> ").Append(Environment.NewLine); if (Mode == ModeType.View) { sbPricing.Append(" <span id=\"PricingTabRecurringBillingUseRecurrentBilling\">").Append(Environment.NewLine); sbPricing.Append(pricing.IsRecurringPrice ? "Yes" : "No"); sbPricing.Append(" </span> ").Append(Environment.NewLine); } else { sbPricing.Append(" <select class=\"recurringBilling\" onchange=\"Ektron.Commerce.Pricing.floatRecurring(this);\" name=\"PricingTabRecurringBillingUseRecurrentBilling\" id=\"PricingTabRecurringBillingUseRecurrentBilling\">").Append(Environment.NewLine); sbPricing.Append(" <option value=\"true\"").Append(pricing.IsRecurringPrice ? "selected=\"selected\"" : "").Append(">Yes</option>").Append(Environment.NewLine); sbPricing.Append(" <option value=\"false\"").Append(pricing.IsRecurringPrice ? "" : "selected=\"selected\"").Append(">No</option>").Append(Environment.NewLine); sbPricing.Append(" </span> ").Append(Environment.NewLine); } sbPricing.Append(" </td> ").Append(Environment.NewLine); sbPricing.Append(" </tr> ").Append(Environment.NewLine); ///'''''''''''''''''''''''''''''''''''''''' //Row: Billing Cycle sbPricing.Append(" <tr class=\"billingCycle stripe\">").Append(Environment.NewLine); sbPricing.Append(" <th>").Append(Environment.NewLine); sbPricing.Append(" <img src=\"").Append(m_WorkAreaBase.AppImgPath).Append("commerce/about.gif\" alt=\"").Append(m_WorkAreaBase.GetMessage("lbl billing cycle")).Append("\" title=\"").Append(m_WorkAreaBase.GetMessage("lbl billing cycle desc")).Append("\" class=\"moreInfo\" /> ").Append(Environment.NewLine); sbPricing.Append(" <label for=\"PricingTabRecurringBillingBillingCycle").Append("\" class=\"billingCycle\">").Append(m_WorkAreaBase.GetMessage("lbl billing cycle")).Append(":</label> ").Append(Environment.NewLine); sbPricing.Append(" </th>").Append(Environment.NewLine); sbPricing.Append(" <td>").Append(Environment.NewLine); if (Mode == ModeType.View) { sbPricing.Append(" <span id=\"PricingTabRecurringBillingBillingCycle\">").Append(Environment.NewLine); sbPricing.Append(recurrenceType == Ektron.Cms.Common.RecurrenceType.MonthlyByDay ? "Monthly" : ""); sbPricing.Append(recurrenceType == Ektron.Cms.Common.RecurrenceType.Yearly ? "Yearly" : ""); } else { sbPricing.Append(" <select id=\"PricingTabRecurringBillingBillingCycle\" name=\"PricingTabRecurringBillingBillingCycle\" ").Append(this.GetEnabled(Mode, pricing)).Append(" /> ").Append(Environment.NewLine); sbPricing.Append(" <option value=\"month\"").Append(recurrenceType == Ektron.Cms.Common.RecurrenceType.MonthlyByDay ? " SELECTED " : "").Append(">Monthly</option>"); sbPricing.Append(" <option value=\"year\"").Append(recurrenceType == Ektron.Cms.Common.RecurrenceType.Yearly ? " SELECTED " : "").Append(">Yearly</option>"); sbPricing.Append(" </select>").Append(Environment.NewLine); } sbPricing.Append(" </td> ").Append(Environment.NewLine); sbPricing.Append(" </tr>").Append(Environment.NewLine); ///'''''''''''''''''''''''''''''''''''''''' //Row: Interval sbPricing.Append(" <tr class=\"interval\">").Append(Environment.NewLine); sbPricing.Append(" <th>").Append(Environment.NewLine); sbPricing.Append(" <img src=\"").Append(m_WorkAreaBase.AppImgPath).Append("commerce/about.gif\" alt=\"").Append(m_WorkAreaBase.GetMessage("lbl billing intervals")).Append("\" title=\"").Append(m_WorkAreaBase.GetMessage("lbl billing intervals desc")).Append("\" class=\"moreInfo\" /> ").Append(Environment.NewLine); sbPricing.Append(" <label for=\"PricingTabRecurringBillingInterval").Append("\" class=\"StartDate\">").Append(m_WorkAreaBase.GetMessage("lbl billing intervals")).Append(":</label> ").Append(Environment.NewLine); sbPricing.Append(" </th>").Append(Environment.NewLine); sbPricing.Append(" <td>").Append(Environment.NewLine); sbPricing.Append(" <input maxlength=\"8\" type=\"text\" class=\"interval\" ").Append(this.GetEnabled(Mode, pricing)).Append(" name=\"PricingTabRecurringBillingInterval\" title=\"Select Interval\" id=\"PricingTabRecurringBillingInterval\" value=\"" + recurrenceInterval + "\" />").Append(Environment.NewLine); sbPricing.Append(" <span class=\"intervalRequired\">* must be numeric</span> ").Append(Environment.NewLine); sbPricing.Append(" </td> ").Append(Environment.NewLine); sbPricing.Append(" </tr> ").Append(Environment.NewLine); sbPricing.Append(" </tbody> ").Append(Environment.NewLine); sbPricing.Append(" </table> ").Append(Environment.NewLine); if (!(Mode == ModeType.View)) { sbPricing.Append(" <div class=\"finish\"> ").Append(Environment.NewLine); sbPricing.Append(" <h3>").Append(m_WorkAreaBase.GetMessage("lbl important")).Append("</h3> ").Append(Environment.NewLine); sbPricing.Append(" <div class=\"innerWrapper\"> ").Append(Environment.NewLine); sbPricing.Append(" <p><span>").Append(m_WorkAreaBase.GetMessage("lbl recurring billing test")).Append("</span></p> ").Append(Environment.NewLine); sbPricing.Append(" </div> ").Append(Environment.NewLine); sbPricing.Append(" </div> ").Append(Environment.NewLine); } } return sbPricing.ToString(); }
protected PricingData Process_GetPricing(PricingData currentPricing) { PricingData updatedPricing = new PricingData(); // If currentPricing Is Nothing Then currentPricing = New PricingData() List<CurrencyData> currencyList; List<CurrencyPricingData> currencyPriceList = new List<CurrencyPricingData>(); currencyList = m_refCurrency.GetActiveCurrencyList(); for (int i = 0; i <= (currencyList.Count - 1); i++) { if (!(!string.IsNullOrEmpty(Request.Form["ektron_UnitPricing_Float_" + currencyList[i].Id.ToString()]))) { CurrencyPricingData currencyPrice = new CurrencyPricingData(); List<TierPriceData> tierPriceList = new List<TierPriceData>(); int tierIndex = 0; TierPriceData defaultTierPrice = new TierPriceData(); //currencyPrice.ActualCost = EkFunctions.ReadDecimalValue(Request.Form("ektron_UnitPricing_ActualPrice_" & currencyList(i).Id.ToString())) currencyPrice.AlphaIsoCode = (string)(currencyList[i].AlphaIsoCode); currencyPrice.CurrencyId = currencyList[i].Id; currencyPrice.ListPrice = EkFunctions.ReadDecimalValue(Request.Form["ektron_UnitPricing_ListPrice_" + currencyList[i].Id.ToString()], 0); currencyPrice.PricingType = Ektron.Cms.Common.EkEnumeration.PricingType.Fixed; defaultTierPrice.Quantity = 1; defaultTierPrice.Id = EkFunctions.ReadDbLong(Request.Form["hdn_ektron_UnitPricing_DefaultTier_" + currencyList[i].Id.ToString()]); defaultTierPrice.SalePrice = EkFunctions.ReadDecimalValue(Request.Form["ektron_UnitPricing_SalesPrice_" + currencyList[i].Id.ToString()], 0); currencyPrice.TierPrices.Add(defaultTierPrice); while ((Request.Form["ektron_TierPricing_TierPrice_" + currencyList[i].Id.ToString() + "_" + tierIndex.ToString()] != null) && Information.IsNumeric(Request.Form["ektron_TierPricing_TierPrice_" + currencyList[i].Id.ToString() + "_" + tierIndex.ToString()])) { TierPriceData tierPrice = new TierPriceData(); if ((Request.Form["ektron_TierPricing_TierQuantity_" + currencyList[i].Id.ToString() + "_" + tierIndex.ToString()] == "0" || Request.Form["ektron_TierPricing_TierQuantity_" + currencyList[i].Id.ToString() + "_" + tierIndex.ToString()] == "1") && (tierPrice.Id == 0 || tierPrice.Id == defaultTierPrice.Id)) { break; } if (Convert.ToInt32(Request.Form["ektron_TierPricing_TierQuantity_" + currencyList[i].Id.ToString() + "_" + tierIndex.ToString()]) > 1 && tierPrice.Id == 0) { tierPrice.Id = EkFunctions.ReadDbLong(Request.Form["hdn_ektron_TierPricing_TierId_" + currencyList[i].Id.ToString() + "_" + tierIndex.ToString()]); tierPrice.Quantity = System.Convert.ToInt32(EkFunctions.ReadDecimalValue(Request.Form["ektron_TierPricing_TierQuantity_" + currencyList[i].Id.ToString() + "_" + tierIndex.ToString()], 0)); tierPrice.SalePrice = EkFunctions.ReadDecimalValue(Request.Form["ektron_TierPricing_TierPrice_" + currencyList[i].Id.ToString() + "_" + tierIndex.ToString()], 0); currencyPrice.TierPrices.Add(tierPrice); } tierIndex++; } currencyPriceList.Add(currencyPrice); } } updatedPricing.CurrencyPricelist = currencyPriceList; if (Request.Form["PricingTabRecurringBillingUseRecurrentBilling"] == "true") { Ektron.Cms.Common.RecurrenceData pricingRecurrance; if (Request.Form["PricingTabRecurringBillingBillingCycle"] == "month") { pricingRecurrance = Ektron.Cms.Common.RecurrenceData.CreateMonthlyByDayRecurrence(1, Ektron.Cms.Common.RecurrenceDayOfMonth.First, Ektron.Cms.Common.RecurrenceDaysOfWeek.Tuesday); } else { pricingRecurrance = Ektron.Cms.Common.RecurrenceData.CreateYearlyRecurrence(1, 4, 15); } pricingRecurrance.StartDateUtc = DateTime.Now; pricingRecurrance.EndDateUtc = DateTime.Now; pricingRecurrance.Intervals = Convert.ToInt32(Request.Form["PricingTabRecurringBillingInterval"]); updatedPricing.Recurrence = pricingRecurrance; } return updatedPricing; }
protected void AssertSessionPricing(PricingData pricing, decimal?sessionPrice, decimal?coursePrice) { Assert.That(pricing, Is.Not.Null); Assert.That(pricing.sessionPrice, Is.EqualTo(sessionPrice)); Assert.That(pricing.coursePrice, Is.EqualTo(coursePrice)); }
public static bool CUDPricingDetails(PricingData pricingData, string QuerySelector) { IPricingDetailsService pricingDetailsService = new PricingDetailsService(); return(pricingDetailsService.CUDPricingDetails(pricingData, QuerySelector)); }