コード例 #1
0
ファイル: AddToDb.cs プロジェクト: fitzerc/Invoice
        private bool saveValues()
        {
            DatabaseHelper dbAccess = new DatabaseHelper();

            if (basicTypes.Contains(this.type))
            {
                //should this be outisde this if?
                if(this.DescriptionTextBox.Text.Trim() == "")
                {
                    MessageBox.Show(this.DescriptionTextBox.Name + " cannot be blank.");
                    return false;
                }
                return dbAccess.insertRecord(typeInBasicTypes());
            }

            if (this.type == "fittings" || this.type == "supports")
            {
                return dbAccess.insertRecord(fittingsOrSupports());
            }

            //type contained in finishes
            return dbAccess.insertRecord(typeInFinishes());
        }
コード例 #2
0
ファイル: Invoice.cs プロジェクト: fitzerc/Invoice
        private void SupportsComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            if(this.SupportsComboBox.SelectedItem == null)
            {
                this.SupportTypeComboBox.DataSource = null;
                return;
            }

            DatabaseHelper createdb = new DatabaseHelper();
            this.SupportTypeComboBox.DataSource =
            createdb.selectSupportTypeName(this.SupportsComboBox.SelectedItem.ToString());
            this.SupportTypeComboBox.SelectedItem = null;
        }
コード例 #3
0
ファイル: Invoice.cs プロジェクト: fitzerc/Invoice
        //Fill comboboxes. Pass in 'all' to fill all
        private void fillComboBox(string type)
        {
            DatabaseHelper createdb = new DatabaseHelper();

            switch (type)
            {
                case "heads":
                    this.HeadComboBox.DataSource = createdb.selectHeadName();
                    this.HeadComboBox.SelectedItem = null;
                    break;
                case "shells":
                    this.ShellComboBox.DataSource = createdb.selectShellName();
                    this.ShellComboBox.SelectedItem = null;
                    break;
                case "fittings":
                    this.FittingsComboBox.DataSource = createdb.selectFittingName();
                    this.FittingsComboBox.SelectedItem = null;
                    break;
                case "supports":
                    this.SupportsComboBox.DataSource = createdb.selectSupportName();
                    this.SupportsComboBox.SelectedItem = null;
                    break;
                case "internals":
                    this.InternalsComboBox.DataSource = createdb.selectInternalsName();
                    this.InternalsComboBox.SelectedItem = null;
                    break;
                case "interiorPrep":
                    this.InteriorPrepComboBox.DataSource = createdb.selectSurfacePrepInterior();
                    this.InteriorPrepComboBox.SelectedItem = null;
                    break;
                case "exteriorPrep":
                    this.ExteriorPrepComboBox.DataSource = createdb.selectSurfacePrepExterior();
                    this.ExteriorPrepComboBox.SelectedItem = null;
                    break;
                case "exteriorPaint":
                    this.ExteriorPaintComboBox.DataSource = createdb.selectExteriorPaint();
                    this.ExteriorPaintComboBox.SelectedItem = null;
                    break;
                case "interiorPaint":
                    this.InteriorPaintComboBox.DataSource = createdb.selectInteriorPaint();
                    this.InteriorPaintComboBox.SelectedItem = null;
                    break;
                case "all":
                    this.HeadComboBox.DataSource = createdb.selectHeadName();
                    this.ShellComboBox.DataSource = createdb.selectShellName();
                    this.FittingsComboBox.DataSource = createdb.selectFittingName();
                    this.SupportsComboBox.DataSource = createdb.selectSupportName();
                    this.InternalsComboBox.DataSource = createdb.selectInternalsName();
                    this.InteriorPrepComboBox.DataSource = createdb.selectSurfacePrepInterior();
                    this.ExteriorPrepComboBox.DataSource = createdb.selectSurfacePrepExterior();
                    this.ExteriorPaintComboBox.DataSource = createdb.selectExteriorPaint();
                    this.InteriorPaintComboBox.DataSource = createdb.selectInteriorPaint();
                    this.HeadComboBox.SelectedItem = null;
                    this.ShellComboBox.SelectedItem = null;
                    this.FittingsComboBox.SelectedItem = null;
                    this.SupportsComboBox.SelectedItem = null;
                    this.InternalsComboBox.SelectedItem = null;
                    this.InteriorPrepComboBox.SelectedItem = null;
                    this.ExteriorPrepComboBox.SelectedItem = null;
                    this.ExteriorPaintComboBox.SelectedItem = null;
                    this.InteriorPaintComboBox.SelectedItem = null;
                    break;
            }
        }
コード例 #4
0
ファイル: Invoice.cs プロジェクト: fitzerc/Invoice
 /* Fill additional combobox on value change of other */
 private void FittingsComboBox_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (this.FittingsComboBox.SelectedItem == null)
     {
         this.FittingTypesComboBox.DataSource = null;
     }
     else
     {
         DatabaseHelper createdb = new DatabaseHelper();
         this.FittingTypesComboBox.DataSource =
         createdb.selectFittingTypeName(this.FittingsComboBox.SelectedItem.ToString());
         this.FittingTypesComboBox.SelectedItem = null;
     }
 }