Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            String    x    = Request.QueryString["name"];
            DataTable data = Database.Query.ExecuteReturnCommand("Select ID from Accounts WHERE Name = '" + x + "';");
            String    ID   = data.Rows[0].ItemArray[0].ToString();

            Database.HelloWorldQueryMethods.Account acc = Database.HelloWorldQueryMethods.GetAccountFromID(ID);
            name.InnerText    = acc.Name;
            email.Value       = acc.Email;
            Year.Value        = Database.HelloWorldQueryMethods.YearfromInt(acc.Year);
            description.Value = acc.Desc;
        }
Esempio n. 2
0
        protected void CreateEve_ServerClick(object sender, EventArgs e)
        {
            String sportsBox      = SportName.Value;
            String profeciencyBox = proficiency.Value;
            String genderBox      = Gender.Value;
            int    reqPeopleBox   = Int32.Parse(ReqPeople.Value);

            if (reqPeopleBox <= 0)
            {
                failedMessage.Visible   = true;
                failedMessage.InnerText = "The Number of people MUST be greater than 0";
            }
            else
            {
                reqPeopleBox++;//this is to accomodate the host as one participant

                String locationBox         = Location.Value;
                String sportDescriptionBox = SportDescription.Value;
                String dateBox             = Calendar.SelectedDate.ToString("yyyy-MM-dd");
                String timeBox             = appt.Value;
                String dateTimeBox         = dateBox + " " + timeBox + ":00";
                Database.HelloWorldQueryMethods.Posts posts = new Database.HelloWorldQueryMethods.Posts();
                posts.Title = sportsBox;
                Database.HelloWorldQueryMethods.Account acc = new Database.HelloWorldQueryMethods.Account();
                //Cookies.WriteCookie("10001", this.Response); // To be removed when sites are connected
                acc = Database.HelloWorldQueryMethods.GetAccountFromCookie(this.Request, this.Response);
                posts.Posts_Name   = acc.Name;
                posts.Gender       = genderBox;
                posts.Desc         = sportDescriptionBox;
                posts.Location     = locationBox;
                posts.NumberNeeded = reqPeopleBox;
                posts.Proficiency  = profeciencyBox;
                posts.DateTime     = DateTime.Parse(dateTimeBox);



                try
                {
                    string postID = Database.HelloWorldQueryMethods.CreatePostInDataBase(posts);
                    Database.HelloWorldQueryMethods.Involvement involvement = new Database.HelloWorldQueryMethods.Involvement();
                    involvement.AccountsID   = acc.ID;
                    involvement.Posts_PostID = postID;
                    involvement.IsHost       = true;
                    Database.HelloWorldQueryMethods.InsertInvolvement(involvement);
                    Response.Redirect("MainPage.aspx");
                }
                catch
                {
                }
            }
        }
Esempio n. 3
0
 protected void SubmitChanges_ServerClick(object sender, EventArgs e)
 {
     acc      = Database.HelloWorldQueryMethods.GetAccountFromCookie(this.Request, this.Response);
     acc.Name = ProfileName.Value.ToString();
     Console.WriteLine(acc.Name);
     acc.Phone = Profile_PhoneNumber.Value.ToString();
     acc.Year  = Database.HelloWorldQueryMethods.IntfromYear(Profile_Year.Value.ToString());
     acc.Desc  = Profile_Description.Value.ToString();
     acc.Email = ProfileEmail.Value.ToString();
     if (Profile_Password.Value != null)
     {
         if (Profile_Password.Value.ToString().Equals(Profile_Password1.Value.ToString()))
         {
             acc.Password    = Profile_Password.Value.ToString();
             Success.Visible = true;
         }
         else
         {
             Error_Flag.Visible = true;
         }
     }
     else
     {
         Success.Visible = true;
     }
     Database.HelloWorldQueryMethods.UpdateAccount(acc);
     Edit.Visible              = true;
     SubmitChanges.Visible     = false;
     label1.Visible            = false;
     label2.Visible            = false;
     Profile_Password1.Visible = false;
     Profile_Password.Visible  = false;
     ProfileName.Attributes.Add("readonly", "readonly");
     ProfileEmail.Attributes.Add("readonly", "readonly");
     Profile_Description.Attributes.Add("readonly", "readonly");
     Profile_PhoneNumber.Attributes.Add("readonly", "readonly");
     Profile_Year.Attributes.Add("readonly", "readonly");
     Profile_Password.Attributes.Add("readonly", "readonly");
     Profile_Password1.Attributes.Add("readonly", "readonly");
 }
Esempio n. 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Error_Flag.Visible = false;
            Success.Visible    = false;
            profileBtn.Enabled = false;

            if (!IsPostBack)
            {
                //Cookies.WriteCookie("10001", this.Response);
                string x = Cookies.ReadCookie(this.Request, this.Response);
                if (String.IsNullOrWhiteSpace(x))
                {
                    Response.Redirect("LoginPage.aspx");
                }
                acc = Database.HelloWorldQueryMethods.GetAccountFromCookie(this.Request, this.Response);


                Edit.Visible              = true;
                SubmitChanges.Visible     = false;
                label1.Visible            = false;
                label2.Visible            = false;
                Profile_Password1.Visible = false;
                Profile_Password.Visible  = false;
                //Filling in textboxes
                ProfileName.Value         = acc.Name;
                ProfileEmail.Value        = acc.Email;
                Profile_Description.Value = acc.Desc;
                Profile_PhoneNumber.Value = acc.Phone;
                Profile_Year.Value        = Database.HelloWorldQueryMethods.YearfromInt(acc.Year);

                //Making Readonly
                ProfileName.Attributes.Add("readonly", "readonly");
                ProfileEmail.Attributes.Add("readonly", "readonly");
                Profile_Description.Attributes.Add("readonly", "readonly");
                Profile_PhoneNumber.Attributes.Add("readonly", "readonly");
                Profile_Year.Attributes.Add("readonly", "readonly");
                Profile_Password.Attributes.Add("readonly", "readonly");
                Profile_Password1.Attributes.Add("readonly", "readonly");
            }
        }