private void btnCancel_Click(object sender, EventArgs e)
        {
            ShowYourAds sya = new ShowYourAds(userid, status);

            sya.Show();
            this.Hide();
        }
        private void btnDelete_Click(object sender, EventArgs e)
        {
            try
            {
                DBConnect dbc = new DBConnect();

                String query = "Delete from MessDetails where messid = " + messid + " ;";



                dbc.InsertIntoDatabase(query);

                //string folderPath = appStartPath + "\\AdvertisePicture\\MessAdsPicture\\" + messid.ToString();
                //DeleteDirectory(folderPath);
                //if (Directory.Exists(folderPath))
                //{
                //    Directory.Delete(folderPath, true);
                //}

                MessageBox.Show("Ads Deleted!");
                ShowYourAds sya = new ShowYourAds(userid, status);
                sya.Show();
                this.Hide();
            }
            catch (Exception er)
            {
                MessageBox.Show("Enter All Data Correctly");
                Console.WriteLine("Error : " + er);
            }
        }
Ejemplo n.º 3
0
 private void lblShowAds_Click(object sender, EventArgs e)
 {
     if (status == "Verified")
     {
         ShowYourAds sad = new ShowYourAds(userid, status);
         sad.Show();
         this.Hide();
     }
     else
     {
         MessageBox.Show(this, "Please Verify Your Account.");
     }
 }
        private void btnUpdate_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 seat     = txtSeat.Text;
            string rent     = txtRent.Text;
            string renttype = null;

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

            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;
            string newstatus  = "Unverified";

            try
            {
                DBConnect dbc = new DBConnect();

                String query = "Update MessDetails set userid = " + userid + ", title = '" + title + "', date = '" + date + "', seat = "
                               + seat + ", rent= " + rent + ", renttype= '" + renttype + "', address = '" + address + "', city = '" + city + "', area = '" + area + "', details = '" + details + "', name = '"
                               + ownerName + "', email = '" + ownerEmail + "', phone = '" + ownerPhone + "', status = '" + newstatus + "' where messid = " + messid + " ;";

                dbc.InsertIntoDatabase(query);
                MessageBox.Show("Ads Updated! Wait For Verification");
                ShowYourAds sya = new ShowYourAds(userid, status);
                sya.Show();
                this.Hide();
            }
            catch (Exception er)
            {
                MessageBox.Show("Enter All Data Correctly");
                Console.WriteLine("Error : " + er);
            }
        }
        private void btnUpdate_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 size     = txtSize.Text;
            string bedroom  = txtBedroom.Text;
            string bathroom = txtBathroom.Text;
            string corridor = txtCorridor.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;
            string newstatus  = "Unverified";

            try
            {
                DBConnect dbc = new DBConnect();

                String query = "Update FlatDetails set userid = " + userid + ", title = '" + title + "', date = '" + date + "', size = " + size + ", bedroom = "
                               + bedroom + ", bathroom = " + bathroom + ", corridor= " + corridor + ", rent= " + rent + ", renttype= '" + renttype + "', specialfacility= '"
                               + specialFacility + "', address = '" + address + "', city = '" + city + "', area = '" + area + "', details = '" + details + "', name = '"
                               + ownerName + "', email = '" + ownerEmail + "', phone = '" + ownerPhone + "', status = '" + newstatus + "' where flatid = " + flatid + " ;";

                dbc.InsertIntoDatabase(query);
                MessageBox.Show("Ads Updated! Wait For Verification");
                ShowYourAds sya = new ShowYourAds(userid, status);
                sya.Show();
                this.Hide();
            }
            catch (Exception er)
            {
                MessageBox.Show("Enter All Data Correctly");
                Console.WriteLine("Error : " + er);
            }
        }