Ejemplo n.º 1
0
        private void lueDuAn_EditValueChanged_1(object sender, EventArgs e)
        {
            WaitDialogForm wait = new DevExpress.Utils.WaitDialogForm("Phần mềm đang tải dữ liệu....", "Vui lòng chờ");

            try
            {
                wait.Show();
                //Phải cho khác null vào vì có lúc người dùng nó không chọn dự án đỡ mất công gửi lên sever
                //Sau này muốn nếu null mà load toàn bộ dự án thì làm vào phần else là được
                if (lueDuAn.EditValue != null)
                {
                    string id = lueDuAn.EditValue.ToString();
                    LoadWork(id);
                }
            }
            catch (Exception ex)
            {
                lg.Error(ex);
                wait.Close();
            }
            finally
            {
                wait.Close();
            }
        }
Ejemplo n.º 2
0
        public FaceCompare()
        {
            InitializeComponent();
            _accuracies = new[] {
                new Tuple <string, int>("低", 60),
                new Tuple <string, int>("中", 65),
                new Tuple <string, int>("高", 70),
            };

            _currentAccuracy = 65;

            this.searchFrom.EditValue = DateTime.Now.AddDays(-1);
            this.searchTo.EditValue   = DateTime.Now;

            this.targetPic.Paint     += new PaintEventHandler(targetPic_Paint);
            this.compareButton.Click += new EventHandler(compareButton_Click);

            if (_faceComparer == null)
            {
                _waitForm = new WaitDialogForm("初始化人脸特征库...", "请稍候");
                var modelPath      = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "model.txt");
                var classifierPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "haarcascade_frontalface_alt2.xml");
                var comparer       = FaceRecoWrapper.FromModel(modelPath, classifierPath);
                _faceComparer = comparer;
            }
        }
Ejemplo n.º 3
0
        public FaceCompare()
        {
            InitializeComponent();
            _accuracies = new[]{
                new Tuple<string, int>("低", 60),
                new Tuple<string, int>("中", 65),
                new Tuple<string, int>("高", 70),
            };

            _currentAccuracy = 65;

            this.searchFrom.EditValue = DateTime.Now.AddDays(-1);
            this.searchTo.EditValue = DateTime.Now;

            this.targetPic.Paint += new PaintEventHandler(targetPic_Paint);
            this.compareButton.Click += new EventHandler(compareButton_Click);

            if (_faceComparer == null)
            {
                _waitForm = new WaitDialogForm("初始化人脸特征库...", "请稍候");
                var modelPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "model.txt");
                var classifierPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "haarcascade_frontalface_alt2.xml");
                var comparer = FaceRecoWrapper.FromModel(modelPath, classifierPath);
                _faceComparer = comparer;
            }
        }
Ejemplo n.º 4
0
        private void LoadBaoCao()
        {
            WaitDialogForm wait = new DevExpress.Utils.WaitDialogForm("Phần mềm đang tải dữ liệu....", "Vui lòng chờ");

            try
            {
                wait.Show();
                DateTime TuNgay  = dateTuNgay.DateTime;
                DateTime DenNgay = dateDenNgay.DateTime;
                int      ID_User = 0;
                ID_User = luedNhanVien.EditValue != null?int.Parse(luedNhanVien.EditValue.ToString()) : 0;

                int ID_LoaiGhim = 0;
                ID_LoaiGhim = luedLoaiGhim.EditValue != null?int.Parse(luedLoaiGhim.EditValue.ToString()) : 0;

                List <BaoCaoTongHopGhim> list = Retrofit.instance.BaoCaoTongHopGhim(TuNgay, DenNgay, ID_User, ID_LoaiGhim);
                gc.DataSource = list;
            }
            catch (Exception ex)
            {
                lg.Error(ex);
                wait.Close();
            }
            finally
            {
                wait.Close();
            }
        }
Ejemplo n.º 5
0
        private void LoadBaoCao()
        {
            WaitDialogForm wait = new DevExpress.Utils.WaitDialogForm("Phần mềm đang tải dữ liệu....", "Vui lòng chờ");

            try
            {
                wait.Show();
                DateTime TuNgay  = dateTuNgay.DateTime;
                DateTime DenNgay = dateDenNgay.DateTime;
                int      ID_User = 0;
                ID_User = luedNhanVien.EditValue != null?int.Parse(luedNhanVien.EditValue.ToString()) : 0;

                List <BaoCaoChiTietGhimOBJ> list = Retrofit.instance.BaoCaoChiTietGhim(TuNgay, DenNgay, ID_User);
                gc.DataSource = list;
            }
            catch (Exception ex)
            {
                lg.Error(ex);
                MessageBox.Show("Có lỗi xảy ra vui lòng liên hệ quản trị viên", "Thông báo");
                wait.Close();
            }
            finally
            {
                wait.Close();
            }
        }
