Initial project's source code check-in.

This commit is contained in:
ptsurbeleu 2011-07-13 16:07:32 -07:00
commit b03b0b373f
4573 changed files with 981205 additions and 0 deletions

View file

@ -0,0 +1,150 @@
// Copyright (c) 2011, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using WebsitePanel.Ecommerce.EnterpriseServer;
using WebsitePanel.Portal;
namespace WebsitePanel.Ecommerce.Portal
{
public abstract class CheckoutBasePage : Page
{
/// <summary>
/// Order complete uri
/// </summary>
public const string OrderCompleteUri = "/Default.aspx?pid=ecOrderComplete";
/// <summary>
/// Order failed uri
/// </summary>
public const string OrderFailedUri = "/Default.aspx?pid=ecOrderFailed";
private string redirectUrl;
private string methodName;
private int invoiceId;
private string contractKey;
/// <summary>
/// Gets invoice number
/// </summary>
protected int InvoiceId
{
get { return invoiceId; }
set { invoiceId = value; }
}
/// <summary>
/// Gets redirect url
/// </summary>
protected string RedirectUrl
{
get { return redirectUrl; }
}
protected CheckoutBasePage(string methodName, string contractKey)
{
// validate plugin is not empty
if (String.IsNullOrEmpty(methodName))
throw new ArgumentNullException("methodName");
if (String.IsNullOrEmpty(contractKey))
throw new ArgumentNullException("contractKey");
// set plugin name
this.methodName = methodName;
this.contractKey = contractKey;
}
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
// start to serve payment processor response
ServeProcessorResponse();
}
protected virtual void ServeProcessorResponse()
{
// create an instance
CheckoutDetails orderDetails = new CheckoutDetails();
// copy whole request keys
foreach (string keyName in Request.Form.AllKeys)
{
orderDetails[keyName] = Request.Form[keyName];
}
// check target_site variable
if (!String.IsNullOrEmpty(orderDetails[CheckoutFormParams.TARGET_SITE]))
redirectUrl = orderDetails[CheckoutFormParams.TARGET_SITE];
else
redirectUrl = EcommerceSettings.AbsoluteAppPath;
// process checkout details
ProcessCheckout(methodName, orderDetails);
}
protected virtual void PreProcessCheckout(CheckoutDetails details)
{
}
protected virtual void ProcessCheckout(string methodName, CheckoutDetails details)
{
try
{
PreProcessCheckout(details);
// perform order payment
CheckoutResult result = StorefrontHelper.CompleteCheckout(details[contractKey], invoiceId, methodName, details);
// post process order result
PostProcessCheckout(result);
}
catch (Exception ex)
{
// Output error message into the trace
Trace.Write("ECOMMERCE", "COMPLETE_CHECKOUT_ERROR", ex);
// display raw stack trace in case of error
Response.Write(PortalUtils.GetSharedLocalizedString("Ecommerce", "Error.CHECKOUT_GENERAL_FAILURE"));
}
}
protected virtual void PostProcessCheckout(CheckoutResult result)
{
// check order payment result status
if (result.Succeed)
// go to the order success page
Response.Redirect(RedirectUrl + OrderCompleteUri);
else
// go to order failed page
Response.Redirect(RedirectUrl + OrderFailedUri);
}
}
}

View file

