public void Suspend_User(object s, EventArgs e)
    {
        if (!string.IsNullOrEmpty(Request.QueryString["uid"]))
        {
            int UserID = int.Parse(Request.QueryString["uid"]);

            //Cannot suspend the Administrator account.
            if (UserID != 1)
            {
                string Type = Request.Form["Type"];
                string Note = Request.Form["Note"];

                Blogic.SuspendUser(UserID, Type, Note);

                ProviderUserDetails user = new ProviderUserDetails();

                user.FillUp(UserID);

                EmailTemplate SendeMail = new EmailTemplate();

                //Flag = 1 = Suspension email notice.
                SendeMail.SendAccountSuspensionReinstateEmail(user.Email, user.Username, Type, 1);

                SendeMail = null;
                user = null;

                Response.Redirect("confirmusersuspenddeleteedit.aspx?mode=Suspend&uid=" + UserID);
            }
        }
    }
Пример #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        CheckUserIDQueryStringParameter();
        ShowProfileContentPublicOrPrivate();
        GetReturnMsgAfterAddingAFriend();

        try
        {
            int userID = (int)Util.Val(Request.QueryString["uid"]);
            int user_ID = UserIdentity.UserID;

            UserFeaturesConfiguration.Fetch(userID);

            ProviderUserDetails user = new ProviderUserDetails();

            user.FillUp(userID);

            userimage.ImageUrl = GetUserImage.GetImage(user.Photo).ToString();

            lblusernameheader.Text ="Thông tin cá nhân " +user.Username;
            lblusername.Text = user.Username;
            lblfullname.Text = user.FirstName + " " + user.LastName;
            lblprofileviews.Text = user.Hits.ToString();
            lbllastupdate.Text = Utility.FormatDate(user.LastUpdated);
            lbljoined.Text = Utility.FormatDate(user.DateJoined);
            lbldob.Text = Utility.FormatDate(user.DOB);
            lblcommentedrecipe.Text = user.CommentRecipeCount.ToString();
            lblaboutme.Text = Util.FormatText(user.AboutMe);
            lblpostedrecipecount.Text = user.PostedRecipeCount.ToString();
            lblpostedarticlecount.Text = user.PostedArticleCount.ToString();
            lblcommentarticle.Text = user.CommentArticleCount.ToString();
            lblfavfood1.Text = user.FavoriteFoods1;
            lblfavfood2.Text = user.FavoriteFoods2;
            lblfavfood3.Text = user.FavoriteFoods3;
            lblnosavedrecipe.Visible = true;
            lblcity.Text = "NA";
            lblstate.Text = "NA";
            lblnosavedrecipe.Text = "Không có bài hát nào.";
            lblnofriends.Text = "Không có bạn nào.";
            lbllastlogin.Text = "NA";

            GetUserProfileInformationWithLink(user);
            ShowAddToFriendsListLinkButton(user, userID);
            ShowSendPrivateMessageLink(user);
            ShowProfileFriendsListQuickView(user, userID);
            ShowProfileCookBookQuickView(user, userID);
            GetMetaTitleTagKeywords(user.Username);
            GetUserLast5Recipe(userID, user.PostedRecipeCount, user.Username);
            GetUserLast5Article(userID, user.PostedArticleCount, user.Username);
            UpdateUserLastVisit(user);

            user = null;
        }
        catch
        {
            Server.Transfer("userdoesnotexists.aspx");
        }
    }
Пример #3
0
    public void DeleteUser_Click(object sender, EventArgs e)
    {
        int UserID = int.Parse(Request.QueryString["uid"]);
        string Reason = Request.Form["Reason"];

        //Cannot delete the Administrator account. You can update the information such as password, email and name, city and so on...
        if (UserID != 1)
        {
            ProviderUserDetails users = new ProviderUserDetails();
            users.FillUp(UserID);

            Blogic.DeleteUserLog(UserID, users.Username, Reason);

            try
            {
                IDataReader dr = Blogic.ActionProcedureDataProvider.GetUserPhotoByUserID(UserID);

                dr.Read();

                if (dr["Photo"] != DBNull.Value)
                {
                    System.IO.File.Delete(Server.MapPath(GetUserImage.ImagePathForUserPhotoForAdmin + dr["Photo"].ToString()));
                }

                dr.Close();
            }
            catch
            {
            }

            UserRepository user = new UserRepository();
            user.UID = UserID;

            if (user.Delete(user) != 0)
            {
                JSLiteral.Text = "Error occured while processing.";
                return;
            }

            SendAnEmailNotificationToTheUser(users, Reason);

            user = null;
            users = null;

            Response.Redirect("confirmusersuspenddeleteedit.aspx?mode=Delete&uid=" + UserID);
        }
    }
Пример #4
0
    private void SendPMEmailNotification(int UserID, string PMSubject)
    {
        ProviderUserDetails user = new ProviderUserDetails();

        user.FillUp(UserID);

        EmailTemplate Email = new EmailTemplate();

        Email.SendEmailPrivateMessageAlert(UserIdentity.UserName, user.Username, user.Email, PMSubject);

        Email = null;
        user = null;
    }
Пример #5
0
    private void AddAFriendSendEmailNotification()
    {
        int FriendID = int.Parse(Request.QueryString["uid"]);

        ProviderUserDetails user = new ProviderUserDetails();

        user.FillUp(FriendID);

        EmailTemplate Email = new EmailTemplate();

        Email.AddAFriendEmailNotification(user.Email, user.Username, UserIdentity.UserName);

        Email = null;
        user = null;
    }
