private void btnSave_Click(object sender, EventArgs e)
        {
            int reportIndex = Convert.ToInt32(NumberIndex.Value);

            reportIndex--;
            if (reportIndex < 0)
            {
                MessageBox.Show("报告索引不能小于1");
                NumberIndex.Focus();
                return;
            }

            Boolean bResult = ModuleHelperClient.UpdateReportIndex(ModuleID, reportIndex, ComboCatlog.Text);

            if (bResult)
            {
                MessageBox.Show("设置成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("设置失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            //this.DialogResult = DialogResult.Yes;
            this.Close();
        }
Exemple #2
0
        public void Test_Duration_NumberIndexSetter_DurationIsNull()
        {
            //Arrange
            Duration    Duration = null;
            NumberIndex Index    = new NumberIndex();

            //Act
            ActualValueDelegate <NumberIndex> testDelegate = () => IndexSetterFactory.Create(typeof(NumberIndex)).Set(Duration, Index) as NumberIndex;

            //Assert
            Assert.That(testDelegate, Throws.TypeOf <ArgumentNullException>());
        }
Exemple #3
0
        private void mergeUtil(NumberIndex[] nums, int[] result, int low, int high)
        {
            if (low == high)
            {
                return;
            }
            int mid = (low + high) / 2;

            mergeUtil(nums, result, low, mid);
            mergeUtil(nums, result, mid + 1, high);

            int i = low;
            int j = mid + 1;

            NumberIndex[] t = new NumberIndex[high - low + 1];
            int           k = 0;

            int[] tempResult = new int[high - low + 1];
            while (i <= mid && j <= high)
            {
                if (nums[i].val <= nums[j].val)
                {
                    tempResult[nums[i].index - low] = j - mid - 1;
                    t[k++] = nums[i++];
                }
                else
                {
                    tempResult[nums[i].index - low] = j - mid;
                    t[k++] = nums[j++];
                }
            }
            int i1 = i;

            while (i1 <= mid)
            {
                tempResult[nums[i1].index - low] = j - mid - 1;
                t[k++] = nums[i1++];
            }

            while (j <= high)
            {
                t[k++] = nums[j++];
            }

            k = 0;
            for (i = low; i <= high; i++)
            {
                nums[i]    = t[k];
                result[i] += tempResult[k++];
            }
        }
Exemple #4
0
        public void Test_Duration_NumberIndexSetter_NoNumberValue()
        {
            //Arrange
            var Comparator = Quantity.QuantityComparator.GreaterOrEqual;
            var Duration   = new Duration();

            Duration.Comparator = Comparator;
            NumberIndex Index = new NumberIndex();

            //Act
            Index = IndexSetterFactory.Create(typeof(NumberIndex)).Set(Duration, Index) as NumberIndex;

            //Assert
            Assert.IsNull(Index);
        }
Exemple #5
0
        public void Test_PositiveInt_NumberIndexSetter_Value_IsNull()
        {
            //Arrange
            var PositiveInt = new PositiveInt();

            PositiveInt.Value = null;

            NumberIndex Index = new NumberIndex();

            //Act
            Index = IndexSetterFactory.Create(typeof(NumberIndex)).Set(PositiveInt, Index) as NumberIndex;

            //Assert
            Assert.IsNull(Index);
        }
Exemple #6
0
        public void Test_Integer_NumberIndexSetter_Value_IsNull()
        {
            //Arrange
            var Integer = new Integer();

            Integer.Value = null;

            NumberIndex Index = new NumberIndex();

            //Act
            Index = IndexSetterFactory.Create(typeof(NumberIndex)).Set(Integer, Index) as NumberIndex;

            //Assert
            Assert.IsNull(Index);
        }
Exemple #7
0
        public void Test_PositiveInt_NumberIndexSetter_BadFormat()
        {
            //Arrange
            int Value       = -13;
            var PositiveInt = new PositiveInt();

            PositiveInt.Value = Value;

            NumberIndex Index = new NumberIndex();

            //Act
            ActualValueDelegate <NumberIndex> testDelegate = () => IndexSetterFactory.Create(typeof(NumberIndex)).Set(PositiveInt, Index) as NumberIndex;

            //Assert
            Assert.That(testDelegate, Throws.TypeOf <FormatException>());
        }
Exemple #8
0
        public void Test_Integer_NumberIndexSetter_GoodFormat()
        {
            //Arrange
            int Value   = 13;
            var Integer = new Integer();

            Integer.Value = Value;

            NumberIndex Index = new NumberIndex();

            //Act
            Index = IndexSetterFactory.Create(typeof(NumberIndex)).Set(Integer, Index) as NumberIndex;

            //Assert
            Assert.AreEqual(Index.Quantity, Value);
            Assert.IsNull(Index.Comparator);
        }
Exemple #9
0
        public void Test_Duration_NumberIndexSetter_GoodFormatNoComparator()
        {
            //Arrange
            decimal Value    = 123.500M;
            var     Duration = new Duration();

            Duration.Value = Value;

            NumberIndex Index = new NumberIndex();

            //Act
            Index = IndexSetterFactory.Create(typeof(NumberIndex)).Set(Duration, Index) as NumberIndex;

            //Assert
            Assert.AreEqual(Index.Quantity, Value);
            Assert.IsNull(Index.Comparator);
        }
Exemple #10
0
        public void Test_PositiveInt_NumberIndexSetter_GoodFormat()
        {
            //Arrange
            int Value       = 13;
            var PositiveInt = new PositiveInt();

            PositiveInt.Value = Value;

            NumberIndex Index = new NumberIndex();

            //Act
            Index = IndexSetterFactory.Create(typeof(NumberIndex)).Set(PositiveInt, Index) as NumberIndex;

            //Assert
            Assert.AreEqual(Index.Quantity, Value);
            Assert.IsNull(Index.Comparator);
        }
Exemple #11
0
        public void Test_Duration_NumberIndexSetter_GoodFormat()
        {
            //Arrange
            decimal Value      = 10.5M;
            var     Comparator = Quantity.QuantityComparator.GreaterOrEqual;
            var     Duration   = new Duration();

            Duration.Value      = Value;
            Duration.Comparator = Comparator;
            NumberIndex Index = new NumberIndex();

            //Act
            Index = IndexSetterFactory.Create(typeof(NumberIndex)).Set(Duration, Index) as NumberIndex;

            //Assert
            Assert.AreEqual(Index.Quantity, Value);
            Assert.AreEqual(Index.Comparator, Comparator);
        }
Exemple #12
0
        public virtual IList <int?> countSmaller(int[] nums)
        {
            if (nums.Length == 0)
            {
                return(new List <int?>());
            }
            NumberIndex[] input = new NumberIndex[nums.Length];
            for (int i = 0; i < nums.Length; i++)
            {
                input[i] = new NumberIndex(nums[i], i);
            }

            int[] result = new int[nums.Length];

            mergeUtil(input, result, 0, input.Length - 1);

            IList <int?> r = new List <int?>();

            foreach (int s in result)
            {
                r.Add(s);
            }
            return(r);
        }