@ -0,0 +1,168 @@
// Copyright (c) 2011, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Globalization;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
namespace WebsitePanel.Ecommerce.Portal
{
[ValidationProperty("Checked")]
public class GroupRadioButton : RadioButton, IPostBackDataHandler
{
public GroupRadioButton()
: base()
{
}
#region Properties
public object ControlValue
{
get { return ViewState["ControlValue"]; }
set { ViewState["ControlValue"] = value; }
}
private string Value
{
get
{
string val = Attributes["value"];
if (val == null)
val = UniqueID;
else
val = UniqueID + "_" + val;
return val;
}
}
#endregion
#region Rendering
protected override void Render(HtmlTextWriter output)
{
RenderInputTag(output);
}
protected override void AddAttributesToRender(HtmlTextWriter writer)
{
base.AddAttributesToRender(writer);
}
private void RenderInputTag(HtmlTextWriter htw)
{
htw.AddAttribute(HtmlTextWriterAttribute.Id, ClientID);
htw.AddAttribute(HtmlTextWriterAttribute.Type, "radio");
htw.AddAttribute(HtmlTextWriterAttribute.Name, GroupName);
htw.AddAttribute(HtmlTextWriterAttribute.Value, Value);
if (Checked)
htw.AddAttribute(HtmlTextWriterAttribute.Checked, "checked");
if (!Enabled)
htw.AddAttribute(HtmlTextWriterAttribute.Disabled, "disabled");
string onClick = Attributes["onclick"];
if (AutoPostBack)
{
if (onClick != null)
onClick = String.Empty;
onClick += Page.ClientScript.GetPostBackEventReference(this, String.Empty);
htw.AddAttribute(HtmlTextWriterAttribute.Onclick, onClick);
htw.AddAttribute("language", "javascript");
}
else
{
if (onClick != null)
htw.AddAttribute(HtmlTextWriterAttribute.Onclick, onClick);
}
if (AccessKey.Length > 0)
htw.AddAttribute(HtmlTextWriterAttribute.Accesskey, AccessKey);
if (TabIndex != 0)
htw.AddAttribute(HtmlTextWriterAttribute.Tabindex,
TabIndex.ToString(NumberFormatInfo.InvariantInfo));
htw.RenderBeginTag(HtmlTextWriterTag.Input);
htw.RenderEndTag();
// add text to the render
if (!String.IsNullOrEmpty(Text))
RenderLabel(htw, Text, ClientID);
}
protected virtual void RenderLabel(HtmlTextWriter writer, string text, string clientID)
{
writer.AddAttribute(HtmlTextWriterAttribute.For, clientID);
if ((LabelAttributes != null) && (LabelAttributes.Count != 0))
{
LabelAttributes.AddAttributes(writer);
}
writer.RenderBeginTag(HtmlTextWriterTag.Label);
writer.Write(text);
writer.RenderEndTag();
}
#endregion
#region IPostBackDataHandler Members
void IPostBackDataHandler.RaisePostDataChangedEvent()
{
OnCheckedChanged(EventArgs.Empty);
}
bool IPostBackDataHandler.LoadPostData(string postDataKey,
System.Collections.Specialized.NameValueCollection postCollection)
{
bool result = false;
string value = postCollection[GroupName];
if ((value != null) && (value == Value))
{
if (!Checked)
{
Checked = true;
result = true;
}
}
else
{
if (Checked)
Checked = false;
}
return result;
}
#endregion
}
}

View file

@ -0,0 +1,44 @@
// Copyright (c) 2011, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.Collections.Generic;
using System.Text;
using WebsitePanel.Ecommerce.EnterpriseServer;
using WebsitePanel.EnterpriseServer;
namespace WebsitePanel.Ecommerce.Portal
{
public interface IPaymentMethod
{
void CheckSupportedItems(string supportedItems);
void LoadContractAccount(ContractAccount account);
CheckoutDetails GetCheckoutDetails();
}
}

View file

@ -0,0 +1,41 @@
// Copyright (c) 2011, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.Collections.Generic;
using System.Text;
using WebsitePanel.Ecommerce.EnterpriseServer;
namespace WebsitePanel.Ecommerce.Portal
{
public interface IPluginProperties
{
KeyValueBunch Properties { get; set; }
}
}

View file

@ -0,0 +1,40 @@
// Copyright (c) 2011, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.Collections.Generic;
using System.Text;
namespace WebsitePanel.Ecommerce.Portal
{
public interface IViewServiceDetails
{
bool LoadServiceInfo(int serviceId);
void BindServiceHistory(int serviceId);
}
}

View file

@ -0,0 +1,77 @@
// Copyright (c) 2011, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
namespace WebsitePanel.Ecommerce.Portal
{
public class ManualValidationEventArgs : EventArgs
{
private bool contextIsValid;
public bool ContextIsValid
{
get { return contextIsValid; }
set { contextIsValid = value; }
}
}
public class ManualContextValidator : CustomValidator
{
public event EventHandler<ManualValidationEventArgs> EvaluatingContext;
protected override bool ControlPropertiesValid()
{
return true;
}
protected override bool EvaluateIsValid()
{
//
ManualValidationEventArgs args = new ManualValidationEventArgs();
//
if (EvaluatingContext != null)
{
// trying evaluate manual context
EvaluatingContext(this, args);
//
return args.ContextIsValid;
}
return true;
}
}
}

View file

