public void FillDropDownLists()
        {
            cmbForcePowerDescriptorType.Items.Clear();

            ForcePowerDescriptor FPD = new ForcePowerDescriptor();

            forcePowerDescriptor = FPD.GetForcePowerDescriptors("", "ForcePowerDescriptorName");
            cmbForcePowerDescriptorType.Items.Add("");
            foreach (ForcePowerDescriptor lstFPD in forcePowerDescriptor)
            {
                //cmbForcePowerDescriptorType.ValueMember = "'ForcePowerDescriptorID";
                //cmbForcePowerDescriptorType.DisplayMember = "ForcePowerDescriptorName";
                //cmbForcePowerDescriptorType.DataSource = forcePowerDescriptor;
                cmbForcePowerDescriptorType.Items.Add(lstFPD.ForcePowerDescriptorName);
            }

            this.cmbTurnSegment.Items.Clear();

            TurnSegment turnSeg = new TurnSegment();

            turnSegment = turnSeg.GetTurnSegments("", "TurnSegmentDescription");
            cmbTurnSegment.Items.Add("");
            foreach (TurnSegment lstTurnSegment in turnSegment)
            {
                cmbTurnSegment.Items.Add(lstTurnSegment.TurnSegmentDescription);
            }
            if (dbconn.Open)
            {
                dbconn.CloseDatabaseConnection();
            }
        }
        private ForcePower FillObjectWithForm()
        {
            ForcePower ForcePower             = new ForcePower();
            int        ForcePowerID           = 0;
            int        ForcePowerDescriptorID = 0;
            int        TurnSegmentID          = 0;


            int.TryParse(this.txtForcePowerID.Text, out ForcePowerID);
            //int.TryParse(this.cmbForcePowerDescriptorType.SelectedIndex.ToString(), out ForcePowerDescriptorID);
            if (cmbForcePowerDescriptorType.SelectedText != "")
            {
                ForcePowerDescriptor fpd = new ForcePowerDescriptor();
                fpd.GetForcePowerDescriptor(cmbForcePowerDescriptorType.SelectedText);
                ForcePowerDescriptorID = fpd.ForcePowerDescriptorID;
            }

            //int.TryParse(this.cmbTurnSegment.SelectedIndex.ToString(), out TurnSegment);
            if (cmbTurnSegment.SelectedText != "")
            {
                TurnSegment ts = new TurnSegment();
                ts.GetTurnSegment(cmbTurnSegment.SelectedText);
                TurnSegmentID = ts.TurnSegmentID;
            }

            ForcePower.ForcePowerID          = ForcePowerID;
            ForcePower.ForcePowerDescription = this.txtForcePowerDescription.Text;
            ForcePower.ForcePowerName        = this.txtForcePowerName.Text;
            ForcePower.TurnSegmentID         = TurnSegmentID;
            //ForcePower.ForcePowerDescriptorID = ForcePowerDescriptorID;

            return(ForcePower);
        }
Beispiel #3
0
        public void Test_GetForcePowerDescriptor_ByID_BadResult()
        {
            int intForcePowerDescriptorID = 0;
            ForcePowerDescriptor objForcePowerDescriptor = new ForcePowerDescriptor();

            objForcePowerDescriptor.GetForcePowerDescriptor(intForcePowerDescriptorID);

            Assert.IsNull(objForcePowerDescriptor.ForcePowerDescriptorName);
        }
Beispiel #4
0
        public void Test_GetForcePowerDescriptor_ByID_GoodResult()
        {
            int intForcePowerDescriptorID = 1;
            ForcePowerDescriptor objForcePowerDescriptor = new ForcePowerDescriptor();

            objForcePowerDescriptor.GetForcePowerDescriptor(intForcePowerDescriptorID);

            Assert.AreEqual(intForcePowerDescriptorID, objForcePowerDescriptor.ForcePowerDescriptorID);
        }
Beispiel #5
0
        public void Test_GetForcePowerDescriptor_ByName_BadResult()
        {
            string strForcePowerDescriptorName           = "blah blah";
            ForcePowerDescriptor objForcePowerDescriptor = new ForcePowerDescriptor();

            objForcePowerDescriptor.GetForcePowerDescriptor(strForcePowerDescriptorName);

            Assert.IsNull(objForcePowerDescriptor.ForcePowerDescriptorName);
        }
Beispiel #6
0
        public void Test_GetForcePowerDescriptor_ByName_GoodResult()
        {
            string strForcePowerDescriptorName           = "Telekenitic";
            ForcePowerDescriptor objForcePowerDescriptor = new ForcePowerDescriptor();

            objForcePowerDescriptor.GetForcePowerDescriptor(strForcePowerDescriptorName);

            Assert.AreEqual(strForcePowerDescriptorName, objForcePowerDescriptor.ForcePowerDescriptorName);
        }
Beispiel #7
0
        public void Test_GetForcePowerDescriptors_WithOutOrderBy_NoResult()
        {
            string strWhere   = "ForcePowerDescriptorName Like '%Toad%'";
            string strOrderBy = "";

            ForcePowerDescriptor        objForcePowerDescriptor  = new ForcePowerDescriptor();
            List <ForcePowerDescriptor> lstForcePowerDescriptors = new List <ForcePowerDescriptor>();

            lstForcePowerDescriptors = objForcePowerDescriptor.GetForcePowerDescriptors(strWhere, strOrderBy);

            Assert.IsTrue(lstForcePowerDescriptors.Count == 0);
        }