Ejemplo n.º 6
0
        private void LoadBieuDoTheoDTV()
        {
            WaitDialogForm wait = new DevExpress.Utils.WaitDialogForm("Phần mềm đang tải dữ liệu....", "Vui lòng chờ");

            try
            {
                wait.Show();
                listGhim = Retrofit.instance.Ghim(deTuNgay.DateTime, deDenNgay.DateTime);
                chartBieuDo.Series.Clear();
                chartBieuDo.Titles.Clear();
                chartBieuDo.DataSource = listGhim;
                // Create four side-by-side stacked bar series.
                Series series1 = new Series("Ghim", ViewType.StackedBar);
                for (int i = 0; i < listGhim.Count; i++)
                {
                    series1.Points.Add(new SeriesPoint(listGhim[i].Name, listGhim[i].SoGhim));
                }
                // Add all series to the chart.
                chartBieuDo.Series.AddRange(new Series[] { series1, });
                // Access the type-specific options of the diagram.
                if (listGhim.Count > 0)
                {
                    // Access the view-type-specific options of the series.
                    ((StackedBarSeriesView)series1.View).BarWidth = 0.8;

                    // Access the type-specific options of the diagram.
                    ((XYDiagram)chartBieuDo.Diagram).EnableAxisXZooming = true;
                }


                // Hide the legend (if necessary).
                chartBieuDo.Legend.Visibility = DevExpress.Utils.DefaultBoolean.True;

                // Add a title to the chart (if necessary).
                chartBieuDo.Titles.Add(new ChartTitle());
                chartBieuDo.Titles[0].Text     = "";
                chartBieuDo.Titles[0].WordWrap = true;

                //Add the chart to the form.
                chartBieuDo.Dock = DockStyle.Fill;
            }
            catch (Exception ex)
            {
                lg.Error(ex);
                wait.Close();
            }
            finally
            {
                wait.Close();
            }
        }
Ejemplo n.º 7
0
        private void btnWait_Click(object sender, EventArgs e)
        {
            WaitDialogForm WaitBeforeLogin = null;

            new Thread((ThreadStart) delegate
            {
                WaitBeforeLogin = new DevExpress.Utils.WaitDialogForm("请稍候...", "正在加载应用系统");
                Thread.Sleep(3000);
                Console.WriteLine("1:" + DateTimeHelper.GetServerDateTime2());
            }).Start();
            Console.WriteLine("2:" + DateTimeHelper.GetServerDateTime2());
            Console.WriteLine("3:" + DateTimeHelper.GetServerDateTime2());
            ChildWinManagement.PopDialogForm(typeof(FrmRegeditTool));

            //关闭登录提示画面
            WaitBeforeLogin.Invoke((EventHandler) delegate { WaitBeforeLogin.Close(); });
        }
        public TargetPersonEditForm()
        {
            InitializeComponent();
            galleryControl1.Gallery.ItemCheckedChanged +=
                (s, e) => removeTarget.Enabled = galleryControl1.Gallery.Groups[0].GetCheckedItems().Count > 0;

            _waitForm = new WaitDialogForm("正在初始化,请稍候...", "请稍候");
            if (_faceComparer == null)
            {
                _waitForm.Caption = "正在初始化人像比对模块...";
                var modelPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "model.txt");
                var classifierPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "haarcascade_frontalface_alt2.xml");
                var comparer = FaceRecoWrapper.FromModel(modelPath, classifierPath);
                _faceComparer = comparer;
            }

            _waitForm.Caption = "正在载入目标人像库...";
            LoadTargets();
        }
        public TargetPersonEditForm()
        {
            InitializeComponent();
            galleryControl1.Gallery.ItemCheckedChanged +=
                (s, e) => removeTarget.Enabled          = galleryControl1.Gallery.Groups[0].GetCheckedItems().Count > 0;


            _waitForm = new WaitDialogForm("正在初始化,请稍候...", "请稍候");
            if (_faceComparer == null)
            {
                _waitForm.Caption = "正在初始化人像比对模块...";
                var modelPath      = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "model.txt");
                var classifierPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "haarcascade_frontalface_alt2.xml");
                var comparer       = FaceRecoWrapper.FromModel(modelPath, classifierPath);
                _faceComparer = comparer;
            }

            _waitForm.Caption = "正在载入目标人像库...";
            LoadTargets();
        }
Ejemplo n.º 10
0
        private void LoadWork(string id)
        {
            WaitDialogForm wait = new DevExpress.Utils.WaitDialogForm("Phần mềm đang tải dữ liệu....", "Vui lòng chờ");

            try
            {
                wait.Show();
                List <WorkV2> works = Retrofit.instance.getAllWork(id);
                gridControl1.DataSource = works;
            }
            catch (Exception ex)
            {
                lg.Error(ex);
                wait.Close();
            }
            finally
            {
                wait.Close();
            }
        }