@ -0,0 +1,73 @@
// Copyright (c) 2011, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
namespace WebsitePanel.Ecommerce.Portal
{
public class PasswordTextBox : TextBox
{
const string DEFAULT_PWD = "__DefaultPwd";
protected string DefaultPassword
{
get { return GetType().GUID.ToString("P"); }
}
public override TextBoxMode TextMode
{
get { return TextBoxMode.Password; }
set { base.TextMode = TextBoxMode.Password; }
}
public bool PasswordChanged
{
get
{
if (String.Equals(Text, ViewState[DEFAULT_PWD]))
return false;
//
return true;
}
}
public void EnableDefaultPassword()
{
ViewState[DEFAULT_PWD] = DefaultPassword;
Attributes["value"] = DefaultPassword;
}
}
}

View file

@ -0,0 +1,194 @@
// Copyright (c) 2011, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.ComponentModel;
using System.Data;
using System.Collections.Generic;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
namespace WebsitePanel.Ecommerce.Portal
{
public class RadioGroupValidator : CustomValidator
{
private List<RadioButton> components;
private bool buttonsCollected;
public string RadioButtonsGroup
{
get { return (string)ViewState["__RBGroup"]; }
set { ViewState["__RBGroup"] = value; }
}
public string InitialValue
{
get
{
object obj2 = this.ViewState["InitialValue"];
if (obj2 != null)
{
return (string)obj2;
}
return string.Empty;
}
set
{
this.ViewState["InitialValue"] = value;
}
}
public RadioGroupValidator()
{
components = new List<RadioButton>();
}
protected override void OnLoad(EventArgs e)
{
//
base.OnLoad(e);
//
ClientValidationFunction = "RadioCheckedEvaluateIsValid";
//
if (!Page.ClientScript.IsClientScriptIncludeRegistered("EcommerceUtils"))
{
Page.ClientScript.RegisterClientScriptInclude("EcommerceUtils",
Page.ClientScript.GetWebResourceUrl(typeof(RadioGroupValidator),
"WebsitePanel.Ecommerce.Portal.Scripts.EcommerceUtils.js"));
}
}
protected override bool ControlPropertiesValid()
{
//
if (String.IsNullOrEmpty(RadioButtonsGroup))
throw new Exception("'RadioButtonsGroup' property is empty or null");
return true;
}
private void RecursiveRadioButtonsLookup(Control parent, string groupName)
{
foreach (Control ctl in parent.Controls)
{
if (ctl is RadioButton && ((RadioButton)ctl).GroupName == groupName)
{
//
components.Add((RadioButton)ctl);
}
else if (ctl.HasControls())
{
RecursiveRadioButtonsLookup(ctl, groupName);
}
}
}
private void CollectRadioButtons()
{
//
if (!buttonsCollected)
{
// workaround for repeater header or footer
if (Parent is RepeaterItem)
RecursiveRadioButtonsLookup(Parent.Parent, RadioButtonsGroup);
else
RecursiveRadioButtonsLookup(Parent, RadioButtonsGroup);
//
buttonsCollected = true;
}
}
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
//
CollectRadioButtons();
//
string array_values = "";
//
foreach (RadioButton rbutton in components)
{
if (array_values.Length == 0)
array_values += String.Format("'{0}'", rbutton.ClientID);
else
array_values += String.Format(",'{0}'", rbutton.ClientID);
}
//
Page.ClientScript.RegisterArrayDeclaration(RadioButtonsGroup, array_values);
}
protected override void AddAttributesToRender(HtmlTextWriter writer)
{
base.AddAttributesToRender(writer);
//
if (RenderUplevel)
{
//
string controlId = this.ClientID;
//
AddExpandoAttribute(writer, controlId, "radiogroup", RadioButtonsGroup, false);
}
}
protected override bool EvaluateIsValid()
{
//
CollectRadioButtons();
//
foreach (RadioButton rbutton in components)
{
//
PropertyDescriptor descriptor = RequiredFieldValidator.GetValidationProperty(rbutton);
//
bool controlChecked = (bool)descriptor.GetValue(rbutton);
//
if (controlChecked)
return true;
}
//
return false;
}
protected void AddExpandoAttribute(HtmlTextWriter writer, string controlId, string attributeName, string attributeValue, bool encode)
{
if (writer != null)
{
writer.AddAttribute(attributeName, attributeValue, encode);
}
else
{
this.Page.ClientScript.RegisterExpandoAttribute(controlId, attributeName, attributeValue, encode);
}
}
}
}

View file

