예제 #1
0
 private void btn_signIn_Click(object sender, EventArgs e)
 {
     try
     {
         con.Open();
         cmd.Connection  = con;
         cmd.CommandText = "select * from Profile where UserName='******'";
         dr = cmd.ExecuteReader();
         if (dr.HasRows)
         {   //get the FK
             FK = txt_username.Text;
             Boolean ok = false;
             while (dr.Read() && ok == false)
             {
                 if (!txt_password.Text.Equals(dr["Password"]))
                 {
                     MessageBox.Show("You need to check your password!"); ok = true;
                 }
                 else if (!txt_Email.Text.Equals(dr["Email"]))
                 {
                     MessageBox.Show("You need to check your E-mail!"); ok = true;
                 }
             }
             if (ok == false)
             {
                 dsh.Show();
                 this.Hide();
                 fb.Hide();
                 tw.Hide();
                 gp.Hide();
             }
         }
         else
         {
             if (txt_password.Text.Equals("") && txt_Email.Text.Equals("") && txt_username.Text.Equals(""))
             {
                 MessageBox.Show("The fields are empty");
             }
             else
             {
                 MessageBox.Show("You need to register!");
             }
             dr.Close();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
     finally
     {
         if (con.State == ConnectionState.Open)
         {
             con.Close();
         }
     }
 }
예제 #2
0
        private void btn_OK_Click(object sender, EventArgs e)
        {
            PersonalInformation p = new PersonalInformation();

            p.Show();
            this.Hide();
            Facebook   f  = new Facebook();
            GooglePlus gp = new GooglePlus();
            twitter    t  = new twitter();

            f.Hide();
            gp.Hide();
            t.Hide();
        }
예제 #3
0
        private void btnSavePersInfo_Click(object sender, EventArgs e)
        {
            SqlConnection con = new SqlConnection();

            con.ConnectionString = @"Data Source=DESKTOP-69MM1NJ\SQLEXPRESS;Initial Catalog=NadhamniDB;Integrated Security=True;Pooling=False";


            try
            {  //tbar9ich lel BD
                if (days != 0)
                {
                    activity = txt_activityInfo.Text;
                }
                else
                {
                    activity = "no activity";
                }
                if (work.Equals("no"))
                {
                    typeofwork = "unemployment";
                }
                else
                {
                    typeofwork = txt_WorkInfo.Text;
                }

                con.Open();
                SqlCommand cmd = new SqlCommand("update Profile set FirstName=@FirstName,LastName=@LastName,Gender=@Gender,Birthday=@Birthday,Adress=@Adress,Work=@Work,TypeOfWork=@TypeOfWork,Student=@Student,CivilStatus=@CivilStatus,Kids=@Kids,Health=@Health,Consultation=@Consultation,DrName=@DrName,Exercice=@Exercice,TypeOfActivity=@TypeOfActivity,DaysOfPractice=@DaysOfPractice where UserName='******'", con);
                cmd.CommandType = CommandType.Text;
                // Add parameters
                cmd.Parameters.AddWithValue("@FirstName", txt_firstnameInfo.Text);
                cmd.Parameters.AddWithValue("@LastName", txt_lastnameInfo.Text);
                cmd.Parameters.AddWithValue("@Gender", gender);
                cmd.Parameters.AddWithValue("@Birthday", birthdayInfo.Value.ToString());
                cmd.Parameters.AddWithValue("@Adress", txt_AdrInfo.Text);
                cmd.Parameters.AddWithValue("@Work", work);
                cmd.Parameters.AddWithValue("@TypeOfWork", typeofwork);
                cmd.Parameters.AddWithValue("@Student", student);
                cmd.Parameters.AddWithValue("@CivilStatus", CivilStatus);
                cmd.Parameters.AddWithValue("@Kids", kids);
                cmd.Parameters.AddWithValue("@Health", health);
                cmd.Parameters.AddWithValue("@Consultation", ConsultationInfo.Value.ToString());
                cmd.Parameters.AddWithValue("@DrName", txt_docNameInfo.Text);
                cmd.Parameters.AddWithValue("@Exercice", exercice);
                cmd.Parameters.AddWithValue("@TypeOfActivity", activity);
                cmd.Parameters.AddWithValue("@DaysOfPractice", days);

                cmd.ExecuteNonQuery();

                //Moving to the rest of interfaces
                Facebook   f  = new Facebook();
                GooglePlus gp = new GooglePlus();
                twitter    t  = new twitter();
                if (Mar)
                {
                    Spouse sp = new Spouse();
                    sp.Show();
                    this.Hide();
                    f.Hide();
                    gp.Hide();
                    t.Hide();
                }

                if ((wid || Div) && (kid))
                {
                    Kids k = new Kids();
                    k.Show();
                    this.Hide();
                    f.Hide();
                    gp.Hide();
                    t.Hide();
                }
                if (sing)
                {
                    Parents p = new Parents();
                    p.Show();
                    this.Hide();
                    f.Hide();
                    gp.Hide();
                    t.Hide();
                }
                if ((wid || Div) && (!kid))
                {
                    Parents p = new Parents();
                    p.Show();
                    this.Hide();
                    f.Hide();
                    gp.Hide();
                    t.Hide();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                if (con.State == ConnectionState.Open)
                {
                    con.Close();
                }
            }
        }