本文整理汇总了C#中DataLayer.IsMemberAdmin方法的典型用法代码示例。如果您正苦于以下问题:C# DataLayer.IsMemberAdmin方法的具体用法?C# DataLayer.IsMemberAdmin怎么用?C# DataLayer.IsMemberAdmin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataLayer
的用法示例。
在下文中一共展示了DataLayer.IsMemberAdmin方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
DataLayer dl = new DataLayer();
if (!this.IsPostBack)
{
string sAboutUs = dl.GetAboutUsContent();
rteBody.Value = sAboutUs;
}
if (User.Identity.IsAuthenticated)
{
if (!dl.IsMemberAdmin(User.Identity.Name))
{
Session["resultColor"] = "#ff0000";
Session["resultTitle"] = "Not Authorized";
Session["resultMessage"] = "You are not authorized to access this area.";
Session["resultReturnURL"] = "Default.aspx";
Response.Redirect("Result.aspx");
}
}
else
{
Session["resultColor"] = "#ff0000";
Session["resultTitle"] = "Not Logged In";
Session["resultMessage"] = "You must log in first.";
Session["resultReturnURL"] = "ManageBlogs.aspx";
Response.Redirect("Result.aspx");
}
loggedinpanels.Controls.Add(new LiteralControl("<div style=\"width:250px;\" class=\"contenttitle\">Featured Member</div><div class=\"contentpanel\">"));
DataTable dtRandomMember = dl.GetRandomMember();
loggedinpanels.Controls.Add(new LiteralControl("<table style=\"width:100%;\"><tr><td style=\"font-size:13px;text-align:center;\"><a href=\"Profile.aspx?member=" + dtRandomMember.Rows[0].ItemArray[0].ToString() + "\"><img style=\"border-width:0px;\" src=\"MakeThumbnail.aspx?size=100&image=images/MemberAvatars/" + dtRandomMember.Rows[0].ItemArray[3].ToString() + "\" /></a><br /><a href=\"Profile.aspx?member=" + dtRandomMember.Rows[0].ItemArray[0].ToString() + "\">View Profile</a></td><td style=\"padding-left:5px;font-size:13px;width:100%;\"><b>Name:</b> " + dtRandomMember.Rows[0].ItemArray[2].ToString() + "<br /><br /><b>Location:</b> " + dtRandomMember.Rows[0].ItemArray[17].ToString() + "<br /><br /><b>Business:</b> " + dtRandomMember.Rows[0].ItemArray[8].ToString() + "<br /><br />"));
if (dtRandomMember.Rows[0].ItemArray[6].ToString() != "")
{
loggedinpanels.Controls.Add(new LiteralControl("<center><a href=\"" + dtRandomMember.Rows[0].ItemArray[6].ToString() + "\">Visit Website</a></center>"));
}
loggedinpanels.Controls.Add(new LiteralControl("</td></tr></table></div>"));
DataTable dtMemberAd = dl.GetRandomAd();
loggedinpanels.Controls.Add(new LiteralControl("<div class=\"contenttitle\">Member Ad</div><div style=\"text-align:center;\" class=\"contentpanel\"><a href=\"" + dtMemberAd.Rows[0].ItemArray[2].ToString() + "\"><img style=\"width:230px; border-width:0px;\" src=\"" + dtMemberAd.Rows[0].ItemArray[1].ToString() + "\" /></a></div>"));
loggedinpanels.Controls.Add(new LiteralControl("<div style=\"width:250px;\" class=\"contenttitle\">Popular Topics</div><div style=\"font-size:15px;\" class=\"contentpanel\"><ul>"));
DataTable dtTopics = dl.GetFiveTopics();
foreach (DataRow dr in dtTopics.Rows)
{
loggedinpanels.Controls.Add(new LiteralControl("<li><a href=\"Topic.aspx?topic=" + dr.ItemArray[0].ToString() + "\">" + dr.ItemArray[4].ToString() + "</a></li>"));
}
loggedinpanels.Controls.Add(new LiteralControl("</ul></div>"));
}
示例2: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
DataLayer dl = new DataLayer();
if (User.Identity.IsAuthenticated)
{
if ((!dl.IsMemberAdmin(User.Identity.Name)) && (!dl.IsMemberGroupLeader(User.Identity.Name)))
{
Session["resultColor"] = "#ff0000";
Session["resultTitle"] = "Not Authorized";
Session["resultMessage"] = "You are not authorized to access this area.";
Session["resultReturnURL"] = "Default.aspx";
Response.Redirect("Result.aspx");
}
}
else
{
Session["resultColor"] = "#ff0000";
Session["resultTitle"] = "Not Logged In";
Session["resultMessage"] = "You must log in first.";
Session["resultReturnURL"] = "ManageGroups.aspx";
Response.Redirect("Result.aspx");
}
string sSheet = Request.QueryString["Sheet"];
DataTable dtFullMembers = dl.GetFullMembershipNamesEmailsGroups();
if (sSheet == "Attendance")
{
SheetContent.InnerHtml = "<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\" style=\"width:700px;\">";
SheetContent.InnerHtml += "<tr><td colspan=\"4\" style=\"font-size:35px;padding:5px;text-align:center;padding-bottom:15px;font-family:arial;\">RNX Group Attendance Sheet</td></tr>";
SheetContent.InnerHtml += "<tr><td style=\"padding:3px;text-align:center;font-size:25px;\"><b>Name</b></td><td style=\"padding:3px;text-align:center;font-size:25px;\"><b>Email</b></td><td style=\"padding:3px;text-align:center;font-size:25px;\"><b>Group</b></td><td style=\"padding:3px;text-align:center;font-size:25px;\"><b>Signature</b></td></tr>";
foreach (DataRow dr in dtFullMembers.Rows)
{
SheetContent.InnerHtml += "<tr><td style=\"padding:3px;\">" + dr.ItemArray[0].ToString() + "</td>";
SheetContent.InnerHtml += "<td style=\"padding:3px;\">" + dr.ItemArray[1].ToString() + "</td>";
SheetContent.InnerHtml += "<td style=\"padding:3px;\">" + dr.ItemArray[2].ToString() + "</td>";
SheetContent.InnerHtml += "<td style=\"width:200px;\"></td></tr>";
}
SheetContent.InnerHtml += "</table>";
}
}
示例3: lbtnLogin_Click
protected void lbtnLogin_Click(object sender, EventArgs e)
{
string sEmail = tbxLoginEmail.Text;
DataLayer dl = new DataLayer();
if (dl.EmailExists(sEmail))
{
string sPassword = dl.GetMemberPasswordBy_Email(sEmail);
string sName = dl.GetMemberNameBy_Email(sEmail);
if (tbxLoginPassword.Text == sPassword)
{
FormsAuthentication.SetAuthCookie(sEmail, cbxRememberMe.Checked);
if (sEmail.ToUpper() != "[email protected]")
{
dl.UpdateLastLogin(sEmail);
}
loginpanel.Visible = false;
memberpanel.Visible = true;
archivespanel.Visible = true;
directorypanel.Visible = true;
nonmemberdirectorypanel.Visible = false;
membername.InnerHtml = "<a class=\"titlelink\" href=\"Profile.aspx\">" + sName + "</a>";
if (dl.IsMemberAdmin(sEmail))
{
adminpanel.Visible = true;
}
Response.Redirect(Request.RawUrl);
}
else
{
failfield.Visible = true;
failfield.InnerText = "Invalid email or password.";
}
}
else
{
failfield.Visible = true;
failfield.InnerText = "Invalid email or password.";
}
}
示例4: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
DataLayer dl = new DataLayer();
if (User.Identity.IsAuthenticated)
{
if (!dl.IsMemberAdmin(User.Identity.Name))
{
Session["resultColor"] = "#ff0000";
Session["resultTitle"] = "Not Authorized";
Session["resultMessage"] = "You are not authorized to access this area.";
Session["resultReturnURL"] = "Default.aspx";
Response.Redirect("Result.aspx");
}
}
else
{
Session["resultColor"] = "#ff0000";
Session["resultTitle"] = "Not Logged In";
Session["resultMessage"] = "You must log in first.";
Session["resultReturnURL"] = "Newsletter.aspx";
Response.Redirect("Result.aspx");
}
}
示例5: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
DataLayer dl = new DataLayer();
if (!this.IsPostBack)
{
btnAddNewFAQ_Click(null, null);
DataTable dt = dl.GetFAQQuestionsAndIDs();
foreach (DataRow dr in dt.Rows)
{
ListItem li = new ListItem(dr.ItemArray[0].ToString(), dr.ItemArray[1].ToString());
lbxFAQs.Items.Add(li);
}
numFAQs.InnerText = lbxFAQs.Items.Count.ToString();
}
if (User.Identity.IsAuthenticated)
{
if (!dl.IsMemberAdmin(User.Identity.Name))
{
Session["resultColor"] = "#ff0000";
Session["resultTitle"] = "Not Authorized";
Session["resultMessage"] = "You are not authorized to access this area.";
Session["resultReturnURL"] = "Default.aspx";
Response.Redirect("Result.aspx");
}
}
else
{
Session["resultColor"] = "#ff0000";
Session["resultTitle"] = "Not Logged In";
Session["resultMessage"] = "You must log in first.";
Session["resultReturnURL"] = "ManageFAQ.aspx";
Response.Redirect("Result.aspx");
}
}
示例6: Page_Load
//.........这里部分代码省略.........
if (dr.ItemArray[1].ToString().StartsWith("ANON"))
{
string[] sSplit = dr.ItemArray[1].ToString().Split('|');
sLink = sSplit[2];
sAvatar = "images/MemberAvatars/no_avatar.gif";
sName = sSplit[1];
}
else
{
DataTable dtMember = dl.GetMemberBy_Email(dr.ItemArray[1].ToString());
sEmail = dtMember.Rows[0].ItemArray[0].ToString();
sLink = "Profile.aspx?member=" + sEmail;
sAvatar = "images/MemberAvatars/" + dtMember.Rows[0].ItemArray[3].ToString();
sName = dtMember.Rows[0].ItemArray[2].ToString();
sSignature = dtMember.Rows[0].ItemArray[18].ToString();
}
comments.Controls.Add(new LiteralControl("<div style=\""));
if (bColored)
{
comments.Controls.Add(new LiteralControl("background-color:#CCDDCC"));
bColored = false;
}
else
{
comments.Controls.Add(new LiteralControl("background-color:#FFFFFF"));
bColored = true;
}
comments.Controls.Add(new LiteralControl(";padding:10px;\"><table style=\"width:100%;\"><tr><td rowspan=\"2\" style=\"vertical-align:top;text-align:center;font-size:17px;font-weight:bold;padding-right:15px;border-right:solid 2px #333333;width:150px;\">"));
if (sLink != "")
{
comments.Controls.Add(new LiteralControl("<a style=\"text-decoration:none;\" href=\"" + sLink + "\">"));
}
comments.Controls.Add(new LiteralControl("<img style=\"border-width:0px;\" src=\"MakeThumbnail.aspx?size=150&image=" + sAvatar + "\" />"));
if (sLink != "")
{
comments.Controls.Add(new LiteralControl("</a>"));
}
comments.Controls.Add(new LiteralControl("<br /><br />"));
if (sLink != "")
{
comments.Controls.Add(new LiteralControl("<a href=\"" + sLink + "\">"));
}
comments.Controls.Add(new LiteralControl(sName));
if (sLink != "")
{
comments.Controls.Add(new LiteralControl("</a>"));
}
if (dr.ItemArray[1].ToString().StartsWith("ANON"))
{
comments.Controls.Add(new LiteralControl("<br />(guest)"));
}
comments.Controls.Add(new LiteralControl("</td><td style=\"text-align:left;vertical-align:top;padding-left:15px;\">" + dr.ItemArray[3].ToString().Replace("\r", "<br />").Replace("\n", "") + "<br /><br />----------------------------------<br />" + sSignature + "</td></tr><tr><td style=\"vertical-align:bottom;padding-left:15px;padding-top:15px;\"><table cellpadding=\"0\" cellspacing=\"0\" style=\"width:100%;\"><tr><td style=\"text-align:left;vertical-align:bottom;font-size:12px;font-weight:bold;\">" + dr.ItemArray[2].ToString()));
if (Convert.ToBoolean(dr.ItemArray[5]))
comments.Controls.Add(new LiteralControl("  | <img style=\"width:25px;\" src=\"images/ThumbsUp.png\" />"));
comments.Controls.Add(new LiteralControl("</td><td style=\"text-align:right;vertical-align:bottom;\">"));
if (User.Identity.IsAuthenticated)
{
if ((User.Identity.Name.ToLower() == dr.ItemArray[1].ToString().ToLower()) || (dl.IsMemberAdmin(User.Identity.Name)) || (dl.IsMemberModerator(User.Identity.Name)))
{
lbDelete = new LinkButton();
lbDelete.Text = "Delete Comment";
lbDelete.ID = dr.ItemArray[0].ToString();
lbDelete.Click += new EventHandler(lbDelete_Click);
lbDelete.CausesValidation = false;
comments.Controls.Add(lbDelete);
}
}
comments.Controls.Add(new LiteralControl("</td></tr></table></td></tr></table></div>"));
}
}
if (User.Identity.IsAuthenticated)
{
loggedinpanels.Controls.Add(new LiteralControl("<div style=\"width:250px;\" class=\"contenttitle\">Featured Member</div><div class=\"contentpanel\">"));
DataTable dtRandomMember = dl.GetRandomMember();
loggedinpanels.Controls.Add(new LiteralControl("<table style=\"width:100%;\"><tr><td style=\"font-size:13px;text-align:center;\"><a href=\"Profile.aspx?member=" + dtRandomMember.Rows[0].ItemArray[0].ToString() + "\"><img style=\"border-width:0px;\" src=\"MakeThumbnail.aspx?size=100&image=images/MemberAvatars/" + dtRandomMember.Rows[0].ItemArray[3].ToString() + "\" /></a><br /><a href=\"Profile.aspx?member=" + dtRandomMember.Rows[0].ItemArray[0].ToString() + "\">View Profile</a></td><td style=\"padding-left:5px;font-size:13px;width:100%;\"><b>Name:</b> " + dtRandomMember.Rows[0].ItemArray[2].ToString() + "<br /><br /><b>Location:</b> " + dtRandomMember.Rows[0].ItemArray[17].ToString() + "<br /><br /><b>Business:</b> " + dtRandomMember.Rows[0].ItemArray[8].ToString() + "<br /><br />"));
if (dtRandomMember.Rows[0].ItemArray[6].ToString() != "")
{
loggedinpanels.Controls.Add(new LiteralControl("<center><a href=\"" + dtRandomMember.Rows[0].ItemArray[6].ToString() + "\">Visit Website</a></center>"));
}
loggedinpanels.Controls.Add(new LiteralControl("</td></tr></table></div>"));
}
DataTable dtMemberAd = dl.GetRandomAd();
loggedinpanels.Controls.Add(new LiteralControl("<div class=\"contenttitle\">Member Ad</div><div style=\"text-align:center;\" class=\"contentpanel\"><a href=\"" + dtMemberAd.Rows[0].ItemArray[2].ToString() + "\"><img style=\"width:230px; border-width:0px;\" src=\"" + dtMemberAd.Rows[0].ItemArray[1].ToString() + "\" /></a></div>"));
if (User.Identity.IsAuthenticated)
{
loggedinpanels.Controls.Add(new LiteralControl("<div style=\"width:250px;\" class=\"contenttitle\">Popular Topics</div><div style=\"font-size:15px;\" class=\"contentpanel\"><ul>"));
DataTable dtTopics = dl.GetFiveTopics();
foreach (DataRow dr in dtTopics.Rows)
{
loggedinpanels.Controls.Add(new LiteralControl("<li><a href=\"Topic.aspx?topic=" + dr.ItemArray[0].ToString() + "\">" + dr.ItemArray[4].ToString() + "</a></li>"));
}
loggedinpanels.Controls.Add(new LiteralControl("</ul></div>"));
}
}
示例7: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
DataLayer dl = new DataLayer();
if (User.Identity.IsAuthenticated)
{
if (!dl.IsMemberAdmin(User.Identity.Name))
{
Session["resultColor"] = "#ff0000";
Session["resultTitle"] = "Not Authorized";
Session["resultMessage"] = "You are not authorized to access this area.";
Session["resultReturnURL"] = "Default.aspx";
Response.Redirect("Result.aspx");
}
else if (dl.IsMemberAdmin(User.Identity.Name))
{
memberform.Visible = true;
}
}
else
{
Session["resultColor"] = "#ff0000";
Session["resultTitle"] = "Not Logged In";
Session["resultMessage"] = "You must log in first.";
Session["resultReturnURL"] = "ManageMembers.aspx";
Response.Redirect("Result.aspx");
}
if (!this.IsPostBack)
{
btnSearch_Click(null, null);
DataTable dtArticleCategories = dl.GetCategories();
foreach (DataRow dr in dtArticleCategories.Rows)
{
ddlArticleColumn.Items.Add(dr.ItemArray[0].ToString());
}
btnAddNewMember_Click(null, null);
}
}
示例8: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
DataLayer dl = new DataLayer();
if (!this.IsPostBack)
{
btnAddNewGroup_Click(null, null);
DataTable dt = dl.GetGroups();
foreach (DataRow dr in dt.Rows)
{
lbxGroups.Items.Add(dr.ItemArray[0].ToString());
}
numGroups.InnerText = lbxGroups.Items.Count.ToString();
if (User.Identity.IsAuthenticated)
{
if (!dl.IsMemberAdmin(User.Identity.Name))
{
if (dl.IsMemberGroupLeader(User.Identity.Name))
{
string sGroup = dl.GetMemberGroupBy_Email(User.Identity.Name);
lbxGroups.SelectedIndex = lbxGroups.Items.IndexOf(new ListItem(sGroup));
lbxGroups.Enabled = false;
tbxGroupName.Enabled = false;
ddlState.Enabled = false;
btnAddNewGroup.Enabled = false;
lbxGroups_SelectedIndexChanged(null, null);
cbxDeleteGroup.Visible = false;
}
else
{
Session["resultColor"] = "#ff0000";
Session["resultTitle"] = "Not Authorized";
Session["resultMessage"] = "You are not authorized to access this area.";
Session["resultReturnURL"] = "Default.aspx";
Response.Redirect("Result.aspx");
}
}
}
else
{
Session["resultColor"] = "#ff0000";
Session["resultTitle"] = "Not Logged In";
Session["resultMessage"] = "You must log in first.";
Session["resultReturnURL"] = "ManageGroups.aspx";
Response.Redirect("Result.aspx");
}
}
}
示例9: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if (Request.UrlReferrer != null)
{
string sReferringAddress = Request.UrlReferrer.AbsoluteUri;
if ((sReferringAddress.ToLower().Contains("encyclopediadramatica.com")) || (sReferringAddress.ToLower().Contains("anonym.to")) || (sReferringAddress.ToLower().Contains("antirefer.com")) || (sReferringAddress.ToLower().Contains("/?http")))
{
Response.Redirect(sReferringAddress, true);
}
}
Page.Title += " | ReferralNetworX.com";
DataLayer dl = new DataLayer();
if (Request.QueryString["bg"] != null)
{
dynamicstyle.InnerHtml = "<style>body{background-image:url(\"" + Request.QueryString["bg"] + "\");}</style>";
}
else
{
if (Request.QueryString["color"] != null)
{
dynamicstyle.InnerHtml = "<style>body{background-color:" + Request.QueryString["color"] + "; background-image: none;}</style>";
}
}
if (Page.User.Identity.IsAuthenticated)
{
loginpanel.Visible = false;
memberpanel.Visible = true;
membername.InnerHtml = "<a class=\"titlelink\" href=\"Profile.aspx\">" + dl.GetMemberNameBy_Email(Page.User.Identity.Name) + "</a>";
if (dl.IsMemberAdmin(Page.User.Identity.Name))
{
adminpanel.Visible = true;
divPostBlog.Visible = false;
divPostArticle.Visible = false;
archivespanel.Visible = true;
directorypanel.Visible = true;
nonmemberdirectorypanel.Visible = false;
MemberToolsPanel.Visible = true;
}
else
{
adminpanel.Visible = false;
archivespanel.Visible = true;
directorypanel.Visible = true;
nonmemberdirectorypanel.Visible = false;
MemberToolsPanel.Visible = true;
if (dl.CanMemberPostBlog(Page.User.Identity.Name))
{
divPostBlog.Visible = true;
}
else
{
divPostBlog.Visible = false;
}
if (dl.MemberArticleColumn(Page.User.Identity.Name) != "None")
{
divPostArticle.Visible = true;
}
else
{
divPostArticle.Visible = false;
}
}
}
else
{
adminpanel.Visible = false;
memberpanel.Visible = false;
loginpanel.Visible = true;
archivespanel.Visible = false;
directorypanel.Visible = false;
nonmemberdirectorypanel.Visible = true;
MemberToolsPanel.Visible = false;
}
if (!this.IsPostBack)
{
failfield.Visible = false;
}
if (Request.Cookies["ExcludeAnalytics"] != null)
{
analytics.Visible = false;
}
else
{
analytics.Visible = true;
}
}
示例10: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
DataLayer dl = new DataLayer();
if (Request.QueryString["post"] != null)
{
int iPostID = Convert.ToInt32(Request.QueryString["post"]);
Object[] oPost = dl.GetForumPostBy_PostID(iPostID).Rows[0].ItemArray;
if (!User.Identity.IsAuthenticated)
{
Session["resultColor"] = "#ff0000";
Session["resultTitle"] = "Members Only";
Session["resultMessage"] = "This is a members only area.<br />You must log in first.";
Session["resultReturnURL"] = "AddEditPost.aspx?post=" + Request.QueryString["post"];
Response.Redirect("Result.aspx", true);
}
else if ((User.Identity.IsAuthenticated) && (User.Identity.Name.ToLower() != oPost[2].ToString().ToLower()) && (!dl.IsMemberAdmin(User.Identity.Name)))
{
Session["resultColor"] = "#ff0000";
Session["resultTitle"] = "Not Authorized";
Session["resultMessage"] = "You are not authorized to edit this post.";
Session["resultReturnURL"] = "Boards.aspx";
Response.Redirect("Result.aspx", true);
}
else
{
if (!this.IsPostBack)
{
addedit.InnerText = "Edit Post";
rteBody.Value = oPost[4].ToString();
}
}
}
else
{
if (!User.Identity.IsAuthenticated)
{
Session["resultColor"] = "#ff0000";
Session["resultTitle"] = "Members Only";
Session["resultMessage"] = "This is a members only area.<br />You must log in first.";
Session["resultReturnURL"] = "AddEditPost.aspx?topic=" + Request.QueryString["topic"];
Response.Redirect("Result.aspx", true);
}
addedit.InnerText = "Reply To Topic";
}
if (Request.QueryString["rt"] != null)
{
int iRTPostID = Convert.ToInt32(Request.QueryString["rt"]);
DataTable dtRTPost = dl.GetForumPostBy_PostID(iRTPostID);
replyto.InnerHtml = dtRTPost.Rows[0].ItemArray[4].ToString();
postedby.InnerHtml = "Posted by <a href=\"Profile.aspx?member=" + dtRTPost.Rows[0].ItemArray[2].ToString() + "\">" + dl.GetFullMemberNameBy_Email(dtRTPost.Rows[0].ItemArray[2].ToString()) + "</a> on " + dtRTPost.Rows[0].ItemArray[3].ToString();
}
else
{
int iRTTopicID = Convert.ToInt32(Request.QueryString["topic"]);
DataTable dtRTTopic = dl.GetForumTopicBy_TopicID(iRTTopicID);
replyto.InnerHtml = dtRTTopic.Rows[0].ItemArray[5].ToString();
postedby.InnerHtml = "Posted by <a href=\"Profile.aspx?member=" + dtRTTopic.Rows[0].ItemArray[2].ToString() + "\">" + dl.GetFullMemberNameBy_Email(dtRTTopic.Rows[0].ItemArray[2].ToString()) + "</a> on " + dtRTTopic.Rows[0].ItemArray[3].ToString();
}
loggedinpanels.Controls.Add(new LiteralControl("<div style=\"width:250px;\" class=\"contenttitle\">Popular Topics</div><div style=\"font-size:15px;\" class=\"contentpanel\"><ul>"));
DataTable dtTopics = dl.GetFiveTopics();
foreach (DataRow dr in dtTopics.Rows)
{
loggedinpanels.Controls.Add(new LiteralControl("<li><a href=\"Topic.aspx?topic=" + dr.ItemArray[0].ToString() + "\">" + dr.ItemArray[4].ToString() + "</a></li>"));
}
loggedinpanels.Controls.Add(new LiteralControl("</ul></div>"));
loggedinpanels.Controls.Add(new LiteralControl("<div style=\"width:250px;\" class=\"contenttitle\">Featured Member</div><div class=\"contentpanel\">"));
DataTable dtRandomMember = dl.GetRandomMember();
loggedinpanels.Controls.Add(new LiteralControl("<table style=\"width:100%;\"><tr><td style=\"font-size:13px;text-align:center;\"><a href=\"Profile.aspx?member=" + dtRandomMember.Rows[0].ItemArray[0].ToString() + "\"><img style=\"border-width:0px;\" src=\"MakeThumbnail.aspx?size=100&image=images/MemberAvatars/" + dtRandomMember.Rows[0].ItemArray[3].ToString() + "\" /></a><br /><a href=\"Profile.aspx?member=" + dtRandomMember.Rows[0].ItemArray[0].ToString() + "\">View Profile</a></td><td style=\"padding-left:5px;font-size:13px;width:100%;\"><b>Name:</b> " + dtRandomMember.Rows[0].ItemArray[2].ToString() + "<br /><br /><b>Location:</b> " + dtRandomMember.Rows[0].ItemArray[17].ToString() + "<br /><br /><b>Business:</b> " + dtRandomMember.Rows[0].ItemArray[8].ToString() + "<br /><br />"));
if (dtRandomMember.Rows[0].ItemArray[6].ToString() != "")
{
loggedinpanels.Controls.Add(new LiteralControl("<center><a href=\"" + dtRandomMember.Rows[0].ItemArray[6].ToString() + "\">Visit Website</a></center>"));
}
loggedinpanels.Controls.Add(new LiteralControl("</td></tr></table></div>"));
DataTable dtMemberAd = dl.GetRandomAd();
loggedinpanels.Controls.Add(new LiteralControl("<div class=\"contenttitle\">Member Ad</div><div style=\"text-align:center;\" class=\"contentpanel\"><a href=\"" + dtMemberAd.Rows[0].ItemArray[2].ToString() + "\"><img style=\"width:230px; border-width:0px;\" src=\"" + dtMemberAd.Rows[0].ItemArray[1].ToString() + "\" /></a></div>"));
}
示例11: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
DataLayer dl = new DataLayer();
DateTime dtLastMotivatorDate = dl.GetLastMotivatorDate();
if (DateTime.Now > dtLastMotivatorDate.Add(new TimeSpan(0, 12, 0, 0)))
{
btnSendMotivator.Enabled = true;
}
else
{
btnSendMotivator.Enabled = false;
}
if (!this.IsPostBack)
{
btnAddNewDailyMotivator_Click(null, null);
DataTable dt = dl.GetDailyMotivatorTitlesAndIDs();
foreach (DataRow dr in dt.Rows)
{
ListItem li = new ListItem(dr.ItemArray[0].ToString(), dr.ItemArray[1].ToString());
lbxDailyMotivators.Items.Add(li);
}
nummotivators.InnerText = lbxDailyMotivators.Items.Count.ToString();
}
if (User.Identity.IsAuthenticated)
{
if (!dl.IsMemberAdmin(User.Identity.Name))
{
Session["resultColor"] = "#ff0000";
Session["resultTitle"] = "Not Authorized";
Session["resultMessage"] = "You are not authorized to access this area.";
Session["resultReturnURL"] = "Default.aspx";
Response.Redirect("Result.aspx");
}
}
else
{
Session["resultColor"] = "#ff0000";
Session["resultTitle"] = "Not Logged In";
Session["resultMessage"] = "You must log in first.";
Session["resultReturnURL"] = "ManageDailyMotivator.aspx";
Response.Redirect("Result.aspx");
}
}
示例12: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
DataLayer dl = new DataLayer();
if (User.Identity.IsAuthenticated)
{
if ((dl.MemberArticleColumn(User.Identity.Name) == "None") && (!dl.IsMemberAdmin(User.Identity.Name)))
{
Session["resultColor"] = "#ff0000";
Session["resultTitle"] = "Not Authorized";
Session["resultMessage"] = "You are not authorized to access this area.";
Session["resultReturnURL"] = "Default.aspx";
Response.Redirect("Result.aspx");
}
}
else
{
Session["resultColor"] = "#ff0000";
Session["resultTitle"] = "Not Logged In";
Session["resultMessage"] = "You must log in first.";
Session["resultReturnURL"] = "ManageArticles.aspx";
Response.Redirect("Result.aspx");
}
if (Request.Cookies["ReadArticleGuidelines"] == null)
{
Response.Redirect("ArticleChecklist.aspx", true);
}
if (!this.IsPostBack)
{
DataTable dtCategories = dl.GetCategories();
foreach (DataRow dr in dtCategories.Rows)
{
ddlCategory.Items.Add(dr.ItemArray[0].ToString());
}
string sArticleCategory = dl.MemberArticleColumn(User.Identity.Name);
if ((sArticleCategory != "None") && (!dl.IsMemberAdmin(User.Identity.Name)))
{
for (int iCount = 0; iCount < ddlCategory.Items.Count; iCount++)
{
if (sArticleCategory == ddlCategory.Items[iCount].ToString())
{
ddlCategory.SelectedIndex = iCount;
ddlCategory.Enabled = false;
break;
}
}
}
else
{
ddlCategory.SelectedIndex = 0;
}
ddlCategory_SelectedIndexChanged(null, null);
}
}
示例13: ddlCategory_SelectedIndexChanged
protected void ddlCategory_SelectedIndexChanged(object sender, EventArgs e)
{
DataLayer dl = new DataLayer();
lbxArticles.Items.Clear();
DataTable dt = dl.GetArticleTitlesAndIDsBy_Category(ddlCategory.SelectedValue);
string sArticleCategory = dl.MemberArticleColumn(User.Identity.Name);
if ((sArticleCategory != "None") && (!dl.IsMemberAdmin(User.Identity.Name)))
{
dt = dl.GetArticleTitlesAndIDsBy_CategoryAndAuthor(ddlCategory.SelectedValue, User.Identity.Name);
}
foreach (DataRow dr in dt.Rows)
{
ListItem li = new ListItem(dr.ItemArray[0].ToString(), dr.ItemArray[1].ToString());
lbxArticles.Items.Add(li);
}
numarticles.InnerText = lbxArticles.Items.Count.ToString();
btnAddNewArticle_Click(null, null);
}
示例14: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
DataLayer dl = new DataLayer();
if (!User.Identity.IsAuthenticated)
{
Session["resultColor"] = "#ff0000";
Session["resultTitle"] = "Not Logged In";
Session["resultMessage"] = "You must log in first.";
Session["resultReturnURL"] = "EditProfile.aspx";
Response.Redirect("Result.aspx");
}
if (!this.IsPostBack)
{
int iStartYear = DateTime.Now.Year - 105;
int iEndYear = DateTime.Now.Year - 3;
for (int iCount = iStartYear; iCount <= iEndYear; iCount++)
{
ddlBirthYear.Items.Add(iCount.ToString());
}
sEmail = User.Identity.Name;
if ((dl.IsMemberAdmin(User.Identity.Name) && (Request.QueryString["member"] != null)))
{
sEmail = Request.QueryString["member"];
if (!dl.IsMemberAdmin(User.Identity.Name))
{
sEmail = User.Identity.Name;
}
}
this.ViewState["sEmail"] = sEmail;
DataRow drMember = dl.GetMemberBy_Email(sEmail).Rows[0];
lblEmail.Text = drMember.ItemArray[0].ToString();
tbxName.Text = drMember.ItemArray[2].ToString();
imgPersonalAvatar.ImageUrl = "MakeThumbnail.aspx?size=150&image=images/MemberAvatars/" + drMember.ItemArray[3].ToString();
tbxPhone.Text = drMember.ItemArray[4].ToString();
tbxInterests.Text = drMember.ItemArray[5].ToString().Replace("<br />", "\r\n");
tbxWebsite.Text = drMember.ItemArray[6].ToString();
tbxPersonalBio.Text = drMember.ItemArray[7].ToString().Replace("<br />", "\r\n");
tbxBusinessName.Text = drMember.ItemArray[8].ToString();
imgBusinessLogo.ImageUrl = "MakeThumbnail.aspx?size=150&image=images/BusinessLogos/" + drMember.ItemArray[9].ToString();
tbxBusinessBio.Text = drMember.ItemArray[10].ToString().Replace("<br />", "\r\n");
tbxAIM.Text = drMember.ItemArray[13].ToString();
tbxMSN.Text = drMember.ItemArray[14].ToString();
tbxYahoo.Text = drMember.ItemArray[15].ToString();
tbxGoogleTalk.Text = drMember.ItemArray[16].ToString();
tbxLocation.Text = drMember.ItemArray[17].ToString();
tbxSignature.Text = drMember.ItemArray[18].ToString().Replace("<br />", "\r\n");
cbxMemberNewsletter.Checked = Convert.ToBoolean(drMember.ItemArray[22]);
cbxDailyMotivator.Checked = Convert.ToBoolean(drMember.ItemArray[23]);
cbxShowEmail.Checked = Convert.ToBoolean(drMember.ItemArray[24]);
tbxTwitterUsername.Text = drMember.ItemArray[26].ToString();
string sGender = drMember.ItemArray[28].ToString();
if (sGender == "Not Specified")
ddlGender.SelectedIndex = 0;
else if (sGender == "Male")
ddlGender.SelectedIndex = 1;
else if (sGender == "Female")
ddlGender.SelectedIndex = 2;
DateTime dtBirthday = Convert.ToDateTime(drMember.ItemArray[30]);
for (int iIndex = 0; iIndex < ddlBirthYear.Items.Count; iIndex++)
{
if (dtBirthday.Year.ToString() == ddlBirthYear.Items[iIndex].ToString())
{
ddlBirthYear.SelectedIndex = iIndex;
break;
}
}
ddlBirthMonth.SelectedIndex = dtBirthday.Month - 1;
calBirthday.SelectedDate = Convert.ToDateTime(dtBirthday.Month.ToString() + "/" + dtBirthday.Day.ToString() + "/" + dtBirthday.Year.ToString());
calBirthday.VisibleDate = calBirthday.SelectedDate;
string sBusinessCategory = drMember.ItemArray[31].ToString();
if (sBusinessCategory != "Not Selected")
{
for (int iCount = 0; iCount < ddlBusinessCategory.Items.Count; iCount++)
{
if (sBusinessCategory == ddlBusinessCategory.Items[iCount].ToString())
{
ddlBusinessCategory.SelectedIndex = iCount;
break;
}
}
}
else
{
ddlBusinessCategory.SelectedIndex = 0;
}
}
else
{
sEmail = this.ViewState["sEmail"].ToString();
}
}
示例15: Page_Load
//.........这里部分代码省略.........
}
if (bShowEmail)
{
divAge.Visible = true;
}
else
{
divAge.Visible = false;
}
if (User.Identity.IsAuthenticated)
{
loggedinpanels.Controls.Add(new LiteralControl("<div style=\"width:250px;\" class=\"contenttitle\">Featured Member</div><div class=\"contentpanel\">"));
DataTable dtRandomMember = dl.GetRandomMember();
loggedinpanels.Controls.Add(new LiteralControl("<table style=\"width:100%;\"><tr><td style=\"font-size:13px;text-align:center;\"><a href=\"Profile.aspx?member=" + dtRandomMember.Rows[0].ItemArray[0].ToString() + "\"><img style=\"border-width:0px;\" src=\"MakeThumbnail.aspx?size=100&image=images/MemberAvatars/" + dtRandomMember.Rows[0].ItemArray[3].ToString() + "\" /></a><br /><a href=\"Profile.aspx?member=" + dtRandomMember.Rows[0].ItemArray[0].ToString() + "\">View Profile</a></td><td style=\"padding-left:5px;font-size:13px;width:100%;\"><b>Name:</b> " + dtRandomMember.Rows[0].ItemArray[2].ToString() + "<br /><br /><b>Location:</b> " + dtRandomMember.Rows[0].ItemArray[17].ToString() + "<br /><br /><b>Business:</b> " + dtRandomMember.Rows[0].ItemArray[8].ToString() + "<br /><br />"));
if (dtRandomMember.Rows[0].ItemArray[6].ToString() != "")
{
loggedinpanels.Controls.Add(new LiteralControl("<center><a href=\"" + dtRandomMember.Rows[0].ItemArray[6].ToString() + "\">Visit Website</a></center>"));
}
loggedinpanels.Controls.Add(new LiteralControl("</td></tr></table></div>"));
}
DataTable dtMemberAd = dl.GetRandomAd();
loggedinpanels.Controls.Add(new LiteralControl("<div class=\"contenttitle\">Member Ad</div><div style=\"text-align:center;\" class=\"contentpanel\"><a href=\"" + dtMemberAd.Rows[0].ItemArray[2].ToString() + "\"><img style=\"width:230px; border-width:0px;\" src=\"" + dtMemberAd.Rows[0].ItemArray[1].ToString() + "\" /></a></div>"));
if (User.Identity.IsAuthenticated)
{
loggedinpanels.Controls.Add(new LiteralControl("<div style=\"width:250px;\" class=\"contenttitle\">Popular Topics</div><div style=\"font-size:15px;\" class=\"contentpanel\"><ul>"));
DataTable dtTopics = dl.GetFiveTopics();
foreach (DataRow dr in dtTopics.Rows)
{
loggedinpanels.Controls.Add(new LiteralControl("<li><a href=\"Topic.aspx?topic=" + dr.ItemArray[0].ToString() + "\">" + dr.ItemArray[4].ToString() + "</a></li>"));
}
loggedinpanels.Controls.Add(new LiteralControl("</ul></div>"));
commentbox.Visible = true;
int iPageNumber = 0;
if (Request.QueryString["p"] != null)
{
iPageNumber = Convert.ToInt32(Request.QueryString["p"]);
}
int iCommentCount = dl.GetMemberCommentCount(sMember);
numthumbsup.InnerText = dl.GetMemberThumbsUpCount(sMember).ToString();
numcomments.InnerText = iCommentCount.ToString();
int iMaxPages = Convert.ToInt32(Math.Ceiling(Convert.ToDecimal(iCommentCount / 15m)));
pageNav1.NumPages = iMaxPages;
pageNav2.NumPages = iMaxPages;
DataTable dtComments = dl.GetFifteenMemberCommentsBy_Page(iPageNumber, sMember);
if (dl.GaveMemberThumbsUpAlready(sMember, User.Identity.Name) || (User.Identity.Name.ToLower() == sMember.ToLower()))
{
cbxThumbsUp.Visible = false;
}
else
{
cbxThumbsUp.Visible = true;
}
bool bColored = true;
foreach (DataRow dr in dtComments.Rows)
{
DataTable dtMember = dl.GetMemberBy_Email(dr.ItemArray[1].ToString());
comments.Controls.Add(new LiteralControl("<div style=\""));
if (bColored)
{
comments.Controls.Add(new LiteralControl("background-color:#CCDDCC"));
bColored = false;
}
else
{
comments.Controls.Add(new LiteralControl("background-color:#FFFFFF"));
bColored = true;
}
comments.Controls.Add(new LiteralControl(";padding:10px;\"><table style=\"width:100%;\"><tr><td rowspan=\"2\" style=\"vertical-align:top;text-align:center;font-size:17px;font-weight:bold;padding-right:15px;border-right:solid 2px #333333;width:150px;\"><a style=\"text-decoration:none;\" href=\"Profile.aspx?member=" + dtMember.Rows[0].ItemArray[0].ToString() + "\"><img style=\"border-width:0px;\" src=\"MakeThumbnail.aspx?size=150&image=images/MemberAvatars/" + dtMember.Rows[0].ItemArray[3].ToString() + "\" /></a><br /><br /><a href=\"Profile.aspx?member=" + dtMember.Rows[0].ItemArray[0].ToString() + "\">" + dtMember.Rows[0].ItemArray[2].ToString() + "</a></td><td style=\"text-align:left;vertical-align:top;padding-left:15px;\">" + dr.ItemArray[3].ToString() + "<br /><br />----------------------------------<br />" + dtMember.Rows[0].ItemArray[18].ToString() + "</td></tr><tr><td style=\"vertical-align:bottom;padding-left:15px;padding-top:15px;\"><table cellpadding=\"0\" cellspacing=\"0\" style=\"width:100%;\"><tr><td style=\"text-align:left;vertical-align:bottom;font-size:12px;font-weight:bold;\">" + dr.ItemArray[2].ToString()));
if (Convert.ToBoolean(dr.ItemArray[5]))
comments.Controls.Add(new LiteralControl("  | <img style=\"width:25px;\" src=\"images/ThumbsUp.png\" />"));
comments.Controls.Add(new LiteralControl("</td><td style=\"text-align:right;vertical-align:bottom;\">"));
if (User.Identity.IsAuthenticated)
{
if ((User.Identity.Name.ToLower() == dr.ItemArray[1].ToString().ToLower()) || (User.Identity.Name.ToLower() == sMember.ToLower()) || (dl.IsMemberAdmin(User.Identity.Name)) || (dl.IsMemberModerator(User.Identity.Name)))
{
lbDelete = new LinkButton();
lbDelete.Text = "Delete Comment";
lbDelete.ID = dr.ItemArray[0].ToString();
lbDelete.Click += new EventHandler(lbDelete_Click);
lbDelete.CausesValidation = false;
comments.Controls.Add(lbDelete);
}
}
comments.Controls.Add(new LiteralControl("</td></tr></table></td></tr></table></div>"));
}
}
else
{
commentbox.Visible = false;
}
}