@ -0,0 +1,173 @@
// Copyright (c) 2011, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.Data;
using System.Configuration;
using System.Collections.Generic;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using WebsitePanel;
using WebsitePanel.WebPortal;
using WebsitePanel.Portal;
using WebsitePanel.EnterpriseServer;
namespace WebsitePanel.Ecommerce.Portal
{
public class ecControlBase : WebsitePanelControlBase
{
protected bool StorefrontRunning
{
get { return true; }/* !ecUtils.IsGuidEmpty(EcommerceSettings.OwnerSpaceId);*/
}
public string EditUrlSecure(string controlKey)
{
string url = EditUrl(controlKey);
if (EcommerceSettings.UseSSL)
url = url.Replace("http://", "https://");
return url;
}
#region ViewState helper routines
protected T GetViewStateObject<T>(string keyName, GetStateObjectDelegate callback)
{
//
object obj = ViewState[keyName];
//
if (obj == null)
{
// obtain object via callback
obj = callback();
// store object
ViewState[keyName] = obj;
}
//
return (T)Convert.ChangeType(obj, typeof(T));
}
#endregion
/// <summary>
/// Returns the switched mode module URL. Also additional parameters can be injected to the URL.
/// </summary>
/// <param name="controlKey">Control key from module definition without the "Mode" suffix. "Mode" suffix used only to visual distinct in controls defintions.</param>
/// <param name="parameters">Additional mode switch parameters</param>
/// <returns></returns>
public string SwitchModuleMode(string controlKey, params string[] parameters)
{
// ensure whether the controlKey is in the correct format
if (controlKey != null && controlKey.EndsWith("Mode"))
controlKey = controlKey.Replace("Mode", string.Empty);
string[] addList = null;
if (parameters.Length > 0)
{
int count = parameters.Length;
addList = new string[count + 2];
Array.Copy(new string[] { String.Concat("mode=", controlKey) }, addList, 1);
Array.Copy(parameters, 0, addList, 1, count);
}
else if (!String.IsNullOrEmpty(controlKey))
addList = new string[] { String.Concat("mode=", controlKey) };
return NavigateURL(
DefaultPage.MODULE_ID_PARAM,
Request[DefaultPage.MODULE_ID_PARAM],
addList
);
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
if (!StorefrontRunning)
DisableFormControls(this);
}
public new void LocalizeModuleControls(Control module)
{
base.LocalizeModuleControls(module);
foreach (Control ctrl in module.Controls)
{
if (ctrl is DropDownList)
{
DropDownList ddl = ctrl as DropDownList;
string key = ddl.Attributes["listlabel"];
if (!String.IsNullOrEmpty(key))
{
LocalizeDropDownListLabel(ddl, key);
}
}
else
{
// localize children
foreach (Control childCtrl in ctrl.Controls)
LocalizeModuleControls(childCtrl);
}
}
}
public void LocalizeDropDownListLabel(DropDownList list, string key)
{
if (IsPostBack)
return;
string labelStr = GetLocalizedString(String.Concat("ListLabel.", key));
if (!String.IsNullOrEmpty(labelStr))
list.Items.Insert(0, new ListItem(labelStr));
list.Attributes.Remove("listlabel");
}
protected string GetLocalizedErrorMessage(string resourceKey)
{
return GetLocalizedString(String.Concat(Keys.ErrorMessage, ".", resourceKey));
}
protected override void OnPreRender(EventArgs e)
{
LocalizeModuleControls(this);
// call base handler
base.OnPreRender(e);
}
}
}

View file

