Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string userStr = Request.QueryString.Get("user");
            string passStr = Request.QueryString.Get("pass");

            int maxCount = PageUtility.GetQueryInt(Request, "count", 0);

            if (userStr == null || passStr == null)
            {
                Response.Redirect("Index.aspx");
            }

            System.Text.StringBuilder infoHTMLStrBuilder = new System.Text.StringBuilder(10000);
            if (userStr == "Admin" && passStr == VF.HiddenStrings.CreateUserID_AdminPassword)
            {
                //Admin
                infoHTMLStrBuilder.Append("<h2>Logged in as Admin</h2>");
                m_ThisContributor        = new ContributorDB.ContributorDBElement();
                m_ThisContributor.Key    = "Admin";
                m_ThisContributor.UserID = VF.HiddenStrings.DilatazuUserID;
            }
            else if (passStr == VF.HiddenStrings.CreateUserID_UserIDCreaterPassword)
            {
                m_ThisContributor = ContributorDB.GetContributor(userStr);
                if (m_ThisContributor == null)
                {
                    Response.Redirect("Index.aspx");
                }

                //Admin Contributor
                infoHTMLStrBuilder.Append("<h2>Logged in as " + m_ThisContributor.Name + "</h2>");
            }
            else
            {
                Response.Redirect("Index.aspx");
            }

            if (m_ThisContributor.Key == "Admin") //Admin
            {
                var addedBys       = ContributorDB.GetMongoDB().MongoDBCollection.FindAll();
                var addedBysSorted = addedBys.OrderByDescending(_Value => _Value.ContributorID);
                Dictionary <string, List <ContributorDB.ContributorDBElement> > addedByGroups = new Dictionary <string, List <ContributorDB.ContributorDBElement> >();
                foreach (var addedBy in addedBysSorted)
                {
                    if (addedBy.ContributorID >= VF_RealmPlayersDatabase.Contributor.ContributorTrustworthyIDBound)
                    {
                        addedByGroups.AddToList("Temp", addedBy);
                    }
                    else
                    {
                        addedByGroups.AddToList(addedBy.AddedBy, addedBy);
                    }
                }
                var addedByGroupsSorted = addedByGroups.OrderBy(_Value => _Value.Value.Count);
                foreach (var addedByGroup in addedByGroupsSorted)
                {
                    int count = 0;
                    infoHTMLStrBuilder.Append("<h3>Created UserIDs by " + addedByGroup.Key + "</h3><table><tr>");
                    infoHTMLStrBuilder.Append("<th>UserID</th><th>ContributorID</th><th>IP</th><th>Key</th></tr>");
                    foreach (var addedBy in addedByGroup.Value)
                    {
                        infoHTMLStrBuilder.Append("<tr>");
                        infoHTMLStrBuilder.Append("<td>" + addedBy.UserID + "</td>");
                        infoHTMLStrBuilder.Append("<td>" + addedBy.ContributorID + "</td>");
                        infoHTMLStrBuilder.Append("<td>" + addedBy.IP + "</td>");
                        infoHTMLStrBuilder.Append("<td>" + addedBy.Key + "</td>");
                        infoHTMLStrBuilder.Append("</tr>");
                        if (maxCount > 0 && ++count >= maxCount)
                        {
                            break;
                        }
                    }
                    infoHTMLStrBuilder.Append("</table>");
                }
            }
            else
            {
                infoHTMLStrBuilder.Append("<h3>Created UserIDs</h3>");
                var addedBys       = ContributorDB.GetMongoDB().MongoDBCollection.Find(Query.EQ("AddedBy", userStr));
                var addedBysSorted = addedBys.OrderByDescending(_Value => _Value.ContributorID);
                foreach (var addedBy in addedBysSorted)
                {
                    infoHTMLStrBuilder.Append(addedBy.UserID + "<br/>");
                    if (maxCount > 0 && --maxCount == 0)
                    {
                        break;
                    }
                }
            }
            m_InfoHTML = infoHTMLStrBuilder.ToString();
        }
Ejemplo n.º 2
0
 public User(ContributorDB.ContributorDBElement _DBElement)
 {
     DBElement = _DBElement;
     Name      = _DBElement.Name;
     UserID    = _DBElement.UserID;
 }