Exemple #1
0
        public void OpenTab(Form pForm)
        {
            if (CheckTabOpened(pForm.Text) == true)
            {
                return;
            }

            // Khoi tao
            DevExpress.XtraTab.XtraTabPage tab = new DevExpress.XtraTab.XtraTabPage();

            // Cai dat form
            pForm.Dock            = DockStyle.Fill;
            pForm.TopLevel        = false;
            pForm.Parent          = this;
            pForm.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;

            // Cai dat tab
            tab.Text = pForm.Text;
            //tab.Size = new System.Drawing.Size(878, 350);
            tab.Controls.Add(pForm);

            // Hien nguyen hien
            pForm.Show();
            tabMain.TabPages.Add(tab);
            tabMain.SelectedTabPage = tab;
        }
Exemple #2
0
 private void btnDSBN_ItemClick(object sender, ItemClickEventArgs e)
 {
     SplashScreenManager.ShowForm(this.ParentForm, typeof(WaitForm), true, true, false);
     try
     {
         int     pagecount = xtraTabControlMain.TabPages.Count;
         Boolean found     = false;
         for (int i = 0; i < pagecount; i++)
         {
             if (xtraTabControlMain.TabPages[i].Name == "xtraTabPageSMS")
             {
                 found = true;
                 xtraTabControlMain.SelectedTabPage = xtraTabControlMain.TabPages[i];
             }
         }
         if (!found)
         {
             XtraTabPage xtraTabPageSMS = new DevExpress.XtraTab.XtraTabPage();
             xtraTabPageSMS.Name            = "xtraTabPageSMS";
             xtraTabPageSMS.ShowCloseButton = DevExpress.Utils.DefaultBoolean.True;
             xtraTabPageSMS.Text            = "Danh sách hẹn tái khám";
             XtraUserControlSMS userControlSMS = new XtraUserControlSMS();
             userControlSMS.Dock = DockStyle.Fill;
             xtraTabPageSMS.Controls.Add(userControlSMS);
             xtraTabControlMain.TabPages.Add(xtraTabPageSMS);
             xtraTabControlMain.SelectedTabPage = xtraTabPageSMS;
         }
     }
     finally
     {
         SplashScreenManager.CloseForm(false);
     }
 }
Exemple #3
0
 /// <summary>
 /// Element클릭시 발생이벤트
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void accordionControl1_ElementClick(object sender, ElementClickEventArgs e)
 {
     if (e.Element.Name == "Calender")
     {
         User_Calendar user_Calendar         = new User_Calendar();
         DevExpress.XtraTab.XtraTabPage page = new DevExpress.XtraTab.XtraTabPage();
         page.Text = e.Element.Name;
         page.Controls.Add(user_Calendar);
         xtraTabControl1.TabPages.Add(page);
         user_Calendar.Dock = DockStyle.Fill;
         user_Calendar.BringToFront();
         xtraTabControl1.SelectedTabPage = page;
     }
     else if (e.Element.Name != "")
     {
         NotePad notePad = new NotePad(e.Element.Name); //Category의 이름을 매개변수로 넘긴다.
         DevExpress.XtraTab.XtraTabPage page = new DevExpress.XtraTab.XtraTabPage();
         page.Text = e.Element.Name;
         page.Controls.Add(notePad);
         xtraTabControl1.TabPages.Add(page);
         notePad.Dock = DockStyle.Fill;
         notePad.BringToFront();
         xtraTabControl1.SelectedTabPage = page;
     }
     else
     {
         return;
     }
 }
Exemple #4
0
        private void btnThamSo_ItemClick(object sender, ItemClickEventArgs e)
        {
            int     pagecount = xtraTabControlMain.TabPages.Count;
            Boolean found     = false;

            for (int i = 0; i < pagecount; i++)
            {
                if (xtraTabControlMain.TabPages[i].Name == "xtraTabPageThamSo")
                {
                    found = true;
                    xtraTabControlMain.SelectedTabPage = xtraTabControlMain.TabPages[i];
                }
            }
            if (!found)
            {
                XtraTabPage xtraTabPageThamSo = new DevExpress.XtraTab.XtraTabPage();
                xtraTabPageThamSo.Name            = "xtraTabPageThamSo";
                xtraTabPageThamSo.ShowCloseButton = DevExpress.Utils.DefaultBoolean.True;
                xtraTabPageThamSo.Text            = "Tham số";
                XtraUserControlThamSo userControlThamSo = new XtraUserControlThamSo();
                userControlThamSo.Dock = DockStyle.Fill;
                xtraTabPageThamSo.Controls.Add(userControlThamSo);
                xtraTabControlMain.TabPages.Add(xtraTabPageThamSo);
                xtraTabControlMain.SelectedTabPage = xtraTabPageThamSo;
            }
        }
Exemple #5
0
 private void barButtonItemMau20_ItemClick(object sender, ItemClickEventArgs e)
 {
     SplashScreenManager.ShowForm(this.ParentForm, typeof(WaitForm), true, true, false);
     try
     {
         int     pagecount = xtraTabControlMain.TabPages.Count;
         Boolean found     = false;
         for (int i = 0; i < pagecount; i++)
         {
             if (xtraTabControlMain.TabPages[i].Name == "xtraTabPageBaoCao")
             {
                 found = true;
                 xtraTabControlMain.SelectedTabPage = xtraTabControlMain.TabPages[i];
             }
         }
         if (!found)
         {
             XtraTabPage xtraTabPageBaoCao = new DevExpress.XtraTab.XtraTabPage();
             xtraTabPageBaoCao.Name            = "xtraTabPageBaoCao";
             xtraTabPageBaoCao.ShowCloseButton = DevExpress.Utils.DefaultBoolean.True;
             xtraTabPageBaoCao.Text            = "Báo cáo";
             XtraUserControlBaoCao userControlBaoCao = new XtraUserControlBaoCao();
             userControlBaoCao.Dock = DockStyle.Fill;
             xtraTabPageBaoCao.Controls.Add(userControlBaoCao);
             xtraTabControlMain.TabPages.Add(xtraTabPageBaoCao);
             xtraTabControlMain.SelectedTabPage = xtraTabPageBaoCao;
         }
     }
     finally
     {
         SplashScreenManager.CloseForm(false);
     }
 }
Exemple #6
0
        private void barButtonItem34_ItemClick(object sender, ItemClickEventArgs e)
        {
            int     pagecount = xtraTabControlMain.TabPages.Count;
            Boolean found     = false;

            for (int i = 0; i < pagecount; i++)
            {
                if (xtraTabControlMain.TabPages[i].Name == "xtraTabPageCV3360")
                {
                    found = true;
                    xtraTabControlMain.SelectedTabPage = xtraTabControlMain.TabPages[i];
                }
            }
            if (!found)
            {
                XtraTabPage xtraTabPageCV3360 = new DevExpress.XtraTab.XtraTabPage();
                xtraTabPageCV3360.Name            = "xtraTabCV3360";
                xtraTabPageCV3360.ShowCloseButton = DevExpress.Utils.DefaultBoolean.True;
                xtraTabPageCV3360.Text            = "CV3360";
                XtraUserControlCV3360 userControlCV3360 = new XtraUserControlCV3360();
                userControlCV3360.Dock = DockStyle.Fill;
                xtraTabPageCV3360.Controls.Add(userControlCV3360);
                xtraTabControlMain.TabPages.Add(xtraTabPageCV3360);
                xtraTabControlMain.SelectedTabPage = xtraTabPageCV3360;
            }
        }
