Esempio n. 1
0
        public void GetSearchedList(string searchkey)
        {
            if (SystemClass.CheckConnection())
            {
                try
                {
                    DList = new List <DivisionList>();
                    using (var db = new ImusCityHallEntities())
                    {
                        var get = db.Divisions.Where(m => m.IsActive == true && (m.DivisionName.Contains(searchkey) || m.DivisionCode.Contains(searchkey))).OrderBy(m => m.DivisionName).ToList();

                        foreach (var item in get)
                        {
                            DivisionList dl = new DivisionList();
                            dl.DivisionID     = item.DivisionID;
                            dl.DivisionCode   = item.DivisionCode;
                            dl.DivisionName   = item.DivisionName;
                            dl.DepartmentName = item.Department.DepartmentName;
                            DList.Add(dl);
                        }
                        dgDivisionList.ItemsSource       = DList.OrderByDescending(m => m.DivisionID);
                        dgDivisionList.SelectedValuePath = "DivisionID";
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Something went wrong." + Environment.NewLine + ex.Message, "System Warning!", MessageBoxButton.OK, MessageBoxImage.Warning);
                }
            }
            else
            {
                MessageBox.Show(SystemClass.DBConnectionErrorMessage);
            }
        }
        public InitViewModel()
        {
            valutaArray = new string[] { "British Pound", "Danish Krone" };

            formationsDictionary = FormationsList.GetFormations();


            formationListItems = new List <SelectListItem>();
            foreach (string key in formationsDictionary.Keys)
            {
                formationListItems.Add(new SelectListItem {
                    Text = key, Value = key
                });
            }

            List <Division> divisions = DivisionList.GetDivisionList();


            divisionListItems = new List <SelectListItem>();
            foreach (Division div in divisions)
            {
                divisionListItems.Add(new SelectListItem {
                    Text = $"{div.Name} ({div.Nation})", Value = div.Name
                });
            }


            valutas = new List <SelectListItem>();
            for (int i = 0; i < valutaArray.Length; i++)
            {
                valutas.Add(new SelectListItem {
                    Text = valutaArray[i], Value = valutaArray[i]
                });
            }
        }
Esempio n. 3
0
        private DivisionList CreateDivisionList(SplitFormat info, PaneCreationDelegate creation, DockStyle host_dock)
        {
            DivisionList list = new DivisionList(this, info.Direction, host_dock);

            list.FirstNode = CreateDivisionNodeList(list, info, creation);
            return(list);
        }
Esempio n. 4
0
            private bool _splitterEventGuarding; //余計なイベントを無視するためのフラグ

            //SplitInfoからの構築用
            public DivisionNode(DivisionList parent, IPane pane, double ratio) {
                Debug.Assert(parent != null);
                Debug.Assert(pane != null);
                _parent = parent;
                _pane = pane;
                _ratio = ratio;
            }
Esempio n. 5
0
            private bool _splitterEventGuarding; //余計なイベントを無視するためのフラグ

            //SplitInfoからの構築用
            public DivisionNode(DivisionList parent, IPane pane, double ratio)
            {
                Debug.Assert(parent != null);
                Debug.Assert(pane != null);
                _parent = parent;
                _pane   = pane;
                _ratio  = ratio;
            }
Esempio n. 6
0
 public void ReplaceChildListByPane(IPane pane)
 {
     Debug.Assert(!IsLeaf);
     _pane      = pane;
     _pane.Size = _childList.HostingControl.Size;
     _childList = null;
     Debug.Assert(IsLeaf);
 }
Esempio n. 7
0
 //子ペインとリストの交換。分割時と併合時に使う
 public void ReplacePaneByChildList(DivisionList newlist)
 {
     Debug.Assert(IsLeaf);
     newlist.HostingControl.Dock = _pane.Dock;
     newlist.HostingControl.Size = _pane.Size;
     _pane      = null;
     _childList = newlist;
     Debug.Assert(!IsLeaf);
 }
Esempio n. 8
0
 public DivisionNode(DivisionList parent, DivisionList child, double ratio)
 {
     Debug.Assert(parent != null);
     Debug.Assert(child != null);
     Debug.Assert(child.ParentNode == null);
     _parent               = parent;
     _childList            = child;
     _childList.ParentNode = this;
     _ratio = ratio;
 }
Esempio n. 9
0
        //ペインの分割
        public SplitResult SplitPane(IPane target, IPane newpane, Direction direction)
        {
            Debug.Assert(newpane.AsDotNet().Parent == null);

            //分割可能かどうかのチェック1 総数
            if (_count >= _countLimit)
            {
                return(SplitResult.F_TooManyPanes);
            }

            //分割可能かどうかのチェック2 分割対象が最小サイズを満たしているか
            if (SizeToLength(target.Size, direction) < _minimumEdgeLength * 2 + PaneSplitter.SPLITTER_WIDTH)
            {
                return(SplitResult.F_TooSmallToSplit);
            }

            Control parent         = target.AsDotNet().Parent;
            bool    splitting_root = _rootList == null;

            if (splitting_root)   //空の状態からの構築
            {
                _rootList = new DivisionList(this, null, direction, target, newpane, target.Size, target.Dock);
                UIUtil.ReplaceControl(parent, target.AsDotNet(), _rootList.HostingControl);
            }
            else
            {
                DivisionNode node = _rootList.FirstNode.FindNode(target);
                Debug.Assert(node != null);
                if (direction == node.ParentList.Direction)   //同方向分割
                {
                    bool eq = node.ParentList.IsEquallyDivided;
                    node.InsertNext(newpane);
                    if (eq)
                    {
                        node.ParentList.AdjustRatioEqually();
                    }
                }
                else   //異方向分割
                {
                    DivisionList newlist = new DivisionList(this, node, direction, target, newpane, target.Size, target.Dock);
                    node.ReplacePaneByChildList(newlist);
                }
            }

            Rebuild();
            DoLayout();
            FindForm().MinimumSize = _rootList.FirstNode.RequiredMinimumSize; //!!TODO これはコントロールのサイズであり、フォームボーダーとは別の話

            _count++;
            return(SplitResult.Success);
        }
Esempio n. 10
0
        public IPane UnifyAll()
        {
            if (_rootList == null)
            {
                return(null);
            }

            IPane   r      = _rootList.FirstPane;
            Control parent = _rootList.HostingControl.Parent;

            UIUtil.ReplaceControl(parent, _rootList.HostingControl, r.AsDotNet());
            _rootList = null;
            _count    = 1;
            return(r);
        }
Esempio n. 11
0
        public void ApplySplitInfo(Control parent, Control prev_content, string format, PaneCreationDelegate creation)
        {
            bool        was_empty = this.IsEmpty;
            SplitFormat info      = SplitFormat.Parse(format);

            _rootList = CreateDivisionList(info, creation, DockStyle.Fill);
            _count    = _rootList.GetDivisionCount();
            Rebuild();

            if (prev_content == null)
            {
                parent.Controls.Add(_rootList.HostingControl);
            }
            else
            {
                Debug.Assert(prev_content.Parent == parent);
                UIUtil.ReplaceControl(parent, prev_content, _rootList.HostingControl);
            }

            DoLayout();
        }
Esempio n. 12
0
        private DivisionNode CreateDivisionNodeList(DivisionList list, SplitFormat info, PaneCreationDelegate creation)
        {
            SplitFormat.Node tag       = info.FirstTag;
            DivisionNode     firstnode = null;
            DivisionNode     prev      = null;
            double           remain    = 1.0;

            while (tag != null)
            {
                DivisionNode node = null;

                if (tag.Content != null)
                {
                    DockStyle dock = tag.Next == null ? (info.Direction == Direction.TB ? DockStyle.Bottom : DockStyle.Right) : DockStyle.Fill;
                    node = new DivisionNode(list, CreateDivisionList(tag.Content, creation, dock), tag.GetActualRatio(remain));
                }
                else
                {
                    node = new DivisionNode(list, creation(tag.Label), tag.GetActualRatio(remain));
                }
                remain -= tag.Ratio;

                if (firstnode == null)
                {
                    firstnode = node;
                }
                else
                {
                    prev.Next = node;
                }

                Debug.Assert(node.ParentList == list);
                prev = node;
                tag  = tag.Next;
            }

            return(firstnode);
        }
Esempio n. 13
0
            //srcの位置を、listの中身で置き換える。ratio調整に注意
            public void ReplaceNodeByList(DivisionNode src, DivisionList list)
            {
                Debug.Assert(src.ParentList == this);
                int    oldcount   = this.NodeCount;
                int    addedcount = list.NodeCount;
                double r          = src.Ratio;

                DivisionNode t    = list.FirstNode;
                DivisionNode last = null;

                while (t != null)
                {
                    t.Ratio *= r;
                    t.SetParentList(this);
                    last = t;
                    t    = t.Next;
                }
                Debug.Assert(last.Next == null); //これを見つけた
                ReplaceNode(src, list.FirstNode);
                last.Next = src.Next;

                Debug.Assert(oldcount + addedcount - 1 == this.NodeCount);
            }
Esempio n. 14
0
            public DivisionNode FindChildList(DivisionList list)
            {
                if (_childList != null && _childList == list)
                {
                    return(this);
                }

                DivisionNode n = null;

                if (_next != null)
                {
                    n = _next.FindChildList(list);
                }
                if (n != null)
                {
                    return(n);
                }

                if (_childList != null)
                {
                    n = _childList.FirstNode.FindChildList(list);
                }
                return(n);
            }
Esempio n. 15
0
 public League(string name)
 {
     Name      = name;
     Divisions = new DivisionList();
 }
Esempio n. 16
0
        //ペインを閉じて結合する。outの引数は次にフォーカスを与えるべきペイン
        public SplitResult UnifyPane(IPane target, out IPane nextfocus)
        {
            nextfocus = null; //失敗時にはクリアできるように
            Debug.Assert(_rootList != null);

            DivisionNode node          = _rootList.FirstNode.FindNode(target);
            bool         unifying_root = node.ParentList == _rootList && _rootList.NodeCount == 2; //結合の結果RootListが入れ替わる予定のとき
            Control      parent        = _rootList.HostingControl.Parent;

            if (unifying_root && _rootList.FirstNode.IsLast)
            {
                return(SplitResult.F_UnifySingle);
            }

            DivisionList list   = node.ParentList;
            DivisionNode active = list.Remove(node);

            if (list.NodeCount == 1) //こうなったときに面倒が発生
            {
                if (active.IsLeaf)   // (1) ペインであるとき
                {
                    IPane newpane = active.Pane;
                    Debug.Assert(newpane != null);
                    if (list.ParentNode == null)   //1-1
                    {
                        UIUtil.ReplaceControl(parent, list.HostingControl, newpane.AsDotNet());
                        _rootList = null;
                    }
                    else   //1-2
                    {
                        list.ParentNode.ReplaceChildListByPane(newpane);
                    }
                }
                else   // (2) ノードであるとき
                {
                    DivisionList newlist = active.ChildList;
                    if (list.ParentNode == null)   //2-1
                    {
                        _rootList = newlist;
                        newlist.ClearParentNode();
                        UIUtil.ReplaceControl(parent, list.HostingControl, newlist.HostingControl);
                    }
                    else                                              //2-2
                    {
                        DivisionList pp = list.ParentNode.ParentList; //長くなる方のリスト
                        Debug.Assert(pp.Direction == newlist.Direction);
                        pp.ReplaceNodeByList(list.ParentNode, newlist);
                    }
                }
            }

            if (_rootList != null)
            {
                Rebuild();
                DoLayout();
                FindForm().MinimumSize = _rootList.FirstNode.RequiredMinimumSize; //!!TODO Splitterだけで構成されていないフォームでアウト
            }

            _count--;
            nextfocus = active.IsLeaf ? active.Pane : active.ChildList.FirstPane;
            return(SplitResult.Success);
        }
Esempio n. 17
0
 public void SetParentList(DivisionList list)
 {
     _parent = list;
 }
Esempio n. 18
0
 public void ReplaceChildListByPane(IPane pane)
 {
     Debug.Assert(!IsLeaf);
     _pane = pane;
     _pane.Size = _childList.HostingControl.Size;
     _childList = null;
     Debug.Assert(IsLeaf);
 }
Esempio n. 19
0
        private DivisionNode CreateDivisionNodeList(DivisionList list, SplitFormat info, PaneCreationDelegate creation)
        {
            SplitFormat.Node tag = info.FirstTag;
            DivisionNode firstnode = null;
            DivisionNode prev = null;
            double remain = 1.0;
            while (tag != null) {
                DivisionNode node = null;

                if (tag.Content != null) {
                    DockStyle dock = tag.Next == null ? (info.Direction == Direction.TB ? DockStyle.Bottom : DockStyle.Right) : DockStyle.Fill;
                    node = new DivisionNode(list, CreateDivisionList(tag.Content, creation, dock), tag.GetActualRatio(remain));
                }
                else {
                    node = new DivisionNode(list, creation(tag.Label), tag.GetActualRatio(remain));
                }
                remain -= tag.Ratio;

                if (firstnode == null)
                    firstnode = node;
                else
                    prev.Next = node;

                Debug.Assert(node.ParentList == list);
                prev = node;
                tag = tag.Next;
            }

            return firstnode;
        }
Esempio n. 20
0
 private DivisionList CreateDivisionList(SplitFormat info, PaneCreationDelegate creation, DockStyle host_dock)
 {
     DivisionList list = new DivisionList(this, info.Direction, host_dock);
     list.FirstNode = CreateDivisionNodeList(list, info, creation);
     return list;
 }
Esempio n. 21
0
        //�y�C����‚��Č�������Bout�̈����͎��Ƀt�H�[�J�X��^����ׂ��y�C��
        public SplitResult UnifyPane(IPane target, out IPane nextfocus)
        {
            nextfocus = null; //���s���ɂ̓N���A�ł���悤��
            Debug.Assert(_rootList != null);

            DivisionNode node = _rootList.FirstNode.FindNode(target);
            bool unifying_root = node.ParentList == _rootList && _rootList.NodeCount == 2; //�����̌���RootList������ւ��\��̂Ƃ�
            Control parent = _rootList.HostingControl.Parent;
            if (unifying_root && _rootList.FirstNode.IsLast)
                return SplitResult.F_UnifySingle;

            DivisionList list = node.ParentList;
            DivisionNode active = list.Remove(node);
            if (list.NodeCount == 1) { //�����Ȃ����Ƃ��ɖʓ|������
                if (active.IsLeaf) { // (1) �y�C���ł���Ƃ�
                    IPane newpane = active.Pane;
                    Debug.Assert(newpane != null);
                    if (list.ParentNode == null) { //1-1
                        UIUtil.ReplaceControl(parent, list.HostingControl, newpane.AsDotNet());
                        _rootList = null;
                    }
                    else { //1-2
                        list.ParentNode.ReplaceChildListByPane(newpane);
                    }
                }
                else { // (2) �m�[�h�ł���Ƃ�
                    DivisionList newlist = active.ChildList;
                    if (list.ParentNode == null) { //2-1
                        _rootList = newlist;
                        newlist.ClearParentNode();
                        UIUtil.ReplaceControl(parent, list.HostingControl, newlist.HostingControl);
                    }
                    else { //2-2
                        DivisionList pp = list.ParentNode.ParentList; //�����Ȃ���̃��X�g
                        Debug.Assert(pp.Direction == newlist.Direction);
                        pp.ReplaceNodeByList(list.ParentNode, newlist);
                    }
                }

            }

            if (_rootList != null) {
                Rebuild();
                DoLayout();
                FindForm().MinimumSize = _rootList.FirstNode.RequiredMinimumSize; //!!TODO Splitter�����ō\������Ă��Ȃ��t�H�[���ŃA�E�g
            }

            _count--;
            nextfocus = active.IsLeaf ? active.Pane : active.ChildList.FirstPane;
            return SplitResult.Success;
        }
Esempio n. 22
0
        public IPane UnifyAll()
        {
            if (_rootList == null)
                return null;

            IPane r = _rootList.FirstPane;
            Control parent = _rootList.HostingControl.Parent;
            UIUtil.ReplaceControl(parent, _rootList.HostingControl, r.AsDotNet());
            _rootList = null;
            _count = 1;
            return r;
        }
Esempio n. 23
0
        //�y�C���̕���
        public SplitResult SplitPane(IPane target, IPane newpane, Direction direction)
        {
            Debug.Assert(newpane.AsDotNet().Parent == null);

            //�����”\���ǂ����̃`�F�b�N1 ����
            if (_count >= _countLimit)
                return SplitResult.F_TooManyPanes;

            //�����”\���ǂ����̃`�F�b�N2 �����Ώۂ��ŏ��T�C�Y�𖞂����Ă��邩
            if (SizeToLength(target.Size, direction) < _minimumEdgeLength * 2 + PaneSplitter.SPLITTER_WIDTH)
                return SplitResult.F_TooSmallToSplit;

            Control parent = target.AsDotNet().Parent;
            bool splitting_root = _rootList == null;

            if (splitting_root) { //��̏�Ԃ���̍\�z
                _rootList = new DivisionList(this, null, direction, target, newpane, target.Size, target.Dock);
                UIUtil.ReplaceControl(parent, target.AsDotNet(), _rootList.HostingControl);
            }
            else {
                DivisionNode node = _rootList.FirstNode.FindNode(target);
                Debug.Assert(node != null);
                if (direction == node.ParentList.Direction) { //����������
                    bool eq = node.ParentList.IsEquallyDivided;
                    node.InsertNext(newpane);
                    if (eq)
                        node.ParentList.AdjustRatioEqually();
                }
                else { //�ٕ�������
                    DivisionList newlist = new DivisionList(this, node, direction, target, newpane, target.Size, target.Dock);
                    node.ReplacePaneByChildList(newlist);
                }
            }

            Rebuild();
            DoLayout();
            FindForm().MinimumSize = _rootList.FirstNode.RequiredMinimumSize; //!!TODO ����̓R���g���[���̃T�C�Y�ł���A�t�H�[���{�[�_�[�Ƃ͕ʂ̘b

            _count++;
            return SplitResult.Success;
        }
Esempio n. 24
0
        public void ApplySplitInfo(Control parent, Control prev_content, string format, PaneCreationDelegate creation)
        {
            bool was_empty = this.IsEmpty;
            SplitFormat info = SplitFormat.Parse(format);
            _rootList = CreateDivisionList(info, creation, DockStyle.Fill);
            _count = _rootList.GetDivisionCount();
            Rebuild();

            if (prev_content == null)
                parent.Controls.Add(_rootList.HostingControl);
            else {
                Debug.Assert(prev_content.Parent == parent);
                UIUtil.ReplaceControl(parent, prev_content, _rootList.HostingControl);
            }

            DoLayout();
        }
Esempio n. 25
0
 public void SetParentList(DivisionList list)
 {
     _parent = list;
 }
Esempio n. 26
0
            public DivisionNode FindChildList(DivisionList list)
            {
                if (_childList != null && _childList == list)
                    return this;

                DivisionNode n = null;
                if (_next != null)
                    n = _next.FindChildList(list);
                if (n != null)
                    return n;

                if (_childList != null)
                    n = _childList.FirstNode.FindChildList(list);
                return n;
            }
Esempio n. 27
0
        //ペインを閉じて結合する。outの引数は次にフォーカスを与えるべきペイン
        public SplitResult UnifyPane(IPane target, out IPane nextfocus) {
            nextfocus = null; //失敗時にはクリアできるように
            Debug.Assert(_rootList != null);

            DivisionNode node = _rootList.FirstNode.FindNode(target);
            bool unifying_root = node.ParentList == _rootList && _rootList.NodeCount == 2; //結合の結果RootListが入れ替わる予定のとき
            Control parent = _rootList.HostingControl.Parent;
            if (unifying_root && _rootList.FirstNode.IsLast)
                return SplitResult.F_UnifySingle;

            DivisionList list = node.ParentList;
            DivisionNode active = list.Remove(node);
            if (list.NodeCount == 1) { //こうなったときに面倒が発生
                if (active.IsLeaf) { // (1) ペインであるとき
                    IPane newpane = active.Pane;
                    Debug.Assert(newpane != null);
                    if (list.ParentNode == null) { //1-1
                        UIUtil.ReplaceControl(parent, list.HostingControl, newpane.AsDotNet());
                        _rootList = null;
                    }
                    else { //1-2
                        list.ParentNode.ReplaceChildListByPane(newpane);
                    }
                }
                else { // (2) ノードであるとき
                    DivisionList newlist = active.ChildList;
                    if (list.ParentNode == null) { //2-1 
                        _rootList = newlist;
                        newlist.ClearParentNode();
                        UIUtil.ReplaceControl(parent, list.HostingControl, newlist.HostingControl);
                    }
                    else { //2-2
                        DivisionList pp = list.ParentNode.ParentList; //長くなる方のリスト
                        Debug.Assert(pp.Direction == newlist.Direction);
                        pp.ReplaceNodeByList(list.ParentNode, newlist);
                    }
                }

            }

            if (_rootList != null) {
                Rebuild();
                DoLayout();
                FindForm().MinimumSize = _rootList.FirstNode.RequiredMinimumSize; //!!TODO Splitterだけで構成されていないフォームでアウト
            }

            _count--;
            nextfocus = active.IsLeaf ? active.Pane : active.ChildList.FirstPane;
            return SplitResult.Success;
        }
Esempio n. 28
0
 //�q�y�C���ƃ��X�g�̌���B�������ƕ������Ɏg��
 public void ReplacePaneByChildList(DivisionList newlist)
 {
     Debug.Assert(IsLeaf);
     newlist.HostingControl.Dock = _pane.Dock;
     newlist.HostingControl.Size = _pane.Size;
     _pane = null;
     _childList = newlist;
     Debug.Assert(!IsLeaf);
 }
Esempio n. 29
0
 public DivisionNode(DivisionList parent, DivisionList child, double ratio)
 {
     Debug.Assert(parent != null);
     Debug.Assert(child != null);
     Debug.Assert(child.ParentNode == null);
     _parent = parent;
     _childList = child;
     _childList.ParentNode = this;
     _ratio = ratio;
 }
Esempio n. 30
0
 public League(string name)
 {
     Name = name;
     Divisions = new DivisionList();
 }
Esempio n. 31
0
            //src�̈ʒu��Alist�̒��g�Œu��������Bratio�����ɒ���
            public void ReplaceNodeByList(DivisionNode src, DivisionList list)
            {
                Debug.Assert(src.ParentList == this);
                int oldcount = this.NodeCount;
                int addedcount = list.NodeCount;
                double r = src.Ratio;

                DivisionNode t = list.FirstNode;
                DivisionNode last = null;
                while (t != null) {
                    t.Ratio *= r;
                    t.SetParentList(this);
                    last = t;
                    t = t.Next;
                }
                Debug.Assert(last.Next == null); //�������‚���
                ReplaceNode(src, list.FirstNode);
                last.Next = src.Next;

                Debug.Assert(oldcount + addedcount - 1 == this.NodeCount);
            }
Esempio n. 32
0
        //ペインの分割
        public SplitResult SplitPane(IPane target, IPane newpane, Direction direction) {
            Debug.Assert(newpane.AsDotNet().Parent == null);

            //分割可能かどうかのチェック1 総数
            if (_count >= _countLimit)
                return SplitResult.F_TooManyPanes;

            //分割可能かどうかのチェック2 分割対象が最小サイズを満たしているか
            if (SizeToLength(target.Size, direction) < _minimumEdgeLength * 2 + PaneSplitter.SPLITTER_WIDTH)
                return SplitResult.F_TooSmallToSplit;

            Control parent = target.AsDotNet().Parent;
            bool splitting_root = _rootList == null;

            if (splitting_root) { //空の状態からの構築
                _rootList = new DivisionList(this, null, direction, target, newpane, target.Size, target.Dock);
                UIUtil.ReplaceControl(parent, target.AsDotNet(), _rootList.HostingControl);
            }
            else {
                DivisionNode node = _rootList.FirstNode.FindNode(target);
                Debug.Assert(node != null);
                if (direction == node.ParentList.Direction) { //同方向分割
                    bool eq = node.ParentList.IsEquallyDivided;
                    node.InsertNext(newpane);
                    if (eq)
                        node.ParentList.AdjustRatioEqually();
                }
                else { //異方向分割
                    DivisionList newlist = new DivisionList(this, node, direction, target, newpane, target.Size, target.Dock);
                    node.ReplacePaneByChildList(newlist);
                }
            }

            Rebuild();
            DoLayout();
            FindForm().MinimumSize = _rootList.FirstNode.RequiredMinimumSize; //!!TODO これはコントロールのサイズであり、フォームボーダーとは別の話

            _count++;
            return SplitResult.Success;
        }