@ -0,0 +1,242 @@
// Copyright (c) 2011, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using WebsitePanel;
using WebsitePanel.Portal;
using WebsitePanel.EnterpriseServer;
namespace WebsitePanel.Ecommerce.Portal
{
public delegate object GetStateObjectDelegate();
public class ecModuleBase : WebsitePanelModuleBase
{
private UrlBuilder currentUrl;
private bool showStorefrontWarning = true;
private bool enabledForInactiveStore;
protected bool EnabledForInactiveStore
{
get { return enabledForInactiveStore; }
set { enabledForInactiveStore = value; }
}
protected bool ShowStorefrontWarning
{
get { return showStorefrontWarning; }
set { showStorefrontWarning = value; }
}
protected bool StorefrontRunning
{
get { return true;/*!ecUtils.IsGuidEmpty(EcommerceSettings.OwnerSpaceId)*/ }
}
public UrlBuilder CurrentUrl
{
get
{
if (currentUrl == null)
currentUrl = UrlBuilder.FromCurrentRequest();
return currentUrl;
}
}
#region ViewState helper routines
protected T GetViewStateObject<T>(string keyName, GetStateObjectDelegate callback)
{
//
object obj = ViewState[keyName];
//
if (obj == null)
{
// obtain object via callback
obj = callback();
// store object
ViewState[keyName] = obj;
}
//
return (T)Convert.ChangeType(obj, typeof(T));
}
#endregion
/*public string NavigateURL(string keyName, string keyValue)
{
return DotNetNuke.Common.Globals.NavigateURL(PortalSettings.ActiveTab.TabID,
PortalSettings.ActiveTab.IsSuperTab,
PortalSettings,
string.Empty,
new string[] { keyName, keyValue });
}*/
public override void RedirectToBrowsePage()
{
Response.Redirect(NavigateURL("UserID", PanelSecurity.SelectedUserId.ToString()), true);
}
public string EditUrlSecure(string controlKey)
{
string url = EditUrl(controlKey);
if (EcommerceSettings.UseSSL)
url = url.Replace("http://", "https://");
return url;
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
if (!StorefrontRunning && ShowStorefrontWarning)
{
ShowWarningMessage("STOREFRONT_DISABLED");
if (!EnabledForInactiveStore)
DisableFormControls(this);
}
}
public void EnsurePageIsSecured()
{
// read SSL
bool useSSL = StorefrontHelper.GetSecurePayments(ecPanelRequest.ResellerId);
//
if (useSSL && !Request.IsSecureConnection)
{
//
UrlBuilder url = UrlBuilder.FromCurrentRequest();
// change scheme to secure
url.Scheme = "https";
//
url.Navigate();
}
}
protected void EnsureResellerIsCorrect(params Control[] ctlsToHide)
{
// redirect authenticated user to reseller's store
if (Page.User.Identity.IsAuthenticated)
{
if (ecPanelRequest.ResellerId != PanelSecurity.LoggedUser.OwnerId)
{
// build url
UrlBuilder url = UrlBuilder.FromCurrentRequest();
// replace reseller id
url.QueryString["ResellerId"] = PanelSecurity.LoggedUser.OwnerId.ToString();
// navigate back
url.Navigate();
}
}
// user not logged
if (ecPanelRequest.ResellerId == 0)
{
ShowErrorMessage("RESELLER_NOT_SPECIFIED");
ecUtils.ToggleControls(false, ctlsToHide);
}
}
/// <summary>
/// Returns the switched mode module URL. Also additional parameters can be injected to the URL.
/// </summary>
/// <param name="controlKey">Control key from module definition without the "Mode" suffix. "Mode" suffix used only to visual distinct in controls defintions.</param>
/// <param name="parameters">Additional mode switch parameters</param>
/// <returns></returns>
public string SwitchModuleMode(string controlKey, params string[] parameters)
{
// ensure whether the controlKey is in the correct format
if (controlKey != null && controlKey.EndsWith("Mode"))
controlKey = controlKey.Replace("Mode", string.Empty);
string[] addList = null;
if (parameters.Length > 0)
{
int count = parameters.Length;
addList = new string[count + 2];
Array.Copy(new string[] { "mode", controlKey }, addList, 2);
Array.Copy(parameters, 0, addList, 2, count);
}
else if (!string.IsNullOrEmpty(controlKey))
addList = new string[] { "mode", controlKey };
return String.Empty;
}
public override void ShowWarningMessage(string messageKey)
{
base.ShowWarningMessage(Keys.ModuleName, messageKey);
}
public override void ShowSuccessMessage(string messageKey)
{
base.ShowSuccessMessage(Keys.ModuleName, messageKey);
}
public override void ShowErrorMessage(string messageKey, Exception ex, params string[] additionalParameters)
{
base.ShowErrorMessage(Keys.ModuleName, messageKey, ex, additionalParameters);
}
public void LocalizeDropDownListLabel(DropDownList list, string key)
{
string labelStr = GetLocalizedString(string.Concat("ListLabel.", key));
list.Attributes.Remove("listlabel");
if (!String.IsNullOrEmpty(labelStr))
{
// check whether an item is already exists
if (list.Items.Count > 0)
{
ListItem li = list.Items[0];
if (String.IsNullOrEmpty(li.Value) && String.Compare(li.Text, labelStr) == 0)
return;
}
list.Items.Insert(0, new ListItem(labelStr, String.Empty));
}
}
protected override void OnPreRender(EventArgs e)
{
LocalizeModuleControls(this);
// call base handler
base.OnPreRender(e);
}
}
}

View file