Ejemplo n.º 11
0
        private void btDangNhap_Click(object sender, EventArgs e)
        {
            _khoaQuyen = false;
            if (txtUser.Text.Trim().Length == 0)
            {
                XtraMessageBox.Show("Tài khoản bạn chưa nhập!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                txtUser.Focus();
                return;
            }
            else if (txtPass.Text.Trim().Length == 0)
            {
                XtraMessageBox.Show("Mật khẩu bạn chưa nhập!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                txtPass.Focus();
                return;
            }

            WaitDialogForm wait = new DevExpress.Utils.WaitDialogForm("Hệ thống đang kiểm tra tài khoản ...", "Vui lòng đợi trong giây lát");

            if (!checkLogin())
            {
                wait.Close();
                if (_khoaQuyen)
                {
                    XtraMessageBox.Show("Tài khoản của bạn đã bị khóa. Vui lòng liên hệ quản trị hệ thống.!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    XtraMessageBox.Show("Tài khoản hoặc mật khẩu không chính xác!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                return;
            }
            wait.Close();
            this.Hide();
            frmMain f = new frmMain();

            f.Show();
        }
        private void btnControl_btnEventExcel_Click(object sender, EventArgs e)
        {
            DevExpress.Utils.WaitDialogForm waitDialogForm = new DevExpress.Utils.WaitDialogForm("Đang xuất excel ...", "Vui lòng chờ giây lát !");
            try
            {
                ExcelManager excelManager = new ExcelManager(true);

                // Print band header
                BandedGridView view = gvGrid;
                view.ExpandAllGroups();
                object[] data = new object[view.VisibleColumns.Count];
                excelManager.BandedGridHeader2Excel(view, false, 9, 1, "headerRangeName");
                excelManager.SetTitleRows();
                excelManager.SelectRange()
                .SetFontFamily("Times New Roman");

                waitDialogForm.SetCaption(String.Format("{0} - {1}%", "Đang xuất excel ...", 50));

                excelManager.GridData2Excel(gvGrid, 10, 1, false, false, "", false, false);

                excelManager.SelectRange(excelManager.WorkingRange.Row + excelManager.WorkingRange.Rows.Count, excelManager.WorkingRange.Column,
                                         excelManager.WorkingRange.Row + excelManager.WorkingRange.Rows.Count, excelManager.WorkingRange.Column + excelManager.WorkingRange.Columns.Count - 1);


                // Save working range
                //excelManager.MoveRange(2, 0);
                //int maxCol = 12;
                //int xtraCol = 2;

                int sr = excelManager.WorkingRange.Row + 1;
                int sc = excelManager.WorkingRange.Column;
                int er = excelManager.WorkingRange.Row + 1;
                int ec = excelManager.WorkingRange.Column + excelManager.WorkingRange.Columns.Count - 1;

                //excelManager.SelectRange(8, 1, 8, maxCol).SetRowHeight("", 45);

                ////Dòng Title
                excelManager
                .SelectRange(1, 1, 1, 1)
                .SetFontStyle(true, false, false)
                .SetFontSize(12)
                .SetHorizontalAlignment(Microsoft.Office.Interop.Excel.XlHAlign.xlHAlignLeft)
                .SetRangeValue(clsParameter.pParentHospital);

                excelManager
                .SelectRange(2, 1, 2, 1)
                .SetFontStyle(false, false, false)
                .SetFontSize(12)
                .SetHorizontalAlignment(Microsoft.Office.Interop.Excel.XlHAlign.xlHAlignLeft)
                .SetRangeValue(clsParameter.pHospital);

                excelManager
                .SelectRange(4, 1, 4, ec)
                .Merge()
                .SetFontStyle(true, false, false)
                .SetFontSize(16)
                .SetHorizontalAlignment(Microsoft.Office.Interop.Excel.XlHAlign.xlHAlignCenter)
                .SetRangeValue("DANH MỤC ĐỀ NGHỊ TRÚNG THẦU (CHO TỪNG GÓI THẦU)");

                excelManager
                .SelectRange(5, 1, 5, ec)
                .Merge()
                .SetFontStyle(true, false, false)
                .SetFontSize(16)
                .SetHorizontalAlignment(Microsoft.Office.Interop.Excel.XlHAlign.xlHAlignCenter)
                .SetRangeValue(string.Format("Gói thầu : {0}", lueGoiThau.Text));

                excelManager
                .SelectRange(6, 1, 6, ec)
                .Merge()
                .SetFontStyle(true, true, false)
                .SetFontSize(16)
                .SetHorizontalAlignment(Microsoft.Office.Interop.Excel.XlHAlign.xlHAlignCenter)
                .SetRangeValue(clsParameter.pQuyetDinh);

                excelManager
                .SelectRange(er, 3, er, 3)
                .SetFontStyle(true, false, false)
                .SetFontSize(12)
                .SetHorizontalAlignment(Microsoft.Office.Interop.Excel.XlHAlign.xlHAlignLeft)
                .SetRangeValue(string.Format("Tổng giá trị theo giá kế hoạch: {0:#,#0}", _tongGiaTriTheoGiaKH));

                excelManager
                .SelectRange(er, 13, er, 18)
                .Merge()
                .SetFontStyle(true, false, false)
                .SetFontSize(12)
                .SetHorizontalAlignment(Microsoft.Office.Interop.Excel.XlHAlign.xlHAlignLeft)
                .SetRangeValue(string.Format("Tổng giá trị theo giá chào thầu: {0:#,#0}", _tongGiaTriTheoGiaChaoThau));
                //excelManager
                //   .SelectRange(4, 1, 4, 1)
                //   .SetFontStyle(false, false, false)
                //   .SetFontSize(12)
                //   .SetHorizontalAlignment(Microsoft.Office.Interop.Excel.XlHAlign.xlHAlignLeft)
                //   .SetRangeValue("MST: 1801318149");
                //excelManager
                //   .SelectRange(5, 1, 5, 1)
                //   .SetFontStyle(false, false, false)
                //   .SetFontSize(12)
                //   .SetHorizontalAlignment(Microsoft.Office.Interop.Excel.XlHAlign.xlHAlignLeft)
                //   .SetRangeValue("SĐT: 07103.737.261 - DĐ: 0932.993.081");
                //excelManager
                //   .SelectRange(6, 1, 6, 1)
                //   .SetFontStyle(false, false, false)
                //   .SetFontSize(12)
                //   .SetHorizontalAlignment(Microsoft.Office.Interop.Excel.XlHAlign.xlHAlignLeft)
                //   .SetRangeValue("Số TK: 1800201218555 tại NH Agribank Cần Thơ");

                //excelManager
                //    .SelectRange(8, 1, 8, ec)
                //    .Merge()
                //    .SetFontStyle(true, false, false)
                //    .SetFontSize(16)
                //    .SetHorizontalAlignment(Microsoft.Office.Interop.Excel.XlHAlign.xlHAlignCenter)
                //    .SetRangeValue(Title);


                //if (RangeTime != string.Empty)
                //    excelManager
                //        .SelectRange(9, 1, 9, ec)
                //        .Merge()
                //        .SetFontStyle(true, false, false)
                //        .SetFontSize(12)
                //        .SetHorizontalAlignment(Microsoft.Office.Interop.Excel.XlHAlign.xlHAlignCenter)
                //        .SetRangeValue(RangeTime);

                excelManager.SelectRange(12, 2, er, ec).AutoFitColumn();
                excelManager.SelectRange(12, 2, er, ec).SetNumberFormat("#,#0");

                excelManager
                .SelectRange(er + 2, ec - 3, er + 2, ec)
                .Merge()
                .SetFontStyle(false, false, false)
                .SetFontSize(12)
                .SetHorizontalAlignment(Microsoft.Office.Interop.Excel.XlHAlign.xlHAlignCenter)
                .SetRangeValue(string.Format("Ngày {0} tháng {1} năm {2}", DateTime.Now.Day, DateTime.Now.Month, DateTime.Now.Year));

                excelManager
                .SelectRange(er + 3, ec - 3, er + 3, ec)
                .Merge()
                .SetFontStyle(false, false, false)
                .SetFontSize(12)
                .SetHorizontalAlignment(Microsoft.Office.Interop.Excel.XlHAlign.xlHAlignCenter)
                .SetRangeValue("Thư ký");

                excelManager
                .SelectRange(er + 6, ec - 3, er + 6, ec)
                .Merge()
                .SetFontStyle(false, false, false)
                .SetFontSize(12)
                .SetHorizontalAlignment(Microsoft.Office.Interop.Excel.XlHAlign.xlHAlignCenter)
                .SetRangeValue(clsParameter.pThuKy);

                excelManager
                .SelectRange(er + 3, 3, er + 3, 4)
                .Merge()
                .SetFontStyle(false, false, false)
                .SetFontSize(12)
                .SetHorizontalAlignment(Microsoft.Office.Interop.Excel.XlHAlign.xlHAlignCenter)
                .SetRangeValue("Giám đốc");

                excelManager
                .SelectRange(er + 6, 3, er + 6, 4)
                .Merge()
                .SetFontStyle(false, false, false)
                .SetFontSize(12)
                .SetHorizontalAlignment(Microsoft.Office.Interop.Excel.XlHAlign.xlHAlignCenter)
                .SetRangeValue(clsParameter.pGiamDoc);
            }
            catch (Exception)
            {
                XtraMessageBox.Show("Lỗi trong quá trình xuất Excel.\nVui lòng kiểm tra lại biểu mẫu hoặc tài liệu đang mở.", "Thông báo lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                //Marshal.ReleaseComObject(excelSheet);
                //Marshal.ReleaseComObject(excelBook);
                //Marshal.ReleaseComObject(books);
                //Marshal.ReleaseComObject(excel);

                waitDialogForm.Close();
            }
        }
        void ExportExcel(String Title, string RangeTime, BandedGridView table, string formatNumber)
        {
            DevExpress.Utils.WaitDialogForm waitDialogForm = new DevExpress.Utils.WaitDialogForm("Đang xuất excel ...", "Vui lòng chờ giây lát !");
            try
            {
                ExcelManager excelManager = new ExcelManager(true);

                // Print band header
                BandedGridView view = table;
                view.ExpandAllGroups();
                object[] data = new object[view.VisibleColumns.Count];
                excelManager.BandedGridHeader2Excel(view, false, 8, 1, "headerRangeName");
                excelManager.SetTitleRows();
                excelManager.SelectRange()
                .SetFontFamily("Times New Roman");

                waitDialogForm.SetCaption(String.Format("{0} - {1}%", "Đang xuất excel ...", 50));

                excelManager.GridData2Excel(table, 9, 1, false, false, "", false, false);

                excelManager.SelectRange(excelManager.WorkingRange.Row + excelManager.WorkingRange.Rows.Count, excelManager.WorkingRange.Column,
                                         excelManager.WorkingRange.Row + excelManager.WorkingRange.Rows.Count, excelManager.WorkingRange.Column + excelManager.WorkingRange.Columns.Count - 1);


                // Save working range
                excelManager.MoveRange(2, 0);
                //int maxCol = 12;
                //int xtraCol = 2;

                int sr = excelManager.WorkingRange.Row + 1;
                int sc = excelManager.WorkingRange.Column;
                int er = excelManager.WorkingRange.Row + 1;
                int ec = excelManager.WorkingRange.Column + excelManager.WorkingRange.Columns.Count - 1;

                //excelManager.SelectRange(8, 1, 8, maxCol).SetRowHeight("", 45);

                ////Dòng Title
                excelManager
                .SelectRange(1, 1, 1, 4)
                .Merge()
                .SetFontStyle(true, false, false)
                .SetFontSize(12)
                .SetHorizontalAlignment(Microsoft.Office.Interop.Excel.XlHAlign.xlHAlignCenter)
                .SetRangeValue(clsParameter.pParentHospital);

                excelManager
                .SelectRange(2, 1, 2, 4)
                .Merge()
                .SetFontStyle(false, false, false)
                .SetFontSize(12)
                .SetHorizontalAlignment(Microsoft.Office.Interop.Excel.XlHAlign.xlHAlignCenter)
                .SetRangeValue(clsParameter.pHospital);

                excelManager
                .SelectRange(1, 11, 1, ec)
                .Merge()
                .SetFontStyle(true, false, false)
                .SetFontSize(12)
                .SetHorizontalAlignment(Microsoft.Office.Interop.Excel.XlHAlign.xlHAlignCenter)
                .SetRangeValue("CỘNG HÒA XÃ HỘI CHỦ NGHĨA VIỆT NAM");
                excelManager
                .SelectRange(2, 11, 2, ec)
                .Merge()
                .SetFontStyle(true, false, false)
                .SetFontSize(12)
                .SetHorizontalAlignment(Microsoft.Office.Interop.Excel.XlHAlign.xlHAlignCenter)
                .SetRangeValue("Độc lập - Tự do - Hạnh phúc");

                excelManager
                .SelectRange(5, 1, 5, ec)
                .Merge()
                .SetFontStyle(true, false, false)
                .SetFontSize(16)
                .SetHorizontalAlignment(Microsoft.Office.Interop.Excel.XlHAlign.xlHAlignCenter)
                .SetRangeValue(Title);

                //excelManager
                //    .SelectRange(6, 1, 6, ec)
                //    .Merge()
                //    .SetFontStyle(true, false, false)
                //    .SetFontSize(14)
                //    .SetHorizontalAlignment(Microsoft.Office.Interop.Excel.XlHAlign.xlHAlignCenter)
                //    .SetRangeValue("Gói thầu: " + lueGoiThau.Text);

                if (RangeTime != string.Empty)
                {
                    excelManager
                    .SelectRange(9, 1, 9, ec)
                    .Merge()
                    .SetFontStyle(true, false, false)
                    .SetFontSize(12)
                    .SetHorizontalAlignment(Microsoft.Office.Interop.Excel.XlHAlign.xlHAlignCenter)
                    .SetRangeValue(RangeTime);
                }

                excelManager.SelectRange(10, 2, er, ec).AutoFitColumn();
                excelManager.SelectRange(10, 2, er, ec).SetNumberFormat("#,#0");
                excelManager
                .SelectRange(er - 2, ec - 3, er - 2, ec - 3)
                .Merge()
                .SetFontStyle(false, false, false)
                .SetFontSize(12)
                .SetHorizontalAlignment(Microsoft.Office.Interop.Excel.XlHAlign.xlHAlignLeft)
                .SetRangeValue(string.Format("Ngày {0} tháng {1} năm {2}", DateTime.Now.Day, DateTime.Now.Month, DateTime.Now.Year));
            }
            catch (Exception)
            {
                XtraMessageBox.Show("Lỗi trong quá trình xuất Excel.\nVui lòng kiểm tra lại biểu mẫu hoặc tài liệu đang mở.", "Thông báo lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                //Marshal.ReleaseComObject(excelSheet);
                //Marshal.ReleaseComObject(excelBook);
                //Marshal.ReleaseComObject(books);
                //Marshal.ReleaseComObject(excel);

                waitDialogForm.Close();
            }
        }
Ejemplo n.º 14
0
 public void CreateWaitDialog()
 {
     dlg = new DevExpress.Utils.WaitDialogForm("Đang tải dữ liệu, xin vui lòng chờ!", "Tải dữ liệu");
 }
Ejemplo n.º 15
0
        public static void LunaticBandedGridToExcel(String Title, string RangeTime, BandedGridView table, string formatNumber)
        {
            DevExpress.Utils.WaitDialogForm waitDialogForm = new DevExpress.Utils.WaitDialogForm("Đang xuất excel ...", "Vui lòng chờ giây lát !");
            try
            {
                ExcelManager excelManager = new ExcelManager(true);

                // Print band header
                BandedGridView view = table;
                view.ExpandAllGroups();
                object[] data = new object[view.VisibleColumns.Count];
                excelManager.BandedGridHeader2Excel(view, false, 11, 1, "headerRangeName");
                excelManager.SetTitleRows();
                excelManager.SelectRange()
                .SetFontFamily("Times New Roman");

                waitDialogForm.SetCaption(String.Format("{0} - {1}%", "Đang xuất excel ...", 50));

                excelManager.GridData2Excel(table, 12, 1, false, false, "", false, false);

                excelManager.SelectRange(excelManager.WorkingRange.Row + excelManager.WorkingRange.Rows.Count, excelManager.WorkingRange.Column,
                                         excelManager.WorkingRange.Row + excelManager.WorkingRange.Rows.Count, excelManager.WorkingRange.Column + excelManager.WorkingRange.Columns.Count - 1);


                // Save working range
                excelManager.MoveRange(2, 0);
                //int maxCol = 12;
                //int xtraCol = 2;

                int sr = excelManager.WorkingRange.Row + 1;
                int sc = excelManager.WorkingRange.Column;
                int er = excelManager.WorkingRange.Row + 1;
                int ec = excelManager.WorkingRange.Column + excelManager.WorkingRange.Columns.Count - 1;

                //excelManager.SelectRange(8, 1, 8, maxCol).SetRowHeight("", 45);

                ////Dòng Title
                //excelManager
                //    .SelectRange(1, 1, 1, 1)
                //    .SetFontStyle(true, false, false)
                //    .SetFontSize(12)
                //    .SetHorizontalAlignment(Microsoft.Office.Interop.Excel.XlHAlign.xlHAlignLeft)
                //    .SetRangeValue("Công ty cổ phần xuất nhập khẩu KIM QUYỀN");

                //excelManager
                //    .SelectRange(2, 1, 2, 1)
                //    .SetFontStyle(false, false, false)
                //    .SetFontSize(12)
                //    .SetHorizontalAlignment(Microsoft.Office.Interop.Excel.XlHAlign.xlHAlignLeft)
                //    .SetRangeValue("Địa chỉ : P08 đường số 8, Khu đô thị mới - Hưng Phú, ");

                //excelManager
                //    .SelectRange(3, 1, 3, 1)
                //    .SetFontStyle(false, false, false)
                //    .SetFontSize(12)
                //    .SetHorizontalAlignment(Microsoft.Office.Interop.Excel.XlHAlign.xlHAlignLeft)
                //    .SetRangeValue("P. Hưng Thạnh, Q. Cái Răng, Tp. Cần Thơ");
                //excelManager
                //   .SelectRange(4, 1, 4, 1)
                //   .SetFontStyle(false, false, false)
                //   .SetFontSize(12)
                //   .SetHorizontalAlignment(Microsoft.Office.Interop.Excel.XlHAlign.xlHAlignLeft)
                //   .SetRangeValue("MST: 1801318149");
                //excelManager
                //   .SelectRange(5, 1, 5, 1)
                //   .SetFontStyle(false, false, false)
                //   .SetFontSize(12)
                //   .SetHorizontalAlignment(Microsoft.Office.Interop.Excel.XlHAlign.xlHAlignLeft)
                //   .SetRangeValue("SĐT: 07103.737.261 - DĐ: 0932.993.081");
                //excelManager
                //   .SelectRange(6, 1, 6, 1)
                //   .SetFontStyle(false, false, false)
                //   .SetFontSize(12)
                //   .SetHorizontalAlignment(Microsoft.Office.Interop.Excel.XlHAlign.xlHAlignLeft)
                //   .SetRangeValue("Số TK: 1800201218555 tại NH Agribank Cần Thơ");

                //excelManager
                //    .SelectRange(8, 1, 8, ec)
                //    .Merge()
                //    .SetFontStyle(true, false, false)
                //    .SetFontSize(16)
                //    .SetHorizontalAlignment(Microsoft.Office.Interop.Excel.XlHAlign.xlHAlignCenter)
                //    .SetRangeValue(Title);


                //if (RangeTime != string.Empty)
                //    excelManager
                //        .SelectRange(9, 1, 9, ec)
                //        .Merge()
                //        .SetFontStyle(true, false, false)
                //        .SetFontSize(12)
                //        .SetHorizontalAlignment(Microsoft.Office.Interop.Excel.XlHAlign.xlHAlignCenter)
                //        .SetRangeValue(RangeTime);

                excelManager.SelectRange(12, 2, er, ec).AutoFitColumn();
                excelManager.SelectRange(12, 2, er, ec).SetNumberFormat("#,#0");
                excelManager
                .SelectRange(er - 2, ec - 3, er - 2, ec - 3)
                .Merge()
                .SetFontStyle(false, false, false)
                .SetFontSize(12)
                .SetHorizontalAlignment(Microsoft.Office.Interop.Excel.XlHAlign.xlHAlignLeft)
                .SetRangeValue(string.Format("Ngày {0} tháng {1} năm {2}", DateTime.Now.Day, DateTime.Now.Month, DateTime.Now.Year));
            }
            catch (Exception)
            {
                XtraMessageBox.Show("Lỗi trong quá trình xuất Excel.\nVui lòng kiểm tra lại biểu mẫu hoặc tài liệu đang mở.", "Thông báo lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                //Marshal.ReleaseComObject(excelSheet);
                //Marshal.ReleaseComObject(excelBook);
                //Marshal.ReleaseComObject(books);
                //Marshal.ReleaseComObject(excel);

                waitDialogForm.Close();
            }
        }
Ejemplo n.º 16
0
        /// <summary>
        /// 窗体加载
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void GISPlatformCenter_Load(object sender, EventArgs e)
        {
            try
            {
                #region wcf检查服务端是否正常运行
                if (ConfigurationManager.AppSettings["ServiceType"].ToString() == "wcf")
                {
                    try
                    {
                        //ServiceFactory.CreateService<IGraphicsbaseinfService>().GetAll();//调用服务端接口,看能否正常调用来判断服务端是否开启
                    }
                    catch
                    {
                        //MessageBox.Show("连接服务端异常,请配置服务器!");


                        //退出应用程序
                        System.Environment.Exit(0);
                    }
                }
                #endregion

                wdf = new WaitDialogForm("正在加载数据...", "请等待...");

                //InitDevControlSkin();//加载皮肤

                //设置窗体高度和宽度
                //this.Width = Screen.GetWorkingArea(this).Width;
                //this.Height = Screen.GetWorkingArea(this).Height;
                this.Left = 0;
                this.Top  = 0;
                if (!GraphOpt.IsGraphicEdit)//如果是非编辑状态
                {
                    //隐藏图形库
                    //navBarControl1.Width = 0;
                    //隐藏图形基本操作、命令操作功能
                    // BasicOptMenu.Visible = false;
                    //CommandPage.Visible = false;
                }
                //判断是否为嵌入方式,如果是嵌入方式,则隐藏ribboncontrol1
                if (IsInIframe)
                {
                    // ribbonControl1.Visible = false;
                    //ribbonStatusBar1.Visible = false;
                }

                //设置不显示gis控件的滚动条
                mx.SetData("showProgress", "false");

                #region 从数据库读取所有图形文件
                GraphOpt.LoadGraphicsInfo();
                #endregion

                #region 加载图元库
                GraphLibindex = 0;
                XtraScrollableControl pal = new XtraScrollableControl();
                pal.Dock       = DockStyle.Fill;
                pal.AutoScroll = true;
                pal.Controls.AddRange(GraphLibLoad(0));
                pal.Controls.AddRange(GraphLibLoad(3));
                GraphLibindex = 0;
                pal.Controls.AddRange(GraphLibTextLoad(0));
                pal.Controls.AddRange(GraphLibTextLoad(3));
                //navBarGroupControlContainer4.Controls.Add(pal);

                GraphLibindex  = 0;
                pal            = new XtraScrollableControl();
                pal.Dock       = DockStyle.Fill;
                pal.AutoScroll = true;
                pal.Controls.AddRange(GraphLibLoad(1));
                GraphLibindex = 0;
                pal.Controls.AddRange(GraphLibTextLoad(1));
                //navBarGroupControlContainer1.Controls.Add(pal);

                GraphLibindex  = 0;
                pal            = new XtraScrollableControl();
                pal.Dock       = DockStyle.Fill;
                pal.AutoScroll = true;
                pal.Controls.AddRange(GraphLibLoad(2));
                GraphLibindex = 0;
                pal.Controls.AddRange(GraphLibTextLoad(2));
                //navBarGroupControlContainer3.Controls.Add(pal);

                #endregion

                //隐藏悬浮拖动图元
                pictureBox1.Visible = false;
                //进入时隐藏菜单
                //ribbonControl1.Minimized = true;

                if (wdf != null)
                {
                    wdf.Close();
                }

                //获取通风系统默认图形
                var graphicsbaseinfInfo = GraphOpt.getAllGraphicDto().ToList().Find(a => a.Bz3 == "1");
                if (graphicsbaseinfInfo != null && !string.IsNullOrWhiteSpace(graphicsbaseinfInfo.GraphId))
                {
                    LoadMap(graphicsbaseinfInfo.GraphName);
                }
                else
                {
                    DevExpress.XtraEditors.XtraMessageBox.Show("没有设置应急联动默认图形,请去设置", "系统提示", MessageBoxButtons.OK);
                }

                //barStaticItem1.Caption = "启动成功";
            }
            catch (Exception ex)
            {
                if (wdf != null)
                {
                    wdf.Close();
                }
                LogHelper.Error("GISPlatformCenter_Load" + ex.Message + ex.StackTrace);
            }
        }
Ejemplo n.º 17
0
        static void Main()
        {
            System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("zh-CN");
            DevExpress.UserSkins.BonusSkins.Register();
            DevExpress.Skins.SkinManager.EnableFormSkins();
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            string  serverIP   = "";
            Int32   serverPort = 0;
            Boolean _isUpdate  = false;

            if (FileUtil.IsExistFile(@"AutoUpdater\AutoUpdater.exe.config"))
            {
                AppConfig appConfig = new AppConfig(@"AutoUpdater\AutoUpdater.exe.config");
                serverIP   = appConfig.AppConfigGet("ServerIP");
                serverPort = Convert.ToInt32(appConfig.AppConfigGet("ServerPort"));
                _isUpdate  = Convert.ToBoolean(appConfig.AppConfigGet("isUpdate"));

                // 检查更新服务器端口是否可用
                if (_isUpdate && (NetworkUtil.CheckIPPortEnabled(serverIP, serverPort) < 0 || NetworkUtil.CheckIPPortEnabled(serverIP, serverPort + 2) < 0))
                {
                    _isUpdate = false;
                    MessageDxUtil.ShowTips("更新服务器端不可用,服务器更新取消!");
                }
            }

            // 自动升级工具
            if (_isUpdate && VersionHelper.HasNewVersion(serverIP, serverPort) && (MessageDxUtil.ShowYesNoAndTips("服务器有新的版本是否更新") == DialogResult.Yes))
            {
                string updateExePath = AppDomain.CurrentDomain.BaseDirectory + "AutoUpdater\\AutoUpdater.exe";
                System.Diagnostics.Process myProcess = System.Diagnostics.Process.Start(updateExePath);
            }
            else
            {
                WaitDialogForm WaitBeforeLogin = null;
                new Thread((ThreadStart) delegate
                {
                    WaitBeforeLogin = new DevExpress.Utils.WaitDialogForm("请稍候...", "正在加载应用系统");
                    //Application.Run(new TestCommons.Form1(WaitBeforeLogin));
                }).Start();
            }
            //Application.Run(new JCodes.Framework.Test.Form1());
            // Application.Run(new JCodes.Framework.TestWinForm.Form2());

            // 分页控件
            //Application.Run(new TestDictionary.Form1());

            // 测试公共类
            //Application.Run(new TestCommons.Form1());

            //Application.Run(new TestControlUtil.Form1());

            // 附件测试
            //Application.Run(new TestAttachmentDx.Form1());

            // 权限管理系统
            //Application.Run(new TestSecurityMix_WCF_WIN.Form1());
            //Application.Run(new JCodes.Framework.SmallTools.Test.FrmWinRarZip());

            //Application.Run(new JCodes.Framework.Test.IPOdepthDealfrm());
            //Application.Run(new JCodes.Framework.AddIn.SmallTools.xlsDataDeal());

            //Application.Run(new JCodes.Framework.TestWinForm.BizControlForm());


            // Application.Run(new ZheshangKaoshi());

            //Application.Run(new JCodes.Framework.AddIn.Test.MainForm());
            //Application.Run(new JCodes.Framework.TestWinForm.Basic.FrmTestBizControl());
            //Application.Run(new JCodes.Framework.TestWinForm.ZSJob.TouHangDiGaoFrm());
            //Application.Run(new JCodes.Framework.TestWinForm.PdfDemo.PdfTestFrm());
            //Application.Run(new JCodes.Framework.TestWinForm.ZsDaixiao.FrmDealConsignment());

            //Application.Run(new JCodes.Framework.Test.AMSDownloadForm());
            //Application.Run(new JCodes.Framework.Test.DakaDateSetFrm());
            Application.Run(new JCodes.Framework.TestWinForm.Basic.InitDataFrm());
            //Application.Run(new JCodes.Framework.Wind.FrmWindDemo());
        }
        private void btnControl_btnEventExcel_Click(object sender, EventArgs e)
        {
            DevExpress.Utils.WaitDialogForm waitDialogForm = new DevExpress.Utils.WaitDialogForm("Đang xuất excel ...", "Vui lòng chờ giây lát !");
            try
            {
                ExcelManager excelManager = new ExcelManager(true);

                // Print band header
                BandedGridView view = gvGrid;
                view.ExpandAllGroups();
                object[] data = new object[view.VisibleColumns.Count];
                excelManager.BandedGridHeader2Excel(view, false, 6, 1, "headerRangeName");
                excelManager.SetTitleRows();
                excelManager.SelectRange()
                .SetFontFamily("Times New Roman");

                waitDialogForm.SetCaption(String.Format("{0} - {1}%", "Đang xuất excel ...", 50));

                excelManager.GridData2Excel(gvGrid, 8, 1, false, false, "", false, false);

                //excelManager.SelectRange(excelManager.WorkingRange.Row + excelManager.WorkingRange.Rows.Count, excelManager.WorkingRange.Column,
                //    excelManager.WorkingRange.Row + excelManager.WorkingRange.Rows.Count, excelManager.WorkingRange.Column + excelManager.WorkingRange.Columns.Count - 1);


                // Save working range
                //excelManager.MoveRange(2, 0);
                //int maxCol = 12;
                //int xtraCol = 2;

                int sr = excelManager.WorkingRange.Row + 1;
                int sc = excelManager.WorkingRange.Column;
                int er = excelManager.WorkingRange.Row + 1;
                int ec = excelManager.WorkingRange.Column + excelManager.WorkingRange.Columns.Count - 1;

                //excelManager.SelectRange(8, 1, 8, maxCol).SetRowHeight("", 45);

                ////Dòng Title
                excelManager
                .SelectRange(1, 1, 1, 1)
                .SetFontStyle(true, false, false)
                .SetFontSize(12)
                .SetHorizontalAlignment(Microsoft.Office.Interop.Excel.XlHAlign.xlHAlignLeft)
                .SetRangeValue(clsParameter.pParentHospital);

                excelManager
                .SelectRange(2, 1, 2, 1)
                .SetFontStyle(false, false, false)
                .SetFontSize(12)
                .SetHorizontalAlignment(Microsoft.Office.Interop.Excel.XlHAlign.xlHAlignLeft)
                .SetRangeValue(clsParameter.pHospital);

                excelManager
                .SelectRange(4, 1, 4, ec)
                .Merge()
                .SetFontStyle(true, false, false)
                .SetFontSize(16)
                .SetHorizontalAlignment(Microsoft.Office.Interop.Excel.XlHAlign.xlHAlignCenter)
                .SetRangeValue("DANH SÁCH HỘI VIÊN");

                excelManager.SelectRange(11, 2, er, ec).AutoFitColumn();
                //excelManager.SelectRange(11, 2, er, ec).SetNumberFormat("#,#0");

                // excelManager
                // .SelectRange(er + 2, ec - 3, er + 2, ec)
                // .Merge()
                // .SetFontStyle(false, false, false)
                // .SetFontSize(12)
                // .SetHorizontalAlignment(Microsoft.Office.Interop.Excel.XlHAlign.xlHAlignCenter)
                // .SetRangeValue(string.Format("Ngày {0} tháng {1} năm {2}", DateTime.Now.Day, DateTime.Now.Month, DateTime.Now.Year));

                // excelManager
                // .SelectRange(er + 3, ec - 3, er + 3, ec)
                // .Merge()
                // .SetFontStyle(false, false, false)
                // .SetFontSize(12)
                // .SetHorizontalAlignment(Microsoft.Office.Interop.Excel.XlHAlign.xlHAlignCenter)
                // .SetRangeValue("Thư ký");

                // excelManager
                // .SelectRange(er + 6, ec - 3, er + 6, ec)
                // .Merge()
                // .SetFontStyle(false, false, false)
                // .SetFontSize(12)
                // .SetHorizontalAlignment(Microsoft.Office.Interop.Excel.XlHAlign.xlHAlignCenter)
                // .SetRangeValue(clsParameter.pThuKy);

                // excelManager
                // .SelectRange(er + 3, 3, er + 3, 4)
                // .Merge()
                // .SetFontStyle(false, false, false)
                // .SetFontSize(12)
                // .SetHorizontalAlignment(Microsoft.Office.Interop.Excel.XlHAlign.xlHAlignCenter)
                // .SetRangeValue("Giám đốc");

                // excelManager
                //.SelectRange(er + 6, 3, er + 6, 4)
                //.Merge()
                //.SetFontStyle(false, false, false)
                //.SetFontSize(12)
                //.SetHorizontalAlignment(Microsoft.Office.Interop.Excel.XlHAlign.xlHAlignCenter)
                //.SetRangeValue(clsParameter.pGiamDoc);
            }
            catch (Exception)
            {
                XtraMessageBox.Show("Lỗi trong quá trình xuất Excel.\nVui lòng kiểm tra lại biểu mẫu hoặc tài liệu đang mở.", "Thông báo lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                //Marshal.ReleaseComObject(excelSheet);
                //Marshal.ReleaseComObject(excelBook);
                //Marshal.ReleaseComObject(books);
                //Marshal.ReleaseComObject(excel);

                waitDialogForm.Close();
            }
        }