Example #1
0
        protected void Edit_Data(object sender, EventArgs e)
        {
            db = new SQLDatabase();
            db.Connect();
            list_users = db.ListUsers();
            string sex  = "";
            string type = "";

            if (!male.Checked && !female.Checked)
            {
                sex = list_users.ElementAt(id_i).sex;
            }
            else
            {
                if (male.Checked)
                {
                    sex = "male";
                }
                else
                {
                    sex = "female";
                }
            }
            if (!volounteer.Checked && !needy.Checked)
            {
                type = list_users.ElementAt(id_i).type;
            }
            else
            {
                if (volounteer.Checked)
                {
                    type = "volounteer";
                }
                else
                {
                    type = "needy";
                }
            }
            if (birthDate.Value == "")
            {
                birthDate.Value = list_users.ElementAt(id_i).birth_date.ToString("yyyy-MM-dd");
            }

            db.EditAccount(id, nickname.Value, pesel.Value, inputEmail.Value, telephone.Value, name.Value, surname.Value, birthDate.Value, sex, type);

            if (!inputEmail.Value.Equals(email))
            {
                Session.RemoveAll();
                Response.Redirect("Login.aspx");
            }
            else
            {
                Response.Redirect("MyAccount.aspx");
            }
            db.Disconnect();
        }