-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathPayment.ascx.cs
140 lines (106 loc) · 4.08 KB
/
Payment.ascx.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.UI.WebControls;
using DotNetNuke.Common;
using DotNetNuke.Entities.Portals;
using NBrightCore.common;
using NBrightCore.render;
using NBrightDNN;
using Nevoweb.DNN.NBrightBuy.Base;
using Nevoweb.DNN.NBrightBuy.Components;
using DataProvider = DotNetNuke.Data.DataProvider;
namespace Nevoweb.DNN.NBrightBuyPayPal
{
/// -----------------------------------------------------------------------------
/// <summary>
/// The ViewNBrightGen class displays the content
/// </summary>
/// -----------------------------------------------------------------------------
public partial class NBrightPayPalPayment : NBrightBuyAdminBase
{
#region Event Handlers
private String _ctrlkey = "";
private NBrightInfo _info;
override protected void OnInit(EventArgs e)
{
base.OnInit(e);
try
{
_ctrlkey = "nbrightpaypalpayment";
_info = ProviderUtils.GetProviderSettings(_ctrlkey);
var rpDataHTempl = ProviderUtils.GetTemplateData("settings.html");
rpDataH.ItemTemplate = NBrightBuyUtils.GetGenXmlTemplate(rpDataHTempl, StoreSettings.Current.Settings(), PortalSettings.HomeDirectory);
}
catch (Exception exc)
{
//display the error on the template (don;t want to log it here, prefer to deal with errors directly.)
var l = new Literal();
l.Text = exc.ToString();
Controls.Add(l);
}
}
protected override void OnLoad(EventArgs e)
{
try
{
base.OnLoad(e);
if (Page.IsPostBack == false)
{
PageLoad();
}
}
catch (Exception exc) //Module failed to load
{
//display the error on the template (don;t want to log it here, prefer to deal with errors directly.)
var l = new Literal();
l.Text = exc.ToString();
Controls.Add(l);
}
}
private void PageLoad()
{
if (UserId > 0) // only logged in users can see data on this module.
{
// display header
base.DoDetail(rpDataH, _info);
}
}
#endregion
#region "Events "
protected void CtrlItemCommand(object source, RepeaterCommandEventArgs e)
{
var cArg = e.CommandArgument.ToString();
var param = new string[3];
switch (e.CommandName.ToLower())
{
case "save":
Update();
param[0] = "ctrl=nbrightpaypalpayment";
Response.Redirect(Globals.NavigateURL(TabId, "", param), true);
break;
case "cancel":
Response.Redirect(Globals.NavigateURL(TabId, "", param), true);
break;
}
}
#endregion
private void Update()
{
var modCtrl = new NBrightBuyController();
var strXml = GenXmlFunctions.GetGenXml(rpDataH);
_info.XMLData = strXml;
_info.SetXmlProperty("genxml/debugmsg", "");
modCtrl.Update(_info);
var resxDic = GenXmlFunctions.GetGenXmlResx(rpDataH);
var genTempl = (GenXmlTemplate)rpDataH.ItemTemplate;
var resxfolders = genTempl.GetResxFolders();
var resxUpdate = NBrightBuyUtils.UpdateResxFields(resxDic, resxfolders, StoreSettings.Current.EditLanguage, true);
//remove current setting from cache for reload
Utils.RemoveCache("NBrightPayPalPaymentProvider" + PortalSettings.Current.PortalId.ToString(""));
}
}
}