Exemple #7
0
        private void barButtonItem35_ItemClick(object sender, ItemClickEventArgs e)
        {
            SplashScreenManager.ShowForm(this.ParentForm, typeof(WaitForm), true, true, false);
            try
            {
                int     pagecount = xtraTabControlMain.TabPages.Count;
                Boolean found     = false;
                for (int i = 0; i < pagecount; i++)
                {
                    if (xtraTabControlMain.TabPages[i].Name == "xtraTabPageMau2526TT4210")
                    {
                        found = true;
                        xtraTabControlMain.SelectedTabPage = xtraTabControlMain.TabPages[i];
                    }
                }
                if (!found)
                {
                    XtraTabPage xtraTabPageMau2526TT4210 = new DevExpress.XtraTab.XtraTabPage();
                    xtraTabPageMau2526TT4210.Name            = "xtraTabPageMau2526TT4210";
                    xtraTabPageMau2526TT4210.ShowCloseButton = DevExpress.Utils.DefaultBoolean.True;
                    xtraTabPageMau2526TT4210.Text            = "Báo cáo phân tích chi phí theo tuyến";

                    Mau2526TT4210 userControlMau2526TT4210 = new Mau2526TT4210();
                    userControlMau2526TT4210.Dock = DockStyle.Fill;
                    xtraTabPageMau2526TT4210.Controls.Add(userControlMau2526TT4210);
                    xtraTabControlMain.TabPages.Add(xtraTabPageMau2526TT4210);
                    xtraTabControlMain.SelectedTabPage = xtraTabPageMau2526TT4210;
                }
            }
            finally
            {
                SplashScreenManager.CloseForm(false);
            }
        }
Exemple #8
0
        private void barButtonItem25_ItemClick(object sender, ItemClickEventArgs e)
        {
            int     pagecount = xtraTabControlMain.TabPages.Count;
            Boolean found     = false;

            for (int i = 0; i < pagecount; i++)
            {
                if (xtraTabControlMain.TabPages[i].Name == "xtraTabPageSoNoiSoi")
                {
                    found = true;
                    xtraTabControlMain.SelectedTabPage = xtraTabControlMain.TabPages[i];
                }
            }
            if (!found)
            {
                XtraTabPage xtraTabPageSoNoiSoi = new DevExpress.XtraTab.XtraTabPage();
                xtraTabPageSoNoiSoi.Name            = "xtraTabPageSoXetNghiem";
                xtraTabPageSoNoiSoi.ShowCloseButton = DevExpress.Utils.DefaultBoolean.True;
                xtraTabPageSoNoiSoi.Text            = "Sổ Nội Soi";
                XtraUserControlSoNoiSoi userControlSoNoiSoi = new XtraUserControlSoNoiSoi();
                userControlSoNoiSoi.Dock = DockStyle.Fill;
                xtraTabPageSoNoiSoi.Controls.Add(userControlSoNoiSoi);
                xtraTabControlMain.TabPages.Add(xtraTabPageSoNoiSoi);
                xtraTabControlMain.SelectedTabPage = xtraTabPageSoNoiSoi;
            }
        }
Exemple #9
0
        private void barButtonItem29_ItemClick(object sender, ItemClickEventArgs e)
        {
            int     pagecount = xtraTabControlMain.TabPages.Count;
            Boolean found     = false;

            for (int i = 0; i < pagecount; i++)
            {
                if (xtraTabControlMain.TabPages[i].Name == "xtraTabPageSoSieuAm")
                {
                    found = true;
                    xtraTabControlMain.SelectedTabPage = xtraTabControlMain.TabPages[i];
                }
            }
            if (!found)
            {
                XtraTabPage xtraTabPageSoSieuAm = new DevExpress.XtraTab.XtraTabPage();
                xtraTabPageSoSieuAm.Name            = "xtraTabPageSoSieuAm";
                xtraTabPageSoSieuAm.ShowCloseButton = DevExpress.Utils.DefaultBoolean.True;
                xtraTabPageSoSieuAm.Text            = "Sổ siêu âm";
                XtraUserControlSoSieuAm userControlSoSieuAm = new XtraUserControlSoSieuAm();
                userControlSoSieuAm.Dock = DockStyle.Fill;
                xtraTabPageSoSieuAm.Controls.Add(userControlSoSieuAm);
                xtraTabControlMain.TabPages.Add(xtraTabPageSoSieuAm);
                xtraTabControlMain.SelectedTabPage = xtraTabPageSoSieuAm;
            }
        }
Exemple #10
0
        private void barButtonItem11_ItemClick(object sender, ItemClickEventArgs e)
        {
            int     pagecount = xtraTabControlMain.TabPages.Count;
            Boolean found     = false;

            for (int i = 0; i < pagecount; i++)
            {
                if (xtraTabControlMain.TabPages[i].Name == "xtraTabPageMauCPKPNG")
                {
                    found = true;
                    xtraTabControlMain.SelectedTabPage = xtraTabControlMain.TabPages[i];
                }
            }
            if (!found)
            {
                XtraTabPage xtraTabPageMauCPKPNG = new DevExpress.XtraTab.XtraTabPage();
                xtraTabPageMauCPKPNG.Name            = "xtraTabPageMauCPKPNG";
                xtraTabPageMauCPKPNG.ShowCloseButton = DevExpress.Utils.DefaultBoolean.True;
                xtraTabPageMauCPKPNG.Text            = "Mẫu CPKP Ngoại";
                XtraUserControlMauCPKPNG userControlMauCPKPNG = new XtraUserControlMauCPKPNG();
                userControlMauCPKPNG.Dock = DockStyle.Fill;
                xtraTabPageMauCPKPNG.Controls.Add(userControlMauCPKPNG);
                xtraTabControlMain.TabPages.Add(xtraTabPageMauCPKPNG);
                xtraTabControlMain.SelectedTabPage = xtraTabPageMauCPKPNG;
            }
        }
Exemple #11
0
        private void barButtonItem16_ItemClick(object sender, ItemClickEventArgs e)
        {
            int     pagecount = xtraTabControlMain.TabPages.Count;
            Boolean found     = false;

            for (int i = 0; i < pagecount; i++)
            {
                if (xtraTabControlMain.TabPages[i].Name == "xtraTabPageMau2526TNN")
                {
                    found = true;
                    xtraTabControlMain.SelectedTabPage = xtraTabControlMain.TabPages[i];
                }
            }
            if (!found)
            {
                XtraTabPage xtraTabPageMau2526TNN = new DevExpress.XtraTab.XtraTabPage();
                xtraTabPageMau2526TNN.Name            = "xtraTabPageMau2526TNN";
                xtraTabPageMau2526TNN.ShowCloseButton = DevExpress.Utils.DefaultBoolean.True;
                xtraTabPageMau2526TNN.Text            = "Sổ 25 26 Theo Nhóm";
                Mau2526TNN userControlMau2526TNN = new Mau2526TNN();
                userControlMau2526TNN.Dock = DockStyle.Fill;
                xtraTabPageMau2526TNN.Controls.Add(userControlMau2526TNN);
                xtraTabControlMain.TabPages.Add(xtraTabPageMau2526TNN);
                xtraTabControlMain.SelectedTabPage = xtraTabPageMau2526TNN;
            }
        }
Exemple #12
0
        private void barButtonItem10_ItemClick(object sender, ItemClickEventArgs e)
        {
            int     pagecount = xtraTabControlMain.TabPages.Count;
            Boolean found     = false;

            for (int i = 0; i < pagecount; i++)
            {
                if (xtraTabControlMain.TabPages[i].Name == "xtraTabPageSoKhamBenh")
                {
                    found = true;
                    xtraTabControlMain.SelectedTabPage = xtraTabControlMain.TabPages[i];
                }
            }
            if (!found)
            {
                XtraTabPage xtraTabPageSoKhamBenh = new DevExpress.XtraTab.XtraTabPage();
                xtraTabPageSoKhamBenh.Name            = "xtraTabPageSoKhamBenh";
                xtraTabPageSoKhamBenh.ShowCloseButton = DevExpress.Utils.DefaultBoolean.True;
                xtraTabPageSoKhamBenh.Text            = "Sổ Khám Bệnh";
                XtraUserControlSoKhamBenh userControlSoKhamBenh = new XtraUserControlSoKhamBenh();
                userControlSoKhamBenh.Dock = DockStyle.Fill;
                xtraTabPageSoKhamBenh.Controls.Add(userControlSoKhamBenh);
                xtraTabControlMain.TabPages.Add(xtraTabPageSoKhamBenh);
                xtraTabControlMain.SelectedTabPage = xtraTabPageSoKhamBenh;
            }
        }