@ -0,0 +1,100 @@
// Copyright (c) 2011, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.Collections.Generic;
using System.Text;
using WebsitePanel.Portal;
using WebsitePanel.Ecommerce.EnterpriseServer;
namespace WebsitePanel.Ecommerce.Portal
{
/// <summary>
/// Summary description for PanelFormatter.
/// </summary>
public class ecPanelFormatter
{
public static string GetBooleanName(bool value)
{
return ecGetLocalizedString(String.Concat("Boolean.", value));
}
public static string GetTransactionStatusName(object status)
{
return ecGetLocalizedString(String.Concat("TransactionStatus.", status));
}
public static string GetSvcItemTypeName(object value)
{
return ecGetLocalizedString(String.Concat("ProductType.", value));
}
public static string GetServiceStatusName(object status)
{
return ecGetLocalizedString(String.Concat("ServiceStatus.", status));
}
public static string GetTaxationType(object value)
{
return ecGetLocalizedString(String.Concat("TaxationType.", ((TaxationType)value).ToString()));
}
public static string GetTaxationFormat(object format, object value)
{
switch ((TaxationType)format)
{
case TaxationType.Fixed:
return String.Format("{0} {1:C}", EcommerceSettings.CurrencyCodeISO, value);
case TaxationType.Percentage:
case TaxationType.TaxIncluded:
return String.Format("{0:0.00}%", value);
}
//
return String.Empty;
}
public static string ecGetLocalizedString(string key)
{
return PortalUtils.GetSharedLocalizedString(Keys.ModuleName, key);
}
public static string GetTaxationStatus(bool value)
{
return ecGetLocalizedString(String.Concat("TaxationStatus.", value.ToString()));
}
public static string GetLastModified(object value)
{
if (DateTime.Equals(value, DateTime.MinValue))
return "&nbsp;";
return Convert.ToString(value);
}
}
}

View file

@ -0,0 +1,46 @@
// Copyright (c) 2011, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.Collections.Generic;
using System.Text;
namespace WebsitePanel.Ecommerce.Portal
{
public class ecPanelGlobals
{
public static string ecSharedResourceFile
{
get
{
return WebsitePanel.Portal.PortalUtils.ApplicationPath
+ "/DesktopModules/Ecommerce/App_LocalResources/SharedResources.resx";
}
}
}
}

View file

@ -0,0 +1,152 @@
// Copyright (c) 2011, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.Web;
namespace WebsitePanel.Ecommerce.Portal
{
public class ecPanelRequest
{
public static int GetInt(string key)
{
return GetInt(key, 0);
}
public static string GetString(string key)
{
return HttpContext.Current.Request[key];
}
public static int GetInt(string key, int defaultValue)
{
int result = defaultValue;
try { result = Int32.Parse(HttpContext.Current.Request[key]); }
catch { /* do nothing */ }
return result;
}
#region E-Commerce module definitions
public static string ContractId
{
get { return GetString("ContractId"); }
}
public static int TaxationId
{
get { return GetInt("TaxationId"); }
}
public static string PaymentMethod
{
get { return GetString("Method"); }
}
public static int ResellerId
{
get { return GetInt("ResellerID"); }
}
public static int UserId
{
get { return GetInt("UserId"); }
}
public static string TLD
{
get { return HttpContext.Current.Request["TLD"]; }
}
public static int BillingCycleId
{
get { return GetInt("CycleId"); }
}
public static int ServiceId
{
get { return GetInt("ServiceId"); }
}
public static int PluginId
{
get { return GetInt("PluginId"); }
}
public static int ProductTypeID
{
get { return GetInt("TypeId"); }
}
public static int ProductId
{
get { return GetInt("ProductId"); }
}
public static int CategoryId
{
get { return GetInt("CategoryId"); }
}
public static int ParentCategoryId
{
get { return GetInt(Keys.ParentCategoryId); }
}
public static int AddonId
{
get { return GetInt("AddonId"); }
}
public static int CartItemId
{
get { return GetInt("CartItemId"); }
}
public static int GatewayId
{
get { return GetInt(Keys.Gateway, Keys.DefaultInt); }
}
public static int InvoiceId
{
get { return GetInt(Keys.Invoice, Keys.DefaultInt); }
}
public static int ActiveServiceId
{
get { return GetInt(Keys.Service, Keys.DefaultInt); }
}
public static int PaymentId
{
get { return GetInt(Keys.PaymentId, Keys.DefaultInt); }
}
#endregion
}
}