示例#1
0
        public void window_loaded_prev1(object sender, RoutedEventArgs e)
        {
            GraphViewer graphViewer = new GraphViewer();

            graphViewer.BindToPanel(panel);
            //panel.LastChildFill = true;
            panel.Background = Brushes.LightGray;
            Graph graph = new Graph();
            //graph.Attr.LayerDirection = LayerDirection.LR;

            var edge = graph.AddEdge("A", "B");

            //edge.DrawEdgeDelegate = edge_rendering_delegate;
            edge.UserData     = "center_of";
            graphViewer.Graph = graph;
            this.MouseWheel  += MouseWheelEventHandler;
            //panel.MouseWheel += MouseWheelEventHandler;
            //graphViewer.GraphCanvas.MouseWheel += MouseWheelEventHandler;
            var gv = graphViewer;

            _graphViewer = gv;

            GVH.addNode(gv, "55", 0, 0);
            GVH.addLineEdge2(gv, "B", "55");
            graph.GeometryGraph.UpdateBoundingBox();
            //DebugV.D.tag = 1;
            gv.SetInitialTransform();
            //gv.GraphCanvas.Background = Brushes.Red;
            var ov = gv.GraphCanvas.Focus();
        }
示例#2
0
        void graphViewer_MouseDown(object sender, MsaglMouseEventArgs evt)
        {
            if (_currentCmd == "add node")
            {
                var    gv = _graphViewer;
                string id = null;
                do
                {
                    id = (++_nodeIdCounter).ToString();
                } while (gv.Graph.FindNode(id) != null);
                var n = gv.Graph.AddNode(id);
                n.Attr    = _defaultNodeAttr.Clone();
                n.Attr.Id = id;
                GVH.addVnodeByDnode(gv, n, gv.ScreenToSource(evt));

                _mouseEventHandled = true;
            }
            else if (_currentCmd == "node editing")
            {
                exitNodeEditor();
                _currentCmd = "select";
            }
            else if (_currentCmd == "apply attr")
            {
                var obj = _graphViewer.ObjectUnderMouseCursor;
                if (obj == null)
                {
                    return;
                }
                var vedge = obj as VEdge;
                if (vedge != null)
                {
                    var att = vedge.Edge.Attr;
                    if (edge_defApplyAttrPanel != null)
                    {
                        EdgeAttrApplyEditor e = edge_defApplyAttrPanel.Content as EdgeAttrApplyEditor;
                        if (e.TarArrowStyleCmb.IsEnabled)
                        {
                            att.ArrowheadAtTarget = (ArrowStyle)e.TarArrowStyleCmb.SelectedValue;
                        }
                        if (e.SrcArrowStyleCmb.IsEnabled)
                        {
                            att.ArrowheadAtSource = (ArrowStyle)e.SrcArrowStyleCmb.SelectedValue;
                        }
                        if (e.LineStyleCmb.IsEnabled)
                        {
                            att.FirstStyle = (DStyle)e.LineStyleCmb.SelectedValue;
                        }
                        if (e.DecorateSymbolCmb.IsEnabled)
                        {
                            att.DefinedDrawDelegateName = (string)e.DecorateSymbolCmb.SelectedValue;
                        }
                    }
                }
            }
        }
示例#3
0
        public void window_loaded_prev2(object sender, RoutedEventArgs e)
        {
            Graph graph = new Graph();
            //graph.Attr.LayerDirection = LayerDirection.LR;
            //graph.AddNode("aaa");

            //graphViewer.Graph.CreateGeometryGraph();

            //var edge = graph.AddEdge("A", "B");
            //edge.DrawEdgeDelegate = edge_rendering_delegate;
            var edgeg = graph.AddEdge("ma", "mi");

            edgeg.LabelText = "has edge";
            var gv = _graphViewer;

            gv.Graph = graph;

            this.MouseWheel += MouseWheelEventHandler;

            //_graphViewer = gv;

            GVH.addNode(gv, "A", 0, 30);
            GVH.addNode(gv, "B", 20, 15);
            var dnode = graph.FindNode("A");
            var vnode = gv.GetIViewerObject(dnode) as VNode;

            //dnode.GeometryNode.BoundaryCurve = null;
            //VDebug.D.tag = 2;
            dnode.Attr.Shape = Shape.Diamond;

            dnode.GeometryNode.BoundaryCurve = NodeBoundaryCurves.GetNodeBoundaryCurve(dnode, 15, 12);


            //vnode.Invalidate();

            var edge = GVH.addLineEdge2(gv, "A", "B");

            //edge.Edge.DrawEdgeDelegate = edge_rendering_delegate;
            edge.Edge.UserData = "center_of";
            GVH.addNode(gv, "55", 0, 0);
            GVH.addLineEdge2(gv, "B", "55");
            graph.GeometryGraph.UpdateBoundingBox();
            //DebugV.D.tag = 1;

            gv.SetInitialTransform();
            gv.Transform = gv.Transform;

            gv.LayoutEditor.ObjectEditingStatusChanged += viewerObjectSelected;

            //timer1 = new System.Windows.Threading.DispatcherTimer();
            //timer1.Tick += TimeTick;
            //timer1.Interval = TimeSpan.FromMilliseconds(500);
            //timer1.Start();
            panel.Focusable = true;
        }