Exemple #13
0
        private void barButtonItem37_ItemClick(object sender, ItemClickEventArgs e)
        {
            SplashScreenManager.ShowForm(this.ParentForm, typeof(WaitForm), true, true, false);
            try
            {
                int     pagecount = xtraTabControlMain.TabPages.Count;
                Boolean found     = false;
                for (int i = 0; i < pagecount; i++)
                {
                    if (xtraTabControlMain.TabPages[i].Name == "xtraTabPageTTHUYQT")
                    {
                        found = true;
                        xtraTabControlMain.SelectedTabPage = xtraTabControlMain.TabPages[i];
                    }
                }
                if (!found)
                {
                    XtraTabPage xtraTabPageTTHuyQT = new DevExpress.XtraTab.XtraTabPage();
                    xtraTabPageTTHuyQT.Name            = "xtraTabPageTTHUYQT";
                    xtraTabPageTTHuyQT.ShowCloseButton = DevExpress.Utils.DefaultBoolean.True;
                    xtraTabPageTTHuyQT.Text            = "Kiểm tra tình trạng hủy quyết toán";

                    XtraUserControlTTHUYQT userControlTTHuyQT = new XtraUserControlTTHUYQT();
                    userControlTTHuyQT.Dock = DockStyle.Fill;
                    xtraTabPageTTHuyQT.Controls.Add(userControlTTHuyQT);
                    xtraTabControlMain.TabPages.Add(xtraTabPageTTHuyQT);
                    xtraTabControlMain.SelectedTabPage = xtraTabPageTTHuyQT;
                }
            }
            finally
            {
                SplashScreenManager.CloseForm(false);
            }
        }
Exemple #14
0
        private void barButtonItem2_ItemClick_1(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            //foreach (Form form in Application.OpenForms)        //da ne prikazuje duple forme
            //{
            //    if (form.GetType() == typeof(FormOperater))
            //    {
            //        form.Activate();
            //        return;
            //    }
            //}

            //FormOperater fdo = new FormOperater();
            //fdo.MdiParent = this;
            //fdo.Show();
            //xtraTabControl1.Visible = false;
            var page = xtraTabControl1.TabPages.FirstOrDefault(it => it.Tag == barButtonItem2.Tag);

            if (page == null)
            {
                page = new DevExpress.XtraTab.XtraTabPage()
                {
                    Tag  = barButtonItem2.Tag,
                    Text = barButtonItem2.Caption,
                };

                FormOperater formoperater = new FormOperater();
                page.ImageOptions.Image     = imageCollection1.Images[imageCollection1.Images.Keys.IndexOf("usergroup_16x16.png")];
                page.Appearance.Header.Font = new Font("Tahoma", (float)8.25, FontStyle.Bold);
                page.Controls.Add(formoperater.MainPanel);
                xtraTabControl1.TabPages.Add(page);
            }

            xtraTabControl1.SelectedTabPage = page;
        }
        public void RefreshDataBinding(PhongDTO phongDTO, Action <ThuePhongDTO> goToThanhToan)
        {
            TabControl.TabPages.Clear();



            ThongTinChiTietPhong thongTinChiTietPhong = new ThongTinChiTietPhong();

            thongTinChiTietPhong.RefreshDataBinding(phongDTO);
            thongTinChiTietPhong.SetActionThanhToanButton(goToThanhToan);
            DevExpress.XtraTab.XtraTabPage xtraTab = new DevExpress.XtraTab.XtraTabPage();

            //
            // thongTinChiTietPhong1
            //
            thongTinChiTietPhong.Appearance.BackColor            = System.Drawing.Color.White;
            thongTinChiTietPhong.Appearance.Options.UseBackColor = true;
            thongTinChiTietPhong.Dock     = System.Windows.Forms.DockStyle.Fill;
            thongTinChiTietPhong.Location = new System.Drawing.Point(0, 0);
            thongTinChiTietPhong.Name     = "thongTinChiTietPhong1";
            thongTinChiTietPhong.Size     = new System.Drawing.Size(989, 591);
            thongTinChiTietPhong.TabIndex = 0;
            thongTinChiTietPhong.Load    += new System.EventHandler(this.thongTinChiTietPhong1_Load);

            //
            // tab1
            //
            xtraTab.Controls.Add(thongTinChiTietPhong);
            xtraTab.Name = thongTinChiTietPhong.phong.MaPhong.ToString();
            xtraTab.Size = new System.Drawing.Size(989, 591);
            xtraTab.Text = thongTinChiTietPhong.phong.TenPhong;
            xtraTab.Tag  = thongTinChiTietPhong.phong.MaPhong;
            //
            this.TabControl.TabPages.AddRange(new DevExpress.XtraTab.XtraTabPage[] { xtraTab });
        }
Exemple #16
0
        private void TabCreating(DevExpress.XtraTab.XtraTabControl tabControl, string Text, string Name, UserControl uc, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            int index = CheckTabExits(tabControl, Name);

            if (index >= 0)
            {
                tabControl.TabPages[index].PageVisible = true;
                tabControl.SelectedTabPage             = tabControl.TabPages[index];
                tabControl.SelectedTabPage.Text        = Text;
                uc.Dispose();
                uc = null;
            }
            else
            {
                DevExpress.XtraTab.XtraTabPage tabpage = new DevExpress.XtraTab.XtraTabPage {
                    Text = Text, Name = Name, ImageIndex = 0
                };
                tabpage.Image = e.Link.Item.SmallImage;
                tabControl.TabPages.Add(tabpage);
                tabControl.SelectedTabPage = tabpage;

                //uc.TopLevel = false;
                uc.Parent = tabpage;
                uc.Show();
                uc.Dock = DockStyle.Fill;
            }
        }
Exemple #17
0
        /// <summary>
        /// 加载功能菜单对应的窗体
        /// </summary>
        /// <param name="CtnerNam">树菜单对应的容器名称</param>
        /// <param name="TrName">树菜单名称</param>
        /// <param name="Frm">XtraTabPage中装载的窗体</param>
        private void LoadFrm(string CtnerNam, string TrName)
        {
            try
            {
                //获取测试管理模块容器
                var query = from Container1 in List_Container
                            where Container1.Name == CtnerNam
                            select Container1;
                NavBarGroupControlContainer NavContainer = null;
                foreach (var Container2 in query)
                {
                    NavContainer = Container2 as NavBarGroupControlContainer;
                }
                //获取容器中的菜单树
                TreeList TrList_ADM = NavContainer.Controls[TrName] as TreeList;
                DevExpress.XtraTab.XtraTabPage Page = new DevExpress.XtraTab.XtraTabPage();

                //页签标题设置
                Page.Text = TrList_ADM.FocusedNode.GetValue("FuncNam").ToString();

                //判断将要打开的页签是否已经存在
                if (!PageIsExist(Page))
                {
                    //利用反射实例化窗体
                    Assembly  assembly = Assembly.GetExecutingAssembly(); // 获取当前程序集
                    FrmCommon Frm      = assembly.CreateInstance(TrList_ADM.FocusedNode.GetValue("FrmNam").ToString()) as FrmCommon;
                    Page.ShowCloseButton = DevExpress.Utils.DefaultBoolean.True;
                    //指定该窗体是有父窗体的窗体(非顶级窗体)。
                    Frm.TopLevel = false;
                    //初始化窗体实例名称
                    Frm.FrmNam = TrList_ADM.FocusedNode.GetValue("FrmNam").ToString();
                    //初始化当前登录用户信息
                    Frm.CurUsrID   = CurUsrID;
                    Frm.CurUsrName = CurUsrName;
                    Frm.Dock       = DockStyle.Fill;

                    //去边框处理
                    Frm.FormBorderStyle = FormBorderStyle.None;
                    //将窗体装载入页面中
                    Page.Controls.Add(Frm);
                    //增加新页面
                    Tab_Main.TabPages.AddRange(new DevExpress.XtraTab.XtraTabPage[] { Page });
                    //实例化关闭页面委托
                    Frm.PgClose = new FrmCommon.PageClose(ClosePage);
                    //将窗体显示出来。
                    Frm.Show();
                    //新页面增加后自动定位到该页面
                    Tab_Main.SelectedTabPage = Page;
                }
            }
            catch (Exception Ex)
            {
                Common.ShowMsg(Ex.Message);
            }
        }
