コード例 #1
0
        private void barBtnXuatBaoCao_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (Object.Equals(objPhong, null))
            {
                XtraMessageBox.Show("Chưa chọn phòng!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (Object.Equals(objPhong.id, Guid.Empty))
            {
                XtraMessageBox.Show("Chưa chọn phòng!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            String strViTri = "[Không Rõ]";
            if (!Object.Equals(objPhong.vitri, null))
                strViTri = objPhong.vitri.coso != null ? objPhong.vitri.coso.ten + (objPhong.vitri.day != null ? " - " + objPhong.vitri.day.ten + (objPhong.vitri.tang != null ? " - " + objPhong.vitri.tang.ten : "") : "") : "";
            if (Object.Equals(listCTThietBis, null))
            {
                XtraMessageBox.Show(String.Format("Phòng {0} ({1}) chưa có thiết bị!", objPhong.ten, strViTri), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            else
            {
                if (listCTThietBis.Count > 0)
                {
                    try
                    {
                        DevExpress.XtraSplashScreen.SplashScreenManager splashScreenManager_Report = new DevExpress.XtraSplashScreen.SplashScreenManager(this, typeof(global::PTB_GUI.WaitForm1), true, true, DevExpress.XtraSplashScreen.ParentType.UserControl);
                        splashScreenManager_Report.ShowWaitForm();
                        splashScreenManager_Report.SetWaitFormCaption("Đang tạo report");
                        splashScreenManager_Report.SetWaitFormDescription("Vui lòng chờ trong giây lát...");

                        XtraReport_Template _XtraReport_Template = new XtraReport_Template(SHARED.Libraries.ReportHelper.FillDatasetFromGrid(gridViewCTThietBi), gridViewCTThietBi, barCheckItemLandscape.Checked);
                        _XtraReport_Template.SetTitleText(String.Format("Danh Sách Thiết Bị Tại Phòng: {0} ({1})", objPhong.ten, strViTri));
                        if (barCheckItemThietKe.Checked)
                        {
                            ReportDesignTool designTool = new ReportDesignTool(_XtraReport_Template);
                            splashScreenManager_Report.CloseWaitForm();
                            designTool.ShowDesignerDialog();

                            ReportPrintTool printTool = new ReportPrintTool(designTool.Report);
                            printTool.ShowPreviewDialog();
                        }
                        else
                        {
                            ReportPrintTool printTool = new ReportPrintTool(_XtraReport_Template);
                            splashScreenManager_Report.CloseWaitForm();
                            printTool.ShowPreviewDialog();
                        }
                    }
                    catch
                    {
                        XtraMessageBox.Show("Đã xảy ra lỗi!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    XtraMessageBox.Show(String.Format("Phòng {0} ({1}) chưa có thiết bị!", objPhong.ten, strViTri), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
コード例 #2
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     splashScreenManager1.ShowWaitForm();
     try
     {
         if (_ischanginglogin)
         {
             ChangeLogin();
             MessageBox.Show("Логин был изменен");
         }
         else
         {
             ChangePassword();
             MessageBox.Show("Пароль был изменен");
         }
         this.DialogResult = DialogResult.OK;
     }
     catch (Exception ex)
     {
         MessageBox.Show(String.Format(ex.Message), "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     finally
     {
         splashScreenManager1.CloseWaitForm();
     }
 }
コード例 #3
0
        private void barBtnXuatBaoCao_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (Object.Equals(_ViTriHienTai, null))
            {
                XtraMessageBox.Show("Chưa chọn vị trí!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (Object.Equals(listPhong, null))
            {
                XtraMessageBox.Show("Không có phòng!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            else
            {
                String strViTri = _ViTriHienTai.coso != null ? _ViTriHienTai.coso.ten + (_ViTriHienTai.day != null ? " - " + _ViTriHienTai.day.ten + (_ViTriHienTai.tang != null ? " - " + _ViTriHienTai.tang.ten : "") : "") : "";
                if (listPhong.Count > 0)
                {
                    try
                    {
                        DevExpress.XtraSplashScreen.SplashScreenManager splashScreenManager_Report = new DevExpress.XtraSplashScreen.SplashScreenManager(this, typeof(global::PTB_GUI.WaitForm1), true, true, DevExpress.XtraSplashScreen.ParentType.UserControl);
                        splashScreenManager_Report.ShowWaitForm();
                        splashScreenManager_Report.SetWaitFormCaption("Đang tạo report");
                        splashScreenManager_Report.SetWaitFormDescription("Vui lòng chờ trong giây lát...");

                        XtraReport_Template _XtraReport_Template = new XtraReport_Template(SHARED.Libraries.ReportHelper.FillDatasetFromGrid(gridViewPhong), gridViewPhong, barCheckItemLandscape.Checked);
                        _XtraReport_Template.SetTitleText("Danh Sách Phòng Tại: " + strViTri);
                        if (barCheckItemThietKe.Checked)
                        {
                            ReportDesignTool designTool = new ReportDesignTool(_XtraReport_Template);
                            splashScreenManager_Report.CloseWaitForm();
                            designTool.ShowDesignerDialog();

                            ReportPrintTool printTool = new ReportPrintTool(designTool.Report);
                            printTool.ShowPreviewDialog();
                        }
                        else
                        {
                            ReportPrintTool printTool = new ReportPrintTool(_XtraReport_Template);
                            splashScreenManager_Report.CloseWaitForm();
                            printTool.ShowPreviewDialog();
                        }
                    }
                    catch
                    {
                        XtraMessageBox.Show("Đã xảy ra lỗi!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    strViTri = "[" + strViTri + "]";
                    XtraMessageBox.Show(strViTri + " không có phòng!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
コード例 #4
0
ファイル: MssBox.cs プロジェクト: suraboth68/Checkup
 public static void iWaitForm(this DevExpress.XtraSplashScreen.SplashScreenManager spmg)
 {
     if (spmg.IsSplashFormVisible)
     {
         spmg.CloseWaitForm();
     }
     else
     {
         spmg.ShowWaitForm();
     }
 }
コード例 #5
0
ファイル: Splash.cs プロジェクト: thachgiasoft/Prioritizer
 private void OpenSplashScreen(Type screenType, Form frm)
 {
     bgWorker = new BackgroundWorker();
     if (bgWorker.IsBusy != true)
     {
         SplashScreenManager = new DevExpress.XtraSplashScreen.SplashScreenManager(frm, screenType, true, true);
         if (!SplashScreenManager.IsSplashFormVisible)
         {
             SplashScreenManager.ShowWaitForm();
         }
     }
 }
コード例 #6
0
ファイル: ConnectionDialogue.cs プロジェクト: tslekwadi/CDS
 public void ShowWaitForm()
 {
     try
     {
         if (!SplashManager.IsSplashFormVisible)
         {
             SplashManager.ShowWaitForm();
         }
     }
     catch (Exception ex)
     {
         if (CDS.Shared.Exception.UserInterfaceExceptionHandler.HandleException(ref ex))
         {
             throw ex;
         }
     }
 }
コード例 #7
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     splashScreenManager1.ShowWaitForm();
     try
     {
         ImportOrder();
         MessageBox.Show("Заявка была импортирована");
         this.DialogResult = DialogResult.OK;
     }
     catch (Exception ex)
     {
         MessageBox.Show(String.Format(ex.Message), "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     finally
     {
         splashScreenManager1.CloseWaitForm();
     }
 }
コード例 #8
0
        private void barBtnXuatBaoCao_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (Object.Equals(NhanVienPTs, null))
            {
                XtraMessageBox.Show("Chưa có nhân viên phụ trách", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (NhanVienPTs.Count > 0)
            {
                try
                {
                    DevExpress.XtraSplashScreen.SplashScreenManager splashScreenManager_Report = new DevExpress.XtraSplashScreen.SplashScreenManager(this, typeof(global::PTB_GUI.WaitForm1), true, true, DevExpress.XtraSplashScreen.ParentType.UserControl);
                    splashScreenManager_Report.ShowWaitForm();
                    splashScreenManager_Report.SetWaitFormCaption("Đang tạo report");
                    splashScreenManager_Report.SetWaitFormDescription("Vui lòng chờ trong giây lát...");

                    XtraReport_Template _XtraReport_Template = new XtraReport_Template(SHARED.Libraries.ReportHelper.FillDatasetFromGrid(gridViewNhanVien), gridViewNhanVien, barCheckItemLandscape.Checked, false);
                    _XtraReport_Template.SetTitleText("Danh Sách Nhân Viên Phụ Trách");
                    if (barCheckItemThietKe.Checked)
                    {
                        ReportDesignTool designTool = new ReportDesignTool(_XtraReport_Template);
                        splashScreenManager_Report.CloseWaitForm();
                        designTool.ShowDesignerDialog();

                        ReportPrintTool printTool = new ReportPrintTool(designTool.Report);
                        printTool.ShowPreviewDialog();
                    }
                    else
                    {
                        ReportPrintTool printTool = new ReportPrintTool(_XtraReport_Template);
                        splashScreenManager_Report.CloseWaitForm();
                        printTool.ShowPreviewDialog();
                    }
                }
                catch
                {
                    XtraMessageBox.Show("Đã xảy ra lỗi!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                XtraMessageBox.Show("Chưa có nhân viên phụ trách", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #9
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            var agencyReportRequest = new AgencyReportRequest();

            agencyReportRequest.ServiceType      = "flights";
            agencyReportRequest.OrganizationCode = _orgcode;
            agencyReportRequest.BeginDate        = calFrom.DateTime;
            agencyReportRequest.EndDate          = calTo.DateTime;

            splashScreenManager1.ShowWaitForm();
            try
            {
                DataProcessor.CreateReport(null, cbFormat.EditValue.ToString(), null, "agentreport", agencyReportRequest);
            }
            finally
            {
                splashScreenManager1.CloseWaitForm();
            }

            this.DialogResult = DialogResult.OK;
        }
コード例 #10
0
        private void wizardControl1_SelectedPageChanged(object sender, WizardPageChangedEventArgs e)
        {
            if (e.Page == pageCreateDatabase)
            {
                Splash = new DevExpress.XtraSplashScreen.SplashScreenManager(this, typeof(Waiting.Wait), true, true);
                Splash.WaitForSplashFormClose();
                if (!Splash.IsSplashFormVisible)
                {
                    Splash.ShowWaitForm();
                }

                do_SQLSettings();
                if (DataBaseControl)
                {
                    e.Page.AllowNext = true;
                    do_CreateTable();
                    if (Splash.IsSplashFormVisible)
                    {
                        Splash.CloseWaitForm();
                    }
                }
                else
                {
                    e.Page.AllowNext = false;
                    do_CreateDatabese();

                    if (Splash.IsSplashFormVisible)
                    {
                        Splash.CloseWaitForm();
                    }
                }
            }
            if (e.Page == pageLisansDemo)
            {
                dt_RecordDate.EditValue = DateTime.Now;
            }
        }
コード例 #11
0
        private void barBtnXuatBaoCao_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (Object.Equals(NhanVienPTs, null))
            {
                XtraMessageBox.Show("Chưa có nhân viên phụ trách", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (NhanVienPTs.Count > 0)
            {
                try
                {
                    DevExpress.XtraSplashScreen.SplashScreenManager splashScreenManager_Report = new DevExpress.XtraSplashScreen.SplashScreenManager(this, typeof(global::PTB_GUI.WaitForm1), true, true, DevExpress.XtraSplashScreen.ParentType.UserControl);
                    splashScreenManager_Report.ShowWaitForm();
                    splashScreenManager_Report.SetWaitFormCaption("Đang tạo report");
                    splashScreenManager_Report.SetWaitFormDescription("Vui lòng chờ trong giây lát...");

                    XtraReport_Template _XtraReport_Template = new XtraReport_Template(SHARED.Libraries.ReportHelper.FillDatasetFromGrid(gridViewNhanVien), gridViewNhanVien, barCheckItemLandscape.Checked, false);
                    _XtraReport_Template.SetTitleText("Danh Sách Nhân Viên Phụ Trách");
                    if (barCheckItemThietKe.Checked)
                    {
                        ReportDesignTool designTool = new ReportDesignTool(_XtraReport_Template);
                        splashScreenManager_Report.CloseWaitForm();
                        designTool.ShowDesignerDialog();

                        ReportPrintTool printTool = new ReportPrintTool(designTool.Report);
                        printTool.ShowPreviewDialog();
                    }
                    else
                    {
                        ReportPrintTool printTool = new ReportPrintTool(_XtraReport_Template);
                        splashScreenManager_Report.CloseWaitForm();
                        printTool.ShowPreviewDialog();
                    }
                }
                catch
                {
                    XtraMessageBox.Show("Đã xảy ra lỗi!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                XtraMessageBox.Show("Chưa có nhân viên phụ trách", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #12
0
ファイル: ucThongKe.cs プロジェクト: toantranit/QuanLyTaiSan
        private void barButtonItemXuatThongKe_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            try
            {
                if (current.Equals(_ucTKPhong))
                {
                    if (Object.Equals(_ucTKPhong.gridControlPhong.DataSource, null))
                    {
                        XtraMessageBox.Show("Chưa có dữ liệu!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                    if (((List <Phong_ThongKe>)_ucTKPhong.gridControlPhong.DataSource).Count > 0)
                    {
                        try
                        {
                            DevExpress.XtraSplashScreen.SplashScreenManager splashScreenManager_Report = new DevExpress.XtraSplashScreen.SplashScreenManager(this, typeof(global::TSCD_GUI.WaitFormLoad), true, true, DevExpress.XtraSplashScreen.ParentType.UserControl);
                            splashScreenManager_Report.ShowWaitForm();
                            splashScreenManager_Report.SetWaitFormCaption("Đang tạo report");
                            splashScreenManager_Report.SetWaitFormDescription("Vui lòng chờ trong giây lát...");

                            XtraReportTSCD_Grid _XtraReportTSCD_Grid = new XtraReportTSCD_Grid(_ucTKPhong.gridControlPhong, false);
                            _XtraReportTSCD_Grid.SetTextTitle("Thống Kê Phòng");
                            _XtraReportTSCD_Grid.SetTextTitle_TopRight("");

                            ReportPrintTool printTool = new ReportPrintTool(_XtraReportTSCD_Grid);
                            splashScreenManager_Report.CloseWaitForm();
                            printTool.ShowPreviewDialog();
                        }
                        catch
                        {
                            XtraMessageBox.Show("Đã xảy ra lỗi!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                    else
                    {
                        XtraMessageBox.Show("Chưa có dữ liệu!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else if (current.Equals(_ucTKTaiSan))
                {
                    if (Object.Equals(_ucTKTaiSan.gridControlTaiSan.DataSource, null))
                    {
                        XtraMessageBox.Show("Chưa có dữ liệu!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                    if (((List <TaiSan_ThongKe>)_ucTKTaiSan.gridControlTaiSan.DataSource).Count > 0)
                    {
                        try
                        {
                            DevExpress.XtraSplashScreen.SplashScreenManager splashScreenManager_Report = new DevExpress.XtraSplashScreen.SplashScreenManager(this, typeof(global::TSCD_GUI.WaitFormLoad), true, true, DevExpress.XtraSplashScreen.ParentType.UserControl);
                            splashScreenManager_Report.ShowWaitForm();
                            splashScreenManager_Report.SetWaitFormCaption("Đang tạo report");
                            splashScreenManager_Report.SetWaitFormDescription("Vui lòng chờ trong giây lát...");

                            XtraReportTSCD_Grid _XtraReportTSCD_Grid = new XtraReportTSCD_Grid(_ucTKTaiSan.gridControlTaiSan, false);
                            _XtraReportTSCD_Grid.SetTextTitle("Thống Kê Tài Sản");
                            _XtraReportTSCD_Grid.SetTextTitle_TopRight("");

                            ReportPrintTool printTool = new ReportPrintTool(_XtraReportTSCD_Grid);
                            splashScreenManager_Report.CloseWaitForm();
                            printTool.ShowPreviewDialog();
                        }
                        catch
                        {
                            XtraMessageBox.Show("Đã xảy ra lỗi!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                    else
                    {
                        XtraMessageBox.Show("Chưa có dữ liệu!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else if (current.Equals(_ucTKHaoMon))
                {
                    if (Object.Equals(_ucTKHaoMon.gridControlHaoMon.DataSource, null))
                    {
                        XtraMessageBox.Show("Chưa có dữ liệu!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                    if (((List <TaiSanHienThi>)_ucTKHaoMon.gridControlHaoMon.DataSource).Count > 0)
                    {
                        try
                        {
                            DevExpress.XtraSplashScreen.SplashScreenManager splashScreenManager_Report = new DevExpress.XtraSplashScreen.SplashScreenManager(this, typeof(global::TSCD_GUI.WaitFormLoad), true, true, DevExpress.XtraSplashScreen.ParentType.UserControl);
                            splashScreenManager_Report.ShowWaitForm();
                            splashScreenManager_Report.SetWaitFormCaption("Đang tạo report");
                            splashScreenManager_Report.SetWaitFormDescription("Vui lòng chờ trong giây lát...");

                            XtraReportTSCD_Grid _XtraReportTSCD_Grid = new XtraReportTSCD_Grid(_ucTKHaoMon.gridControlHaoMon, false);
                            _XtraReportTSCD_Grid.SetTextTitle("Thống Kê Hao Mòn");
                            _XtraReportTSCD_Grid.SetTextTitle_TopRight("");

                            ReportPrintTool printTool = new ReportPrintTool(_XtraReportTSCD_Grid);
                            splashScreenManager_Report.CloseWaitForm();
                            printTool.ShowPreviewDialog();
                        }
                        catch
                        {
                            XtraMessageBox.Show("Đã xảy ra lỗi!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                    else
                    {
                        XtraMessageBox.Show("Chưa có dữ liệu!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else if (current.Equals(_ucTKTHPhong))
                {
                    if (Object.Equals(_ucTKTHPhong.gridControlPhong.DataSource, null))
                    {
                        XtraMessageBox.Show("Chưa có dữ liệu!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                    if (((List <Phong_ThongKe>)_ucTKTHPhong.gridControlPhong.DataSource).Count > 0)
                    {
                        try
                        {
                            DevExpress.XtraSplashScreen.SplashScreenManager splashScreenManager_Report = new DevExpress.XtraSplashScreen.SplashScreenManager(this, typeof(global::TSCD_GUI.WaitFormLoad), true, true, DevExpress.XtraSplashScreen.ParentType.UserControl);
                            splashScreenManager_Report.ShowWaitForm();
                            splashScreenManager_Report.SetWaitFormCaption("Đang tạo report");
                            splashScreenManager_Report.SetWaitFormDescription("Vui lòng chờ trong giây lát...");

                            XtraReportTSCD_Grid _XtraReportTSCD_Grid = new XtraReportTSCD_Grid(_ucTKTHPhong.gridControlPhong, false);
                            _XtraReportTSCD_Grid.SetTextTitle("Thống Kê Tổng Hợp Phòng");
                            _XtraReportTSCD_Grid.SetTextTitle_TopRight("");

                            ReportPrintTool printTool = new ReportPrintTool(_XtraReportTSCD_Grid);
                            splashScreenManager_Report.CloseWaitForm();
                            printTool.ShowPreviewDialog();
                        }
                        catch
                        {
                            XtraMessageBox.Show("Đã xảy ra lỗi!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                    else
                    {
                        XtraMessageBox.Show("Chưa có dữ liệu!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else if (current.Equals(_ucTKTHTaiSan))
                {
                    if (Object.Equals(_ucTKTHTaiSan.gridControlTaiSan.DataSource, null))
                    {
                        XtraMessageBox.Show("Chưa có dữ liệu!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                    if (((List <TaiSanHienThi>)_ucTKTHTaiSan.gridControlTaiSan.DataSource).Count > 0)
                    {
                        try
                        {
                            DevExpress.XtraSplashScreen.SplashScreenManager splashScreenManager_Report = new DevExpress.XtraSplashScreen.SplashScreenManager(this, typeof(global::TSCD_GUI.WaitFormLoad), true, true, DevExpress.XtraSplashScreen.ParentType.UserControl);
                            splashScreenManager_Report.ShowWaitForm();
                            splashScreenManager_Report.SetWaitFormCaption("Đang tạo report");
                            splashScreenManager_Report.SetWaitFormDescription("Vui lòng chờ trong giây lát...");

                            XtraReportTSCD_Grid _XtraReportTSCD_Grid = new XtraReportTSCD_Grid(_ucTKTHTaiSan.gridControlTaiSan, false);
                            _XtraReportTSCD_Grid.SetTextTitle("Thống Kê Tổng Hợp Tài Sản");
                            _XtraReportTSCD_Grid.SetTextTitle_TopRight("");

                            ReportPrintTool printTool = new ReportPrintTool(_XtraReportTSCD_Grid);
                            splashScreenManager_Report.CloseWaitForm();
                            printTool.ShowPreviewDialog();
                        }
                        catch
                        {
                            XtraMessageBox.Show("Đã xảy ra lỗi!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                    else
                    {
                        XtraMessageBox.Show("Chưa có dữ liệu!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
            catch
            {
                XtraMessageBox.Show("Đã xảy ra lỗi!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #13
0
        private void do_FirstRecord()
        {
            if (Convert.ToString(txtKullaniciAdi.EditValue) == "")
            {
                XtraMessageBox.Show("Kullanıcı Adı Giriniz.");
                return;
            }
            if (Convert.ToString(txtUserParola.EditValue) == "")
            {
                XtraMessageBox.Show("Parola Giriniz.");
                return;
            }
            if (Convert.ToString(txtSirketAdi.EditValue) == "")
            {
                XtraMessageBox.Show("Şirket Adı Giriniz.");
                return;
            }
            if (Convert.ToString(txtDepotAdi.EditValue) == "")
            {
                XtraMessageBox.Show("Depo Adı Giriniz.");
                return;
            }



            try
            {
                Splash = new DevExpress.XtraSplashScreen.SplashScreenManager(this, typeof(Waiting.Wait), true, true);
                Splash.WaitForSplashFormClose();
                if (!Splash.IsSplashFormVisible)
                {
                    Splash.ShowWaitForm();
                }
                SqlCommand sCommand = SqlCreateCommandFront(SqlConnectionString);


                sCommand.CommandText = "SELECT  [TableName] = so.name FROM sysobjects so WHERE so.xtype = 'U' GROUP BY so.name ";
                DataTable    tblTableList  = ExecuteSelectCommand(sCommand);
                DataColumn[] KeysTableList = new DataColumn[1];
                KeysTableList[0]        = tblTableList.Columns["TableName"];
                tblTableList.PrimaryKey = KeysTableList;


                #region Users

                if (tblTableList.Rows.Contains("Users") == false)
                {
                    sCommand.CommandText = "CREATE TABLE [dbo].[Users]( "
                                           + "     [id][int] IDENTITY(1, 1) NOT NULL, "
                                           + "     [username] [nvarchar] (50) NOT NULL, "
                                           + "     [password] [nvarchar] (50) NULL, "
                                           + " 	[note] [text] NULL, "
                                           + " 	[date] [datetime] NULL, "
                                           + " 	[Active] [bit] NULL, "
                                           + " 	[HaspPassword] [nvarchar] (50) NULL, "
                                           + " 	[Email] [nvarchar] (50) NULL, "
                                           + " 	[DefaultTheme] "
                                           + "         [nvarchar] "
                                           + "         (max) NULL, "
                                           + "     [DefaultTheme2] [nvarchar] "
                                           + "         (max) NULL, "
                                           + "     [AdminAuthority] [bit] NULL, "
                                           + " [ReportPrint][bit] NULL, "
                                           + " [ExportExcelPdf] [bit] NULL, "
                                           + " [DailyEndOperation] [bit] NULL, "
                                           + " [EnvanterEntry] [bit] NULL, "
                                           + " [VeresiyeDefterClosed] [bit] NULL, "
                                           + "  CONSTRAINT[PK_users] PRIMARY KEY CLUSTERED "
                                           + " ( "
                                           + "    [username] ASC "
                                           + " )WITH(PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON[PRIMARY] "
                                           + " ) ON[PRIMARY] TEXTIMAGE_ON[PRIMARY]";
                    ExecuteNonQuery(sCommand);
                }

                sCommand.CommandText = "INSERT INTO [dbo].[Users] "
                                       + "         ([username] "
                                       + "         ,[password] "
                                       + "         ,[date] "
                                       + "         ,[Active] "
                                       + "         ,[HaspPassword]) "
                                       + "   VALUES "
                                       + "         ('Admin' "
                                       + "         ,@Password "
                                       + "         ,@date "
                                       + "         ,'True' "
                                       + "         ,@HashPassword)";
                sCommand.Parameters.Clear();
                sCommand.Parameters.Add("Password", SqlDbType.NVarChar).Value     = SecurityExtension.Sifrele("c4e128b141aFb");
                sCommand.Parameters.Add("date", SqlDbType.DateTime).Value         = DateTime.Now;
                sCommand.Parameters.Add("HashPassword", SqlDbType.NVarChar).Value = SecurityExtension.ConvertStringToMD5("c4e128b141aFb");
                ExecuteNonQuery(sCommand);

                sCommand.CommandText = "INSERT INTO [dbo].[Users] "
                                       + "         ([username] "
                                       + "         ,[password] "
                                       + "         ,[date] "
                                       + "         ,[Active] "
                                       + "         ,[HaspPassword]) "
                                       + "   VALUES "
                                       + "         (@userName "
                                       + "         ,@Password "
                                       + "         ,@date "
                                       + "         ,'True' "
                                       + "         ,@HashPassword)";
                sCommand.Parameters.Clear();
                sCommand.Parameters.Add("userName", SqlDbType.NVarChar).Value     = txtKullaniciAdi.EditValue;
                sCommand.Parameters.Add("Password", SqlDbType.NVarChar).Value     = SecurityExtension.Sifrele(txtUserParola.EditValue.ToString());
                sCommand.Parameters.Add("date", SqlDbType.DateTime).Value         = DateTime.Now;
                sCommand.Parameters.Add("HashPassword", SqlDbType.NVarChar).Value = SecurityExtension.ConvertStringToMD5(txtUserParola.EditValue.ToString());
                ExecuteNonQuery(sCommand);
                #endregion

                #region Company

                if (tblTableList.Rows.Contains("Company") == false)
                {
                    sCommand.CommandText = "CREATE TABLE [dbo].[Company]( "
                                           + "     [RecId][int] IDENTITY(1, 1) NOT NULL, "
                                           + "     [CompanyCode] [nvarchar] (50) NULL, "
                                           + " 	[CompanyName] [nvarchar] (50) NULL, "
                                           + " 	[Logo] [image] NULL, "
                                           + " 	[Adress1] [nvarchar] (50) NULL, "
                                           + " 	[Adress2] [nvarchar] (50) NULL, "
                                           + " 	[BulvarCadde] [nvarchar] (50) NULL, "
                                           + " 	[TelNo] [int] NULL, "
                                           + " 	[BinaAdi] [nvarchar] (50) NULL, "
                                           + " 	[BinaNo] [nvarchar] (50) NULL, "
                                           + " 	[MahalleSemt] [nvarchar] (50) NULL, "
                                           + " 	[Sehir] [nvarchar] (50) NULL, "
                                           + " 	[PostaKodu] [int] NULL, "
                                           + " 	[Ulke] [nvarchar] (50) NULL, "
                                           + "  CONSTRAINT[PK_Company] PRIMARY KEY CLUSTERED "
                                           + " ( "
                                           + "    [RecId] ASC "
                                           + " )WITH(PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON[PRIMARY] "
                                           + " ) ON[PRIMARY] TEXTIMAGE_ON[PRIMARY]";
                    ExecuteNonQuery(sCommand);
                }

                sCommand.CommandText = "INSERT INTO [dbo].[Company] ([CompanyCode], [CompanyName]) VALUES ('001', @companyName);SELECT SCOPE_IDENTITY();";
                sCommand.Parameters.Clear();
                sCommand.Parameters.Add("companyName", SqlDbType.NVarChar).Value = txtSirketAdi.EditValue;
                int CompanyRecId = Convert.ToInt32(ExecuteScalar(sCommand));
                //ExecuteNonQuery(sCommand);
                #endregion

                #region Depo

                if (tblTableList.Rows.Contains("Depot") == false)
                {
                    sCommand.CommandText = "CREATE TABLE [dbo].[Depot]( "
                                           + "     [DID][int] IDENTITY(1, 1) NOT NULL, "
                                           + "     [DepName] [nvarchar] (50) NULL, "
                                           + " 	[DepAddress] [nvarchar] (50) NULL, "
                                           + " 	[DepDistrict] [nvarchar] (50) NULL, "
                                           + " 	[DepCity] [nvarchar] (50) NULL, "
                                           + " 	[DepAuthPerson] [nvarchar] (50) NULL, "
                                           + " 	[DepPhoneOne] [nvarchar] (50) NULL, "
                                           + " 	[DepPhoneTwo] [nvarchar] (50) NULL, "
                                           + " 	[DepTaxAdministration] [nvarchar] (50) NULL, "
                                           + " 	[DepTaxNo] [nvarchar] (50) NULL, "
                                           + " 	[DepActive] [bit] NULL, "
                                           + " 	[DepDate] [datetime] NULL, "
                                           + " 	[CompanyRecId] [int] NULL, "
                                           + "  CONSTRAINT[PK_Depot] PRIMARY KEY CLUSTERED "
                                           + " ( "
                                           + "    [DID] ASC "
                                           + " )WITH(PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON[PRIMARY] "
                                           + " ) ON[PRIMARY]";
                    ExecuteNonQuery(sCommand);
                }

                sCommand.CommandText = "INSERT INTO [dbo].[Depot] ([DepName],[CompanyRecId])  VALUES (@DepName, @CompanyRecId)";
                sCommand.Parameters.Clear();
                sCommand.Parameters.Add("DepName", SqlDbType.NVarChar).Value = txtDepotAdi.EditValue;
                sCommand.Parameters.Add("CompanyRecId", SqlDbType.Int).Value = CompanyRecId;
                ExecuteNonQuery(sCommand);
                #endregion

                #region ApplicatonServer

                if (tblTableList.Rows.Contains("ApplicationServer") == false)
                {
                    sCommand.CommandText = "CREATE TABLE [dbo].[ApplicationServer]( "
                                           + "     [Id][int] IDENTITY(1, 1) NOT NULL, "
                                           + "  "
                                           + "     [Server] [nvarchar] "
                                           + "         (max) NULL, "
                                           + "  "
                                           + "     [ServerName] [nvarchar] "
                                           + "         (max) NULL, "
                                           + "  "
                                           + "     [UserName] [nvarchar] (200) NULL, "
                                           + " 	[Password] "
                                           + "         [nvarchar] "
                                           + "         (max) NULL, "
                                           + "  "
                                           + "     [DataBase] [nvarchar] (50) NULL, "
                                           + "  CONSTRAINT[PK_ApplicationServer] PRIMARY KEY CLUSTERED "
                                           + " ( "
                                           + "    [Id] ASC "
                                           + " )WITH(PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON[PRIMARY] "
                                           + " ) ON[PRIMARY] TEXTIMAGE_ON[PRIMARY]";
                    ExecuteNonQuery(sCommand);
                }



                string[] conArry;
                conArry = SqlConnectionString.Split(';');
                List <string> conn = new List <string>();
                foreach (var item in conArry)
                {
                    int position = item.IndexOf("=");
                    if (position < 0)
                    {
                        continue;
                    }
                    conn.Add(item.Substring(position + 1));
                }


                if (SqlLocal)
                {
                    sCommand.CommandText = "INSERT INTO [dbo].[ApplicationServer] "
                                           + "        ([Server] "
                                           + "        ,[ServerName] "
                                           + "        ,[UserName] "
                                           + "        ,[Password] "
                                           + "        ,[DataBase])"
                                           + "  VALUES "
                                           + "        (@server "
                                           + "        ,@serverName "
                                           + "        ,'' "
                                           + "        ,'' , @DataBase)";
                    sCommand.Parameters.Clear();
                    sCommand.Parameters.Add("server", SqlDbType.NVarChar).Value     = "(localdb)\\MSSQLLocalDB";
                    sCommand.Parameters.Add("serverName", SqlDbType.NVarChar).Value = "SQLLocal";
                    sCommand.Parameters.Add("DataBase", SqlDbType.NVarChar).Value   = "Msp";
                    ExecuteNonQuery(sCommand);
                }
                else
                {
                    //sCommand.CommandText = "INSERT INTO [dbo].[ApplicationServer] "
                    //                    + "        ([Server] "
                    //                    + "        ,[ServerName] "
                    //                    + "        ,[UserName] "
                    //                    + "        ,[Password] "
                    //                    + "        ,[DataBase])"
                    //                    + "  VALUES "
                    //                    + "        (@server "
                    //                    + "        ,@serverName "
                    //                    + "        ,'' "
                    //                    + "        ,'' , @DataBase)";
                    //sCommand.Parameters.Clear();
                    //sCommand.Parameters.Add("server", SqlDbType.NVarChar).Value = "(localdb)\\MSSQLLocalDB";
                    //sCommand.Parameters.Add("serverName", SqlDbType.NVarChar).Value = "SQLLocal";
                    //sCommand.Parameters.Add("DataBase", SqlDbType.NVarChar).Value = "Msp";
                    //ExecuteNonQuery(sCommand);
                }

                #endregion

                #region Parameter

                if (tblTableList.Rows.Contains("Parameters") == false)
                {
                    sCommand.CommandText = "CREATE TABLE [dbo].[Parameters]( "
                                           + "     [RecId][int] IDENTITY(1, 1) NOT NULL, "
                                           + "     [NumaratorShow] [bit] NULL, "
                                           + " 	[SaleApproval] [bit] NULL, "
                                           + " 	[SaleOutOfStock] [bit] NULL, "
                                           + " 	[SaleCahnge] [bit] NULL, "
                                           + " 	[SaleInformationSlip] [bit] NULL, "
                                           + " 	[MainSaleForm] [bit] NULL, "
                                           + " 	[AutoCurrency] [bit] NULL, "
                                           + " 	[UserRecordMy] [bit] NULL, "
                                           + " 	[PaymentLock] [bit] NULL, "
                                           + " 	[PaymentyForced] [bit] NULL, "
                                           + " 	[SaleNewRecord] [bit] NULL, "
                                           + " 	[SaleProductEndDate] [bit] NULL, "
                                           + " 	[ProductEndDateDay] [int] NULL, "
                                           + "  CONSTRAINT[PK_Parameters] PRIMARY KEY CLUSTERED "
                                           + " ( "
                                           + "    [RecId] ASC "
                                           + " )WITH(PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON[PRIMARY] "
                                           + " ) ON[PRIMARY]";
                    ExecuteNonQuery(sCommand);
                }

                sCommand.CommandText = "INSERT INTO [dbo].[Parameters] "
                                       + "           ([NumaratorShow] "
                                       + "           ,[SaleApproval] "
                                       + "           ,[SaleOutOfStock] "
                                       + "           ,[SaleCahnge] "
                                       + "           ,[SaleInformationSlip] "
                                       + "           ,[MainSaleForm] "
                                       + "           ,[AutoCurrency] "
                                       + "           ,[UserRecordMy] "
                                       + "           ,[PaymentLock] "
                                       + "           ,[PaymentyForced] "
                                       + "           ,[SaleNewRecord] "
                                       + "           ,[SaleProductEndDate] "
                                       + "           ,[ProductEndDateDay]) "
                                       + "     VALUES "
                                       + "           ('True' "
                                       + "           ,'False' "
                                       + "           ,'False' "
                                       + "           ,'False' "
                                       + "           ,'False' "
                                       + "           ,'False' "
                                       + "           ,'False' "
                                       + "           ,'False' "
                                       + "           ,'False' "
                                       + "           ,'True' "
                                       + "           ,'True' "
                                       + "           ,'False' "
                                       + "           ,10)";
                sCommand.Parameters.Clear();
                ExecuteNonQuery(sCommand);
                #endregion

                #region Currency

                if (tblTableList.Rows.Contains("CurrencyType") == false)
                {
                    sCommand.CommandText = "CREATE TABLE [dbo].[CurrencyType]( "
                                           + "    [RecId][int] IDENTITY(1, 1) NOT NULL, "
                                           + "    [CurrencyCode] [varchar] (3) NOT NULL, "
                                           + "     [Remark] [varchar] (50) NULL, "
                                           + "	[CompanyRecId] [int] NULL, "
                                           + " CONSTRAINT[PK_CurrencyType] PRIMARY KEY CLUSTERED "
                                           + "( "
                                           + "   [CurrencyCode] ASC "
                                           + ")WITH(PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON[PRIMARY] "
                                           + ") ON[PRIMARY]";
                    ExecuteNonQuery(sCommand);
                }

                sCommand.CommandText = "INSERT INTO [dbo].[CurrencyType] ([CurrencyCode],[Remark],[CompanyRecId]) VALUES ('TL','TL',@CompanyRecId) ";
                sCommand.Parameters.Clear();
                sCommand.Parameters.Add("CompanyRecId", SqlDbType.Int).Value = CompanyRecId;
                ExecuteNonQuery(sCommand);

                sCommand.CommandText = "INSERT INTO [dbo].[CurrencyType] ([CurrencyCode],[Remark],[CompanyRecId]) VALUES ('USD','USD',@CompanyRecId) ";
                sCommand.Parameters.Clear();
                sCommand.Parameters.Add("CompanyRecId", SqlDbType.Int).Value = CompanyRecId;
                ExecuteNonQuery(sCommand);

                #endregion

                #region ProgramsControl

                if (tblTableList.Rows.Contains("ProgramsControl") == false)
                {
                    sCommand.CommandText = "CREATE TABLE [dbo].[ProgramsControl]( "
                                           + "     [RecId][int] IDENTITY(1, 1) NOT NULL, "
                                           + "     [MspVersion] [nvarchar] (50) NULL, "
                                           + " 	[Licence] [nvarchar] (50) NULL, "
                                           + " 	[FirstDate] [datetime] NULL, "
                                           + " 	[MacAdress] [nvarchar] (50) NULL, "
                                           + " 	[IpAdress] [nvarchar] (50) NULL, "
                                           + " 	[LocalIpAdress] [nvarchar] (50) NULL, "
                                           + "     [IsDemo] [bit] NULL, "
                                           + "  CONSTRAINT[PK_ProgramsControl] PRIMARY KEY CLUSTERED "
                                           + " ( "
                                           + "    [RecId] ASC "
                                           + " )WITH(PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON[PRIMARY] "
                                           + " ) ON[PRIMARY]";
                    ExecuteNonQuery(sCommand);
                }


                sCommand.CommandText = "INSERT INTO [dbo].[ProgramsControl]([MspVersion],[Licence],[FirstDate],[IsDemo]) VALUES ('1.0.0.0','',@date,@Demo)";
                sCommand.Parameters.Clear();
                sCommand.Parameters.Add("Demo", SqlDbType.Bit).Value      = IsDemo;
                sCommand.Parameters.Add("date", SqlDbType.DateTime).Value = dt_RecordDate.DateTime;
                //sCommand.Parameters.Add("MacAdress", SqlDbType.NVarChar).Value = AppMain.MAcAdress;
                //sCommand.Parameters.Add("IpAdress", SqlDbType.NVarChar).Value = AppMain.IpAdress;
                //sCommand.Parameters.Add("LocalIp", SqlDbType.NVarChar).Value = AppMain.LocalIpAdress;
                ExecuteNonQuery(sCommand);


                #endregion

                #region PaymentType

                if (tblTableList.Rows.Contains("PaymentType") == false)
                {
                    sCommand.CommandText = "CREATE TABLE [dbo].[PaymentType]( "
                                           + "     [RecId][int] IDENTITY(1, 1) NOT NULL, "
                                           + "     [Remark] [nvarchar] (50) NULL, "
                                           + "  CONSTRAINT[PK_PaymentType] PRIMARY KEY CLUSTERED "
                                           + " ( "
                                           + "    [RecId] ASC "
                                           + " )WITH(PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON[PRIMARY] "
                                           + " ) ON[PRIMARY]";
                    ExecuteNonQuery(sCommand);
                }

                sCommand.CommandText = "INSERT INTO [dbo].[PaymentType] ([Remark]) VALUES ('Nakit')";
                sCommand.Parameters.Clear();
                ExecuteNonQuery(sCommand);
                sCommand.CommandText = "INSERT INTO [dbo].[PaymentType] ([Remark]) VALUES ('Pos')";
                sCommand.Parameters.Clear();
                ExecuteNonQuery(sCommand);
                sCommand.CommandText = "INSERT INTO [dbo].[PaymentType] ([Remark]) VALUES ('Pos & Nakit')";
                sCommand.Parameters.Clear();
                ExecuteNonQuery(sCommand);


                #endregion
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(ex.Message);
            }
            finally
            {
                if (Splash.IsSplashFormVisible)
                {
                    Splash.CloseWaitForm();
                }
                string path = @"C:\Msp\ConnectString.txt";
                if (!File.Exists(path))
                {
                    using (StreamWriter sw = File.CreateText(path))
                    {
                        string sifrele = SecurityExtension.Sifrele(SqlConnectionString);
                        sw.WriteLine(sifrele);
                    }
                }
                pageLisansDemo.AllowNext = true;
            }
        }
コード例 #14
0
        /// <summary>
        /// 保存数据导入到数据库和表格中
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void toolSave_Click(object sender, EventArgs e)
        {
            gv.PostEditor();
            gv.CloseEditor();
            if (gv.SelectedRowsCount == 0)
            {
                MessageUtil.ShowWarning("请选择导入条目!");
                return;
            }
            successTable.Rows.Clear();
            failureTable.Rows.Clear();

            List <ArchiveInfoDto> importedArvList = new List <ArchiveInfoDto>();

            // 将表格中的数据导入数据库中
            if (gv.DataSource != null)
            {
                // 设置列对应的数据库表字段名
                foreach (GridColumn col in gv.Columns)
                {
                    //  从属性类中读取字段对应的显示名
                    List <FieldCfgDto> arvField = PropertyHelper.FieldCfgItems.Where <FieldCfgDto>(item => item.FieldShowName == col.FieldName).ToList <FieldCfgDto>();

                    if (arvField.Count == 1)
                    {
                        col.Name = arvField[0].FieldShowName;
                        col.Tag  = true;                   // 指示该列是要写入数据库的信息
                    }
                    else
                    {
                        col.Tag = false;
                    }
                }

                loading.ShowWaitForm();//数据多时界面可能会有卡顿

                // 遍历所有行
                //for (int i = 0; i < gv.RowCount; i++)
                int[] toDelete = gv.GetSelectedRows().Reverse().ToArray();
                //List<ArchiveInfoDto> infos=new List<ArchiveInfoDto>();
                foreach (int i in toDelete)
                {
                    // 当前行对象转化为类实例
                    //ArchiveInfoDto info = GridControlHelper.Instance.ConvertDataRowToObject<ArchiveInfoDto>(gv, i);
                    ArchiveInfoDto info = (ArchiveInfoDto)gv.GetRow(i);//单条保存,如果多条保存出错全部回滚不合理
                    info.ArvStatus = "在档";

                    try
                    {
                        // 记录写入数据库
                        CallerFactory.Instance.GetService <IArvOpService>().InToStorage(info);
                        // 加入写入成功的数据表
                        successTable.Rows.Add(gv.GetDataRow(i).ItemArray);
                        tbImport.Rows.RemoveAt(i);//成功写入的记录从表中移除
                        importedArvList.Add(info);
                    }
                    catch (Exception)
                    {
                        // 加入写入失败的数据表
                        failureTable.Rows.Add(gv.GetDataRow(i).ItemArray);
                    }
                }
                gc.RefreshDataSource();

                OnGetImportArchives(importedArvList);

                // 显示导入结果的对话框
                FormPBExcelShow frmPBExcelShow = new FormPBExcelShow();

                frmPBExcelShow.sCount           = successTable.Rows.Count;
                frmPBExcelShow.xCount           = failureTable.Rows.Count;
                frmPBExcelShow.Tb_ImportFailure = failureTable;

                frmPBExcelShow.ShowDialog();
            }
            else
            {
                MessageUtil.ShowTips("没有数据可以导入");
            }
        }
コード例 #15
0
        private void barBtnXuatBaoCao_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (Object.Equals(objPhong, null))
            {
                XtraMessageBox.Show("Chưa chọn phòng!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (Object.Equals(objPhong.id, Guid.Empty))
            {
                XtraMessageBox.Show("Chưa chọn phòng!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            String strViTri = "[Không Rõ]";
            if (!Object.Equals(objPhong.vitri, null))
                strViTri = objPhong.vitri.coso != null ? objPhong.vitri.coso.ten + (objPhong.vitri.day != null ? " - " + objPhong.vitri.day.ten + (objPhong.vitri.tang != null ? " - " + objPhong.vitri.tang.ten : "") : "") : "";
            if (Object.Equals(listCTThietBis, null))
            {
                XtraMessageBox.Show(String.Format("Phòng {0} ({1}) chưa có thiết bị!", objPhong.ten, strViTri), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            else
            {
                if (listCTThietBis.Count > 0)
                {
                    try
                    {
                        DevExpress.XtraSplashScreen.SplashScreenManager splashScreenManager_Report = new DevExpress.XtraSplashScreen.SplashScreenManager(this, typeof(global::PTB_GUI.WaitForm1), true, true, DevExpress.XtraSplashScreen.ParentType.UserControl);
                        splashScreenManager_Report.ShowWaitForm();
                        splashScreenManager_Report.SetWaitFormCaption("Đang tạo report");
                        splashScreenManager_Report.SetWaitFormDescription("Vui lòng chờ trong giây lát...");

                        XtraReport_Template _XtraReport_Template = new XtraReport_Template(SHARED.Libraries.ReportHelper.FillDatasetFromGrid(gridViewCTThietBi), gridViewCTThietBi, barCheckItemLandscape.Checked);
                        _XtraReport_Template.SetTitleText(String.Format("Danh Sách Thiết Bị Tại Phòng: {0} ({1})", objPhong.ten, strViTri));
                        if (barCheckItemThietKe.Checked)
                        {
                            ReportDesignTool designTool = new ReportDesignTool(_XtraReport_Template);
                            splashScreenManager_Report.CloseWaitForm();
                            designTool.ShowDesignerDialog();

                            ReportPrintTool printTool = new ReportPrintTool(designTool.Report);
                            printTool.ShowPreviewDialog();
                        }
                        else
                        {
                            ReportPrintTool printTool = new ReportPrintTool(_XtraReport_Template);
                            splashScreenManager_Report.CloseWaitForm();
                            printTool.ShowPreviewDialog();
                        }
                    }
                    catch
                    {
                        XtraMessageBox.Show("Đã xảy ra lỗi!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    XtraMessageBox.Show(String.Format("Phòng {0} ({1}) chưa có thiết bị!", objPhong.ten, strViTri), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
コード例 #16
0
ファイル: Funciones.cs プロジェクト: moyohub/Andromeda
 public void openWaitForm(DevExpress.XtraSplashScreen.SplashScreenManager ssm)
 {
     ssm.ShowWaitForm();
     ssm.SetWaitFormDescription("Espere un momento...");
     ssm.SetWaitFormCaption("Cargando");
 }
コード例 #17
0
        private void barBtnXuatBaoCao_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (Object.Equals(_ViTriHienTai, null))
            {
                XtraMessageBox.Show("Chưa chọn vị trí!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (Object.Equals(listPhong, null))
            {
                XtraMessageBox.Show("Không có phòng!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            else
            {
                String strViTri = _ViTriHienTai.coso != null ? _ViTriHienTai.coso.ten + (_ViTriHienTai.day != null ? " - " + _ViTriHienTai.day.ten + (_ViTriHienTai.tang != null ? " - " + _ViTriHienTai.tang.ten : "") : "") : "";
                if (listPhong.Count > 0)
                {
                    try
                    {
                        DevExpress.XtraSplashScreen.SplashScreenManager splashScreenManager_Report = new DevExpress.XtraSplashScreen.SplashScreenManager(this, typeof(global::PTB_GUI.WaitForm1), true, true, DevExpress.XtraSplashScreen.ParentType.UserControl);
                        splashScreenManager_Report.ShowWaitForm();
                        splashScreenManager_Report.SetWaitFormCaption("Đang tạo report");
                        splashScreenManager_Report.SetWaitFormDescription("Vui lòng chờ trong giây lát...");

                        XtraReport_Template _XtraReport_Template = new XtraReport_Template(SHARED.Libraries.ReportHelper.FillDatasetFromGrid(gridViewPhong), gridViewPhong, barCheckItemLandscape.Checked);
                        _XtraReport_Template.SetTitleText("Danh Sách Phòng Tại: " + strViTri);
                        if (barCheckItemThietKe.Checked)
                        {
                            ReportDesignTool designTool = new ReportDesignTool(_XtraReport_Template);
                            splashScreenManager_Report.CloseWaitForm();
                            designTool.ShowDesignerDialog();

                            ReportPrintTool printTool = new ReportPrintTool(designTool.Report);
                            printTool.ShowPreviewDialog();
                        }
                        else
                        {
                            ReportPrintTool printTool = new ReportPrintTool(_XtraReport_Template);
                            splashScreenManager_Report.CloseWaitForm();
                            printTool.ShowPreviewDialog();
                        }
                    }
                    catch
                    {
                        XtraMessageBox.Show("Đã xảy ra lỗi!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    strViTri = "[" + strViTri + "]";
                    XtraMessageBox.Show(strViTri + " không có phòng!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
コード例 #18
0
        private void barButtonItemXuatThongKe_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            try
            {
                if (current.Equals(_ucTKPhong))
                {
                    if (Object.Equals(_ucTKPhong.gridControlPhong.DataSource, null))
                    {
                        XtraMessageBox.Show("Chưa có dữ liệu!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                    if (((List<Phong_ThongKe>)_ucTKPhong.gridControlPhong.DataSource).Count > 0)
                    {
                        try
                        {
                            DevExpress.XtraSplashScreen.SplashScreenManager splashScreenManager_Report = new DevExpress.XtraSplashScreen.SplashScreenManager(this, typeof(global::TSCD_GUI.WaitFormLoad), true, true, DevExpress.XtraSplashScreen.ParentType.UserControl);
                            splashScreenManager_Report.ShowWaitForm();
                            splashScreenManager_Report.SetWaitFormCaption("Đang tạo report");
                            splashScreenManager_Report.SetWaitFormDescription("Vui lòng chờ trong giây lát...");

                            XtraReportTSCD_Grid _XtraReportTSCD_Grid = new XtraReportTSCD_Grid(_ucTKPhong.gridControlPhong, false);
                            _XtraReportTSCD_Grid.SetTextTitle("Thống Kê Phòng");
                            _XtraReportTSCD_Grid.SetTextTitle_TopRight("");

                            ReportPrintTool printTool = new ReportPrintTool(_XtraReportTSCD_Grid);
                            splashScreenManager_Report.CloseWaitForm();
                            printTool.ShowPreviewDialog();
                        }
                        catch
                        {
                            XtraMessageBox.Show("Đã xảy ra lỗi!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                    else
                    {
                        XtraMessageBox.Show("Chưa có dữ liệu!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else if (current.Equals(_ucTKTaiSan))
                {
                    if (Object.Equals(_ucTKTaiSan.gridControlTaiSan.DataSource, null))
                    {
                        XtraMessageBox.Show("Chưa có dữ liệu!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                    if (((List<TaiSan_ThongKe>)_ucTKTaiSan.gridControlTaiSan.DataSource).Count > 0)
                    {
                        try
                        {
                            DevExpress.XtraSplashScreen.SplashScreenManager splashScreenManager_Report = new DevExpress.XtraSplashScreen.SplashScreenManager(this, typeof(global::TSCD_GUI.WaitFormLoad), true, true, DevExpress.XtraSplashScreen.ParentType.UserControl);
                            splashScreenManager_Report.ShowWaitForm();
                            splashScreenManager_Report.SetWaitFormCaption("Đang tạo report");
                            splashScreenManager_Report.SetWaitFormDescription("Vui lòng chờ trong giây lát...");

                            XtraReportTSCD_Grid _XtraReportTSCD_Grid = new XtraReportTSCD_Grid(_ucTKTaiSan.gridControlTaiSan, false);
                            _XtraReportTSCD_Grid.SetTextTitle("Thống Kê Tài Sản");
                            _XtraReportTSCD_Grid.SetTextTitle_TopRight("");

                            ReportPrintTool printTool = new ReportPrintTool(_XtraReportTSCD_Grid);
                            splashScreenManager_Report.CloseWaitForm();
                            printTool.ShowPreviewDialog();
                        }
                        catch
                        {
                            XtraMessageBox.Show("Đã xảy ra lỗi!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                    else
                    {
                        XtraMessageBox.Show("Chưa có dữ liệu!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else if (current.Equals(_ucTKHaoMon))
                {
                    if (Object.Equals(_ucTKHaoMon.gridControlHaoMon.DataSource, null))
                    {
                        XtraMessageBox.Show("Chưa có dữ liệu!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                    if (((List<TaiSanHienThi>)_ucTKHaoMon.gridControlHaoMon.DataSource).Count > 0)
                    {
                        try
                        {
                            DevExpress.XtraSplashScreen.SplashScreenManager splashScreenManager_Report = new DevExpress.XtraSplashScreen.SplashScreenManager(this, typeof(global::TSCD_GUI.WaitFormLoad), true, true, DevExpress.XtraSplashScreen.ParentType.UserControl);
                            splashScreenManager_Report.ShowWaitForm();
                            splashScreenManager_Report.SetWaitFormCaption("Đang tạo report");
                            splashScreenManager_Report.SetWaitFormDescription("Vui lòng chờ trong giây lát...");

                            XtraReportTSCD_Grid _XtraReportTSCD_Grid = new XtraReportTSCD_Grid(_ucTKHaoMon.gridControlHaoMon, false);
                            _XtraReportTSCD_Grid.SetTextTitle("Thống Kê Hao Mòn");
                            _XtraReportTSCD_Grid.SetTextTitle_TopRight("");

                            ReportPrintTool printTool = new ReportPrintTool(_XtraReportTSCD_Grid);
                            splashScreenManager_Report.CloseWaitForm();
                            printTool.ShowPreviewDialog();
                        }
                        catch
                        {
                            XtraMessageBox.Show("Đã xảy ra lỗi!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                    else
                    {
                        XtraMessageBox.Show("Chưa có dữ liệu!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else if (current.Equals(_ucTKTHPhong))
                {
                    if (Object.Equals(_ucTKTHPhong.gridControlPhong.DataSource, null))
                    {
                        XtraMessageBox.Show("Chưa có dữ liệu!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                    if (((List<Phong_ThongKe>)_ucTKTHPhong.gridControlPhong.DataSource).Count > 0)
                    {
                        try
                        {
                            DevExpress.XtraSplashScreen.SplashScreenManager splashScreenManager_Report = new DevExpress.XtraSplashScreen.SplashScreenManager(this, typeof(global::TSCD_GUI.WaitFormLoad), true, true, DevExpress.XtraSplashScreen.ParentType.UserControl);
                            splashScreenManager_Report.ShowWaitForm();
                            splashScreenManager_Report.SetWaitFormCaption("Đang tạo report");
                            splashScreenManager_Report.SetWaitFormDescription("Vui lòng chờ trong giây lát...");

                            XtraReportTSCD_Grid _XtraReportTSCD_Grid = new XtraReportTSCD_Grid(_ucTKTHPhong.gridControlPhong, false);
                            _XtraReportTSCD_Grid.SetTextTitle("Thống Kê Tổng Hợp Phòng");
                            _XtraReportTSCD_Grid.SetTextTitle_TopRight("");

                            ReportPrintTool printTool = new ReportPrintTool(_XtraReportTSCD_Grid);
                            splashScreenManager_Report.CloseWaitForm();
                            printTool.ShowPreviewDialog();
                        }
                        catch
                        {
                            XtraMessageBox.Show("Đã xảy ra lỗi!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                    else
                    {
                        XtraMessageBox.Show("Chưa có dữ liệu!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else if (current.Equals(_ucTKTHTaiSan))
                {
                    if (Object.Equals(_ucTKTHTaiSan.gridControlTaiSan.DataSource, null))
                    {
                        XtraMessageBox.Show("Chưa có dữ liệu!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                    if (((List<TaiSanHienThi>)_ucTKTHTaiSan.gridControlTaiSan.DataSource).Count > 0)
                    {
                        try
                        {
                            DevExpress.XtraSplashScreen.SplashScreenManager splashScreenManager_Report = new DevExpress.XtraSplashScreen.SplashScreenManager(this, typeof(global::TSCD_GUI.WaitFormLoad), true, true, DevExpress.XtraSplashScreen.ParentType.UserControl);
                            splashScreenManager_Report.ShowWaitForm();
                            splashScreenManager_Report.SetWaitFormCaption("Đang tạo report");
                            splashScreenManager_Report.SetWaitFormDescription("Vui lòng chờ trong giây lát...");

                            XtraReportTSCD_Grid _XtraReportTSCD_Grid = new XtraReportTSCD_Grid(_ucTKTHTaiSan.gridControlTaiSan, false);
                            _XtraReportTSCD_Grid.SetTextTitle("Thống Kê Tổng Hợp Tài Sản");
                            _XtraReportTSCD_Grid.SetTextTitle_TopRight("");

                            ReportPrintTool printTool = new ReportPrintTool(_XtraReportTSCD_Grid);
                            splashScreenManager_Report.CloseWaitForm();
                            printTool.ShowPreviewDialog();
                        }
                        catch
                        {
                            XtraMessageBox.Show("Đã xảy ra lỗi!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                    else
                    {
                        XtraMessageBox.Show("Chưa có dữ liệu!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
            catch
            {
                XtraMessageBox.Show("Đã xảy ra lỗi!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }