示例#1
0
        /// <summary>
        /// Creates an exact copy of a grouptype, including its list of ItemTypeOrders
        /// </summary>
        /// <param name="gt"></param>
        /// <returns></returns>
        public GroupType DeepCopyGroupType(GroupType gt)
        {
            GroupType deepCopyGroupType = new GroupType();
            deepCopyGroupType.DanishTranslationText = gt.DanishTranslationText;
            deepCopyGroupType.EnglishTranslationText = gt.EnglishTranslationText;
            deepCopyGroupType.GroupHeader = gt.GroupHeader;
            deepCopyGroupType.GroupTypeID = gt.GroupTypeID;
            deepCopyGroupType.ItemOrder = gt.ItemOrder;
            deepCopyGroupType.LanguageID = gt.LanguageID;
            deepCopyGroupType.ResourceID = gt.ResourceID;
            deepCopyGroupType.ResourceType = gt.ResourceType;
            deepCopyGroupType.ResourceTypeID = gt.ResourceTypeID;
            ObservableCollection<ItemTypeOrder> deepCopyItemTypeOrders = new ObservableCollection<ItemTypeOrder>();
            foreach (ItemTypeOrder ito in gt.ItemOrder)
            {
                ItemTypeOrder clonedito = new ItemTypeOrder();
                clonedito.DesignID = ito.DesignID;
                clonedito.GroupTypeID = ito.GroupTypeID;
                clonedito.IncludedTypeID = ito.IncludedTypeID;
                clonedito.Item = ito.Item;
                clonedito.ItemOrder = ito.ItemOrder;
                deepCopyItemTypeOrders.Add(clonedito);
            }

            deepCopyGroupType.ItemOrder = deepCopyItemTypeOrders;
            return deepCopyGroupType;
        }
 private void AddNewEmptyItemRow()
 {
     RowDefinition rd = new RowDefinition();
     GroupTable.RowDefinitions.Add(rd);
     int row = GroupTable.RowDefinitions.Count - 1;
     int i = 0;
     while (i < GroupTable.ColumnDefinitions.Count)
     {
         ItemTypeOrder item = new ItemTypeOrder();
         item.ItemOrder = ((row - 1) * 4) + i;
         Border border = CreateItemCell(item);
         Grid.SetRow(border, row);
         Grid.SetColumn(border, i);
         GroupTable.Children.Add(border);
         i++;
     }
 }
        /// <summary>
        /// Handles drop logic for NewLineItem from toolbox
        /// </summary>
        /// <param name="dropTargetItemTypeOrder"></param>
        /// <param name="tbi"></param>
        /// <param name="gt"></param>
        public void ToolboxSpecialNewLineItemDrop(ItemTypeOrder dropTargetItemTypeOrder, ToolboxItem tbi, GroupType gt)
        {
            CheckForNewLineItem(dropTargetItemTypeOrder);
            ItemTypeOrder itemTypeOrder = new ItemTypeOrder();
            itemTypeOrder.DesignID = tbi.ItemType.DesignID;
            ItemType itemType = new ItemType();
            itemType.DesignID = tbi.ItemType.DesignID;
            itemType.Header = tbi.ItemType.Header;
            itemTypeOrder.ItemOrder = dropTargetItemTypeOrder.ItemOrder;
            itemType.DanishTranslationText = tbi.ItemType.DanishTranslationText;
            itemType.EnglishTranslationText = tbi.ItemType.EnglishTranslationText;
            itemType.LanguageID = tbi.ItemType.LanguageID;
            itemTypeOrder.GroupTypeID = gt.GroupTypeID;
            itemTypeOrder.IncludedTypeID = "1";
            itemTypeOrder.Item = itemType;

            int index = gt.ItemOrder.IndexOf(dropTargetItemTypeOrder);

            gt.ItemOrder.Insert(index, itemTypeOrder);
            int draggedIndex = gt.ItemOrder.IndexOf(itemTypeOrder);

            AdjustItemOrderNewLineItemDrop(gt, draggedIndex);
            //AdjustItemOrder(gt);
        }
 /// <summary>
 /// Handles drop logic for standard item from toolbox
 /// </summary>
 /// <param name="dropTargetItemTypeOrder"></param>
 /// <param name="tbi"></param>
 /// <param name="gt"></param>
 public void ToolboxItemDropOnStandardItem(ItemTypeOrder dropTargetItemTypeOrder, ToolboxItem tbi, GroupType gt)
 {
     ItemTypeOrder itemTypeOrder = new ItemTypeOrder();
     itemTypeOrder.DesignID = tbi.ItemType.DesignID;
     ItemType itemType = new ItemType { DesignID = tbi.ItemType.DesignID, Header = tbi.ItemType.Header };
     itemTypeOrder.ItemOrder = dropTargetItemTypeOrder.ItemOrder;
     itemType.DanishTranslationText = tbi.ItemType.DanishTranslationText;
     itemType.EnglishTranslationText = tbi.ItemType.EnglishTranslationText;
     itemType.LanguageID = tbi.ItemType.LanguageID;
     itemTypeOrder.GroupTypeID = gt.GroupTypeID;
     itemTypeOrder.IncludedTypeID = "1";
     itemTypeOrder.Item = itemType;
     int startPosition = gt.ItemOrder.IndexOf(dropTargetItemTypeOrder);
     MoveItemsForward(startPosition, itemTypeOrder, gt);
 }
 /// <summary>
 /// Handles drop logic on null field
 /// </summary>
 /// <param name="dropTargetItemTypeOrder"></param>
 /// <param name="tbi"></param>
 /// <param name="gt"></param>
 public void ToolboxItemDropOnNullField(ItemTypeOrder dropTargetItemTypeOrder, ToolboxItem tbi, GroupType gt)
 {
     dropTargetItemTypeOrder.DesignID = tbi.ItemType.DesignID;
     ItemType itemType = new ItemType();
     itemType.DesignID = tbi.ItemType.DesignID;
     itemType.Header = tbi.ItemType.Header;
     itemType.DanishTranslationText = tbi.ItemType.DanishTranslationText;
     itemType.EnglishTranslationText = tbi.ItemType.EnglishTranslationText;
     itemType.LanguageID = tbi.ItemType.LanguageID;
     dropTargetItemTypeOrder.GroupTypeID = gt.GroupTypeID;
     dropTargetItemTypeOrder.IncludedTypeID = "1";
     dropTargetItemTypeOrder.Item = itemType;
     gt.ItemOrder.Add(dropTargetItemTypeOrder);
     GenerateEmptyFields(gt);
 }
 /// <summary>
 /// Handles drop logic on emptyfield
 /// </summary>
 /// <param name="dropTargetItemTypeOrder"></param>
 /// <param name="tbi"></param>
 /// <param name="gt"></param>
 public void ToolboxItemDropOnEmptyField(ItemTypeOrder dropTargetItemTypeOrder, ToolboxItem tbi, GroupType gt)
 {
     dropTargetItemTypeOrder.DesignID = tbi.ItemType.DesignID;
     dropTargetItemTypeOrder.Item.Header = tbi.ItemType.Header;
     dropTargetItemTypeOrder.Item.DanishTranslationText = tbi.ItemType.DanishTranslationText;
     dropTargetItemTypeOrder.Item.EnglishTranslationText = tbi.ItemType.EnglishTranslationText;
     dropTargetItemTypeOrder.Item.LanguageID = tbi.ItemType.LanguageID;
     dropTargetItemTypeOrder.GroupTypeID = gt.GroupTypeID;
     dropTargetItemTypeOrder.IncludedTypeID = "1";
 }
