예제 #1
0
        private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
        {
            for (int i = 0; i < frmMain.Main.DockPanelMain.Contents.Count; i++)
            {
                if (frmMain.Main.DockPanelMain.Contents[i] is dockCustomer)
                {
                    dockCustomer dc =
                        (dockCustomer)frmMain.Main.DockPanelMain.Contents[i];
                    if (dc.GUID.ToString() == e.Node.Name)
                    {
                        if (!(dc.GUID == Guid.Empty) && 
                            dc.TabText.Substring(5) != 
                             e.Node.Text)
                        {
                            string str = "客户信息-";
                            dc.TabText = str + e.Node.Text;
                        }

                        dc.Focus();
                        dc.GetData();
                        return;
                    }
                }
            }

            dockCustomer dock = new dockCustomer();
            if (!(e.Node.Name == Guid.Empty.ToString()))
            {
                dock.TabText += "-" + e.Node.Text;
            }
            dock.GUID = new Guid(e.Node.Name);
            dock.Show(frmMain.Main.DockPanelMain);
        }
예제 #2
0
        private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
        {
            for (int i = 0; i < frmMain.Main.DockPanelMain.Contents.Count; i++)
            {
                if (frmMain.Main.DockPanelMain.Contents[i] is dockCustomer)
                {
                    dockCustomer dc =
                        (dockCustomer)frmMain.Main.DockPanelMain.Contents[i];
                    if (dc.GUID.ToString() == e.Node.Name)
                    {
                        if (!(dc.GUID == Guid.Empty) &&
                            dc.TabText.Substring(5) !=
                            e.Node.Text)
                        {
                            string str = "客户信息-";
                            dc.TabText = str + e.Node.Text;
                        }

                        dc.Focus();
                        dc.GetData();
                        return;
                    }
                }
            }

            dockCustomer dock = new dockCustomer();

            if (!(e.Node.Name == Guid.Empty.ToString()))
            {
                dock.TabText += "-" + e.Node.Text;
            }
            dock.GUID = new Guid(e.Node.Name);
            dock.Show(frmMain.Main.DockPanelMain);
        }
예제 #3
0
파일: frmMain.cs 프로젝트: rotorliu/demo
        private void tsbCustomer_Click(object sender, EventArgs e)
        {
            for (int i = 0; i < this.dockPanel1.Contents.Count; i++)
            {
                if (frmMain.Main.DockPanelMain.Contents[i] is dockCustomer)
                {
                    dockCustomer dc =
                        (dockCustomer)this.dockPanel1.Contents[i];
                    if (dc.GUID.ToString() == Guid.Empty.ToString())
                    {
                        dc.Focus();
                        dc.GetData();
                        return;
                    }
                }
            }

            dockCustomer dock = new dockCustomer();

            dock.Show(this.dockPanel1);
        }
예제 #4
0
파일: frmMain.cs 프로젝트: rotorliu/demo
        /// <summary>
        /// 初始化
        /// </summary>
        private void Init()
        {
            //加载
            _customerGroup.Show(this.dockPanel1);
            dockCustomer customer = new dockCustomer();

            customer.Show(this.dockPanel1);


            //菜单栏
            tsmiAddCustomerGroup.Click += (sender, e) =>
                                          (new frmCustomerGroup()).ShowDialog(this);
            tsmiAddCustomer.Click += (sender, e) =>
                                     (new frmCustomer()).ShowDialog(this);
            tsmiAddService.Click += (sender, e) =>
                                    (new frmService()).ShowDialog(this);

            //报表菜单
            tsmiReportCustomerInfo.Click += (sender, e) =>
                                            (new frmPrint(GetReport <rptCustomerInfo>("Customer", ""))).ShowDialog(this);
            tsmiReportCustomerPie.Click += (sender, e) =>
                                           (new frmPrint(GetReport <rptCustomerPie>("Customer", ""))).ShowDialog(this);
            tsmiReportServiceInfo.Click += (sender, e) =>
                                           (new frmPrint(GetReport <rptServiceInfo>("Service", ""))).ShowDialog(this);
            tsmiReportServiceMonth.Click += (sender, e) =>
            {
                rptServiceMonth rpt = (rptServiceMonth)GetReport <rptServiceMonth>("Service", "DATEDIFF(MONTH, '" + DateTime.Now + "', 受理时间) = 0");
                //设置月份
                TextObject obj = (TextObject)rpt.Section1.ReportObjects["Text1"];
                obj.Text = DateTime.Now.ToString("yyyy年MM月");
                frmPrint frm = new frmPrint(rpt);
                frm.ShowDialog(this);
            };
            tsmiReportServiceTotal.Click += (sender, e) =>
                                            (new frmPrint(GetReport <rptServiceTotal>("Service", ""))).ShowDialog(this);

            tsmiOption.Click += (sender, e) =>
                                (new frmOption()).ShowDialog(this);


            //状态栏时间
            tmr.Tick += (sender, e) => tsslblTime.Text =
                DateTime.Now.ToString("当前时间:yyyy-MM-dd HH:mm:ss");
            tmr.Start();

            //工具栏、客户组、状态栏隐藏和现实
            tsmiTools.Click += (sender, e) =>
                               toolStrip1.Visible = tsmiTools.Checked;

            tsmiCustomerGroup.Click += (sender, e) =>
                                       _customerGroup.IsHidden = !tsmiCustomerGroup.Checked;

            _customerGroup.VisibleChanged += (sender, e) =>
                                             tsmiCustomerGroup.Checked = !_customerGroup.IsHidden;

            tsmiStatus.Click += (sender, e) =>
                                statusStrip1.Visible = tsmiStatus.Checked;
            //搜索故障解决方案效果
            tstSulotion.Enter += (sender, e) =>
            {
                if (tstSulotion.ForeColor == Color.Gray)
                {
                    tstSulotion.Text      = string.Empty;
                    tstSulotion.ForeColor = Color.Black;
                }
            };
            tstSulotion.Leave += (sender, e) =>
            {
                if (tstSulotion.Text.Trim().Length == 0)
                {
                    tstSulotion.Text      = "在此输入故障现象";
                    tstSulotion.ForeColor = Color.Gray;
                }
            };

            //加载布局
            //string path = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), @"xml\DockPanel.xml ");

            //if (File.Exists(path))
            //{
            //    dockPanel1.LoadFromXml(path, persistString =>
            //    {
            //        if (persistString ==
            //            typeof(dockCustomerGroup).ToString())
            //        {
            //            return _customerGroup;
            //        }
            //        else
            //        {
            //            return null;
            //        }
            //    });
            //}
        }