forked from KimRossey/MerchantTribe
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Default.aspx.cs
71 lines (60 loc) · 2.41 KB
/
Default.aspx.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
using System;
using MerchantTribe.Commerce;
using System.Text;
using System.Web;
namespace MerchantTribeStore
{
partial class BVAdmin_Default : BaseAdminPage
{
public string NewsUrl { get; set; }
public override bool RequiresSSL
{
get
{
return true;
}
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
this.NewsUrl = BuildNewsUrl();
if (WebAppSettings.IsIndividualMode)
{
// Simple pci check for default admin username
if (MTApp.CurrentRequestContext.CurrentAdministrator(MTApp).Email == "admin@merchanttribe.com") Response.Redirect("ChangeEmail.aspx?pci=1");
}
this.pnlGettingStarted.Visible = !MTApp.CurrentStore.Settings.HideGettingStarted;
ShowFreeMessage();
}
protected override void OnPreInit(System.EventArgs e)
{
base.OnPreInit(e);
this.PageTitle = "Dashboard";
this.CurrentTab = AdminTabType.Dashboard;
}
protected void lnkHideGettingStarted_Click(object sender, EventArgs e)
{
MTApp.CurrentStore.Settings.HideGettingStarted = true;
MTApp.UpdateCurrentStore();
this.pnlGettingStarted.Visible = false;
}
private void ShowFreeMessage()
{
if (MTApp.CurrentStore.PlanId == 0)
{
this.litFreePlan.Text = "<div class=\"flash-message-info\">Your store is on the Free plan. <a href=\"ChangePlan.aspx\">Upgrade Your Store</a> to support more products and features.</div>";
}
}
private string BuildNewsUrl()
{
StringBuilder sb = new StringBuilder();
sb.Append("https://merchanttribe.com/news");
sb.Append("?uid=" + HttpUtility.UrlEncode(MTApp.CurrentStore.StoreUniqueId(MTApp)));
sb.Append("&host=" + HttpUtility.UrlEncode(MTApp.CurrentStore.RootUrl()));
sb.Append("&ver=" + HttpUtility.UrlEncode(WebAppSettings.SystemVersionNumber));
sb.Append("&com=" + HttpUtility.UrlEncode(WebAppSettings.IsCommercialVersion ? "1" : "0"));
sb.Append("&email=" + HttpUtility.UrlEncode(this.CurrentUser.Email));
return sb.ToString();
}
}
}