示例#7
0
 public void DropStandardItemOnNullField()
 {
     ObservableCollection<GroupTypeOrder> gtoList = wvm.PageList[14].GroupTypeOrders; // Page 15
     GroupType gt = wvm.PageList[14].GroupTypeOrders[0].Group;
     gtvm.Group = gt;
     gtvm.GroupTypeOrderCollection = gtoList;
     ItemTypeOrder draggedItemTypeOrder = gt.ItemOrder[3];
     ItemTypeOrder targetItemTypeOrder = new ItemTypeOrder()
     {
         DesignID = null,
         GroupTypeID = null,
         IncludedTypeID = null,
         Item = null,
         ItemOrder = 7
     };
     gtvm.HandleDropAndDropBetweenItems(gt, targetItemTypeOrder, draggedItemTypeOrder);
     Assert.AreEqual(7, gt.ItemOrder.IndexOf(draggedItemTypeOrder));
     Assert.AreEqual(7, gt.ItemOrder[7].ItemOrder);
 }
示例#8
0
        public void AddItemsToExistingGroup()
        {
            //Get items and add them to a group
            string groupTypeID1 = "0";
            double itemOrder1 = 35.00;
            string designID1 = "12";
            string includedType1 = "1";
            ItemTypeOrder tempItemOrder1 =
                (from a in _wvm.ItemTypeOrderList.Where(x => x.Item.DesignID.Equals(designID1))
                 select a).FirstOrDefault();
            ItemType item1 = tempItemOrder1.Item;

            string groupTypeID2 = "0";
            double itemOrder2 = 36.00;
            string designID2 = "5";
            string includedType2 = "1";
            ItemTypeOrder tempItemOrder2 =
                (from a in _wvm.ItemTypeOrderList.Where(x => x.Item.DesignID.Equals(designID2))
                 select a).FirstOrDefault();
            ItemType item2 = tempItemOrder2.Item;

            ItemTypeOrder itemTypeOrder1 = new ItemTypeOrder(item1, groupTypeID1,
                itemOrder1, designID1, includedType1);

            ItemTypeOrder itemTypeOrder2 = new ItemTypeOrder(item2, groupTypeID2,
                itemOrder2, designID2, includedType2);

            //Add the new ItemTypeOrder items to page 15, group 0
            PageType testPage = _wvm.PageList.FirstOrDefault(x => x.PageTypeID.Equals("15"));
            GroupTypeOrder testGto = testPage.GroupTypeOrders.FirstOrDefault(x => x.GroupTypeID.Equals("0"));
            testGto.Group.ItemOrder.Add(itemTypeOrder1);
            testGto.Group.ItemOrder.Add(itemTypeOrder2);

            //Export excel with the added items in it
            _exExcel.CreateNewExcel(_exportPath);

            //Import the new excel file
            _impExcel.ImportExcelConfiguration(_exportPath);

            #region ktUIOrder tests

            //Get the new group in ktUIOrder
            List<ktUIOrder> orders1 =
                _impExcel._workSheetktUIOrder.ktUIOrderList.Where(
                    x => x.GroupTypeID.Equals(itemTypeOrder1.GroupTypeID)).ToList();

            foreach (var order in orders1)
            {
                if (order.DesignID.Equals(designID1))
                {
                    Assert.AreEqual(order.GroupOrder, itemOrder1);
                    Assert.AreEqual(order.IncludedTypeID, includedType1);
                }
                if (order.DesignID.Equals(designID2))
                {
                    Assert.AreEqual(order.GroupOrder, itemOrder2);
                    Assert.AreEqual(order.IncludedTypeID, includedType2);
                }
            }

            #endregion
        }
 /// <summary>
 /// Handles drop logic for items from toolbox. Drop logic depends on the type of the dropped item 
 /// </summary>
 /// <param name="gt"></param>
 /// <param name="tbi"></param>
 /// <param name="dropTargetItemTypeOrder"></param>
 public void HandleToolboxItemDrop(GroupType gt, ToolboxItem tbi, ItemTypeOrder dropTargetItemTypeOrder)
 {
     string dropTargetDesignID = dropTargetItemTypeOrder.DesignID;
     if (tbi.ItemType.DesignID.Equals("198") && dropTargetDesignID != null)
     {
         ToolboxSpecialNewLineItemDrop(dropTargetItemTypeOrder, tbi, gt);
     }
     if (dropTargetDesignID != null && !tbi.ItemType.DesignID.Equals("198") && !dropTargetDesignID.Equals("197"))
     {
         ToolboxItemDropOnStandardItem(dropTargetItemTypeOrder, tbi, gt);
     }
     if (dropTargetDesignID == null) //drop on null field
     {
         ToolboxItemDropOnNullField(dropTargetItemTypeOrder, tbi, gt);
     }
     if (dropTargetDesignID != null && dropTargetDesignID.Equals("197") && !tbi.ItemType.DesignID.Equals("198"))
     {
         ToolboxItemDropOnEmptyField(dropTargetItemTypeOrder, tbi, gt);
     }
 }