Пример #6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        int User_ID = int.Parse(Request.QueryString["uid"]);

        lblusername.Text = "Welcome Admin: " + UserIdentity.AdminUsername;

        ProviderUserDetails user = new ProviderUserDetails();

        user.FillUp(User_ID);

        lbllegendheader.Text = "Editting " + user.Username + "'s Profile";

        username = user.Username;

        Password1.Value = Encryption.Decrypt(user.Password);
        Password2.Value = Encryption.Decrypt(user.Password);
        Email.Value = user.Email;
        Firstname.Value = user.FirstName;
        Lastname.Value = user.LastName;
        City.Value = user.City;
        State.Value = user.State;
        Date1.CalendarDateString = user.DOB.ToShortDateString();
        FavoriteFoods1.Value = user.FavoriteFoods1;
        FavoriteFoods2.Value = user.FavoriteFoods2;
        FavoriteFoods3.Value = user.FavoriteFoods3;
        Website.Value = user.Website;
        AboutMe.Value = user.AboutMe;

        usercurrentemail = user.Email;
        usercurrentpassword = Encryption.Decrypt(user.Password);

        userimageedit.ImageUrl = GetUserImage.GetImageForAdmin(user.Photo).ToString();

        string[] Countries = Utility.CountriesList;

        Country.Items.Insert(0, new ListItem(user.Country.ToString(), user.Country.ToString()));

        foreach (string country in Countries)
        {
            Country.Items.Add(country);
        }

        user = null;
    }
