Exemplo n.º 1
0
        private void btnCancel_Click(object sender, EventArgs e)
        {
            OwnerHomePage ohp = new OwnerHomePage(userid, status);

            ohp.Show();
            this.Hide();
        }
Exemplo n.º 2
0
        private void btnSubmitAds_Click(object sender, EventArgs e)
        {
            string title = txtTitle.Text;
            //string month = combxMonth.GetItemText(combxMonth.SelectedItem);
            //string year = combxYear.GetItemText(combxYear.SelectedItem);
            //string date = month + ", " + year;
            string date     = dtpDate.Text;
            string rent     = txtRent.Text;
            string renttype = null;

            if (rbtnFixed.Checked)
            {
                renttype = "(Fixed)";
            }
            else if (rbtnNegotiable.Checked)
            {
                renttype = "(Negotiable)";
            }

            string seat    = txtSeat.Text;
            string address = txtAddress.Text;
            string city    = combxCity.GetItemText(combxCity.SelectedItem);
            string area    = combxArea.GetItemText(combxArea.SelectedItem);
            string details = txtDetails.Text;

            string ownerName  = txtOwnerName.Text;
            string ownerEmail = txtOwnerEmail.Text;
            string ownerPhone = txtOwnerPhone.Text;

            SavePicture();

            try
            {
                DBConnect dbc = new DBConnect();

                string query = "insert into MessDetails(userid, title, date, rent, renttype, seat, address, city, area, details, name, email, phone, photo) values("
                               + userid + ",'" + title + "','" + date + "'," + rent + ",'" + renttype + "'," + seat + ",'" + address + "','" + city + "','" + area + "','"
                               + details + "','" + ownerName + "','" + ownerEmail + "','" + ownerPhone + "','" + dpath + "' " + ");";

                dbc.InsertIntoDatabase(query);
                MessageBox.Show("Ads Posted! Wait For Verification");
                OwnerHomePage ohp = new OwnerHomePage(userid, status);
                ohp.Show();
                this.Hide();
            }
            catch (Exception er)
            {
                MessageBox.Show("Enter All Data Correctly");
                Console.WriteLine("Error : " + er);
            }
        }
Exemplo n.º 3
0
        private void btnSubmitAds_Click(object sender, EventArgs e)
        {
            string title = txtTitle.Text;
            //string month = combxMonth.GetItemText(combxMonth.SelectedItem);
            //string year = combxYear.GetItemText(combxYear.SelectedItem);
            //string date = month + ", " + year;
            string date     = dtpDate.Text;
            string rent     = txtRent.Text;
            string renttype = null;

            if (rbtnFixed.Checked)
            {
                renttype = "(Fixed)";
            }
            else if (rbtnNegotiable.Checked)
            {
                renttype = "(Negotiable)";
            }

            String specialFacility = null;

            if (chkLift.Checked == true && chkWifi.Checked == true && chkGenerator.Checked == true)
            {
                specialFacility = "Lift, Generator, WiFi";
            }
            else if (chkLift.Checked == true && chkGenerator.Checked == true)
            {
                specialFacility = "Lift, Generator";
            }
            else if (chkGenerator.Checked == true && chkWifi.Checked == true)
            {
                specialFacility = "Generator, WiFi";
            }
            else if (chkLift.Checked == true && chkWifi.Checked == true)
            {
                specialFacility = "Lift, WiFi";
            }
            else if (chkLift.Checked)
            {
                specialFacility = "Lift";
            }
            else if (chkGenerator.Checked)
            {
                specialFacility = "Generator";
            }
            else if (chkWifi.Checked)
            {
                specialFacility = "WiFi";
            }

            string address = txtAddress.Text;
            string city    = combxCity.GetItemText(combxCity.SelectedItem);
            string area    = combxArea.GetItemText(combxArea.SelectedItem);
            string details = txtDetails.Text;

            string ownerName  = txtOwnerName.Text;
            string ownerEmail = txtOwnerEmail.Text;
            string ownerPhone = txtOwnerPhone.Text;

            //ArrayList info = new ArrayList();
            //info.Add(userid);
            //info.Add(title);
            //info.Add(date);
            //info.Add(rent);
            //info.Add(renttype);
            //info.Add(specialFacility);
            //info.Add(address);
            //info.Add(city);
            //info.Add(area);
            //info.Add(details);
            //info.Add(ownerName);
            //info.Add(ownerEmail);
            //info.Add(ownerPhone);
            //info.Add(dpath);

            SavePicture();

            try
            {
                DBConnect dbc = new DBConnect();

                string query = "insert into SubletDetails(userid, title, date, rent, renttype, specialfacility, address, city, area, details, name, email, phone, photo) values("
                               + userid + ",'" + title + "','" + date + "'," + rent + ",'" + renttype + "','" + specialFacility + "','" + address + "','" + city + "','"
                               + area + "','" + details + "','" + ownerName + "','" + ownerEmail + "','" + ownerPhone + "','" + dpath + "' " + ");";

                dbc.InsertIntoDatabase(query);
                MessageBox.Show("Ads Posted! Wait For Verification");
                OwnerHomePage ohp = new OwnerHomePage(userid, status);
                ohp.Show();
                this.Hide();
            }
            catch (Exception er)
            {
                MessageBox.Show("Enter All Data Correctly");
                Console.WriteLine("Error : " + er);
            }
        }
Exemplo n.º 4
0
        private void btnLogIn_Click(object sender, EventArgs e)
        {
            DBConnect dbc = new DBConnect();

            string username = txtLogInUserName.Text;
            string password = txtLogInPassword.Text;
            string dpass    = "";
            string userid   = null;
            string status   = null;

            if (rbtnLogInOwner.Checked)
            {
                try
                {
                    string  query = "select password, userid, status from OwnerDetails where username = '******'";
                    DataSet ds    = dbc.GetInfo(query);

                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        dpass  = ds.Tables[0].Rows[i]["password"].ToString();
                        userid = ds.Tables[0].Rows[i]["userid"].ToString();
                        status = ds.Tables[0].Rows[i]["status"].ToString();
                    }

                    if (dpass == password)
                    {
                        Owner.OwnerHomePage ohp = new Owner.OwnerHomePage(userid, status);
                        ohp.Show();
                        this.Hide();
                    }
                    else
                    {
                        MessageBox.Show(this, "Username or Password Incorrect. Try again");
                        txtLogInPassword.Text = "";
                    }
                }
                catch (Exception er)
                {
                    Console.WriteLine("Error : " + er);
                }
            }
            else if (rbtnLogInStudent.Checked)
            {
                try
                {
                    string  query = "select password, userid, status from StudentDetails where username = '******'";
                    DataSet ds    = dbc.GetInfo(query);

                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        dpass  = ds.Tables[0].Rows[i]["password"].ToString();
                        userid = ds.Tables[0].Rows[i]["userid"].ToString();
                        status = ds.Tables[0].Rows[i]["status"].ToString();
                    }

                    if (dpass == password)
                    {
                        Student.StudentHomePage shp = new Student.StudentHomePage(userid, status);
                        shp.Show();
                        this.Hide();
                    }
                    else
                    {
                        MessageBox.Show(this, "Username or Password Incorrect. Try again");
                        txtLogInPassword.Text = "";
                    }
                }
                catch (Exception er)
                {
                    Console.WriteLine("Error : " + er);
                }
            }
            else
            {
                MessageBox.Show("Select Owner/Student");
            }
        }