Exemple #18
0
        private void barButtonItemLeerPedidosEbay_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            var page = new DevExpress.XtraTab.XtraTabPage();

            xtraTabControl.TabPages.Add(page);
            page.Text = "Leer Ebay";
            var cliente = new GetOrdersUserControl();

            page.Controls.Add(cliente);
            xtraTabControl.SelectedTabPageIndex = xtraTabControl.TabPages.Count - 1;
        }
Exemple #19
0
        public void OpenGroupControl(IOpenModuleForm IOpenModule)
        {
            _IOpenForm = IOpenModule;
            if (_IOpenForm == null)
            {
                Msg.ShowError("窗口打开错误!!未设置导航窗口!!请联系系统开发商。错误代码YIEAccontForm-32");
                return;
            }

            if (String.IsNullOrEmpty(_IOpenForm.FormAssembly) || String.IsNullOrEmpty(_IOpenForm.FormName))
            {
                Msg.ShowError("窗口打开错误!设置导航窗口!请联系系统开发商。错误代码:YIEAccontForm-37");
            }

            if (xtabAccont.TabPages.Count > 0)
            {
                //判断是否打开,如果打开直接几选择
                foreach (DevExpress.XtraTab.XtraTabPage pages in xtabAccont.TabPages)
                {
                    if (pages.Name == _IOpenForm.FormName)
                    {
                        xtabAccont.SelectedTabPage = pages;
                        return;
                    }
                }
            }

            try
            {
                //xtabAccont.TabPages.Clear();

                System.Reflection.Assembly asm = System.Reflection.Assembly.Load(_IOpenForm.FormAssembly); //程序集名
                object Obj = asm.CreateInstance(_IOpenForm.FormAssembly + "." + _IOpenForm.FormName);      //程序集+form的类名。
                //创建新的当行页面
                DevExpress.XtraEditors.XtraUserControl xControlPage;
                xControlPage = (DevExpress.XtraEditors.XtraUserControl)Obj;
                DevExpress.XtraTab.XtraTabPage AddPage = new DevExpress.XtraTab.XtraTabPage();

                //设置导航页面属性
                AddPage.Name      = _IOpenForm.FormName;
                xControlPage.Dock = DockStyle.Fill;
                AddPage.Controls.Add(xControlPage);
                //不显示右上角的关闭X
                AddPage.ShowCloseButton = DevExpress.Utils.DefaultBoolean.False;
                xtabAccont.TabPages.Add(AddPage);
                xtabAccont.SelectedTabPage = AddPage;

                this.Activate();
            }
            catch (Exception e)
            {
                Msg.ShowException(e);
            }
        }
Exemple #20
0
        private void barButtonItemImportarFactura_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            var page = new DevExpress.XtraTab.XtraTabPage();

            xtraTabControl.TabPages.Add(page);
            page.Text = "Importar Factura";
            var cliente = new ImportarFacturaEbayUserControl();

            page.Controls.Add(cliente);
            xtraTabControl.SelectedTabPageIndex = xtraTabControl.TabPages.Count - 1;
        }
Exemple #21
0
        private void barButtonLeerPedidosAmazon_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            var page = new DevExpress.XtraTab.XtraTabPage();

            xtraTabControl.TabPages.Add(page);
            page.Text = "Leer Pedidos Amazon";
            var cliente = new LeerPedidosAmazonUserControl();

            page.Controls.Add(cliente);
            xtraTabControl.SelectedTabPageIndex = xtraTabControl.TabPages.Count - 1;
            cliente.main = this;
        }
Exemple #22
0
        private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            barStaticItemArticulo.Enabled = false;
            var page = new DevExpress.XtraTab.XtraTabPage();

            xtraTabControl.TabPages.Add(page);
            page.Text = "Artículos";
            var cliente = new ArticulosUserControl();

            page.Controls.Add(cliente);
            xtraTabControl.SelectedTabPageIndex = xtraTabControl.TabPages.Count - 1;
            barStaticItemArticulo.Enabled       = true;
        }
        public void RefreshDataBinding(ThuePhongDTO thuePhongDTO, Action <ThuePhongDTO> goToThanhToan)
        {
            this.goToThanhToan = goToThanhToan;
            this.thuePhongDTO  = thuePhongDTO;

            TabControl.TabPages.Clear();

            this.hoaDon = BUS.HoaDonBUS.LayThongTinHoaDonDangThue(thuePhongDTO.MaHoaDon);


            foreach (ThuePhongDTO thuePhong in HoaDonBUS.LayTatCaCacThuePhong(hoaDon.MaHoaDon))
            {
                ThongTinChiTietPhong thongTinChiTietPhong = new ThongTinChiTietPhong();
                thongTinChiTietPhong.RefreshDataBinding(PhongBUS.LayThongTinPhong(thuePhong.MaPhong), thuePhong);
                thongTinChiTietPhong.SetActionThanhToanButton(goToThanhToan);
                DevExpress.XtraTab.XtraTabPage xtraTab = new DevExpress.XtraTab.XtraTabPage();

                //
                // thongTinChiTietPhong1
                //
                thongTinChiTietPhong.Appearance.BackColor            = System.Drawing.Color.White;
                thongTinChiTietPhong.Appearance.Options.UseBackColor = true;
                thongTinChiTietPhong.Dock     = System.Windows.Forms.DockStyle.Fill;
                thongTinChiTietPhong.Location = new System.Drawing.Point(0, 0);
                thongTinChiTietPhong.Name     = "thongTinChiTietPhong1";
                thongTinChiTietPhong.Size     = new System.Drawing.Size(989, 591);
                thongTinChiTietPhong.TabIndex = 0;
                thongTinChiTietPhong.Load    += new System.EventHandler(this.thongTinChiTietPhong1_Load);

                //
                // tab1
                //
                xtraTab.Controls.Add(thongTinChiTietPhong);
                xtraTab.Name = thongTinChiTietPhong.phong.MaPhong.ToString();
                xtraTab.Size = new System.Drawing.Size(989, 591);
                xtraTab.Text = thongTinChiTietPhong.phong.TenPhong;
                xtraTab.Tag  = thongTinChiTietPhong.phong.MaPhong;
                //
                this.TabControl.TabPages.AddRange(new DevExpress.XtraTab.XtraTabPage[] { xtraTab });
            }

            foreach (XtraTabPage tab in this.TabControl.TabPages)
            {
                if ((int)tab.Tag == thuePhongDTO.MaPhong)
                {
                    this.TabControl.SelectedTabPage = tab;
                    break;
                }
            }
        }
Exemple #24
0
 public void AddTab(XtraTabControl XtraTabCha, string TabNameAdd, UserControl UserControl)
 {
     // Khởi tạo 1 Tab Con (XtraTabPage)
     DevExpress.XtraTab.XtraTabPage TAbAdd = new DevExpress.XtraTab.XtraTabPage();
     // Đặt đại cái tên cho nó là TestTab (Đây là tên nhé)
     TAbAdd.Name = "Tab";
     // Tên của nó là đối số như đã nói ở trên
     TAbAdd.Text = TabNameAdd;
     // Add đối số UserControl vào Tab con vừa khởi tạo ở trên
     TAbAdd.Controls.Add(UserControl);
     // Dock cho nó tràn hết TAb con đó
     UserControl.Dock = DockStyle.Fill;
     // Quăng nó lên TAb Cha (XtraTabCha là đối số thứ nhất như đã nói ở trên)
     XtraTabCha.TabPages.Add(TAbAdd);
 }
 public void AddTab(XtraTabControl XtraTabCha, string TabNameAdd, UserControl UserControl)
 {
     // Khởi tạo 1 Tab Con (XtraTabPage)
     DevExpress.XtraTab.XtraTabPage TAbAdd = new DevExpress.XtraTab.XtraTabPage();
     // Đặt đại cái tên cho nó là TestTab (Đây là tên nhé)
     TAbAdd.Name = "Tab";
     // Tên của nó là đối số như đã nói ở trên
     TAbAdd.Text = TabNameAdd;
     // Add đối số UserControl vào Tab con vừa khởi tạo ở trên
     TAbAdd.Controls.Add(UserControl);
     // Dock cho nó tràn hết TAb con đó
     UserControl.Dock = DockStyle.Fill;
     // Quăng nó lên TAb Cha (XtraTabCha là đối số thứ nhất như đã nói ở trên)
     XtraTabCha.TabPages.Add(TAbAdd);
 }