Пример #7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Response.Write("<br><br>");
        Response.Write(BuildCalendar(5, 2009));
        Response.Write("<br><br>");

        int userids = 1;
        //Refresh cached data
        //Caching.PurgeCacheItems("MyCookBook_SideMenu_" + userids);

        //This is the generic extended collection unit test page.
        //You can remove/delete this page anytime you want.

        //Caching.PurgeCacheItems("Newest_Articles");
        //Caching.PurgeCacheItems("ArticleCategory_SideMenu");
        //Caching.PurgeCacheItems("Last5_ArticlePublishedByUser_1");

        //Blogic.UpdateArticleCommentAdmin(ID, Comment);
        //int SenderUID = 2;
        //string ToUserName = "******";
        //Response.Write("IsUserBlockedFomSendingPM = " + Blogic.IsUserBlockedByLyric(ToUserName, SenderUID) + "<br>");
        //Response.Write("<br><br>");

        /*
        PrivateMessageRepository Message = new PrivateMessageRepository();

        string mode = Request.QueryString["method"];

        Message.Subject = "How are you Webmaster?";
        Message.LyricUserName = "******";
        Message.SenderUserID = userids;
        Message.Message = "What'sbyte up dude";

        Message.Add(Message);

        Message = null;
         */

        //int UID = 2;
        /*
        int GetUserID = Blogic.GetUserIDByUsername("Webmaster");
        UserFeaturesConfiguration.Fetch(GetUserID);
        Response.Write("IsReceivePM = " + UserFeaturesConfiguration.IsUserChooseToReceivePM + "<br>");
        Response.Write("IsReceiveEmailPMAlert = " + UserFeaturesConfiguration.IsUserChooseToReceiveEmailAlertReceivePM + "<br>");
        Response.Write("<br><br>");
         */

        //string strText = "C# substring function";

        /*
        //Response.Write(strText.Substring(0, 1) + "<br><br>");
        string strText = "8:30 AM";
        string strText2 = "10:00 AM";
        Response.Write(strText.Substring(1, 1) + "<br><br>");
        Response.Write(strText2.Substring(0, 2) + "<br><br>");

        Response.Write("IsPM = " + IsPM(strText2) + "<br><br>");

        //AM
        if (IsIndex1AColon(strText) && !IsIndex1AColon(strText2) && !IsPM(strText) && !IsPM(strText2))
        {
            //string combined = strText2.Substring(0, 1) + "" + strText2.Substring(1, 1);
            int HrDiff = HoursDiff(int.Parse(strText.Substring(0, 1)), int.Parse(strText2.Substring(0, 2)));
            Response.Write("HrDiff = [ " + HrDiff + " ]<br><br>");
        }

        //AM to PM
        if (IsIndex1AColon(strText) && !IsIndex1AColon(strText2) && !IsPM(strText) && !IsPM(strText2))
        {
            //string combined = strText2.Substring(0, 1) + "" + strText2.Substring(1, 1);
            int HrDiff = HoursDiff(int.Parse(strText.Substring(0, 1)), int.Parse(strText2.Substring(0, 2)));
            Response.Write("HrDiff = [ " + HrDiff + " ]<br><br>");
        }
        */

        /*
        DateTime bd = DateTime.Parse("4/26/2009");
        DateTime ed = DateTime.Parse("5/2/2009");

        int beginDateNum = bd.Day;
        int endDateNum = ed.Day;

        Response.Write("beginDateNum = [ " + beginDateNum + " ]<br><br>");
        Response.Write("endDateNum = [ " + endDateNum + " ]<br><br>");

        Response.Write("<table cellpadding='0' cellspacing='0' width='100%'>");
        Response.Write("<tr>");
        for (int i = beginDateNum; i < endDateNum + 1; i++)
        {
            //Response.Write("sequentialDayNum = [ " + i + " ]<br><br>");
            Response.Write("<td width='15%'><div style='background-color: #ECF3FF;'><span class='content01'>" + i + "</span></div></td>");
        }
        Response.Write("</tr>");
        Response.Write("</table>");
         */

        /*
        DateTime bd = DateTime.Parse("4/26/2009");
        DateTime ed = DateTime.Parse("5/2/2009");
        TimeSpan ts = ed.Subtract(bd);
        Response.Write("countDays = " + ts.Days + "<br><br>");
        for (int i = 0; i < ts.Days; i++)
        {
            Response.Write("sequentialDayNum = [ " + i + " ]<br><br>");
        }
         */

        /*
        DateTime dt = DateTime.Parse("4/26/2009");
        int difference = -((int)dt.DayOfWeek);
        DateTime start = dt.AddDays(difference).Date;
        DateTime end = start.AddDays(7).Date.AddMilliseconds(-1);

        for (int i = 0; i < 7; i++)
        {
            Response.Write("sequentialDayNum = [ " + start.AddDays(i).Day + " ]<br><br>");
        }
         */
        /*
        int EventID = 1;
        string EventURL = "\"showEvent(" + EventID + ",'top','left')\"";
        Response.Write(EventURL);
         */

        //DateTime startDate;
        //DateTime endDate;

        //Response.Write("GetWeekStartDate = " + GetWeekStartDate(2009, 18) + "<br>");
        //PrintDay(2009, 5, DayOfWeek.Sunday);

        /*
        Response.Write("startDate = " + start + "<br>");
        Response.Write("endDate = " + end + "<br>");
        Response.Write("<br><br>");
         */

        //Response.Write("IsNumeric = " + Utility.IsNumeric(Request.QueryString["num"]) + "<br>");
        //Response.Write("<br><br>");

        DateTime testdate = Convert.ToDateTime("4/26/2009");

        Response.Write("Day Name = " + testdate.DayOfWeek.ToString() + "<br>");

        //Response.Write("Week Number = " + GetWeekNumber(DateTime.Now.AddDays(1).Date) + "<br>");
        //Response.Write("Week Number = " + GetWeekNumber(testdate.AddDays(1).Date) + "<br>");
        //Response.Write("Current Date = " + testdate.AddDays(1).Date + "<br>");
        Response.Write("<br><br>");

        ExtendedCollection<int> dinos = new ExtendedCollection<int>();
        ExtendedCollection<string> dinosaurs = new ExtendedCollection<string>();
        ExtendedCollection<string> MyList = dinosaurs;

        ExtendedCollection<string> mystring = new ExtendedCollection<string>();

        ExtendedCollection<string> mytest = new ExtendedCollection<string>();

        ExtendedCollection<string> mysublist = mystring.FindAll(EndsWithSaurus);

        ExtendedCollection<int> a = new ExtendedCollection<int>();

        ProviderUserDetails user = new ProviderUserDetails();

        user.UID = 1;

        user.FillUp(1);

        Response.Write("Encrypt Username = "******"zafra") + "<br>");
        //Response.Write("Encrypted Admin Password = "******"adminpassword"].ToString() + "<br>");
        Response.Write("<br><br>");

        //Response.Write("Email = " + user.Email.ToString() + "<br>");
        Response.Write("UserRole = " + UserIdentity.UserRole + "<br>");

        Response.Write("<br><br>");

        //Response.Write("IsUserSessionExists = " + CookieLoginHelper.IsLoginSessionExists + "<br>");
        //Response.Write("IsAdminLoginSessionExists = " + CookieLoginHelper.IsLoginAdminSessionExists + "<br>");
        string date = "1/5/2009";
        Response.Write("CustomDateFormat = " + Utility.FormatDate(DateTime.Parse(date)) + "<br>");

        Response.Write("<br><br>");

        UserFeaturesConfiguration.Fetch(1);
        Response.Write("UserConfigFeatures = " + UserFeaturesConfiguration.GetNumRecordsCookBookShow.ToString() + "<br>");

        Response.Write("<br><br>");

        string unametest = "Teststststststststs";

        if (unametest.Length > 50)
        {
            Response.Write("About me lenght = Too long.");
        }
        else
        {
            Response.Write("About me lenght = OK");
        }

        Response.Write("<br>");
        DateTime Age;
        Age = DateTime.Parse("12/5/1997");
        Response.Write("IsValidAge = " + Validator.IsValidAge(Age, 10) + "<br>");
        Response.Write("IsAlphaNumericOnly = " + Validator.IsAlphaNumericOnly("") + "<br>");
        Response.Write("IsValidName = " + Validator.IsValidName("Jun jun") + "<br>");
        Response.Write("IsValidEmail = " + Validator.IsValidEmail("*****@*****.**") + "<br>");
        Response.Write("IsUserAuthenticated = " + Authentication.IsUserAuthenticated);
        Response.Write("<br><br>");

        Response.Write("<br><br>");

        UserNameAndEmailValidation.Param("DeZaf", "*****@*****.**");

        Response.Write("Username and Email = " + UserNameAndEmailValidation.ErrMsg);

        Response.Write("<br><br>");

        Response.Write("Username and Email Boolean Result = " + UserNameAndEmailValidation.IsValid);

        Response.Write("<br><br>");

        string Filename = "adminphotowafo.gif";

        string Exten = Filename.Substring(Filename.Length - 4);

        string GetName = Filename.Substring(0, Filename.Length - 4);

        Response.Write("Filanem = " + GetName.ToString() + " Exten = " + Exten);

        Response.Write("<br><br>");

        HttpCookie GetUserInfo = HttpContext.Current.Request.Cookies["VGWRUserInfo"];

        if (GetUserInfo != null)
        {
            Response.Write("UnEncrypted CookieUsername = "******"<br>UnEncrypted password = "******"<br><br>");

        //Response.Write("NewGuid = " + Guid.NewGuid().ToString("N"));

        Response.Write("<br><br>");

        /*
        //Email test
        //Instantiate emailtemplate object
        EmailTemplate SendeMail = new EmailTemplate();

        SendeMail.LyricEmail = "*****@*****.**";

        //Send the activation link
        SendeMail.SendActivationLink("karlos25", Guid.NewGuid().ToString("N"));

        SendeMail = null;

        user = null;

        EmailTemplate SendCredential = new EmailTemplate();

        lostpassword.GetUserCredential("*****@*****.**");

        SendCredential.SendPassword("*****@*****.**", lostpassword.GetFirstname, lostpassword.GetUserName, Encryption.Decrypt(lostpassword.GetUserPass));

        SendCredential = null;
         */

        /*
        EmailTemplate SendeMail = new EmailTemplate();

        SendeMail.SendAccountSuspensionReinstateEmail("*****@*****.**", "dotnetdude", "Reinstate Account", 2);

        SendeMail = null;
         */

        a.Add(4);
        a.Add(2);
        a.Add(7);
        a.Add(95);
        a.Add(3);
        a.Add(45);
        a.Add(5);
        a.Add(6);
        a.Add(1);
        a.Add(9);
        a.Add(18);
        a.Add(29);
        a.SortAscending();
        //a.Reverse();
        //a.SortDescending();
        //a.ReplaceWithByItem(3, 10);

        Response.Write("GetSumInt: " + a.GetSumInt(a.ToArray()).ToString() + "<br>");

        int[] myIntArray = a.ToArray();
        //int[] myArray = new int[] { 22, 10, 4, 6, 33, 7, 8, 9, 11, 35, 48, 64, 78 };

        Response.Write("GetMaxInt: " + a.GetMaxInt(myIntArray).ToString() + "<br>");
        Response.Write("GetMaxInt: " + a.GetMaxInt(a.ToArray()).ToString() + "<br>");
        Response.Write("GetMinInt: " + a.GetMinInt(a.ToArray()).ToString() + "<br>");

        ExtendedCollection<double> d = new ExtendedCollection<double>();

        d.Add(4.1);
        d.Add(6.2);
        d.Add(7.9);
        d.Add(15.8);
        d.Add(3.5);
        d.Add(45.6);
        d.Add(54.6);

        Response.Write("<br>");

        Response.Write("GetMinDouble: " + d.GetMinDouble(d.ToArray()).ToString() + "<br>");
        Response.Write("GetMaxDouble: " + d.GetMaxDouble(d.ToArray()).ToString() + "<br>");
        Response.Write("GetSumDouble: " + d.GetSumDouble(d.ToArray()).ToString() + "<br>");

        Response.Write("<br>");

        foreach (int s in a)
        {
            Response.Write(s.ToString() + "<br>");
        }

        Response.Write("<br>");

        ExtendedCollection<string> x = new ExtendedCollection<string>();
        x.Add("Hello");
        x.Add("There");
        x.Add("World");
        x.Add("Four");
        x.Add("Three");
        x.Add("Two");
        x.Add("One");

        ExtendedCollection<string> l = new ExtendedCollection<string>();
        l.Add("one");
        l.Add("two");
        l.Add("three");
        l.Add("four");
        l.Add("five");
        //l.TrimExcess();

        // B.
        string[] s1 = l.ToArray();

        Response.Write("ToArrayLenght = " + s1.Length.ToString() + "<br>");
        Response.Write("ToArrayGetValue = " + s1.GetValue(2).ToString() + "<br>");

        Response.Write("<br>");

        // Make a collection of Cars.
        ExtendedCollection<Car> myCars = new ExtendedCollection<Car>();
        myCars.Add(new Car("Rusty", 20));
        myCars.Add(new Car("Zippy", 90));
        myCars.Add(new Car("Rudy", 60));
        myCars.Add(new Car("Tom", 60));
        myCars.Add(new Car("Henry", 70));
        myCars.Add(new Car("Carl", 50));
        myCars.Add(new Car("Robert", 60));
        myCars.RemoveAt(1);
        myCars.RemoveAt(3);

        foreach (Car c in myCars)
        {
            Response.Write("PersonName: " + c.PersonName + " , Speed: " + c.Speed + "<br>");
        }

        Response.Write("<br>");

        Response.Write("<b>Removed Items History:</b>" + "<br>");
        foreach (Car cr in myCars.RemovedItemHistory)
        {
            Response.Write("PersonName: " + cr.PersonName + " , Speed: " + cr.Speed + "<br>");
        }

        Response.Write("<br>");
        Response.Write("RemoveItemCount: " + myCars.RemovedItemCounter.ToString() + "<br>");
        Response.Write("Exist: " + l.Exists(TestForLength5) + "<br>");
        Response.Write("Capacity: " + l.Capacity.ToString() + "<br>");
        Response.Write("TrueForAll = " + l.TrueForAll(TestForLength5) + "<br>");

        Response.Write("<br><br>");

        foreach (string s in x.FindAll(TestForLength5))
        {
            Response.Write(s.ToString() + "<br>");
        }

        Response.Write("<br>");

        /*
        mystring.Add("One");
        mystring.Add("Four");
        mystring.Add("Two");
        mystring.Add("Five");
        mystring.Add("Six");
        mystring.Add("Three");
        mystring.Sort();
         */

        mystring.Add("Compsognathus");
        mystring.Add("Testsaurus");
        mystring.Add("Amargasaurus");
        mystring.Add("Oviraptor");
        mystring.Add("Tsaurus");
        mystring.Add("Velociraptor");
        mystring.Add("Masasaurus");
        mystring.Add("Deinonychus");
        mystring.Add("Dilophosaurus");
        mystring.Add("Gallimimus");
        mystring.Add("Triceratops");
        mystring.Add("Sagasaurus");
        mystring.Add("Taurus");
        mystring.Add("Elephant");
        mystring.Add("Dragonsaurus");

        mytest.Add("One");
        mytest.Add("Two");
        mytest.Add("Three");
        mytest.Add("Four");
        mytest.Add("Five");
        mytest.Add("Six");
        mytest.Add("Seven");
        mytest.Add("Eight");
        mytest.Add("Nine");
        mytest.Add("Ten");

        mytest.ReplaceWithByIndex(1, "Test1");
        mytest.ReplaceWithByItem("Four", "Test2");

        Response.Write("<br>");
        foreach (string mt in mytest)
        {
            Response.Write(mt.ToString() + "<br>");
        }
        Response.Write("<br>");

        //mystring.RemoveRange(2, 2);

        //mystring.Reverse();
        //mystring.Reverse(1,4);

        string[] output = mystring.GetRange(2, 3).ToArray();
        foreach (string dinosaur in output)
        {
            Response.Write(dinosaur.ToString() + "<br>");
        }

        Response.Write("<br>");

        foreach (string st in mysublist)
        {
            Response.Write(st + "<br>");
        }

        Response.Write("<br>");

        foreach (string str in mystring)
        {
            Response.Write(str + "<br>");
        }

        Response.Write("<br>");
        Response.Write("GetValue mystring = " + mystring.GetValue(6).ToString() + "<br>");
        Response.Write("<br>");
        Response.Write("mystringcount = " + mystring.Count.ToString() + "<br>");
        Response.Write("GetValue = " + mystring[4] + "<br>");

        Response.Write("<br>");

        dinos.Add(1);
        dinos.Add(2);
        dinos.Add(3);
        dinos.Add(4);
        dinos.Add(5);
        dinos.Add(6);
        dinos.Remove(3);

        foreach (int i in dinos)
        {
            Response.Write(i + "<br>");
        }

        dinosaurs.Add("Compsognathus");
        dinosaurs.Add("Testsaurus");
        dinosaurs.Add("Amargasaurus");
        dinosaurs.Add("Oviraptor");
        dinosaurs.Add("Tsaurus");
        dinosaurs.Add("Velociraptor");
        dinosaurs.Add("Deinonychus");
        dinosaurs.Add("Dilophosaurus");
        dinosaurs.Add("Gallimimus");
        dinosaurs.Add("Triceratops");
        dinosaurs.Insert(2, "Arrarrathus");
        dinosaurs.ReplaceWithByIndex(2, "Test");
        dinosaurs.ReplaceWithByItem("Deinonychus", "Test2");
        dinosaurs.RemoveByItem("Velociraptor");
        dinosaurs.RemoveAt(5);

        Response.Write("<br>");
        for (int i = 0; i < dinosaurs.Count; i++)
        {
            //Response.Write(MyList[i].ToString() + "<br>");
            Response.Write(dinosaurs.GetValue(i).ToString() + "<br>");
        }

        Response.Write("<br>");
        foreach (string dinosaur in dinosaurs)
        {
            Response.Write(dinosaur.ToString() + "<br>");
        }

        Response.Write("<br>");
        Response.Write("Find = " + dinosaurs.Find(EndsWithSaurus) + "<br>");
        Response.Write("Dinosaurs count = " + dinosaurs.Count.ToString() + "<br>");
        Response.Write("FindIndexOf = " + dinosaurs.IndexOf("Amargasaurus").ToString() + "<br>");
        Response.Write("LastIndexOf = " + dinosaurs.FindLastIndexOf("Gallimimus") + "<br>");
        Response.Write("IndexOf = " + dinosaurs.IndexOf("Dilophosaurus") + "<br>");
        Response.Write("GetLastIndex = " + dinosaurs.GetLastIndex.ToString() + "<br>");
        Response.Write("GetValue = " + dinosaurs[7] + "<br>");
        Response.Write("GetFirstIndexValue = " + dinosaurs.GetFirstIndexValue.ToString() + "<br>");
        Response.Write("GetLastIndexValue = " + dinosaurs.GetLastIndexValue.ToString() + "<br>");
        Response.Write("GetIndexValue = " + dinosaurs.GetValue(6).ToString() + "<br>");
        Response.Write("TrueForAll = " + dinosaurs.TrueForAll(EndsWithSaurus) + "<br>");
        Response.Write("Contained Dilophosaurus = " + dinosaurs.Contains("Dilophosaurus"));
    }
