示例#1
0
        private void Backbutton_Click(object sender, EventArgs e)
        {
            this.Hide();
            ViewProps view_props = new ViewProps();

            view_props.Show();
        }
示例#2
0
        //---------------------------- delete function-------------------
        public void delete_props(string Pno)
        {
            var delete = MessageBox.Show("Delete Property ?", "Confirm Delete Property", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk);

            if (delete == DialogResult.Yes)
            {
                SqlCommand delete_props = SqlConnectionCommand.getCommand();
                delete_props.CommandText = "USE SRDB DELETE FROM PROPERTY WHERE Pno = @pno";
                delete_props.Parameters.AddWithValue("@Pno", Pno);
                delete_props.ExecuteNonQuery();

                try
                {
                    MessageBox.Show("Successfully Deleted" + " " + Pno,
                                    "Added property", MessageBoxButtons.OK, MessageBoxIcon.Information);

                    this.Hide();
                    ViewProps Props_page = new ViewProps();
                    Props_page.Show();
                }

                catch (Exception ex)
                {
                }
            }


            //  MessageBox.Show(delete_props.CommandText.ToString());
        }
        private void button1_Click(object sender, EventArgs e)
        {
            this.Hide();
            ViewProps Prop_page = new ViewProps();

            Prop_page.Show();
        }
        public void addproperty(string Pno, string type, string status, string Address, string city, string state, string zip, string county,
                                float Area, float price, float tax, string Date, string ownerssn)
        {
            {
                SqlCommand addproperty = SqlConnectionCommand.getCommand();
                addproperty.CommandText = "USE SRDB INSERT INTO PROPERTY Values" +
                                          "(@strPNO, @strtype, @strDate, @floatprice, @strstatus, @floatTax, @strAddress, @strcity, @strstate, @strzip," +
                                          "@strcounty, @floatArea, @strownerssn)";

                //addproperty.Parameters.AddWithValue("@strproperty", comboboxtype.SelectedText);
                addproperty.Parameters.AddWithValue("@strPno", Pno);
                addproperty.Parameters.AddWithValue("@strtype", type);
                addproperty.Parameters.AddWithValue("@strstatus", status);
                addproperty.Parameters.AddWithValue("@strAddress", Address);
                addproperty.Parameters.AddWithValue("@strCity", city);
                addproperty.Parameters.AddWithValue("@strstate", state);
                addproperty.Parameters.AddWithValue("@strzip", zip);
                addproperty.Parameters.AddWithValue("@strcounty", county);
                addproperty.Parameters.AddWithValue("@floatarea", Area);
                addproperty.Parameters.AddWithValue("@floatprice", price);
                addproperty.Parameters.AddWithValue("@floatTax", tax);
                addproperty.Parameters.AddWithValue("@strDate", Date);
                addproperty.Parameters.AddWithValue("@strownerssn", ownerssn);

                //  MessageBox.Show(addproperty.CommandText.ToString());
                try
                {
                    addproperty.ExecuteNonQuery();
                    MessageBox.Show("Successfully added" + " " + Pno + " " + type,
                                    "Added property", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.Hide();
                    ViewProps view_props = new ViewProps();
                    view_props.Show();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(" Please Make sure that you Entered a Valid Seller SSN Number in the OwnerSSN Box ", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);


                    // MessageBox.Show("Faild to Add a property: " + ex.Message, "Add Property Failure", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }//end
            }
        }
示例#5
0
        public void Update_Property(string type, string Pno, string Address, string city, string state, string zip, string county, string status,
                                    float Area, float price, float tax, string Date, string ownerssn)
        {
            {
                SqlCommand Update_Property = SqlConnectionCommand.getCommand();
                Update_Property.CommandText = "USE srdb UPDATE PROPERTY SET " +
                                              "Type = @strtype, Date = @strDate, price = @floatprice, status = @strstatus, Tax = @floatTax, Address = @strAddress, city = @strcity, state = @strstate, zip = @strzip," +
                                              " county = @strcounty, Area = @floatArea, ownerssn = @strOwnerssn WHERE PNO = @strPno";

                //addproperty.Parameters.AddWithValue("@strproperty", comboboxtype.SelectedText);
                Update_Property.Parameters.AddWithValue("@strPno", Pno);
                Update_Property.Parameters.AddWithValue("@strtype", type);
                Update_Property.Parameters.AddWithValue("@strstatus", status);
                Update_Property.Parameters.AddWithValue("@strAddress", Address);
                Update_Property.Parameters.AddWithValue("@strCity", city);
                Update_Property.Parameters.AddWithValue("@strstate", state);
                Update_Property.Parameters.AddWithValue("@strzip", zip);
                Update_Property.Parameters.AddWithValue("@strcounty", county);
                Update_Property.Parameters.AddWithValue("@floatarea", Area);
                Update_Property.Parameters.AddWithValue("@floatprice", price);
                Update_Property.Parameters.AddWithValue("@floatTax", tax);
                Update_Property.Parameters.AddWithValue("@strDate", Date);
                Update_Property.Parameters.AddWithValue("@strOwnerssn", ownerssn);

                //   MessageBox.Show(Update_Property.CommandText.ToString());
                try
                {
                    Update_Property.ExecuteNonQuery();
                    MessageBox.Show("Successfully Updated" + " " + Pno + " " + type,
                                    "Updated property", MessageBoxButtons.OK, MessageBoxIcon.Information);

                    this.Hide();
                    ViewProps view_props = new ViewProps();
                    view_props.Show();
                }
                catch (Exception ex)
                {
                    //MessageBox.Show(" Please Enter a Different PNO Number ", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    MessageBox.Show("Faild to Update a property: " + ex.Message, "Update Property Failure", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }//end
            }
        }