Example #1
0
        //***PROPERTY CRUD***
        private void btnCreateProperty_Click(object sender, EventArgs e)//CREATE PROPERTY
        {
            CASA newHouse = new CASA()
            {
                address = "default"
            };

            db.CASAs.InsertOnSubmit(newHouse);
            db.SubmitChanges();
            currentRecord             = newHouse.Id;
            txtCurrentPropertyId.Text = Convert.ToString(newHouse.Id);

            //combo boxes to blank.
            cboBedrooms.SelectedIndex  = -1;
            cboBathrooms.SelectedIndex = -1;
            cboGarage.SelectedIndex    = -1;
            cboBasement.SelectedIndex  = -1;

            // list of the owner just created with just the ID
            var         data   = db.CASAs.Where(c => c.Id == currentRecord).Select(c => c);
            List <CASA> houses = data.ToList();

            txtCurrentPropertyId.Text = String.Format("{0}", houses[0].Id);
            MessageBox.Show("record created with unique ID, now complete the rest of the form and click save to update the record.");

            DisplayAllPropertyRecords();
            PopulatePropertyComboBox();
            MakePropertyTextBoxesVisible();
        }
Example #2
0
        private void cboPropertyIDs_SelectedIndexChanged(object sender, EventArgs e)
        {
            int         q               = Convert.ToInt32(cboPropertyIDs.SelectedItem); //this is the index in the property list, get it and then get its ID.
            CASA        houseLookup     = new CASA();
            var         display         = db.CASAs.Where(c => c.Id == q).Select(c => c);
            List <CASA> houseLookupList = display.ToList();

            txtCurrentPropertyID.Text      = String.Format("{0}", houseLookupList[0].Id);
            txtCurrentPropertyAddress.Text = String.Format("{0}", houseLookupList[0].address);
        }
Example #3
0
        private void btnDeleteProperty_Click(object sender, EventArgs e)//DELETE PROPERTY
        {
            //get the current record's Id, it's in the text box
            int instantCase  = Convert.ToInt32(txtCurrentPropertyId.Text);
            var itemToDelete = db.CASAs.Where(c => c.Id == currentRecord).Select(c => c).Single();

            //now delete from the record.
            CASA casa = (CASA)itemToDelete;

            db.CASAs.DeleteOnSubmit(casa); db.SubmitChanges();

            //display all data; there is no single record to display because it is deleted.
            DisplayAllPropertyRecords();
            PopulatePropertyComboBox();
        }
Example #4
0
        private void cboAllProperties_SelectedIndexChanged(object sender, EventArgs e)
        {
            //CASA q = new CASA();
            //q = (CASA)cboAllProperties.SelectedItem;
            grpOperatingInputs.Visible = true;
            grpResults.Visible         = false;
            int         q               = Convert.ToInt32(cboAllProperties.SelectedItem);
            CASA        houseLookup     = new CASA();
            var         display         = db.CASAs.Where(c => c.Id == q).Select(c => c);
            List <CASA> houseLookupList = display.ToList();

            currentPropertyId = houseLookupList[0].Id;
            txtCurrentPropertyAnalyzed.Text = String.Format("{0}", currentPropertyId);
            txtAddress.Text = String.Format("{0}", houseLookupList[0].address);
            //var findQ = db.CASAs.Where(c => c.address == q).Select(c => c);
            //List<CASA> foundQList = findQ.ToList();
            //currentPropertyComboBoxIndex = cboAllProperties.SelectedIndex;
            //txtCurrentPropertyAnalyzed.Text = string.Format("{0}", q);
            cboAllProperties.Items.Clear();
            PopulatePropertyComboBox();
        }
 partial void DeleteCASA(CASA instance);
 partial void UpdateCASA(CASA instance);
 partial void InsertCASA(CASA instance);