Пример #8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        HideFormIfLogin.Visible = false;
        lblWarningMessage.Text = "Xin lỗi! Bạn phải đăng nhập trước khi sửa thông tin cá nhân.";
        lbllegendheader.Text = "Sửa thông tin cá nhân";

        if (Authentication.IsUserAuthenticated)
        {
            ProviderUserDetails user = new ProviderUserDetails();

            user.FillUp(UserIdentity.UserID);

            lbllegendheader.Text = "Đang sửa thông tin cá nhân của " + UserIdentity.UserName + "";
            HideFormIfLogin.Visible = true;
            lblWarningMessage.Visible = false;

            Password1.Value = Encryption.Decrypt(user.Password);
            Password2.Value = Encryption.Decrypt(user.Password);
            Email.Value = user.Email;
            Firstname.Value = user.FirstName;
            Lastname.Value = user.LastName;
            City.Value = user.City;
            State.Value = user.State;
            Date1.CalendarDateString = user.DOB.ToShortDateString();
            FavoriteFoods1.Value = user.FavoriteFoods1;
            FavoriteFoods2.Value = user.FavoriteFoods2;
            FavoriteFoods3.Value = user.FavoriteFoods3;
            Website.Value = user.Website;
            AboutMe.Value = user.AboutMe;

            usercurrentemail = user.Email;
            usercurrentpassword = Encryption.Decrypt(user.Password);

            userimageedit.ImageUrl = GetUserImage.GetImage(user.Photo).ToString();

            string[] Countries = Utility.CountriesList;

            Country.Items.Insert(0, new ListItem(user.Country.ToString(), user.Country.ToString()));

            foreach (string country in Countries)
            {
                Country.Items.Add(country);
            }

            user = null;
        }
    }