Exemple #26
0
        public bool ContainsKey(string tabPageName)
        {
            bool res = false;

            foreach (DevExpress.XtraTab.XtraTabPage currTab in xtraTabControl1.TabPages)
            {
                if (currTab.Text.Equals(tabPageName))
                {
                    res      = true;
                    currPage = currTab;
                    //tabIndex = currTab.
                    break;
                }
            }
            return(res);
        }
Exemple #27
0
        private void AddControl(Control ctrl, string caption)
        {
            DevExpress.XtraTab.XtraTabPage newTab = new DevExpress.XtraTab.XtraTabPage();
            newTab.Controls.Add(ctrl);
            newTab.Text = newTab.Name = caption;

            newTab.Controls[ctrl.Name].Dock = DockStyle.Fill;

            if (ContainsKey(newTab.Name))
            {
                xtraTabControl1.SelectedTabPage = currPage;
            }
            else
            {
                xtraTabControl1.TabPages.Add(newTab);
                xtraTabControl1.SelectedTabPage = newTab;
            }
        }
Exemple #28
0
 public void ThemTabPages(UserControl uct, byte typeControl, string tenTab)
 {
     for (int i = 0; i < tabHienThi.TabPages.Count; i++)
     {
         if (tabHienThi.TabPages[i].Contains(uct) == true)
         {
             tabHienThi.SelectedTabPage = tabHienThi.TabPages[i];
             return;
         }
     }
     DevExpress.XtraTab.XtraTabPage tab = new DevExpress.XtraTab.XtraTabPage();
     typePages.Add(typeControl);
     tab.Name = uct.Name;
     tab.Size = tabHienThi.Size;
     tab.Text = tenTab;
     tabHienThi.TabPages.Add(tab);
     uct.Dock = DockStyle.Fill;
     tab.Controls.Add(uct);
     uct.Focus();
 }
Exemple #29
0
        public void LoadForm(UserControl ctl, string tabName)
        {
            try
            {
                if (NotTabExist(tabName))
                {
                    ctl.Dock = DockStyle.Fill;
                    DevExpress.XtraTab.XtraTabPage xtra = new DevExpress.XtraTab.XtraTabPage();
                    xtra.Text = tabName;
                    xtra.Controls.Add(ctl);
                    xtra.Padding = new System.Windows.Forms.Padding(2);
                    xtraTabControl1.TabPages.Add(xtra);
                }

                tabPageIndex = TabPageIndex(tabName);
                if (tabPageIndex == -1)
                {
                    xtraTabControl1.SelectedTabPageIndex = 0;
                }
                else
                {
                    try
                    {
                        xtraTabControl1.SelectedTabPageIndex = tabPageIndex;
                    }
                    catch
                    {
                        XtraMessageBox.Show("Có lỗi xảy ra");
                    }
                }
            }
            catch
            {
                XtraMessageBox.Show("Có lỗi xảy ra");
            }
        }
        public void OpenTab(Form pForm)
        {
            if (CheckTabOpened(pForm.Text) == true) return;

            // Khoi tao
            DevExpress.XtraTab.XtraTabPage tab = new DevExpress.XtraTab.XtraTabPage();

            // Cai dat form
            pForm.Dock = DockStyle.Fill;
            pForm.TopLevel = false;
            pForm.Parent = this;
            pForm.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;

            // Cai dat tab
            tab.Text = pForm.Text;
            //tab.Size = new System.Drawing.Size(878, 350);
            tab.Controls.Add(pForm);

            // Hien nguyen hien
            pForm.Show();
            tabMain.TabPages.Add(tab);
            tabMain.SelectedTabPage = tab;
        }
        public void RefreshDataBinding(int maDatPhong)
        {
            //Lấy tất cả tinh trang phong vào cmb
            listTinhTrangDatPhong = DatPhongBUS.LayTatCaTinhTrangDatPhong_List();
            //combobox tinh trang phong
            txtTinhTrangDat.Properties.Items.Clear();

            foreach (TinhTrangDatPhongDTO tinhtrang in listTinhTrangDatPhong)
            {
                txtTinhTrangDat.Properties.Items.Add(new MyComboBoxItem(tinhtrang.TinhTrangDatPhong, tinhtrang.MaTinhDatTrangPhong));
            }


            this.datPhong             = DatPhongBUS.LayThongTinDatPhong(maDatPhong);
            txtMaDatPhong.EditValue   = maDatPhong;
            txtTienTraTruoc.EditValue = datPhong.SoTienDatTruoc;
            txtThoiGian.EditValue     = datPhong.ThoiGianDatPhong;
            txtGhiChu.EditValue       = datPhong.GhiChu;
            dateNgayLapPhieu.DateTime = datPhong.NgayLapPhieuDat;
            txtTinhTrangDat.EditValue = DatPhongBUS.LayTinhTrangPhong(datPhong.MaTinhTrangDatPhong).TinhTrangDatPhong;

            khachHang             = KhachHangBUS.LayKhachHang(datPhong.MaKH);
            txtMaKH.EditValue     = khachHang.MaKH;
            txtLoaiKH.EditValue   = LoaiKhachHangBUS.LayLoaiKhachHang(khachHang.MaLoaiKH).TenLoaiKH;
            txtEmail.EditValue    = khachHang.Email;
            txtSDT.EditValue      = khachHang.SDT;
            txtTenKH.EditValue    = khachHang.TenKH;
            txtDiaChi.EditValue   = khachHang.DiaChi;
            txtNgaySinh.EditValue = khachHang.NgaySinh;

            txtTenNhanVien.EditValue = NhanVienBUS.LayNhanVien(datPhong.MaNhanVien).TenNhanVien;

            this.TabControl.TabPages.Clear();
            foreach (ChiTietDatPhongDTO chiTiet in DatPhongBUS.LayTatCaCacChiTietDatPhong(datPhong.MaDatPhong))
            {
                ThongTinChiTietDatPhong thongTinChiTietDatPhong = new ThongTinChiTietDatPhong(datPhong);
                thongTinChiTietDatPhong.RefreshDataBinding(chiTiet);
                DevExpress.XtraTab.XtraTabPage xtraTab = new DevExpress.XtraTab.XtraTabPage();

                //
                // thongTinChiTietPhong1
                //
                thongTinChiTietDatPhong.Appearance.BackColor            = System.Drawing.Color.White;
                thongTinChiTietDatPhong.Appearance.Options.UseBackColor = true;
                thongTinChiTietDatPhong.Dock     = System.Windows.Forms.DockStyle.Fill;
                thongTinChiTietDatPhong.Location = new System.Drawing.Point(0, 0);
                thongTinChiTietDatPhong.Name     = "thongTinChiTietPhong1";
                thongTinChiTietDatPhong.Size     = new System.Drawing.Size(989, 591);
                thongTinChiTietDatPhong.TabIndex = 0;

                //
                // tab1
                //
                xtraTab.Controls.Add(thongTinChiTietDatPhong);
                xtraTab.Name = thongTinChiTietDatPhong.phong.MaPhong.ToString();
                xtraTab.Size = new System.Drawing.Size(989, 591);
                xtraTab.Text = thongTinChiTietDatPhong.phong.TenPhong;
                xtraTab.Tag  = thongTinChiTietDatPhong;
                //
                this.TabControl.TabPages.AddRange(new DevExpress.XtraTab.XtraTabPage[] { xtraTab });
            }

            if (datPhong.MaTinhTrangDatPhong == 3)
            {
                txtTienTraTruoc.ReadOnly = true;
                txtGhiChu.ReadOnly       = true;
            }
        }