示例#10
0
        /// <summary>
        /// Handles drop logic for items from a group. Drop logic depends on both drop target and dragged item
        /// </summary>
        /// <param name="gt"></param>
        /// <param name="targetItemType"></param>
        /// <param name="draggedItemType"></param>
        public void HandleDropAndDropBetweenItems(GroupType gt, ItemTypeOrder targetItemType, ItemTypeOrder draggedItemType)
        {
            if (!gt.Equals(Group)) //dropping an item from one group to another
            {
                ToolboxItem tbi = new ToolboxItem();
                RemoveItemTypeOrder(gt, draggedItemType);
                tbi.ItemType = draggedItemType.Item;
                HandleToolboxItemDrop(Group, tbi, targetItemType);
                GroupTypeOrderCollection.Sort(x => x.GroupOrder); //refresh all groups to show the changes
            }
            else
            {
                int draggedPosition = gt.ItemOrder.IndexOf(draggedItemType);
                double targetItemTypeNo = targetItemType.ItemOrder; //affected item
                int targetPosition = gt.ItemOrder.IndexOf(targetItemType);

                if (targetItemType != draggedItemType)
                {
                    gt.ItemOrder.Remove(draggedItemType);
                    if (targetItemType.DesignID == null && !draggedItemType.DesignID.Equals("198"))
                    {
                        AdjustItemOrder(gt);
                        draggedItemType.ItemOrder = targetItemType.ItemOrder;
                        gt.ItemOrder.Add(draggedItemType);
                        gt.ItemOrder.Sort(i => i.ItemOrder);
                        GenerateEmptyFields(gt);
                    }
                    else if (targetItemType.DesignID == null && draggedItemType.DesignID.Equals("198"))
                    {

                        draggedItemType.ItemOrder = targetItemType.ItemOrder;
                        gt.ItemOrder.Add(draggedItemType);
                        gt.ItemOrder.Sort(i => i.ItemOrder);
                        GenerateEmptyFields(gt);
                        AdjustItemOrder(gt);

                    }

                    else if (draggedItemType.DesignID.Equals("198"))
                    {
                        if (draggedItemType.ItemOrder > targetItemType.ItemOrder)
                        {
                            gt.ItemOrder.Insert(targetPosition, draggedItemType);
                            draggedItemType.ItemOrder = targetItemTypeNo;
                            gt.ItemOrder.Sort(i => i.ItemOrder);
                            AdjustItemOrder(gt);
                        }
                        else
                        {
                            draggedItemType.ItemOrder = targetItemTypeNo;

                            //gt.ItemOrder.Insert(targetPosition - 1, draggedItemType);
                            gt.ItemOrder.Insert(targetPosition - 1, draggedItemType);
                            gt.ItemOrder.Sort(i => i.ItemOrder);
                            GenerateEmptyFields(gt);
                            AdjustItemOrder(gt);
                        }
                        //GenerateEmptyFields(gt);
                        gt.ItemOrder.Sort(i => i.ItemOrder);
                    }

                    else if (targetItemType.DesignID != null && draggedItemType.DesignID != null /*&& !draggedItemType.DesignID.Equals("198")*/)
                    {
                        if (draggedItemType.ItemOrder > targetItemType.ItemOrder)
                        {
                            gt.ItemOrder.Insert(targetPosition, draggedItemType);
                            draggedItemType.ItemOrder = targetItemTypeNo;
                        }
                        else
                        {
                            if (gt.ItemOrder.Count != targetPosition)
                            {
                                draggedItemType.ItemOrder = targetItemTypeNo;
                                gt.ItemOrder.Insert(targetPosition, draggedItemType);
                            }
                            else
                            {
                                draggedItemType.ItemOrder = targetItemTypeNo;
                                gt.ItemOrder.Add(draggedItemType);
                            }
                        }
                        AdjustItemOrder(gt, targetPosition, draggedPosition);

                        GenerateEmptyFields(gt);
                        gt.ItemOrder.Sort(i => i.ItemOrder);
                    }
                }
            }
        }