Пример #9
0
    /**********************************************************************
    * This page is only accessible to Administrator.
    * This page is use in the Admin Membership pahe to view user profile.
    ***********************************************************************/
    protected void Page_Load(object sender, EventArgs e)
    {
        //Instantiate utility/common object
        Utility Util = new Utility();

        if (!CookieLoginHelper.IsLoginAdminSessionExists)
        {
            PanelIsProfilePublicOrPrivate.Visible = false;
            lblyouarenotauthorizedtoview.Visible = true;
            lblyouarenotauthorizedtoview.Text = "<div style='margin-top: 12px; margin-bottom: 7px;'><img src='images/lock.gif' align='absmiddle'> Bạn không được phép để xem trang này.</div>";
        }
        else
        {
            PanelIsProfilePublicOrPrivate.Visible = true;
        }

        string mode;

        //After adding a friend redirect back to this page.
        //Make sure parameter is not empty. The passed in parameter mode is "Success"
        if (!string.IsNullOrEmpty(Request.QueryString["mode"]))
        {
            //Validate to make sure it does not contain illegal characters i.e. HTML tags.
            Util.SecureQueryString(Request.QueryString["mode"]);

            mode = Request.QueryString["mode"];

            lbladdfriendsuccessmsg.Visible = true;
            lbladdfriendsuccessmsg.Text = "<div style='text-align: center; margin-top: 15px; color: #800000;'>Thêm bạn thành công. Một người bạn mới đã được thêm vào Danh sách Bạn bè của bạn.</div>";
        }
        else
        {
            //Assign failed if not coming from redirect page.
            mode = "Failed";
        }

        try
        {
            int userID = (int)Util.Val(Request.QueryString["uid"]);
            int user_ID = UserIdentity.UserID;

            //Get the users settings based on the passed in querystring.
            UserFeaturesConfiguration.Fetch(userID);

            ProviderFriendsList MyFriends = new ProviderFriendsList(userID, UserFeaturesConfiguration.GetNumRecordsFriendsListShow);
            UsersCookBook CookBook = new UsersCookBook(userID, UserFeaturesConfiguration.GetNumRecordsCookBookShow);

            ProviderUserDetails user = new ProviderUserDetails();

            user.FillUp(userID);

            userimage.ImageUrl = GetUserImage.GetImage(user.Photo).ToString();

            lblusernameheader.Text = "Thông tin cá nhân của " + user.Username;
            lblusername.Text = user.Username;
            lblfullname.Text = user.FirstName + "&nbsp;" + user.LastName;
            lblprofileviews.Text = user.Hits.ToString();
            lbllastupdate.Text = Utility.FormatDate(user.LastUpdated);
            lbljoined.Text = Utility.FormatDate(user.DateJoined);
            lbldob.Text = Utility.FormatDate(user.DOB);
            lblcommentedrecipe.Text = user.CommentRecipeCount.ToString();
            lblaboutme.Text = user.AboutMe;
            lblpostedrecipecount.Text = user.PostedRecipeCount.ToString();
            lblpostedarticlecount.Text = user.PostedArticleCount.ToString();
            lblfavfood1.Text = user.FavoriteFoods1;
            lblfavfood2.Text = user.FavoriteFoods2;
            lblfavfood3.Text = user.FavoriteFoods3;
            lblnosavedrecipe.Visible = true;
            lblcity.Text = "NA";
            lblstate.Text = "NA";
            lblnosavedrecipe.Text = "Không có bài hát nào được lưu.";
            lblnofriends.Text = "Không có người bạn nào thêm vào.";
            lbllastlogin.Text = "NA";

            //Show last visit to registered users only.
            if (Authentication.IsUserAuthenticated)
            {
                lbllastlogin.Text = Utility.FormatDate(user.LastLogin);
            }

            if (user.City != "NA")
            {
                lblcity.Text = "<a title href=searchuser.aspx?input=" + user.City + "&condition=4>" + user.City + "</a>";
                lblcity.Attributes.Add("onmouseover", "Tip('Xem tất cả thành viên sống ở <b>" + user.City + "</b>', BGCOLOR, '#FFFBE1', BORDERCOLOR, '#acc6db')");
                lblcity.Attributes.Add("onmouseout", "UnTip()");
            }

            if (user.State != "NA")
            {
                lblstate.Text = "<a title href=searchuser.aspx?input=" + user.State + "&condition=5>" + user.State + "</a>";
                lblstate.Attributes.Add("onmouseover", "Tip('Xem tất cả thành viên sống ở <b>" + user.State + "</b>', BGCOLOR, '#FFFBE1', BORDERCOLOR, '#acc6db')");
                lblstate.Attributes.Add("onmouseout", "UnTip()");
            }

            lblcountry.Text = "<a title href=searchuser.aspx?input=" + user.Country + "&condition=6>" + user.Country + "</a>";
            lblcountry.Attributes.Add("onmouseover", "Tip('Xem tất cả thành viên sống ở <b>" + user.Country + "</b>', BGCOLOR, '#FFFBE1', BORDERCOLOR, '#acc6db')");
            lblcountry.Attributes.Add("onmouseout", "UnTip()");

            //Prevent adding himself/herself to the Friends List.
            if (Authentication.IsUserAuthenticated && (user_ID == userID))
            {
                lbladdtofriendslist.Visible = true;
                lbladdtofriendslist.Attributes.Add("onclick", "csscody.alert('<b>Denied Save</b><br>Sorry! You cannot add yourself.');return false;");
                lbladdtofriendslist.Attributes.Add("onmouseover", "Tip('Xin lỗi! Bạn không thể thêm mới<br>chính bạn vào danh sách bạn.', BGCOLOR, '#FFFBE1', BORDERCOLOR, '#acc6db')");
                lbladdtofriendslist.Attributes.Add("onmouseout", "UnTip()");
                lbladdtofriendslist.Text = "<a title='Xin lỗi! Bạn không thể thêm chính.' href='javascript:void(0)'>Thêm mới vào danh sách bạn bè</a>";
            }
            else if (Authentication.IsUserAuthenticated && (user_ID != userID))
            {
                //Check mode - adding a friend.
                //This prevent successive clicking after adding a friend
                if (mode == "Success")
                {
                    LinkButtonAddfriendLogin.Visible = false;
                    lbladdtofriendslist.Visible = true;
                    lbladdtofriendslist.Attributes.Add("onclick", "csscody.alert('<b>Không được phép lưu</b><br>Xin lỗi! (" + user.Username + ")  đã tồn tại trong danh sách của bạn.');return false;");
                    lbladdtofriendslist.Attributes.Add("onmouseover", "Tip('Xin lỗi! (" + user.Username + ") đã tồn tại trong danh sách của bạn.', BGCOLOR, '#FFFBE1', BORDERCOLOR, '#acc6db')");
                    lbladdtofriendslist.Attributes.Add("onmouseout", "UnTip()");
                    lbladdtofriendslist.Text = "<a title='Xin lỗi! Bạn đã thêm vào người dùng này Danh sách Bạn bè của bạn.' href='javascript:void(0)'>Thêm vào danh sách bạn</a>";
                }
                //Check if the user is already in friends List. If exists, hide linkbutton and show the label link.
                else if (Blogic.IsFriendExists(user_ID, userID))
                {
                    LinkButtonAddfriendLogin.Visible = false;
                    lbladdtofriendslist.Visible = true;
                    lbladdtofriendslist.Attributes.Add("onclick", "csscody.alert('<b>Denied Save</b><br>Sorry! (" + user.Username + ") is already in your Friends List.');return false;");
                    lbladdtofriendslist.Attributes.Add("onmouseover", "Tip('Xin lỗi! (" + user.Username + ") đã tồn tại trong danh sách.', BGCOLOR, '#FFFBE1', BORDERCOLOR, '#acc6db')");
                    lbladdtofriendslist.Attributes.Add("onmouseout", "UnTip()");
                    lbladdtofriendslist.Text = "<a title='Tài khoản đã tồn tại trong danh sách.' href='javascript:void(0)'>Thêm vào Danh sách Bạn bè</a>";
                }
                else
                {
                    LinkButtonAddfriendLogin.Visible = true;
                    LinkButtonAddfriendLogin.Text = "Thêm vào Danh sách Bạn bè";
                    LinkButtonAddfriendLogin.Attributes.Add("onmouseover", "Tip('Thêm (" + user.Username + ") vào danh sách bạn bè.', BGCOLOR, '#FFFBE1', BORDERCOLOR, '#acc6db')");
                    LinkButtonAddfriendLogin.Attributes.Add("onmouseout", "UnTip()");
                }
            }
            else
            {
                lbladdtofriendslist.Visible = true;
                lbladdtofriendslist.Attributes.Add("onclick", "csscody.alert('<b>Không có quyền nhớ</b><br>Bạn cần đăng nhập để thêm (" + user.Username + ") vào danh sách bạn bè.');return false;");
                lbladdtofriendslist.Attributes.Add("onmouseover", "Tip('bạn cần đăng nhập để thêm (" + user.Username + ") vào danh sách bạn bè.', BGCOLOR, '#FFFBE1', BORDERCOLOR, '#acc6db')");
                lbladdtofriendslist.Attributes.Add("onmouseout", "UnTip()");
                lbladdtofriendslist.Text = "<a title='Bạn phải đăng nhập để thêm người dùng này vào Danh sách Bạn bè của bạn.' href='javascript:void(0)'>hêm vào Danh sách Bạn bè</a>";
            }

            if (user.FavoriteFoods1 != "NA")
            {
                lblfavfood1.Text = "<a title='Tìm kiếm' href=" + "searchlyric.aspx?find=" + user.FavoriteFoods1.Replace(" ", "+") + "&catid=0>" + user.FavoriteFoods1 + "</a>";
                lblfavfood1.Attributes.Add("onmouseover", "Tip('Tìm kiếm bài hát (<b>" + user.FavoriteFoods1.Replace(" ", "+") + "</b>).', BGCOLOR, '#FFFBE1', BORDERCOLOR, '#acc6db')");
                lblfavfood1.Attributes.Add("onmouseout", "UnTip()");
            }

            if (user.FavoriteFoods2 != "NA")
            {
                lblfavfood2.Text = "<a title='Tìm kiếm' target='_blank' href=" + "searchlyric.aspx?find=" + user.FavoriteFoods2.Replace(" ", "+") + "&catid=0>" + user.FavoriteFoods2 + "</a>";
                lblfavfood2.Attributes.Add("onmouseover", "Tip('Tìm kiếm bài hát (<b>" + user.FavoriteFoods1.Replace(" ", "+") + "</b>).', BGCOLOR, '#FFFBE1', BORDERCOLOR, '#acc6db')");
                lblfavfood2.Attributes.Add("onmouseout", "UnTip()");
            }

            if (user.FavoriteFoods3 != "NA")
            {
                lblfavfood3.Text = "<a title='Tìm kiếm' target='_blank' href=" + "searchlyric.aspx?find=" + user.FavoriteFoods3.Replace(" ", "+") + "&catid=0>" + user.FavoriteFoods3 + "</a>";
                lblfavfood3.Attributes.Add("onmouseover", "Tip('Tìm kiếm bài hát (<b>" + user.FavoriteFoods1.Replace(" ", "+") + "</b>) .', BGCOLOR, '#FFFBE1', BORDERCOLOR, '#acc6db')");
                lblfavfood3.Attributes.Add("onmouseout", "UnTip()");
            }

            if (user.PostedRecipeCount != 0)
            {
                lblpostedrecipecount.Text = "<a target='_blank' href=" + "findalllyricbyauthor.aspx?author=" + user.Username + ">" + user.PostedRecipeCount + "</a>";
                lblpostedrecipecount.Attributes.Add("onmouseover", "Tip('Xem tất cả bài hát <b>" + user.Username + "</b>.', BGCOLOR, '#FFFBE1', BORDERCOLOR, '#acc6db')");
                lblpostedrecipecount.Attributes.Add("onmouseout", "UnTip()");
            }

            if (user.CommentRecipeCount != 0)
            {
                lblcommentedrecipe.Text = "<a target='_blank' href=" + "findalllyriccommentedbyuser.aspx?commentauthor=" + user.Username + ">" + user.CommentRecipeCount + "</a>";
                lblcommentedrecipe.Attributes.Add("onmouseover", "Tip('Xem tất cả bài hát chia sẻ bởi <b>" + user.Username + "</b>.', BGCOLOR, '#FFFBE1', BORDERCOLOR, '#acc6db')");
                lblcommentedrecipe.Attributes.Add("onmouseout", "UnTip()");
            }

            if (user.SavedrecipeCount != 0)
                lblnosavedrecipe.Visible = false;

            if (user.FriendsCount != 0)
                lblnofriends.Visible = false;

            string websiteURL = user.Website;

            if (websiteURL.IndexOf("http://") == -1)
            {
                lblwebsite.Text = "<a title='Ghé thăm trang web' target='_blank' href=" + "http://" + websiteURL + ">" + websiteURL + "</a>";
            }
            if (websiteURL.IndexOf("http://") != -1)
            {
                lblwebsite.Text = "<a title='Ghé thắm trang web' target='_blank' href=" + websiteURL + ">" + websiteURL + "</a>";
            }
            if (websiteURL == "NA")
            {
                lblwebsite.Text = websiteURL;
            }

            GetMetaTitleTagKeywords(user.Username);

            //Check whether the user wants to make Friends List quick view public in profile page.
            //Public view - everyone who access the profile including non-member will be able to see the quick view.
            //Quick view only show up to 20 items maximun. The main Friends List page can show up to 50 or more...
            if (UserFeaturesConfiguration.IsPublicFriendsListQuickView(userID))
            {
                MyFriendsListPanel.Visible = true;

                MyFriendsList.DataSource = MyFriends.GetFriendsList();
                MyFriendsList.DataBind();

                lblmyfriendscount.Text = "(" + MyFriends.TotalCount.ToString() + ")";
            }
            else
            {
                //Private only - only the owner will see the quick view.
                if (Authentication.IsUserAuthenticated && (user_ID == userID))
                {
                    MyFriendsListPanel.Visible = true;

                    MyFriendsList.DataSource = MyFriends.GetFriendsList();
                    MyFriendsList.DataBind();

                    lblmyfriendscount.Text = "(" + MyFriends.TotalCount.ToString() + ")";
                }
            }

            //Check whether the user wants to make the CookBook quick view public in profile page.
            //Public view - everyone who access the profile including non-member will be able to see the quick view.
            //Quick view only show up to 20 items maximun. The main Cook Book page can show up to 50 or more...
            if (UserFeaturesConfiguration.IsPublicCookBookQuickView(userID))
            {
                MyCookBookPanel.Visible = true;

                SavedUserCookBookProfile.DataSource = CookBook.GetUserRecipeInCookBook();
                SavedUserCookBookProfile.DataBind();

                lblmycookbookcount.Text = "(" + user.SavedrecipeCount.ToString() + ")";
            }
            else
            {
                //Private only - only the owner will see the quick view.
                if (Authentication.IsUserAuthenticated && (user_ID == userID))
                {
                    MyCookBookPanel.Visible = true;

                    SavedUserCookBookProfile.DataSource = CookBook.GetUserRecipeInCookBook();
                    SavedUserCookBookProfile.DataBind();

                    lblmycookbookcount.Text = "(" + user.SavedrecipeCount.ToString() + ")";

                }
            }

            //Release allocated memory
            MyFriends = null;
            CookBook = null;
            user = null;

        }
        catch
        {
            Server.Transfer("pagenotfound.aspx");
        }

        //Clean up memory
        Util = null;
    }
