Exemplo n.º 1
0
        static void Main( )
        {
            DevExpress.Skins.SkinManager.EnableFormSkins();
            DevExpress.LookAndFeel.LookAndFeelHelper.ForceDefaultLookAndFeelChanged();
            DevExpress.Skins.SkinManager.EnableMdiFormSkins();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            DevExpress.Utils.WaitDialogForm waiting = new DevExpress.Utils.WaitDialogForm();
            waiting.SetCaption("Connecting . . .!");
            waiting.Text = "";
            waiting.Show();

            if (DataQueryProvider.Connect() == false)
            {
                waiting.Close();
                DevExpress.XtraEditors.XtraMessageBox.Show("Please check connection", "Auto generator", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            DataQueryProvider.InitDataTables();

            Form1 form = new Form1();

            waiting.Close();

            Application.Run(form);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Tạo Caption cho WaitDialog
 /// </summary>
 /// <param name="fCaption"></param>
 public void SetWaitDialogCaption(string fCaption)
 {
     if (_dlg != null)
     {
         _dlg.SetCaption(fCaption); _dlg.Caption = fCaption;
     }
 }
Exemplo n.º 3
0
        public void ExecuteScript( )
        {
            if (ScriptTabControl.SelectedTabPage == null)
            {
                return;
            }

            Scintilla rtbScript = (Scintilla)ScriptTabControl.SelectedTabPage.Controls[0];
            String    stQuery   = rtbScript.Selection.Text.Trim();

            if (String.IsNullOrEmpty(stQuery))
            {
                stQuery = rtbScript.Text;
            }

            if (String.IsNullOrEmpty(stQuery))
            {
                return;
            }

            Cursor.Current = Cursors.WaitCursor;
            DevExpress.Utils.WaitDialogForm waiting = new DevExpress.Utils.WaitDialogForm();
            waiting.SetCaption("Executing . . .!");
            waiting.Show();

            DataSet ds = DataQueryProvider.RunQuery(stQuery);

            if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count == 1)
            {
                ResultRichText.Text = ds.Tables[0].Rows[0][0].ToString();
            }

            waiting.Close();
            Cursor.Current = Cursors.Default;
        }
Exemplo n.º 4
0
        public static void SetCaption(String strCaption)
        {
            if (waiting == null || waiting.Visible == false)
            {
                Show("", strCaption);
            }

            waiting.SetCaption(strCaption);
        }
Exemplo n.º 5
0
        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, 1, 1, "headerRangeName");
                excelManager.SetTitleRows();
                excelManager.SelectRange()
                .SetFontFamily("Times New Roman");

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

                excelManager.GridData2Excel(gvGrid, 2, 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);

                excelManager.SelectRange(12, 2, er, ec).AutoFitColumn();
                excelManager.SelectRange(12, 2, er, ec).SetNumberFormat("#,#0");
            }
            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();
            }
        }
Exemplo n.º 6
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            DevExpress.Utils.WaitDialogForm waiting = new DevExpress.Utils.WaitDialogForm();
            waiting.SetCaption("Saving . . .!");
            waiting.Text = "";
            waiting.Show();
            Cursor.Current = Cursors.WaitCursor;
            STTableConfigController aliasCtrl = new STTableConfigController();

            foreach (DataRow dr in ((DataTable)this.gridControl1.DataSource).Rows)
            {
                STTableConfigInfo aliasInfo = (STTableConfigInfo)aliasCtrl.GetObjectFromDataRow(dr);
                if (aliasInfo != null)
                {
                    aliasCtrl.UpdateObject(aliasInfo);
                }
            }

            ABCDataLib.Tables.ConfigProvider.InvalidateConfigList();
            InvalidateData();
            Cursor.Current = Cursors.Default;
            waiting.Close();
        }
Exemplo n.º 7
0
 public static void SetCaption(string caption)
 {
     wdf.SetCaption(caption);
 }
        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, 7, 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 CÔNG TY MUA HỒ SƠ MỜI THẦU");

                excelManager.SelectRange(10, 2, er, ec).AutoFitColumn();
                //excelManager.SelectRange(11, 2, er, ec).SetNumberFormat("#,#0");
            }
            catch (Exception ex)
            {
                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();
            }
        }
Exemplo n.º 9
0
        private void btnChangeCrator_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            string CreatorName = this.bItemUserName.EditValue.ToString().Trim();

            if (CreatorName == null || CreatorName.Length <= 0)
            {
                XtraMessageBox.Show("请输入用户名!", "提示!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            using (FrmUsers _FrmUsers = new FrmUsers())
            {
                if (_FrmUsers.ShowDialog() == DialogResult.OK)
                {
                    UserInfo newuser = _FrmUsers.NewUser;


                    UserInfo  _UserInfo = GetUserInfoByLoginName(CreatorName);
                    DataTable dt;
                    if (_UserInfo != null)
                    {
                        int OKCount    = 0;
                        int ErrorCount = 0;
                        DevExpress.Utils.WaitDialogForm dlgQuery = new DevExpress.Utils.WaitDialogForm("用户:" + CreatorName + " 的节目", "正在查询", new Size(300, 50), this);
                        dt = GetProgramsByCreatorUserID(_UserInfo.UserID);
                        dlgQuery.Close();
                        if (dt != null)
                        {
                            string call = "确定将用户:" + _UserInfo.UserName + "(" + _UserInfo.FullName + ")的 " + dt.Rows.Count + " 条 节目转给 用户:" + newuser.UserName + "(" + newuser.FullName + ")";

                            if (XtraMessageBox.Show(call, "提示!", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.No)
                            {
                                return;
                            }
                            using (DevExpress.Utils.WaitDialogForm dlg = new DevExpress.Utils.WaitDialogForm("用户:" + CreatorName + " 的节目", "正在转换节目", new Size(300, 50), this))
                            {
                                for (int i = 0; i < dt.Rows.Count; i++)
                                {
                                    if (this.UpdateProgramCreator(dt.Rows[i]["ProgramID"].ToString(), newuser))
                                    {
                                        dlg.SetCaption("节目:" + dt.Rows[i]["ProgramTitle"].ToString() + "转换成功");

                                        string SuccessData = newuser.FullName + "," + newuser.UserID + "," + dt.Rows[i]["ProgramTitle"].ToString() + "," + dt.Rows[i]["ProgramID"].ToString() + "," + dt.Rows[i]["CreatorUserName"].ToString() + "," + dt.Rows[i]["CreatorUser"].ToString();
                                        LogService.WriteSuccessData(SuccessData);
                                        OKCount++;
                                    }
                                    else
                                    {
                                        dlg.SetCaption("节目:" + dt.Rows[i]["ProgramTitle"].ToString() + "转换失败");

                                        string FailData = dt.Rows[i]["ProgramID"].ToString() + "," + dt.Rows[i]["ProgramTitle"].ToString();
                                        LogService.WriteFailData(FailData);
                                        ErrorCount++;
                                    }
                                }
                            }
                        }
                        string info = "转换完成";
                        if (OKCount == dt.Rows.Count)
                        {
                            info = "转换完成,全部成功!";
                        }
                        else
                        {
                            info = "转换完成,成功:" + OKCount + "条,失败:" + ErrorCount + "";
                        }
                        XtraMessageBox.Show(this, info, "提示!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                    else
                    {
                        XtraMessageBox.Show(this, "未找到用户:" + this.bItemUserName.EditValue.ToString().Trim(), "提示!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
            }
        }