Exemple #32
0
        private void preview()
        {
            string reportFile = "";
            try
            {
                if (this.splitContainerControl1.Panel2.Controls.Count > 0 && this.treeList1.Selection[0].Tag != null)
                {
                    IReportFilter filter = (IReportFilter)this.splitContainerControl1.Panel2.Controls[0];

                    //Kiểm tra lỗi
                    Error.ClearErrors();
                    filter.ValidateFilter(Error);
                    if (Error.HasErrors) return;

                    #region Khởi tạo Main DataSet
                    DataSet ds = null;
                    ds = filter.getDataSet();
                    if (showEmptyReport == false)
                    {
                        if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                        {
                            HelpMsgBox.ShowNotificationMessage("Không tìm thấy dữ liệu báo cáo.");
                            return;
                        }
                    }
                    ReportInfo info = (ReportInfo)this.treeList1.Selection[0].Tag;
                    ParameterFields Params = null;
                    ReportClass Report = null;
                    if (this.splitContainerControl1.Panel2.Controls[0] is IDynSheetReportFilter)
                    {
                        string Title = null;
                        string SubTitle = null;
                        string[] FieldNames = null;
                        string[] Captions = null;
                        int[] Widths = null;
                        bool IsVertical = false;
                        //Alignment[] aligns = null;

                        ((IDynSheetReportFilter)this.splitContainerControl1.Panel2.Controls[0]).GetParam(
                            out Title, out SubTitle, out FieldNames,
                            out Captions, out Widths, out IsVertical);

                        if (IsVertical)
                        {
                            Report = new VSheetReport();
                        }
                        else
                        {
                            Report = new HSheetReport();
                        }

                        DynamicSheetReport.ToSheetReport(Report, out Params, ds,
                            FieldNames,
                            Captions,
                            Widths, Title, SubTitle);

                    }
                    #endregion
                    FrameworkParams.wait = new WaitingMsg();

                    #region Thêm 1 Viewer
                    DevExpress.XtraTab.XtraTabPage page = null;
                    PLCrystalReportViewer view = new PLCrystalReportViewer();
                    view._SetSupportRefresh(false);

                    lock(AddPageFlag){
                        if (AddPageFlag.Value == true)
                        {
                            page = new DevExpress.XtraTab.XtraTabPage();
                            page.Text = this.treeList1.Selection[0].GetValue(0).ToString();
                            page.Controls.Add(view);
                            AddPageFlag.Value = false;

                            this.xtraTabControl1.TabPages.Add(page);
                            page.Tag = this.splitContainerControl1.Panel2.Controls[0];
                            this.xtraTabControl1.SelectedTabPage = page;
                        }
                        else
                        {
                            page = this.xtraTabControl1.SelectedTabPage;
                            page.Controls.Clear();
                            page.Controls.Add(view);
                        }
                    }
                    view.Dock = DockStyle.Fill;
                    //DevExpress.XtraTab.XtraTabPage page = new DevExpress.XtraTab.XtraTabPage();
                    //page.Text = this.treeList1.Selection[0].GetValue(0).ToString();
                    //PLCrystalReportViewer view = new PLCrystalReportViewer();
                    //page.Controls.Add(view);

                    //view.Dock = DockStyle.Fill;
                    #endregion

                    if (this.splitContainerControl1.Panel2.Controls[0] is IDynSheetReportFilter)
                    {
                        //#region Phiên bản 12
                        //view._I.ParameterFieldInfo = Params;
                        //view._SetSupportRefresh(false);
                        ////EnableParameterPrompting
                        //view._I.ReportSource = Report;
                        //#endregion
                        #region Phiên bản 10
                        view.ParameterFieldInfo = Params;
                        view._SetSupportRefresh(false);
                        //EnableParameterPrompting
                        view.ReportSource = Report;
                        #endregion
                    }
                    else {
                        #region Lấy 1 ReportDocument
                        ReportDocument report = new ReportDocument();
                        if (this.splitContainerControl1.Panel2.Controls[0] is IAdvanceReportFilter)
                            info.ReportFile = ((IAdvanceReportFilter)this.splitContainerControl1.Panel2.Controls[0]).getReportFile();
                        reportFile = info.ReportFile;
                        if (reportFile.StartsWith("EMB"))
                        {
                            reportFile = reportFile.Substring(3);
                            try { report = (ReportDocument)GenerateClass.initObject(reportFile); }
                            catch { }
                        }
                        else if (reportFile.StartsWith("PATH"))
                        {
                            reportFile = reportFile.Substring(4);
                            report.Load(reportFile);
                        }
                        else //if (reportFile.StartsWith("\\report"))
                        { //Load theo dạng file
                            reportFile = RadParams.RUNTIME_PATH + reportFile;
                            report.Load(reportFile);
                        }

                        #endregion

                        #region Gán DataSet
                        //2008
                        view._DSList = new List<DataSet>();
                        ////Set DataSet cho Main Report
                        view._DSList.Add(ds);
                        for (int i = 0; i < ds.Tables.Count; i++)
                        {
                            report.Database.Tables[i].SetDataSource(ds.Tables[i]);
                        }

                        //Set DataSet cho SubReport
                        DataSet[] dsArray = filter.getSubReports();
                        if(dsArray!=null){
                            for (int i = 0; i < dsArray.Length; i++)
                            {
                                report.Subreports[i].SetDataSource(dsArray[i]);
                                view._DSList.Add(dsArray[i]);
                            }
                        }
                        #endregion

                        #region Parameter
                        Dictionary<string, object> dic = filter.GetParamFieldValue();
                        foreach (CrystalDecisions.Shared.ParameterField pa in report.ParameterFields)
                        {
                            if (dic.ContainsKey(pa.Name))
                            {
                                report.SetParameterValue(pa.Name, dic[pa.Name]);
                            }
                        }
                        //view._SetSupportRefresh(true);
                        if (FrameworkParams.wait != null) FrameworkParams.wait.Finish();

                        //view._I.ReportSource = report;//phiên bản 12
                        view.ReportSource = report;//phiên bản 10
                        #endregion

                        report.RefreshReport += new EventHandler(report_RefreshReport);
                    }

                    if (FrameworkParams.isFax == true)
                    {
                        frmFax frmFax = new frmFax(info.Caption, FrameworkParams.TEMP_FOLDER + @"\" + "$faxdoc.pdf", "Thông tin người nhận", "Điện thoại");
                        view.frmFax = frmFax;
                    }

                    //this.xtraTabControl1.TabPages.Add(page);
                    //page.Tag = this.splitContainerControl1.Panel2.Controls[0];

                    //this.xtraTabControl1.SelectedTabPage = page;

                }
                //if (FrameworkParams.wait != null) FrameworkParams.wait.Finish();
            }
            catch(Exception e){
                if (FrameworkParams.wait != null) FrameworkParams.wait.Finish();
                //HelpMsgBox.ShowNotificationMessage("Tập tin " + reportFile + " không tồn tại.\nVui lòng liên hệ Công ty P R O T O C O L.");
                HelpMsgBox.ShowNotificationMessage("Quá trình tạo báo cáo không thành công. \nVui lòng thực thực hiện lại.");
                PLException.AddException(e);
            }
            finally {
                if (FrameworkParams.wait != null) FrameworkParams.wait.Finish();
            }
        }
        private void preview()
        {
            string reportFile = "";
            try
            {
                if (this.splitContainerControl1.Panel2.Controls.Count > 0 && this.treeList1.Selection[0].Tag != null)
                {
                    IReportFilter filter = (IReportFilter)this.splitContainerControl1.Panel2.Controls[0];

                    //Kiểm tra lỗi
                    Error.ClearErrors();
                    filter.ValidateFilter(Error);
                    if (Error.HasErrors) return;

                    #region Khởi tạo Main DataSet
                    DataSet ds = null;
                    ds = filter.getDataSet();
                    if (showEmptyReport==false)
                    {
                        if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                        {
                            HelpMsgBox.ShowNotificationMessage("Không tìm thấy dữ liệu báo cáo.");
                            return;
                        }
                    }
                    ReportInfo info = (ReportInfo)this.treeList1.Selection[0].Tag;
                    ParameterFields Params = null;
                    ReportClass Report = null;
                    if (this.splitContainerControl1.Panel2.Controls[0] is IDynSheetReportFilter)
                    {
                        string Title = null;
                        string SubTitle = null;
                        string[] FieldNames = null;
                        string[] Captions = null;
                        int[] Widths = null;
                        bool IsVertical = false;
                        //Alignment[] aligns = null;

                        ((IDynSheetReportFilter)this.splitContainerControl1.Panel2.Controls[0]).GetParam(
                            out Title, out SubTitle, out FieldNames,
                            out Captions, out Widths, out IsVertical);

                        if (IsVertical)
                        {
                            Report = new VSheetReport();
                        }
                        else
                        {
                            Report = new HSheetReport();
                        }

                        DynamicSheetReport.ToSheetReport(Report, out Params, ds,
                            FieldNames,
                            Captions,
                            Widths, Title, SubTitle);

                    }
                    #endregion
                    FrameworkParams.wait = new WaitingMsg();

                    #region Thêm 1 Viewer
                    DevExpress.XtraTab.XtraTabPage page = null;
                    bool usingXtraReport = info.ReportFile.StartsWith("EMBXTRA");
                    PLCrystalReportViewer view = null;
                    PLXtraPreview xtraview = null;
                    Control viewCtrl = null;
                    if (usingXtraReport)
                    {
                        xtraview = new PLXtraPreview();
                        viewCtrl = xtraview;
                    }
                    else
                    {
                        view = new PLCrystalReportViewer();
                        view._SetSupportRefresh(false);
                        viewCtrl = view;
                    }
                    lock(AddPageFlag){
                        if (AddPageFlag.Value == true)
                        {
                            page = new DevExpress.XtraTab.XtraTabPage();
                            page.Text = this.treeList1.Selection[0].GetValue(0).ToString();
                            page.Controls.Add(viewCtrl);
                            AddPageFlag.Value = false;

                            this.xtraTabControl1.TabPages.Add(page);
                            page.Tag = this.splitContainerControl1.Panel2.Controls[0];
                            this.xtraTabControl1.SelectedTabPage = page;
                        }
                        else
                        {
                            page = this.xtraTabControl1.SelectedTabPage;
                            page.Controls.Clear();
                            page.Controls.Add(viewCtrl);
                        }
                    }
                    viewCtrl.Dock = DockStyle.Fill;
                    //DevExpress.XtraTab.XtraTabPage page = new DevExpress.XtraTab.XtraTabPage();
                    //page.Text = this.treeList1.Selection[0].GetValue(0).ToString();
                    //PLCrystalReportViewer view = new PLCrystalReportViewer();
                    //page.Controls.Add(view);

                    //view.Dock = DockStyle.Fill;
                    #endregion
                    XtraReport xtraReport = null;
                    if (this.splitContainerControl1.Panel2.Controls[0] is IDynSheetReportFilter)
                    {
                        #region Phiên bản 14
                        //view._I.ParameterFieldInfo = Params;
                        //view._SetSupportRefresh(false);
                        ////EnableParameterPrompting
                        //view._I.ReportSource = Report;
                        #endregion
                        #region Phiên bản 10
                        view.ParameterFieldInfo = Params;
                        view._SetSupportRefresh(false);
                        //EnableParameterPrompting
                        view.ReportSource = Report;
                        #endregion
                    }
                    else {
                        #region Lấy 1 ReportDocument

                        if (this.splitContainerControl1.Panel2.Controls[0] is IAdvanceReportFilter)
                            info.ReportFile = ((IAdvanceReportFilter)this.splitContainerControl1.Panel2.Controls[0]).getReportFile();
                        reportFile = info.ReportFile;
                        ReportDocument report = new ReportDocument();

                        if (reportFile.StartsWith("EMBXTRA"))
                        {
                            reportFile = reportFile.Substring(7);
                            try { xtraReport = (DevExpress.XtraReports.UI.XtraReport)GenerateClass.initObject(reportFile); }
                            catch { }
                        }
                        else if (reportFile.StartsWith("EMB"))
                        {
                            reportFile = reportFile.Substring(3);
                            try { report = (ReportDocument)GenerateClass.initObject(reportFile); }
                            catch { }
                        }
                        else if (reportFile.StartsWith("PATH"))
                        {
                            reportFile = reportFile.Substring(4);
                            report.Load(reportFile);
                        }
                        else //if (reportFile.StartsWith("\\report"))
                        { //Load theo dạng file
                            reportFile = RadParams.RUNTIME_PATH + reportFile;
                            report.Load(reportFile);
                        }

                        #endregion

                        #region Gán DataSet
                        if (usingXtraReport == false)
                        {
                            view._DSList = new List<DataSet>();
                            //Set DataSet cho Main Report
                            view._DSList.Add(ds);
                            for (int i = 0; i < ds.Tables.Count; i++)
                            {
                                report.Database.Tables[i].SetDataSource(ds.Tables[i]);
                            }
                            //Set DataSet cho SubReport
                            DataSet[] dsArray = filter.getSubReports();
                            if (dsArray != null)
                            {
                                for (int i = 0; i < dsArray.Length; i++)
                                {
                                    report.Subreports[i].SetDataSource(dsArray[i]);
                                    view._DSList.Add(dsArray[i]);
                                }
                            }
                            #region Parameter
                            Dictionary<string, object> dic = filter.GetParamFieldValue();
                            foreach (CrystalDecisions.Shared.ParameterField pa in report.ParameterFields)
                            {
                                if (dic.ContainsKey(pa.Name))
                                {
                                    report.SetParameterValue(pa.Name, dic[pa.Name]);
                                }
                            }
                            if (FrameworkParams.wait != null) FrameworkParams.wait.Finish();
                            //view._SetSupportRefresh(true);
                            //view._I.ReportSource = report;//phiên bản 12
                            view.ReportSource = report;//phiên bản 10
                            #endregion

                            report.RefreshReport += new EventHandler(report_RefreshReport);
                        }
                        else//XtraReport
                        {
                            xtraReport.DataSource = ds;
                            //Dạng có Main Report + Sub Report
                            DataSet[] dsArray = filter.getSubReports();
                            if (dsArray != null)
                            {
                                List<XRSubreport> subreport = new List<XRSubreport>();
                                foreach (Band band in xtraReport.Bands)//getBands(xtraReport))
                                {
                                    foreach (XRControl xrControl in band.Controls)
                                    {
                                        if (xrControl is XRSubreport)
                                        {
                                            subreport.Add((XRSubreport)xrControl);
                                        }
                                    }
                                }

                                //for (int i = 0; i < dsArray.Length; i++)
                                //{
                                //    subreport[i].ReportSource.DataSource = dsArray[i];
                                //}
                                //duchs: gan dataset cho datasource cua subreport dua vao ten bang
                                for (int i = 0; i < dsArray.Length; i++)
                                {
                                    foreach (XRSubreport itemreport in subreport)
                                    {
                                        try
                                        {
                                            //DataSet ds=(DataSet)itemreport.DataSource;
                                            if (itemreport.ReportSource.DataMember.ToUpper().Equals(dsArray[i].Tables[0].TableName))
                                            {
                                                itemreport.ReportSource.DataSource = dsArray[i].Tables[0];
                                                break;
                                            }
                                        }
                                        catch { }
                                    }
                                }
                            }
                            #region Parameter
                            Dictionary<string, object> dic = filter.GetParamFieldValue();
                            foreach (DevExpress.XtraReports.Parameters.Parameter par in xtraReport.Parameters)
                            {
                                if (dic.ContainsKey(par.Name))
                                {
                                    xtraReport.Parameters[par.Name].Value = dic[par.Name];
                                }
                            }
                            xtraReport.PrintingSystem.SetCommandVisibility(DevExpress.XtraPrinting.PrintingSystemCommand.ClosePreview, DevExpress.XtraPrinting.CommandVisibility.None);
                            //ẩn phần nhập Parameters
                            xtraReport.RequestParameters = false;
                            xtraview.PrintingSystem = xtraReport.PrintingSystem;
                            xtraReport.CreateDocument();
                            //ẩn nút Parameters trên toolbar
                            xtraReport.PrintingSystem.SetCommandVisibility(DevExpress.XtraPrinting.PrintingSystemCommand.Parameters, DevExpress.XtraPrinting.CommandVisibility.None);
                            //MessageBox.Show(view.PrintingSystem.Pages.Count.ToString());
                            #endregion
                        }
                        #endregion

                    }

                    if (FrameworkParams.isFax == true)
                    {
                        frmFax frmFax = new frmFax(info.Caption, FrameworkParams.TEMP_FOLDER + @"\" + "$faxdoc.pdf", "Thông tin người nhận", "Điện thoại");
                        view.frmFax = frmFax;
                    }

                    //this.xtraTabControl1.TabPages.Add(page);
                    //page.Tag = this.splitContainerControl1.Panel2.Controls[0];

                    //this.xtraTabControl1.SelectedTabPage = page;

                }
                //if (FrameworkParams.wait != null) FrameworkParams.wait.Finish();
            }
            catch(Exception e){
                if (FrameworkParams.wait != null) FrameworkParams.wait.Finish();
                HelpMsgBox.ShowNotificationMessage("Tập tin " + reportFile + " không tồn tại.\nVui lòng liên hệ Công ty P R O T O C O L.");
                PLException.AddException(e);
            }
            finally {
                if (FrameworkParams.wait != null) FrameworkParams.wait.Finish();
            }
        }
Exemple #34
0
        //起始位置11、11 |128、8;size 337:21|
        //垂直增加33  
        private void frmSBTZ_Load(object sender, EventArgs e)
        {
            List<DicType> dicTypeList = new List<DicType>();
            if (sdxl != null)
            {
                gtList = Client.ClientHelper.PlatformSqlMap.GetListByWhere<sd_gt>("where LineCode='" + sdxl.LineCode + "'");
            }
            foreach (sd_gt sdgt in gtList)
            {
                dicTypeList.Add(new DicType(sdgt.gtCode, sdgt.gtCode));
            }
            //lable一个字符站12个宽度
            this.xtraTabControl1.TabPages.Clear();
            this.splitContainerControl1.Panel2.Controls.Clear();
            //lable起始位置
            int startlblw = 11;
            int startlblh = 11;
            //textbox起始位置
            int starttextw = 180;
            int starttexth = 8;
            int addh = 33;
            int pageNumber = 1;
            int nrows = 30;
            IList<sd_tsqyzlsx> sbsxList = Client.ClientHelper.PlatformSqlMap.GetListByWhere<sd_tsqyzlsx>("where zldm='" + tsqyzl.zldm + "' and isuse='是' order by convert(int,norder)");
            int[] widthArr = new int[sbsxList.Count / nrows + 1];
            for (int i = 0; i < widthArr.Length; i++)
            {
                widthArr[i] = GetMaxLblWidth(i, sbsxList);
            }
            if (widthArr[0] == 0)
                widthArr[0] = 48;
            if (pageNumber == 1)
            {
                XtraPage = new DevExpress.XtraTab.XtraTabPage();
                XtraPage.Name = "xtrpage" + pageNumber;
                XtraPage.Text = string.Format("特殊区域属性");
                this.xtraTabControl1.TabPages.Add(XtraPage);

                DevExpress.XtraEditors.LabelControl lblstart = new DevExpress.XtraEditors.LabelControl();
                lblstart.Name = "lblStart";
                lblstart.Text = "起始杆塔";
                lblstart.Location = new Point(startlblw, startlblh);

                DevExpress.XtraEditors.LookUpEdit lkueStart = new LookUpEdit();
                lkueStart.Name = "lkueStart";
                SetComboBoxData(lkueStart, "Value", "Key", "请选择", "起始杆塔", dicTypeList);

                lkueStart.Location = new Point(widthArr[pageNumber - 1] + 40, starttexth);
                lkueStart.DataBindings.Add("EditValue", rowData, "gtbegin");

                XtraPage.Controls.Add(lblstart);
                XtraPage.Controls.Add(lkueStart);
                startlblh += 33;
                starttexth += 33;
                

                DevExpress.XtraEditors.LabelControl lblend = new DevExpress.XtraEditors.LabelControl();
                lblend.Name = "lblend";
                lblend.Text = "终止杆塔";
                lblend.Location = new Point(startlblw, startlblh);

                DevExpress.XtraEditors.LookUpEdit lkueEnd = new LookUpEdit();
                lkueEnd.Name = "lkueend";
                SetComboBoxData(lkueEnd, "Value", "Key", "请选择", "终止杆塔", dicTypeList);
                lkueEnd.Location = new Point(widthArr[pageNumber - 1] + 40, starttexth);
                lkueEnd.DataBindings.Add("EditValue", rowData, "gtend");

                XtraPage.Controls.Add(lblend);
                XtraPage.Controls.Add(lkueEnd);
                startlblh += 33;
                starttexth += 33;
                
            }

                if (sbsxList.Count > 0)
                {
                    
                    int i = 3;
                    foreach (sd_tsqyzlsx sbsx in sbsxList)
                    {
                        if (i > nrows || XtraPage == null)
                        {
                            pageNumber++;
                            XtraPage = new DevExpress.XtraTab.XtraTabPage();
                            XtraPage.Name = "xtrpage" + pageNumber;
                            XtraPage.Text = string.Format("特殊区域第{0}页", pageNumber);
                            this.xtraTabControl1.TabPages.Add(XtraPage);
                            XtraPage.AutoScroll = true;
                            //XtraPage.SizeChanged += new EventHandler(XtraPage_SizeChanged);
                        }

                        if (i > nrows)
                        {
                            i = 1;
                            startlblw = 11;
                            startlblh = 11;
                            starttextw = 180;
                            starttexth = 8;
                        }
                        
                        DevExpress.XtraEditors.LabelControl lbl = new DevExpress.XtraEditors.LabelControl();
                        lbl.Name = lbl + sbsx.sxcol;
                        lbl.Text = sbsx.sxname.Trim();
                        lbl.Location = new Point(startlblw, startlblh);

                        Control txtEdit = createControl(sbsx);
                        txtEdit.Name = sbsx.sxcol;
                        //txtEdit.DataBindings.Add("EditValue", rowData, sbsx.sxcol);
                        txtEdit.Size = new Size(337, 21);
                        //txtEdit.Location = new Point(starttextw, starttexth);
                        txtEdit.Location = new Point(widthArr[pageNumber - 1] + 40, starttexth);
                        
                        XtraPage.Controls.Add(lbl);
                        XtraPage.Controls.Add(txtEdit);
                        XtraPage.AutoScrollMinSize = new Size(txtEdit.Right + 10, txtEdit.Bottom + 10);
                        startlblh += 33;
                        starttexth += 33;
                        i++;
                    }
                    

                }
                XtraPage = new DevExpress.XtraTab.XtraTabPage();
                XtraPage.Name = "xtrPagePicture";
                XtraPage.Text = "特殊区域照片";
                this.xtraTabControl1.TabPages.Add(XtraPage);
                GroupBox grpbox = new GroupBox();
                grpbox.Location = new Point(0, 0);
                grpbox.Text = "照片";
                grpbox.Name = "grppicture";
                //grpbox.Dock = DockStyle.Top;
                grpbox.Dock = DockStyle.Fill;
                grpbox.Size = new Size(565, 386);
                XtraPage.Controls.Add(grpbox);

                pictureEdit1 = new DevExpress.XtraEditors.PictureEdit();
                pictureEdit1.Dock = DockStyle.Fill;
                pictureEdit1.Name = "pictureEdit1";
                grpbox.Controls.Add(pictureEdit1);
                pictureEdit1.EditValueChanged += new EventHandler(pictureEdit1_EditValueChanged);


                DevExpress.XtraEditors.SimpleButton btnOk = new DevExpress.XtraEditors.SimpleButton();
                btnOk.Name = "btnOk";
                btnOk.Text = "确定";
                btnOk.Location = new Point(357, 9);
                btnOk.Click += new EventHandler(btnOk_Click);
                btnOk.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
                DevExpress.XtraEditors.SimpleButton btnCancel = new DevExpress.XtraEditors.SimpleButton();
                btnCancel.Name = "btnCancel";
                btnCancel.Text = "取消";
                btnCancel.Location = new Point(461, 9);
                btnCancel.Click += new EventHandler(btnCancel_Click);
                btnCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
                this.splitContainerControl1.Panel2.Controls.Add(btnOk);
                this.splitContainerControl1.Panel2.Controls.Add(btnCancel);
            setImage();

        }
Exemple #35
0
 //模块关闭事件
 private void xtraTabControl1_CloseButtonClick(object sender, EventArgs e)
 {
     DevExpress.XtraTab.ViewInfo.ClosePageButtonEventArgs c = (DevExpress.XtraTab.ViewInfo.ClosePageButtonEventArgs)e;
     DevExpress.XtraTab.XtraTabPage page = (DevExpress.XtraTab.XtraTabPage)c.PrevPage;
     this.xtraTabControl1.TabPages.Remove(page);
 }