Пример #10
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Authentication.IsUserAuthenticated)
        {
            HideContentIfNotLogin.Visible = true;

            int UserID = UserIdentity.UserID;
            string Username = UserIdentity.UserName;

            Blogic.UpdateUserLastLogin(UserID);

            lblusernameheader.Text = "Tài khoản:" + Username;

            ProviderUserDetails user = new ProviderUserDetails();

            user.FillUp(UserID);

            lbllastactivitymsg.Text = " Hoạt động lần cuối vào lúc: (<span style='color: #800000'>" +
                                      string.Format("{0:g}", user.LastLogin) + "</span>)";
            lblmyprofilelink.Text = "<img src='images/user1_icon.gif'>&nbsp;<a href=userprofile.aspx?uid=" + UserID +
                                    ">Hồ sơ của bạn</a>";
            lbleditmyprofile.Text =
                "<img src='images/editsmall.gif'>&nbsp;<a href='editprofile.aspx'>Sửa hồ sơ</a>";
            lblmycookbooklink.Text =
                "<img src='images/cookbookicon_smll.gif'>&nbsp;<a href='myfavorite.aspx'>Mục yêu thích</a>";
            lblmyfriendslistlink.Text =
                "<img src='images/friendlisticon_smll.gif'>&nbsp;<a href='myfriendslist.aspx'>Danh sách bạn bè</a>";
            lblmypminbox.Text = "<img src='images/newmsg_icon_smll2.gif'>&nbsp;<a href='pmview.aspx'>Hộp thư</a>";
            lblmyprofilelink.Attributes.Add("onmouseover",
                                            "Tip('Xem hồ sơ của bạn.', BGCOLOR, '#FFFBE1', BORDERCOLOR, '#acc6db')");
            lblmyprofilelink.Attributes.Add("onmouseout", "UnTip()");
            lbleditmyprofile.Attributes.Add("onmouseover",
                                            "Tip('Cập nhật thông tin, thay đổi mật khẩu, email và ảnh.', BGCOLOR, '#FFFBE1', BORDERCOLOR, '#acc6db')");
            lbleditmyprofile.Attributes.Add("onmouseout", "UnTip()");
            lblmycookbooklink.Attributes.Add("onmouseover",
                                             "Tip('Xem mục yêu thích của bạn.', BGCOLOR, '#FFFBE1', BORDERCOLOR, '#acc6db')");
            lblmycookbooklink.Attributes.Add("onmouseout", "UnTip()");
            lblmyfriendslistlink.Attributes.Add("onmouseover",
                                                "Tip('Xem danh sách bạn bè.', BGCOLOR, '#FFFBE1', BORDERCOLOR, '#acc6db')");
            lblmyfriendslistlink.Attributes.Add("onmouseout", "UnTip()");
            lblmypminbox.Attributes.Add("onmouseover",
                                        "Tip('Xem hòm thư của bạn.', BGCOLOR, '#FFFBE1', BORDERCOLOR, '#acc6db')");
            lblmypminbox.Attributes.Add("onmouseout", "UnTip()");

            GetMetaTitleTagKeywords(Username);
            GetMyStatisticsCounter(user);
            GetCounters(user);
            GetUserWhoAddMeInFriendsList(UserID);
            GetLast5UsersWhoSavedMyRecipeInCookBook(UserID);
            GetDDLSelectedValue();
            GetStatisticsCounters();
            GetReturnFromUpdateMsg();

            user = null;
        }
        else
        {
            GetMetaTitleTagKeywords("Không cho phép xem");
            HideContentIfNotLogin.Visible = false;
            lblyouarenotlogin.Visible = true;
            lblusernameheader.Text = "Tài khoản của bạn bị từ chối xem";
            lblyouarenotlogin.Text =
                "<div style='margin-top: 12px; margin-bottom: 7px;'><img src='images/lock.gif' align='absmiddle'> Bạn không được phép vào trang Tài khoản của tôi. Xin vui lòng đăng nhập để xem tài khoản của bạn.</div>";
        }
    }