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);
        }
示例#3
0
        public void Test_GetTurnSegment_ByID_BadResult()
        {
            int         intTurnSegmentID = 0;
            TurnSegment objTurnSegment   = new TurnSegment();

            objTurnSegment.GetTurnSegment(intTurnSegmentID);

            Assert.IsNull(objTurnSegment.TurnSegmentName);
        }
示例#4
0
        public void Test_GetTurnSegment_ByID_GoodResult()
        {
            int         intTurnSegmentID = 1;
            TurnSegment objTurnSegment   = new TurnSegment();

            objTurnSegment.GetTurnSegment(intTurnSegmentID);

            Assert.AreEqual(intTurnSegmentID, objTurnSegment.TurnSegmentID);
        }
示例#5
0
        public void Test_GetTurnSegment_ByName_BadResult()
        {
            string      strTurnSegmentName = "blah blah";
            TurnSegment objTurnSegment     = new TurnSegment();

            objTurnSegment.GetTurnSegment(strTurnSegmentName);

            Assert.IsNull(objTurnSegment.TurnSegmentName);
        }
示例#6
0
        public void Test_GetTurnSegment_ByName_GoodResult()
        {
            string      strTurnSegmentName = "Swift";
            TurnSegment objTurnSegment     = new TurnSegment();

            objTurnSegment.GetTurnSegment(strTurnSegmentName);

            Assert.AreEqual(strTurnSegmentName, objTurnSegment.TurnSegmentName);
        }
示例#7
0
        public void Test_GetTurnSegments_WithOutOrderBy_NoResult()
        {
            string strWhere   = "TurnSegmentName Like '%Toad%'";
            string strOrderBy = "";

            TurnSegment        objTurnSegment  = new TurnSegment();
            List <TurnSegment> lstTurnSegments = new List <TurnSegment>();

            lstTurnSegments = objTurnSegment.GetTurnSegments(strWhere, strOrderBy);

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