示例#11
0
        public ItemTypeOrder CreateEmptyField(GroupType gt, int itemOrder)
        {
            ItemTypeOrder itemTypeOrder = new ItemTypeOrder();
            itemTypeOrder.GroupTypeID = gt.GroupTypeID;
            itemTypeOrder.DesignID = "197";
            ItemType emptyFieldItemType = new ItemType();
            emptyFieldItemType.DesignID = "197";
            emptyFieldItemType.Header = "<EmptyField>";
            itemTypeOrder.IncludedTypeID = "1";
            itemTypeOrder.ItemOrder = itemOrder;
            itemTypeOrder.Item = emptyFieldItemType;

            _wvm._changedFlag = true;

            return itemTypeOrder;
        }
示例#12
0
 /// <summary>
 /// Makes sure that a NewLineItem cannot be dropped on a row in a group that already contains a NewLineItem
 /// </summary>
 /// <param name="dropTargetItemTypeOrder"></param>
 public void CheckForNewLineItem(ItemTypeOrder dropTargetItemTypeOrder)
 {
     int itemOrder = (int)dropTargetItemTypeOrder.ItemOrder;
     int i = itemOrder - (itemOrder % 4);
     int j = itemOrder + (4 - (itemOrder % 4));
     while (i < j && i < Group.ItemOrder.Count - 1)
     {
         if (Group.ItemOrder[i].DesignID.Equals("198"))
         {
             throw new Exception("The row already contains a <NewLineItem>");
         }
         i++;
     }
 }
