本文整理汇总了C#中DotNetNuke.Entities.Portals.PortalController.UpdatePortalExpiry方法的典型用法代码示例。如果您正苦于以下问题:C# PortalController.UpdatePortalExpiry方法的具体用法?C# PortalController.UpdatePortalExpiry怎么用?C# PortalController.UpdatePortalExpiry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DotNetNuke.Entities.Portals.PortalController
的用法示例。
在下文中一共展示了PortalController.UpdatePortalExpiry方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnLoad
//.........这里部分代码省略.........
if (blnValid)
{
Dictionary<string, string> settings = PortalController.GetPortalSettingsDictionary(PortalSettings.PortalId);
string strPayPalURL;
// Sandbox mode
if (settings.ContainsKey("paypalsandbox") && !String.IsNullOrEmpty(settings["paypalsandbox"]) && settings["paypalsandbox"].Equals("true", StringComparison.InvariantCultureIgnoreCase))
{
strPayPalURL = "https://www.sandbox.paypal.com/cgi-bin/webscr?";
}
else
{
strPayPalURL = "https://www.paypal.com/cgi-bin/webscr?";
}
var objRequest = Globals.GetExternalRequest(strPayPalURL);
objRequest.Method = "POST";
objRequest.ContentLength = strPost.Length;
objRequest.ContentType = "application/x-www-form-urlencoded";
using (var objStream = new StreamWriter(objRequest.GetRequestStream()))
{
objStream.Write(strPost);
}
string strResponse;
using (var objResponse = (HttpWebResponse) objRequest.GetResponse())
{
using (var sr = new StreamReader(objResponse.GetResponseStream()))
{
strResponse = sr.ReadToEnd();
}
}
switch (strResponse)
{
case "VERIFIED":
break;
default:
//possible fraud
blnValid = false;
break;
}
}
if (blnValid)
{
int intAdministratorRoleId = 0;
string strProcessorID = Null.NullString;
PortalInfo objPortalInfo = objPortalController.GetPortal(intPortalID);
if (objPortalInfo != null)
{
intAdministratorRoleId = objPortalInfo.AdministratorRoleId;
strProcessorID = objPortalInfo.ProcessorUserId.ToLower();
}
if (intRoleID == intAdministratorRoleId)
{
//admin portal renewal
strProcessorID = Host.ProcessorUserId.ToLower();
float portalPrice = objPortalInfo.HostFee;
if ((portalPrice.ToString() == dblAmount.ToString()) && (HttpUtility.UrlDecode(strPayPalID.ToLower()) == strProcessorID))
{
objPortalController.UpdatePortalExpiry(intPortalID);
}
else
{
var objEventLog = new EventLogController();
var objEventLogInfo = new LogInfo();
objEventLogInfo.LogPortalID = intPortalID;
objEventLogInfo.LogPortalName = PortalSettings.PortalName;
objEventLogInfo.LogUserID = intUserID;
objEventLogInfo.LogTypeKey = "POTENTIAL PAYPAL PAYMENT FRAUD";
objEventLog.AddLog(objEventLogInfo);
}
}
else
{
//user subscription
RoleInfo objRoleInfo = TestableRoleController.Instance.GetRole(intPortalID, r => r.RoleID == intRoleID);
float rolePrice = objRoleInfo.ServiceFee;
float trialPrice = objRoleInfo.TrialFee;
if ((rolePrice.ToString() == dblAmount.ToString() || trialPrice.ToString() == dblAmount.ToString()) && (HttpUtility.UrlDecode(strPayPalID.ToLower()) == strProcessorID))
{
objRoles.UpdateUserRole(intPortalID, intUserID, intRoleID, blnCancel);
}
else
{
var objEventLog = new EventLogController();
var objEventLogInfo = new LogInfo();
objEventLogInfo.LogPortalID = intPortalID;
objEventLogInfo.LogPortalName = PortalSettings.PortalName;
objEventLogInfo.LogUserID = intUserID;
objEventLogInfo.LogTypeKey = "POTENTIAL PAYPAL PAYMENT FRAUD";
objEventLog.AddLog(objEventLogInfo);
}
}
}
}
catch (Exception exc) //Page failed to load
{
Exceptions.ProcessPageLoadException(exc);
}
}
示例2: Page_Load
//.........这里部分代码省略.........
strEmail = strValue;
break;
}
// reconstruct post for postback validation
strPost += string.Format( "&{0}={1}", strName, Globals.HTTPPOSTEncode( strValue ) );
}
// postback to verify the source
if( blnValid )
{
HttpWebRequest objRequest = (HttpWebRequest)WebRequest.Create( "https://www.paypal.com/cgi-bin/webscr" );
objRequest.Method = "POST";
objRequest.ContentLength = strPost.Length;
objRequest.ContentType = "application/x-www-form-urlencoded";
objStream = new StreamWriter( objRequest.GetRequestStream() );
objStream.Write( strPost );
objStream.Close();
HttpWebResponse objResponse = (HttpWebResponse)objRequest.GetResponse();
StreamReader sr;
sr = new StreamReader( objResponse.GetResponseStream() );
string strResponse = sr.ReadToEnd();
sr.Close();
switch( strResponse )
{
case "VERIFIED":
break;
default:
// possible fraud
blnValid = false;
break;
}
}
if( blnValid )
{
int intAdministratorRoleId = 0;
string strProcessorID = String.Empty;
PortalInfo objPortalInfo = objPortalController.GetPortal( intPortalID );
if( objPortalInfo != null )
{
intAdministratorRoleId = objPortalInfo.AdministratorRoleId;
strProcessorID = objPortalInfo.ProcessorUserId.ToLower();
}
if( intRoleID == intAdministratorRoleId )
{
// admin portal renewal
strProcessorID = Convert.ToString( PortalSettings.HostSettings["ProcessorUserId"] ).ToLower();
float portalPrice = objPortalInfo.HostFee;
if( ( portalPrice.ToString() == dblAmount.ToString() ) && ( HttpUtility.UrlDecode( strPayPalID.ToLower() ) == strProcessorID ) )
{
objPortalController.UpdatePortalExpiry( intPortalID );
}
else
{
try
{
EventLogController objEventLog = new EventLogController();
LogInfo objEventLogInfo = new LogInfo();
objEventLogInfo.LogPortalID = intPortalID;
objEventLogInfo.LogPortalName = PortalSettings.PortalName;
objEventLogInfo.LogUserID = intUserID;
objEventLogInfo.LogTypeKey = "POTENTIAL PAYPAL PAYMENT FRAUD";
objEventLog.AddLog( objEventLogInfo );
}
catch( Exception )
{
}
}
}
else
{
// user subscription
RoleInfo objRoleInfo = objRoles.GetRole( intRoleID, intPortalID );
double rolePrice = objRoleInfo.ServiceFee;
if( ( rolePrice.ToString() == dblAmount.ToString() ) && ( HttpUtility.UrlDecode( strPayPalID.ToLower() ) == strProcessorID ) )
{
objRoles.UpdateUserRole( intPortalID, intUserID, intRoleID, blnCancel );
}
else
{
try
{
//let's use the new logging provider.
}
catch( Exception )
{
}
}
}
}
}
catch( Exception exc ) //Page failed to load
{
Exceptions.ProcessPageLoadException( exc );
}
}