示例#4
0
        void XulyDuLieuTruocKhiThem(Dictionary <string, object> Dic)
        {
            long a = 0;
            List <Dictionary <string, object> > lstDicS = new List <Dictionary <string, object> >();
            List <string> lstCTV = new List <string>();

            for (int i = 0; i < GVH.RowCount; i++)
            {
                Dictionary <string, object> dicS = new Dictionary <string, object>(Dic);
                for (int y = 0; y < GVH.Columns.Count; y++) //Dòng
                {
                    if (y == GVH.Columns.Count - 1)
                    {
                        object G = GVH.GetRowCellValue(i, GVH.Columns[y]);
                        lstCTV.Add(string.Format("WHERE ID = {0}", G));
                        lstDicS.Add(dicS);
                    }
                    else
                    {
                        object G = GVH.GetRowCellValue(i, GVH.Columns[y]);
                        dicS.Add(GVH.Columns[y].FieldName, G);
                    }
                }
            }
            a = (_GiaoDichO.ID > 0) ? _GiaoDichD.SuaNhieu1Ban(lstDicS, lstCTV) : _GiaoDichD.ThemNhieu1Ban(lstDicS);
            if (XuLyGiaoDien.ThongBao(Text, a == lstDicS.Count))
            {
                GhiChuCmt(_GiaoDichO.ID);
                if (iLoaiKhachHang.EditValue.ToString() != "3")
                {
                    new D_DAILY().ChayLaiPhi((_GiaoDichO.NgayGD > iNgayGD.DateTime) ? iNgayGD.DateTime : _GiaoDichO.NgayGD);
                }
                if (Owner.ActiveMdiChild is frmVe)
                {
                    (Owner.ActiveMdiChild as frmVe).DuLieu();
                }
                else
                {
                    (Owner.ActiveMdiChild as frmTheoDoiHoan).DuLieu();
                }
                Close();
            }
        }
示例#5
0
        private void gridView1_DoubleClick(object sender, EventArgs e)
        {
            _GiaoDichO = GVH.GetRow(GVH.GetSelectedRows()[0]) as O_GIAODICH;
            List <O_GIAODICH> lst = _ListGiaoDichO.Where(w => w.MaCho.Equals(_GiaoDichO.MaCho) && w.IDKhachHang.Equals(_GiaoDichO.IDKhachHang) && w.TinhCongNo.Equals(_GiaoDichO.TinhCongNo) && w.NgayGD.Date.Equals(_GiaoDichO.NgayGD.Date)).ToList();

            if (lst.Count > 1)
            {
                DialogResult dc = XtraMessageBox.Show("Bạn muốn sửa tất cả giao dịch cùng Mã Chỗ ?", "Câu hỏi", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                switch (dc)
                {
                case DialogResult.No:
                    lst = _ListGiaoDichO.Where(w => w.ID.Equals(_GiaoDichO.ID)).ToList();
                    break;

                case DialogResult.Cancel:
                    return;
                }
            }

            new frmVeHoanThem(lst).ShowDialog(this);
        }
示例#6
0
        private void btnDel_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            List <object> lstCtv = new List <object>();

            _GiaoDichO = GVH.GetRow(GVH.GetSelectedRows()[0]) as O_GIAODICH;

            List <O_GIAODICH> lst = _ListGiaoDichO.Where(w => (w.SoVeVN ?? "").Equals((_GiaoDichO.SoVeVN ?? "")) && w.IDKhachHang.Equals(_GiaoDichO.IDKhachHang)).ToList();

            O_KHOANGAY kn = new D_KHOANGAY().KiemTraNgayKhoa(_GiaoDichO.NgayGD);

            if (_GiaoDichO.TinhCongNo)
            {
                if (!DuLieuTaoSan.Q.TheoDoiHoanAdmin)
                {
                    if ((kn.HoatDong) && !(kn.Code ?? string.Empty).Contains(_GiaoDichO.MaCho.Replace(" ", string.Empty)))
                    {
                        XuLyGiaoDien.Alert("Ngày đã bị khóa", Form_Alert.enmType.Warning);
                        return;
                    }
                }

                if (DateTime.Now.Date.Subtract(_GiaoDichO.NgayGD.Date).Days > 30)
                {
                    XuLyGiaoDien.Alert("Ngày đã bị khóa", Form_Alert.enmType.Warning);
                    return;
                }
            }

            if (lst.Count > 1)
            {
                DialogResult dc = XtraMessageBox.Show("Bạn muốn xóa tất cả giao dịch cùng Mã Chỗ ?", "Câu hỏi", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                switch (dc)
                {
                case DialogResult.No:
                    lst = _ListGiaoDichO.Where(w => w.ID.Equals(_GiaoDichO.ID)).ToList();
                    break;

                case DialogResult.Cancel:
                    return;
                }
            }

            foreach (O_GIAODICH gdoz in lst)
            {
                lstCtv.Add(gdoz.ID);
            }

            if (XuLyGiaoDien.ThongBao(Text, _GiaoDichD.XoaNhieu1Ban(lstCtv) > 0, true))
            {
                if (_GiaoDichO.TinhCongNo)
                {
                    new D_DAILY().ChayLaiPhi(_GiaoDichO.NgayGD);
                    string NoiDung = string.Format("Xóa vé hoàn\r\n");
                    Dictionary <string, object> dic = new Dictionary <string, object>();
                    dic.Add("FormName", Text);
                    dic.Add("MaCho", _GiaoDichO.MaCho);
                    dic.Add("NoiDung", NoiDung);
                    dic.Add("NVGiaoDich", DuLieuTaoSan.NV.ID);
                    dic.Add("LoaiKhachHang", _GiaoDichO.LoaiKhachHang);
                    dic.Add("Ma", _GiaoDichO.IDKhachHang);
                    if (NoiDung.Length > 10)
                    {
                        new D_LS_GIAODICH().ThemMoi(dic);
                    }
                }
                DuLieu();
            }
        }