Esempio n. 1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            ForcePower ForcePower = FillObjectWithForm();

            if (ForcePower.Validate())
            {
                try
                {
                    ForcePower.SaveForcePower();
                }
                catch (Exception ex)
                {
                    throw ex;
                }
                finally
                {
                    MessageBox.Show("Reload does not work.  ");  //TODO: Mulitple descriptors now, this needs to be looked at.
                    //MessageBox.Show("The ForcePower was saved Successfully", "Saved Successfully", MessageBoxButtons.OK);
                    //FillDropDownLists();
                    //this.cmbForcePowerDescriptorType.SelectedItem = ForcePower.objForcePowerDescriptor.ForcePowerDescriptorName;
                }
            }
            else
            {
                MessageBox.Show(ForcePower.ValidationMessage, "ForcePower is not valid!", MessageBoxButtons.OK);
            }
            if (dbconn.Open)
            {
                dbconn.CloseDatabaseConnection();
            }
            this.btnSave.Enabled = false;
            this.btnNew.Enabled  = true;
            this.btnEdit.Enabled = false;
        }
        public void Test_SaveAndDeleteForcePower()
        {
            bool returnVal;

            objNewForcePower.SaveForcePower();

            Assert.IsTrue(objNewForcePower.ForcePowerID != 0);

            returnVal = objNewForcePower.DeleteForcePower();

            Assert.IsTrue(returnVal && objNewForcePower.DeleteOK);
        }