示例#13
0
 public void DropToolboxSpecialItemOnNullField()
 {
     ifvm.PopulateToolbox();
     GroupType gt = wvm.PageList[14].GroupTypeOrders[0].Group; // Page 15
     gtvm.Group = gt;
     List<ToolboxItem> tbsiList = sfvm.SpecialItemsView.Cast<ToolboxItem>().ToList();
     ToolboxItem tbsi = tbsiList.Find(x => x.ItemType.DesignID.Equals("197"));
     ItemTypeOrder dropTargetItemTypeOrder = new ItemTypeOrder()
     {
         DesignID = null,
         GroupTypeID = null,
         IncludedTypeID = null,
         Item = null,
         ItemOrder = 7
     };
     int lastIndex = gt.ItemOrder.Count - 1;
     gtvm.HandleToolboxItemDrop(gt, tbsi, dropTargetItemTypeOrder);
     Assert.AreEqual(gt.ItemOrder[7].DesignID, tbsi.ItemType.DesignID);
     int i = lastIndex + 1;
     while (i < gt.ItemOrder.Count - 1)
     {
         Assert.AreEqual(gt.ItemOrder[i].DesignID, "197");
         i++;
     }
 }
示例#14
0
 public void DropToolboxItemOnEmptyField()
 {
     ifvm.PopulateToolbox();
     GroupType gt = wvm.PageList[14].GroupTypeOrders[0].Group; // Page 15
     gtvm.Group = gt;
     List<ToolboxItem> tbiList = ifvm.DesignItemsView.Cast<ToolboxItem>().ToList();
     ToolboxItem tbi = tbiList.Find(x => x.ItemType.DesignID.Equals("38")); //ItemType-Name: Temperatur
     List<ToolboxItem> tbsiList = sfvm.SpecialItemsView.Cast<ToolboxItem>().ToList();
     ToolboxItem tbsi = tbsiList.Find(x => x.ItemType.DesignID.Equals("197"));
     ItemTypeOrder dropTargetItemTypeOrder = new ItemTypeOrder()
     {
         DesignID = null,
         GroupTypeID = null,
         IncludedTypeID = null,
         Item = null,
         ItemOrder = gt.ItemOrder.Count()
     };
     gtvm.HandleToolboxItemDrop(gt, tbi, dropTargetItemTypeOrder);
     Assert.AreEqual(gt.ItemOrder[gt.ItemOrder.Count() - 1].Item.DesignID, tbi.ItemType.DesignID);
 }
 private Border CreateItemCell(ItemTypeOrder itemType)
 {
     Border bCell = CreateBorderContainer(_cellBorderColor, _cellColor);
     bCell.DataContext = itemType;
     bCell.MouseEnter += border_MouseEnter;
     bCell.MouseLeave += border_MouseLeave;
     bCell.AllowDrop = true;
     bCell.Drop += border_Drop;
     bCell.DragEnter += border_DragEnter;
     bCell.DragLeave += border_DragLeave;
     bCell.DragOver += border_DragOver;
     TextBlock tb = new TextBlock
     {
         FontSize = 14.0,
         HorizontalAlignment = HorizontalAlignment.Stretch,
         VerticalAlignment = VerticalAlignment.Stretch
     };
     tb.SetBinding(TextBlock.TextProperty, "Item.Header");
     //bCell.SetBinding(Border.ToolTipProperty, "Item.ToolTip");
     tb.SetBinding(TextBlock.ToolTipProperty, "Item.ToolTip");
     //ToolTipService.SetInitialShowDelay(bCell, 700);
     Grid gridCell = new Grid();
     CreateColumns(gridCell, 2);
     Button clearCellBtn = CreateClearCellBtn();
     Grid.SetColumn(clearCellBtn, 1);
     Grid.SetColumn(tb, 0);
     gridCell.Children.Add(clearCellBtn);
     gridCell.Children.Add(tb);
     bCell.Child = gridCell;
     return bCell;
 }
