예제 #1
0
 /// <summary>单击事件
 /// 单击事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void BarButtonItem_ItemClick(object sender, ItemClickEventArgs e)
 {
     try
     {
         //获取左侧栏的name值
         string strPageName = e.Link.Item.Name;
         string strCaption  = e.Link.Caption;
         string strUrl      = e.Link.Item.Tag.ToString();
         if (StaticInfoHelper.IsOpen == 0)
         {
             SplashScreenManager.ShowWaitForm();
             SplashScreenManager.SetWaitFormCaption("正在努力打开");
             SplashScreenManager.SetWaitFormDescription("第一个页面加载稍微慢点,稍等一会");
             OpenForm(this, strPageName, strCaption, strUrl);
             SplashScreenManager.CloseWaitForm();
             StaticInfoHelper.IsOpen = 1;
         }
         else if (StaticInfoHelper.IsOpen == 1)
         {
             OpenForm(this, strPageName, strCaption, strUrl);
         }
         tabControl.Visible = MdiChildren.Length <= 0;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
예제 #2
0
        public static void ShowWait(string Msg)
        {
            try
            {
                bool flag = !LoadForm.IsSplashFormVisible;
                if (flag)
                {
                    LoadForm.ShowWaitForm();

                    if (string.IsNullOrEmpty(Msg))
                    {
                        Msg = "请稍后,正在加载中...";
                    }

                    _loadForm.SetWaitFormCaption(Msg);
                }
                else
                {
                    LoadForm.CloseWaitForm();
                    LoadForm.ShowWaitForm();
                }
            }
            catch (Exception ex)
            {
            }

            //try
            //{
            //    SplashScreenManager.ShowForm(typeof(CustomWaitForm));
            //}
            //catch
            //{

            //}
        }
예제 #3
0
 internal void ShowLoading(string caption, string description)
 {
     this.Enabled = false;
     ssmLoader.ShowWaitForm();
     ssmLoader.SetWaitFormCaption(caption);
     ssmLoader.SetWaitFormDescription(description);
 }
예제 #4
0
        public static void ShowWaitForm(Type splashFormType, Form parentForm, string caption = "", string description = "")
        {
            if (_splashScreenManager == null)
            {
                SplashFormProperties info = new SplashFormProperties(parentForm, false, false);

                _splashScreenManager = new SplashScreenManager(splashFormType, info);
            }
            else
            {
                if (_splashScreenManager.Properties.ParentForm != parentForm)
                {
                    _splashScreenManager.Properties = new SplashFormProperties(parentForm, false, false);
                }

                _splashScreenManager.ActiveSplashFormTypeInfo = DevExpress.XtraSplashScreen.TypeInfo.FromType(splashFormType);
            }

            _splashScreenManager.ShowWaitForm();

            if (!String.IsNullOrEmpty(caption))
            {
                _splashScreenManager.SetWaitFormCaption(caption);
            }

            if (!String.IsNullOrEmpty(description))
            {
                _splashScreenManager.SetWaitFormDescription(description);
            }
        }
예제 #5
0
        public void ShowWaitForm(string description, string caption = "")
        {
            if (!ssm.IsSplashFormVisible)
            {
                ssm.ShowWaitForm();
            }

            if (caption == "")
            {
                ssm.SetWaitFormCaption("请稍等......");
            }
            else
            {
                ssm.SetWaitFormCaption(caption);
            }
            ssm.SetWaitFormDescription(description);
        }
예제 #6
0
 /// <summary>
 /// Показать форму ожидания загрузки
 /// </summary>
 public void ShowWaitForm(string caption = null)
 {
     if (ssManager.IsSplashFormVisible)
     {
         return;
     }
     if (!string.IsNullOrEmpty(caption))
     {
         ssManager.SetWaitFormCaption(caption);
     }
     ssManager.ShowWaitForm();
 }
예제 #7
0
 private void Bitacora_Load(object sender, EventArgs e)
 {
     splash.SetWaitFormCaption("Cargando Información...");
     lookUpEditMonth.EditValue = month;
     lookUpEditYear.EditValue  = year;
     lookUpEditUser.EditValue  = user;
     //lookUpEditUser.EditValue = controlador.GetNombreUsuario(Properties.Settings.Default.Usuario.ToString().ToUpper());
     CargaTabla();
     if (splash.IsSplashFormVisible.Equals(true))
     {
         splash.CloseWaitForm();
     }
 }
예제 #8
0
 private void AltaClavesSAT_Load(object sender, EventArgs e)
 {
     // This line of code is generated by Data Source Configuration Wizard
     // Fill a SqlDataSource
     sqlDataSource1.Fill();
     // This line of code is generated by Data Source Configuration Wizard
     // Fill a SqlDataSource
     splash.SetWaitFormCaption("Cargando Catalogo Claves..");
     sqlDataSource1.Fill();
     if (splash.IsSplashFormVisible.Equals(true))
     {
         splash.CloseWaitForm();
     }
 }
예제 #9
0
        protected internal static bool CreateDatabase <TContext>(string splashCaption, string splashDescription, string onayMesaj, string bilgiMesaj)
            where TContext : DbContext, new()
        {
            using (var con = new TContext())
            {
                con.Database.Connection.ConnectionString = Business.Functions.GeneralFunctions.GetConnectionString();
                if (con.Database.Exists())
                {
                    return(true);                        //db oluşmuşsa return yap
                }
                if (Messages.EvetSeciliEvetHayir(onayMesaj, "Onay") != DialogResult.Yes)
                {
                    return(false);
                }

                var splashForm = new SplashScreenManager(Form.ActiveForm, typeof(BekleForm), true, true);
                SplashBaslat(splashForm);

                splashForm.SetWaitFormCaption(splashCaption);
                splashForm.SetWaitFormDescription(splashDescription);

                try
                {
                    if (con.Database.CreateIfNotExists())
                    {
                        SplashDurdur(splashForm);
                        Messages.BilgiMesaji(bilgiMesaj);
                        return(true);
                    }
                }
                catch (SqlException exception)
                {
                    SplashDurdur(splashForm);

                    switch (exception.Number)
                    {
                    case 5170:
                        Messages.HataMesaji("Veritabanı Dosyalarının Yükleneceği Klasörde Aynı İsimde Bir Dosya Var. Lütfen Kontrol Ediniz \n\n" + exception.Message);
                        break;

                    default:
                        Messages.HataMesaji(exception.Message);
                        break;
                    }
                }

                return(false);
            }
        }
        public static bool CreateDatabase <TContext>(string splashCaption, string splashDescription, string onayMesaj, string bilgiMesaj) where TContext : DbContext, new()
        {
            using (var con = new TContext())
            {
                con.Database.Connection.ConnectionString = GetConnectionString();
                if (con.Database.Exists())
                {
                    return(true);
                }
                if (Messages.EvetSeciliEvetHayir(onayMesaj, "Onay") != DialogResult.Yes)
                {
                    return(false);
                }
                var splashForm = new SplashScreenManager(Form.ActiveForm, typeof(BekleForm), true, true);
                SplashBaslat(splashForm);

                splashForm.SetWaitFormCaption(splashCaption);
                splashForm.SetWaitFormDescription(splashDescription);

                try
                {
                    if (con.Database.CreateIfNotExists())
                    {
                        SplashDurdur(splashForm);
                        Messages.BilgiMesaji(bilgiMesaj);
                        return(true);
                    }
                }
                catch (SqlException ex)
                {
                    SplashDurdur(splashForm);

                    switch (ex.ErrorCode)
                    {
                    case 5170:
                        Messages.HataMesaji("Veritabanı Dosyalarının Yükleneceği Klasorder Aynı İsimde Zaten Bir Dosya Var. Lütfen Kontrol Ediniz.\n\n" + ex.Message);
                        break;

                    default:
                        Messages.HataMesaji(ex.Message);
                        break;
                    }
                    throw;
                }
                return(false);
            }
        }
예제 #11
0
 public static void SetCaptionWaitForm(string Caption = "", string Desctiption = "")
 {
     try
     {
         if (ssmWait != null && ssmWait.IsSplashFormVisible)
         {
             if (!string.IsNullOrEmpty(Caption))
             {
                 ssmWait.SetWaitFormCaption(Caption);
             }
             if (!string.IsNullOrEmpty(Desctiption))
             {
                 ssmWait.SetWaitFormDescription(Desctiption);
             }
         }
     }
     catch { }
 }
예제 #12
0
 private void EditarEmpresa_Load(object sender, EventArgs e)
 {
     try
     {
         splash.SetWaitFormCaption("Cargando información Empresa..");
         layoutControlGroup8.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
         parametros = controlador.GetParametros(RFCEmpr);
         //XtraMessageBox.Show(parametros.REGIMEN);
         TxtEmpresa.Text = parametros.NombreEmpresa;
         TxtRFC.Text     = parametros.RFC;
         TxtRegPat.Text  = parametros.RegistroPatronal;
         if (parametros.RegistroPatronal.Equals(null) || parametros.RegistroPatronal.Equals(""))
         {
             ChAsimilados.Checked           = true;
             Asimilados                     = true;
             layoutControlItem12.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
         }
         else
         {
             Asimilados = false;
             layoutControlItem12.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
         }
         LookUpRegFis.Text     = parametros.DescripcionRegimen;
         LookUpRegFis.ReadOnly = true;
         if (parametros.ORIGEN_RECURSOS.Equals(null) || parametros.ORIGEN_RECURSOS.Equals(""))
         {
             recursos = controlador.GetTipoRecu(RFCEmpr);
             if (recursos.Equals("") || recursos.Equals(null))
             {
                 LookUpRecu.Text = "NO APLICA";
             }
             else
             {
                 LookUpRecu.Text = recursos;
             }
         }
         else
         {
             recursos        = controlador.GetTipoRecu(RFCEmpr);
             LookUpRecu.Text = recursos;
         }
         //LookUpRecu.Text = parametros.ORIGEN_RECURSOS;
         LookUpRecu.ReadOnly   = true;
         LookUpPuesto.Text     = parametros.DescripcionPuesto;
         LookUpPuesto.ReadOnly = true;
         LookUpNomi.Text       = parametros.DescripcionNomina;
         LookUpNomi.ReadOnly   = true;
         TxtCalle.Text         = parametros.Calle;
         TxtNumInt.Text        = parametros.NUM_INT;
         TxtNumExt.Text        = parametros.NUM_EXT;
         LookUpEst.Text        = parametros.ESTADO;
         LookUpEst.ReadOnly    = true;
         LookUpMuni.Text       = parametros.MUNICIPIO;
         LookUpMuni.ReadOnly   = true;
         TxtCP.Text            = parametros.CODIGO_POSTAL;
         TxtCP.ReadOnly        = true;
         LookUpCol.Text        = parametros.COLONIA;
         LookUpCol.ReadOnly    = true;
         TxtCer.Text           = parametros.ARCHIVO_CER;
         TxtKey.Text           = parametros.ARCHIVO_KEY;
         TxtPassKey.Text       = parametros.CLAVE_CERTIFICADO;
         TxtAsunto.Text        = parametros.ASUNTO_CERTIFICADO;
         TxtSerie.Text         = parametros.NUMERO_CERTIFICADO;
         TxtFecIniVig.Text     = parametros.FECHA_INICIO_CERTIFICADO.ToString("dd/MM/yyyy");
         TxtFevFinVig.Text     = parametros.FECHA_VENCIMIENTO_CERTIFICADO.ToString("dd/MM/yyyy");
         TxtCuenta.Text        = parametros.cuentaOrigen;
         TxtCuenta.ReadOnly    = true;
         TxtCorreo.Text        = parametros.correo_cliente;
         splash.CloseWaitForm();
     }
     catch (Exception ex)
     {
         if (splash.IsSplashFormVisible.Equals(true))
         {
             splash.CloseWaitForm();
         }
         XtraMessageBox.Show(ex.Message + "Error Componente EditarEmpresa", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
예제 #13
0
        /// <summary>
        /// Backups the database.
        /// </summary>
        /// <returns></returns>
        public static bool BackupDatabase(SplashScreenManager splashScreenManager, string backupName, bool openBackupFolder)
        {
            try
            {
                var globalVariable = new GlobalVariable();
                if (splashScreenManager != null)
                {
                    splashScreenManager.ShowWaitForm();
                    splashScreenManager.SetWaitFormCaption("Đang sao lưu dữ liệu");
                    splashScreenManager.SetWaitFormDescription("Vui lòng đợi ..");
                }

                var databaseNameForBackup = RegistryHelper.GetValueByRegistryKey("DatabaseName");
                var databaseForBackup     = GlobalVariable.Server.Databases[databaseNameForBackup];
                var backup = new Backup
                {
                    //option for backup
                    Action = BackupActionType.Database,
                    BackupSetDescription = "Sao lưu CSDL, ngày " + DateTime.Now,
                    BackupSetName        = databaseNameForBackup + " Backup",
                    Database             = databaseForBackup.Name
                };

                //create backupdevice
                var folderBackup   = globalVariable.DailyBackupPath;
                var dateTimeString = "NG" + DateTime.Now.Day.ToString(CultureInfo.InvariantCulture) +
                                     "T" + DateTime.Now.Month.ToString(CultureInfo.InvariantCulture) +
                                     "N" + DateTime.Now.Year.ToString(CultureInfo.InvariantCulture) +
                                     "_" + DateTime.Now.Hour.ToString(CultureInfo.InvariantCulture) + "GI" +
                                     DateTime.Now.Minute.ToString(CultureInfo.InvariantCulture) + "P";

                var databaseName = databaseNameForBackup + "_" + (string.IsNullOrEmpty(backupName) ? "" : backupName) + "_" + dateTimeString + ".bak";

                //LINHMC kiem tra neu folder ko ton tai thi tao
                if (string.IsNullOrEmpty(folderBackup))
                {
                    DriveInfo[] allDrives = DriveInfo.GetDrives();
                    if (allDrives.Length > 1)
                    {
                        folderBackup = allDrives[1].Name + @"BACKUP_A_BIGTIME";
                    }
                    else
                    {
                        folderBackup = allDrives[0].Name + @"BACKUP_A_BIGTIME";
                    }
                }
                if (!Directory.Exists(folderBackup))
                {
                    Directory.CreateDirectory(folderBackup);
                }

                var fileBackup = folderBackup + @"\" + databaseName;
                if (File.Exists(fileBackup))
                {
                    XtraMessageBox.Show(ResourceHelper.GetResourceValueByName("ResFileBackupExits"),
                                        ResourceHelper.GetResourceValueByName("ResExceptionCaption"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(false);
                }
                var backupDevice = new BackupDeviceItem(fileBackup, DeviceType.File);

                backup.Devices.Add(backupDevice);
                backup.Incremental = false;

                backup.SqlBackup(GlobalVariable.Server);

                //Cách nén file này chỉ dùng trong trường hợp hệ quản trị dữ liệu và chương trình cùng nằm trên 1 máy
                using (var zip = new ZipFile())
                {
                    zip.AddFile(fileBackup, "");
                    var zipFileName = fileBackup.Replace(".bak", ".zip");
                    zip.ParallelDeflateThreshold = -1;
                    zip.Save(zipFileName);
                    File.Delete(fileBackup);
                }
                if (splashScreenManager != null)
                {
                    splashScreenManager.CloseWaitForm();
                }

                if (openBackupFolder)
                {
                    Process.Start(folderBackup);
                }
                return(true);
            }
            catch (Exception ex)
            {
                if (splashScreenManager != null)
                {
                    splashScreenManager.CloseWaitForm();
                }
                XtraMessageBox.Show(ex.ToString(),
                                    ResourceHelper.GetResourceValueByName("ResExceptionCaption"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
        }
 //TODO Comment
 public static bool CheckConnectTimeOutWait(SplashScreenManager splashScreenManager)
 {
     if (IsConnectedToInternet() == false)
     {
         splashScreenManager.ShowWaitForm();
         //TODO Set Constant
         splashScreenManager.SetWaitFormCaption("Checking the network connection!");
         splashScreenManager.SetWaitFormDescription(SEDConst.SET_PLEASE_WAIT);
         Thread.Sleep(7000);
         splashScreenManager.CloseWaitForm();
         if (IsConnectedToInternet() == false)
         {
             //TODO Set Constant
             XtraMessageBox.Show("Connect Timout. Checking the network connection...!",
                 SEDConst.MESSAGE_WARNING_DISCONNECTED);
             return false;
         }
         return true;
     }
     return true;
 }
예제 #15
0
 /// <summary>
 ///  显示进度条
 /// </summary>
 /// <param name="manager">进度条</param>
 /// <param name="caption">标题</param>
 /// <param name="description">描述</param>
 /// Author  : Napoleon
 /// Created : 2015-02-26 20:30:27
 protected void ShowManager(SplashScreenManager manager, string caption, string description)
 {
     manager.ShowWaitForm();
     manager.SetWaitFormCaption(caption);
     manager.SetWaitFormDescription(description);
 }
예제 #16
0
 /// <summary>
 ///  显示进度条
 /// </summary>
 /// <param name="manager">进度条</param>
 /// <param name="caption">标题</param>
 /// <param name="description">描述</param>
 /// Author  : Napoleon
 /// Created : 2015-02-26 20:30:27
 protected void ShowManager(SplashScreenManager manager, string caption, string description)
 {
     manager.ShowWaitForm();
     manager.SetWaitFormCaption(caption);
     manager.SetWaitFormDescription(description);
 }
예제 #17
0
        private void BtnGenerarReporte_Click(object sender, EventArgs e)
        {
            try
            {
                if (LookUpMeses.Text.Equals("Seleccione"))
                {
                    XtraMessageBox.Show("Por favor seleccione mes.", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                else
                {
                    mes = LookUpMeses.EditValue.ToString();
                }
                if (LookUpAño.Text.Equals("Seleccione"))
                {
                    XtraMessageBox.Show("Por favor seleccione año.", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                else
                {
                    año = LookUpAño.EditValue.ToString();
                }
                splash.ShowWaitForm();
                splash.SetWaitFormCaption("Generando Reporte..");
                XtraReport reporte;
                reporte = new Reports.RepNomina(mes, año);
                ReportPrintTool printTool    = new ReportPrintTool(reporte);
                PrintControl    printControl = printTool.PreviewForm.PrintControl;
                //PrintControl printControl = printTool.PreviewRibbonForm.PrintControl;


                // Zoom the document, so that it fits the entire page into the Print Preview's dimensions.
                if (printControl.CanExecCommand(PrintingSystemCommand.ViewWholePage))
                {
                    printControl.ExecCommand(PrintingSystemCommand.ViewWholePage);
                }

                // Invoke the Hand tool to scroll the document using the mouse.
                if (printControl.CanExecCommand(PrintingSystemCommand.HandTool))
                {
                    printControl.ExecCommand(PrintingSystemCommand.HandTool, new object[] { true });
                }

                // Hide the Hand tool.
                //if (printControlCanExecCommand(PrintingSystemCommand.HandTool)) {
                //    printControl.ExecCommand(PrintingSystemCommand.HandTool, new object[] { false });
                //}

                // Show the report's Print Preview in a dialog window.
                printControl.Zoom = 1.2F;
                printTool.ShowPreview();
                splash.CloseWaitForm();
                //printTool.ShowPreviewDialog();
                //printTool.ShowRibbonPreviewDialog();
            }
            catch (Exception genRep)
            {
                splash.CloseWaitForm();
                XtraMessageBox.Show(genRep.Message + "mostrarReporte()", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #18
0
 /// <summary>
 ///     [EN] ShowWaitForm
 ///     Create By: ManhNV1 -Date:02/25/2016
 ///     Descripton: ShowWaitForm
 /// </summary>
 /// <param name="frmWaitForm">Form Used</param>
 /// <param name="strCaption">
 ///     Title WaitForm:
 ///     if strCaption = null => Value = Please Wait
 ///     else => Value = strCaption
 /// </param>
 /// <param name="strDescription">Description WaitForm</param>
 /// <returns>SplashScreenManager Type</returns>
 public static SplashScreenManager ShowWaitForm(Form frmWaitForm, string strCaption
     , string strDescription)
 {
     var splashScreenManager = new SplashScreenManager(frmWaitForm
         , typeof (WaitFormPlease), true, true);
     splashScreenManager.ShowWaitForm();
     if (strCaption == null)
         splashScreenManager.SetWaitFormCaption(SEDConst.SET_PLEASE_WAIT);
     else splashScreenManager.SetWaitFormCaption(strCaption);
     // Nếu Null thì dùng strDescription không thì  Set_Loading
     splashScreenManager.SetWaitFormDescription(strDescription ?? SEDConst.SET_LOADING);
     return splashScreenManager;
 }