示例#16
0
        public void MoveItemsForward(int startPosition, ItemTypeOrder newItemType, GroupType gt)
        {
            ObservableCollection<ItemTypeOrder> itemTypeList = gt.ItemOrder;
            bool stopCounting = false;
            int i = startPosition;
            while (i < itemTypeList.Count && !stopCounting)
            {
                if (itemTypeList[i].DesignID.Equals("198"))
                {
                    if (itemTypeList[i].ItemOrder % 4 == 3)
                    {
                        itemTypeList.RemoveAt(i);
                    }
                    else
                    {
                        itemTypeList[i].ItemOrder++;
                    }
                    stopCounting = true;
                }
                else
                {
                    itemTypeList[i].ItemOrder++;
                    i++;
                }
            }
            itemTypeList.Add(newItemType);
            itemTypeList.Sort(ito => ito.ItemOrder);

            _wvm._changedFlag = true;
        }
 private void InsertItem(ItemTypeOrder item, int row, int column)
 {
     Border bCell = GetCellItem(row, column);
     Grid cellItem = (Grid)bCell.Child;
     TextBlock tb = (TextBlock)cellItem.Children[1];
     ItemTypeOrder dummyItemType = (ItemTypeOrder)bCell.DataContext;
     item.ItemOrder = dummyItemType.ItemOrder;
     bCell.DataContext = item;
     //tb.DataContext = itemType;
     //tb.SetBinding(TextBlock.TextProperty, "Header");
     tb.Foreground = new SolidColorBrush(_cellTextColor);
 }
示例#18
0
 /// <summary>
 /// Removes an ItemTypeOrder from a group
 /// </summary>
 /// <param name="gt"></param>
 /// <param name="ito">The ItemTypeOrder to be removed</param>
 public void RemoveItemTypeOrder(GroupType gt, ItemTypeOrder ito)
 {
     gt.ItemOrder.Remove(ito);
     AdjustItemOrder(gt);
 }
示例#19
0
        public void CreateGroupWithItems()
        {
            //Get items and add them to a group

            int highestId = 0;

            foreach (PageType page in _wvm.PageList)
            {
                int index = 0;

                while (index < page.GroupTypeOrders.Count)
                {
                    if (Convert.ToInt32(page.GroupTypeOrders[index].GroupTypeID) > highestId)
                    {
                        highestId = Convert.ToInt32(page.GroupTypeOrders[index].GroupTypeID);
                    }

                    index++;
                }
            }

            string groupTypeID = (highestId + 1).ToString();
            double itemOrder1 = 0.00;
            string designID1 = "12";
            string includedType1 = "1";
            ItemTypeOrder tempItemOrder1 =
                (from a in _wvm.ItemTypeOrderList.Where(x => x.Item.DesignID.Equals(designID1))
                 select a).FirstOrDefault();
            ItemType item1 = tempItemOrder1.Item;

            double itemOrder2 = 1.00;
            string designID2 = "5";
            string includedType2 = "1";
            ItemTypeOrder tempItemOrder2 =
                (from a in _wvm.ItemTypeOrderList.Where(x => x.Item.DesignID.Equals(designID2))
                 select a).FirstOrDefault();
            ItemType item2 = tempItemOrder2.Item;

            ItemTypeOrder itemTypeOrder1 = new ItemTypeOrder(item1, groupTypeID,
                itemOrder1, designID1, includedType1);

            ItemTypeOrder itemTypeOrder2 = new ItemTypeOrder(item2, groupTypeID,
                itemOrder2, designID2, includedType2);

            //Create a new group
            string pageTypeID = "15";
            string engTransText = "New group";
            string danTransText = "Ny gruppe";
            List<string> departmentList1 = new List<string>();
            departmentList1.Add("-1");
            _wvm.CreateGroup(pageTypeID, engTransText, danTransText, departmentList1);

            //Add the new ItemTypeOrder items to page 15
            PageType testPage = _wvm.PageList.FirstOrDefault(x => x.PageTypeID.Equals(pageTypeID));
            GroupTypeOrder testGto = testPage.GroupTypeOrders.FirstOrDefault(x => x.GroupTypeID.Equals(groupTypeID));
            testGto.Group.ItemOrder.Add(itemTypeOrder1);
            testGto.Group.ItemOrder.Add(itemTypeOrder2);

            //Export excel with the new group in it
            _exExcel.CreateNewExcel(_exportPath);

            //Import the new excel file
            _impExcel.ImportExcelConfiguration(_exportPath);

            #region ktUIOrder tests

            //Get the new group in ktUIOrder
            List<ktUIOrder> orders =
                _impExcel._workSheetktUIOrder.ktUIOrderList.Where(x => x.GroupTypeID.Equals(groupTypeID)).ToList();

            Assert.AreEqual(orders.Count(), 2);

            Assert.IsTrue(orders.Exists(x => x.DesignID.Equals(designID1)));
            Assert.IsTrue(orders.Exists(x => x.DesignID.Equals(designID2)));

            Assert.IsTrue(orders.Exists(x => x.GroupOrder.Equals(itemOrder1)));
            Assert.IsTrue(orders.Exists(x => x.GroupOrder.Equals(itemOrder2)));

            foreach (ktUIOrder order in orders)
            {
                Assert.AreEqual(order.GroupTypeID, groupTypeID);
            }

            #endregion
        }
示例#20
0
 public void DropEmptyFieldOnStandardItem()
 {
     ifvm.PopulateToolbox();
     GroupType gt = wvm.PageList[14].GroupTypeOrders[0].Group; // First group on page 15
     gtvm.Group = gt;
     List<ToolboxItem> tbsiList = sfvm.SpecialItemsView.Cast<ToolboxItem>().ToList();
     ToolboxItem tbsi = tbsiList.Find(x => x.ItemType.DesignID.Equals("197"));
     ItemTypeOrder dropTargetItemTypeOrder = new ItemTypeOrder()
     {
         DesignID = null,
         GroupTypeID = null,
         IncludedTypeID = null,
         Item = null,
         ItemOrder = 7
     };
     gtvm.HandleToolboxItemDrop(gt, tbsi, dropTargetItemTypeOrder);
     Assert.AreEqual(gt.ItemOrder[7].DesignID, tbsi.ItemType.DesignID);
     ItemTypeOrder targetItemTypeOrder = gt.ItemOrder[7];
     ItemTypeOrder draggedItemTypeOrder = gt.ItemOrder[2];
     gtvm.HandleDropAndDropBetweenItems(gt, targetItemTypeOrder, draggedItemTypeOrder);
     Assert.AreEqual(6, gt.ItemOrder.IndexOf(targetItemTypeOrder));
     Assert.AreEqual(7, gt.ItemOrder.IndexOf(draggedItemTypeOrder));
     Assert.AreEqual(7, gt.ItemOrder[7].ItemOrder);
     Assert.AreEqual(6, gt.ItemOrder[6].ItemOrder);
 }