/// <summary> /// Inicializa el modulo con el Login y el Splash /// </summary> protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); frmSplash frmSplash = new frmSplash(); frmLogin frmLogin = new frmLogin(frmSplash, EnumLoginType.Normal, validateRole: true, role: EnumRole.Manager, changePassword: true); frmSplash.Show(); frmSplash.ShowLogin(ref frmLogin); if (frmLogin.IsAuthenticated) { Context.User = frmLogin.UserData; if (Context.User.HasRole(EnumRole.Manager)) { frmProcessorOuthouse frmMain = new frmProcessorOuthouse(); frmMain.Title = $"{Context.Module} - [{Context.Environment}]"; frmMain.Show(); frmLogin.Close(); frmSplash.Close(); } else { UIHelper.ShowMessage("User doesn't have access"); } } }
/// <summary> /// Inicializa el modulo con el Login y el Splash /// </summary> /// <history> /// [erosado] 01/06/2016 Modified. Se agrego async /// [vipacheco] 09/Agosto/2016 Modified -> Se agrego el manejador de eventos. /// </history> protected async override void OnStartup(StartupEventArgs e) { base.OnStartup(e); EventManager.RegisterClassHandler(typeof(DataGrid), UIElement.MouseLeftButtonUpEvent, new MouseButtonEventHandler(dataGrid_MouseLeftButtonUp)); //Creamos el Splash Base! frmSplash frmSplash = new frmSplash(); //Creamos el tipo de login que se necesita! var frmLogin = new frmLogin(frmSplash, EnumLoginType.SalesRoom, changePassword: true, autoSign: true, validatePermission: true, permission: EnumPermission.Host, permissionLevel: EnumPermisionLevel.ReadOnly); await frmLogin.getAllPlaces(); //Mostramos el Splash frmSplash.Show(); //Mandamos llamar el Login frmSplash.ShowLogin(ref frmLogin); if (frmLogin.IsAuthenticated) { Context.User = frmLogin.UserData; frmHost frmMain = new frmHost(); frmMain.Title = $"{Context.Module} - [{Context.Environment}]"; frmMain.ShowDialog(); frmSplash.Close(); } }
public static frmSplash CreateInstance() { frmSplash theInstance = new frmSplash(); theInstance.Form_Load(); return(theInstance); }
private void btnSignIn_Click(object sender, EventArgs e) { lblWrongLogin.Visible = false; epUserName.Clear(); epPassword.Clear(); if (txtUserName.Text.Trim().Length == 0) { epUserName.SetError(txtUserName, "Kullacı adını giriniz!"); txtUserName.Focus(); return; } if (txtPassword.Text.Trim().Length == 0) { epPassword.SetError(txtPassword, "Şifre giriniz!"); txtPassword.Focus(); return; } if (UsersHelper.Login(txtUserName.Text, txtPassword.Text).Item1) { this.Hide(); int staffID = UsersHelper.Login(txtUserName.Text, txtPassword.Text).Item2; frmSplash f = new frmSplash(staffID); f.ShowDialog(); //Application.Exit(); } else { lblWrongLogin.Visible = true; } }
/// <summary> /// Inicializa el modulo con el Login y el Splash /// </summary> protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); frmSplash frmSplash = new frmSplash(); frmLogin frmLogin = new frmLogin(frmSplash, EnumLoginType.Normal, validateRole: true, role: EnumRole.Manager, changePassword: true); frmSplash.Show(); frmSplash.ShowLogin(ref frmLogin); if (frmLogin.IsAuthenticated) { Context.User = frmLogin.UserData; if (Context.User.HasRole(EnumRole.Manager)) { EventManager.RegisterClassHandler(typeof(AccessText), AccessKeyManager.AccessKeyPressedEvent, new RoutedEventHandler(keyManager_keyPressed)); EventManager.RegisterClassHandler(typeof(DataGrid), UIElement.MouseLeftButtonUpEvent, new MouseButtonEventHandler(dataGrid_MouseLeftButtonUp)); EventManager.RegisterClassHandler(typeof(ComboBox), UIElement.KeyDownEvent, new KeyEventHandler(cmb_KeyDown)); frmAdmin frmMain = new frmAdmin(); frmMain.Title = $"{Context.Module} - [{Context.Environment}]"; frmMain.ShowDialog(); frmSplash.Close(); } else { // No tiene permiso para ingresar al modulo UIHelper.ShowMessage("User doesn't have access"); } } }
/// <summary> /// Method for button to quit the game. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnQuitGame_Click(object sender, System.EventArgs e) { // Exit the playfield frmSplash form = new frmSplash(); form.Show(); Dispose(); }
public frmMain() { InitializeComponent(); frmSplash f = new frmSplash(); f.Show(); System.Threading.Thread.Sleep(2000); f.Close(); }
private void createDatabaseUser(frmSplash splash, DatabaseEngineUtil dbEngineUtil, string superUserPassword, string userName, string userPassword) { try { splash.ChangeText(getDisplayMember("createDatabaseUser{start}", "Creating database users as needed...")); var dnsName = Dns.GetHostName(); var netBIOSName = Toolkit.Cut(dnsName, 0, 15); var output = ""; if (dbEngineUtil is SqlServerEngineUtil) { // SQL Server and using Windows Authentication... // XP output = dbEngineUtil.CreateUser(superUserPassword, "gringlobal", "NETWORK SERVICE", netBIOSName, null, false, true); EventLog.WriteEntry("GRIN-Global Web Application", "Created db user NETWORK SERVICE allowed from machine " + netBIOSName + "... Result: " + output, EventLogEntryType.Information); output = dbEngineUtil.CreateUser(superUserPassword, "gringlobal", "ASPNET", netBIOSName, null, false, true); EventLog.WriteEntry("GRIN-Global Web Application", "Created db user ASPNET allowed from machine " + netBIOSName + "... Result: " + output, EventLogEntryType.Information); // Vista output = dbEngineUtil.CreateUser(superUserPassword, "gringlobal", "NETWORK SERVICE", "NT AUTHORITY", null, false, true); EventLog.WriteEntry("GRIN-Global Web Application", "Created db user NETWORK SERVICE allowed from machine NT AUTHORITY" + "... Result: " + output, EventLogEntryType.Information); output = dbEngineUtil.CreateUser(superUserPassword, "gringlobal", "SYSTEM", "NT AUTHORITY", null, false, true); EventLog.WriteEntry("GRIN-Global Web Application", "Created db user SYSTEM allowed from machine NT AUTHORITY" + "... Result: " + output, EventLogEntryType.Information); // Windows 7 output = dbEngineUtil.CreateUser(superUserPassword, "gringlobal", "DEFAULTAPPPOOL", "IIS AppPool", null, false, true); EventLog.WriteEntry("GRIN-Global Web Application", "Created db user DEFAULTAPPPOOL allowed from machine " + netBIOSName + "... Result: " + output, EventLogEntryType.Information); // SQL Server mixed mode... output = dbEngineUtil.CreateUser(superUserPassword, "gringlobal", userName, netBIOSName, userPassword, false, false); EventLog.WriteEntry("GRIN-Global Web Application", "Created db user " + userName + " allowed from machine " + netBIOSName + "... Result: " + output, EventLogEntryType.Information); } else if (dbEngineUtil is MySqlEngineUtil) { output = dbEngineUtil.CreateUser(superUserPassword, "gringlobal", userName, "%", userPassword, false, false); EventLog.WriteEntry("GRIN-Global Web Application", "Created db user " + userName + " allowed from machine % ... Result: " + output, EventLogEntryType.Information); } else if (dbEngineUtil is OracleEngineUtil) { output = dbEngineUtil.CreateUser(superUserPassword, "gringlobal", userName, null, userPassword, false, false); EventLog.WriteEntry("GRIN-Global Web Application", "Created db user " + userName + " allowed from machine [null] ... Result: " + output, EventLogEntryType.Information); } else if (dbEngineUtil is PostgreSqlEngineUtil) { output = dbEngineUtil.CreateUser(superUserPassword, "gringlobal", userName, dnsName, userPassword, false, false); EventLog.WriteEntry("GRIN-Global Web Application", "Created db user " + userName + " allowed from machine " + dnsName + "... Result: " + output, EventLogEntryType.Information); } } catch (Exception exCreateUsers) { //Context.LogMessage("Exception creating users: " + exCreateUsers.Message); EventLog.WriteEntry("GRIN-Global Web Application", "Exception creating user(s): " + exCreateUsers.Message, EventLogEntryType.Error); //MessageBox.Show("could not create db user: " + exCreateUsers.Message); } }
public static async Task <ReturnedSaveFuncInfo> RunAsync(IWin32Window owner, string Script, SqlConnection cn, SqlTransaction transaction = null, short tryCount = 2) { var ret = new ReturnedSaveFuncInfo(); try { if (string.IsNullOrEmpty(Script)) { return(ret); } string[] seperator = { "go\r", "go\r\n", "\ngo\n", "\ngo\r\n", "\tgo\t", " go ", "\rgo\r" }; Script = Script.Replace("GO", "go").Replace("Go", "go").Replace("gO", "go"); var scripts = Script.Split(seperator, StringSplitOptions.RemoveEmptyEntries); var cmd = new SqlCommand("", cn) { CommandTimeout = 60 * 1000 * 2,//2دقیقه CommandType = CommandType.Text }; if (transaction != null) { cmd.Transaction = transaction; } if (cn.State != ConnectionState.Open) { cn.Open(); } var frm = new frmSplash(scripts.ToList().Count); frm.Show(owner); var index = 1; foreach (var item in scripts) { index++; frm.Level = index; ret.AddReturnedValue(await ExecuteAsync(item, cmd)); } frm.Close(); } catch (Exception ex) { WebErrorLog.ErrorInstence.StartErrorLog(ex); ret.AddReturnedValue(ex); } if (ret.HasError && tryCount > 0) { await Task.Delay(1000); return(await RunAsync(owner, Script, cn, transaction, --tryCount)); } return(ret); }
static void Main() { Application.EnableVisualStyles(); Application.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture; SetDefaultCulture(System.Globalization.CultureInfo.InvariantCulture); Application.SetCompatibleTextRenderingDefault(false); //init the app object UVDLPApp.Instance().DoAppStartup(); // start the app and load the plug-ins //iterate through the plugins bool showlicensedialog = false; //iterate through all plugins, // if they are un-licensed and enabled - show licensing dialog. foreach (PluginEntry pe in UVDLPApp.Instance().m_plugins) { if (pe.m_licensed == false && pe.m_enabled == true) // if we don't have a license, and it's marked enabled { showlicensedialog = true; } int options = pe.m_plugin.GetInt("Options"); if (options != -1 && pe.m_enabled == true) // check to see if this plugin has options { if ((options & PluginOptions.OPTION_TIMED_TRIAL) != 0) // check for timed trial bit { // check for trial version //start trial version if (!CheckTrial(pe)) { //disable the plug-in pe.m_enabled = false; //exit? Application.Exit(); return; } } } } if (showlicensedialog == true) { frmPluginManager pim = new frmPluginManager(); pim.ShowDialog(); } try { #if !DEBUG // no splash screen under debug release frmSplash splash = new frmSplash(); // should pull from a licensed plug-in if need-be splash.Show(); #endif Application.Run(new frmMain2()); } catch (Exception ex) { DebugLogger.Instance().LogError(ex); } }
public static void ExportLog(IEnumerable <SmsLogBussines> list, IWin32Window owner) { try { var sfd = new SaveFileDialog() { Filter = "Excel Files|*.xls" }; if (sfd.ShowDialog(owner) != DialogResult.OK) { return; } var excel = new Microsoft.Office.Interop.Excel.Application(); var wb = excel.Workbooks.Add(XlSheetType.xlWorksheet); var ws = (Worksheet)excel.ActiveSheet; excel.Visible = false; var index = 1; var frm = new frmSplash(list.ToList().Count); frm.Show(owner); //Add column ws.Cells[1, 1] = "تاریخ ارسال"; ws.Cells[1, 2] = "کاربر ارسال کننده"; ws.Cells[1, 3] = "هزینه به ریال"; ws.Cells[1, 4] = "وضعیت"; ws.Cells[1, 5] = "متن ارسال شده"; foreach (var item in list) { index++; frm.Level = index; ws.Cells[index, 1] = item.DateSh; ws.Cells[index, 2] = item.UserName; ws.Cells[index, 3] = item.Cost.ToString("N0"); ws.Cells[index, 4] = item.StatusText; ws.Cells[index, 5] = item.Message; } ws.SaveAs(sfd.FileName, XlFileFormat.xlWorkbookDefault, Type.Missing, Type.Missing, true, false, XlSaveAsAccessMode.xlNoChange, XlSaveConflictResolution.xlLocalSessionChanges, Type.Missing, Type.Missing); excel.Quit(); frm.Close(); } catch (Exception ex) { WebErrorLog.ErrorInstence.StartErrorLog(ex); } }
static void frmLaunch_Load(object sender, EventArgs e) { //close splasheriinooos if (frmSplashScreen == null) { return; } frmSplashScreen.Invoke(new Action(frmSplashScreen.Close)); frmSplashScreen.Dispose(); frmSplashScreen = null; }
static void Main() { Application.EnableVisualStyles(); Application.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture; SetDefaultCulture(System.Globalization.CultureInfo.InvariantCulture); Application.SetCompatibleTextRenderingDefault(false); //init the app object UVDLPApp.Instance().DoAppStartup(); // start the app and load the plug-ins frmSplash splash = new frmSplash(); // should pull from a licensed plug-in if need-be splash.Show(); Application.Run(new frmMain2()); }
static void Main() { Application.EnableVisualStyles(); Application.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture; SetDefaultCulture(System.Globalization.CultureInfo.InvariantCulture); Application.SetCompatibleTextRenderingDefault(false); //init the app object frmSplash splash = new frmSplash(); splash.Show(); UVDLPApp.Instance().DoAppStartup(); Application.Run(new frmMain()); }
static void Main(string[] args) { //SetProcessDPIAware(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); //exception handler Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException); AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); //if the exe was passed a filename argument then run the script if (args.Length > 0) { string filePath = args[0]; if (!File.Exists(filePath)) { using (EventLog eventLog = new EventLog("Application")) { eventLog.Source = "Application"; eventLog.WriteEntry("An attempt was made to run an OpenBots script file from '" + filePath + "' but the file was not found. Please verify that the file exists at the path indicated.", EventLogEntryType.Error, 101, 1); } Application.Exit(); return; } //initialize Logger string engineLoggerFilePath = Path.Combine(Folders.GetFolder(FolderType.LogFolder), "OpenBots Engine Logs.txt"); Logger engineLogger = new Logging().CreateFileLogger(engineLoggerFilePath, Serilog.RollingInterval.Day); Application.Run(new frmScriptEngine(filePath, "", null, engineLogger)); } else { //clean up updater var updaterExecutableDestination = Application.StartupPath + "\\OpenBots.Updater.exe"; if (File.Exists(updaterExecutableDestination)) { File.Delete(updaterExecutableDestination); } SplashForm = new frmSplash(); SplashForm.Show(); Application.DoEvents(); Application.Run(new frmScriptBuilder()); } }
static void Main() { try { frmSplash objfrmSplash = new frmSplash(); objfrmSplash.ShowDialog(); clsGlobal.g_objfrmMDIMain = new frmMDIMain(); Application.Run(clsGlobal.g_objfrmMDIMain); } catch (Exception ex) { MessageBox.Show(ex.Message, "Logic Navigator", MessageBoxButtons.OK, MessageBoxIcon.Stop); } }
public static bool PluginMode; // запускаем ли прогу из DAZ или просто #endregion static ProgramCore() { Nfi = new NumberFormatInfo { NumberDecimalSeparator = "." }; Splash = new frmSplash(); LogFolder = "log"; // determine the name of the folder that will be used for logging logFileName = String.Format("log_{0}.txt", DateTime.Now.ToShortDateString().Replace(".", "_")); // determine log filename. It has prefix "log_" and current date in short format (28.03.2014). tmr.Interval = 40; tmr.Elapsed += tmr_Elapsed; tmr.Start(); }
private DatabaseEngineUtil promptForDatabaseConnectionInfo(frmSplash splash, ref string superUserPassword, ref bool?useWindowsAuthentication) { var f = new frmDatabaseLoginPrompt(); if (DialogResult.OK == f.ShowDialog(splash, null, true, true, false, superUserPassword, useWindowsAuthentication, true, false)) { superUserPassword = f.txtPassword.Text; useWindowsAuthentication = f.UseWindowsAuthentication; return(f.DatabaseEngineUtil); } else { throw new InvalidOperationException(getDisplayMember("promptForDatabaseConnectionInfo", "User cancelled out of database connection dialog")); } }
public static void Close() { if (MySplashThread == null) return; if (MySplashForm == null) return; try { MySplashForm.Invoke(new MethodInvoker(MySplashForm.Close)); } catch (Exception) { } MySplashThread = null; MySplashForm = null; }
private void cmiExport_Click(object sender, EventArgs e) { if (lvDataviews.SelectedItems.Count > 0) { sfdExport.FileName = DateTime.Now.ToString("yyyy_MM_dd_"); if (lvDataviews.SelectedItems.Count == 1) { sfdExport.FileName += lvDataviews.SelectedItems[0].Text; } else { sfdExport.FileName += lvDataviews.SelectedItems.Count; } sfdExport.OverwritePrompt = true; sfdExport.SupportMultiDottedExtensions = true; if (DialogResult.OK == sfdExport.ShowDialog(this)) { var dvs = new List <string>(); var splash = new frmSplash(); foreach (ListViewItem lvi in lvDataviews.SelectedItems) { dvs.Add(lvi.Tag.ToString()); } splash.Show("Exporting " + dvs.Count + " dataview(s)...", false, this); processInBackground( (worker) => { var ds = AdminProxy.ExportDataViewDefinitions(dvs); BinaryFormatter bin = new BinaryFormatter(); using (StreamWriter sw = new StreamWriter(sfdExport.FileName)) { ds.RemotingFormat = SerializationFormat.Binary; bin.Serialize(sw.BaseStream, ds); } }, (worker2, e2) => { splash.ChangeText(getDisplayMember("export{working}", "Still working...")); }, (worker3, e3) => { splash.Close(); MainFormUpdateStatus(getDisplayMember("export{exported}", "Exported {0} dataview(s)", dvs.Count.ToString("###,##0")), true); }); } } }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); frmMap map = new frmMap(); frmSplash splash = new frmSplash(Application.ProductName, Application.ProductVersion, map.Icon); splash.Progress = "Iniciando o sistema"; splash.Show(); splash.Wait(2000); splash.Dispose(); Application.Run(map); }
/// <summary> /// Inicializa el modulo con el Login y el Splash /// </summary> /// <history> /// [erosado] 21/04/2016 Created /// </history> protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); frmSplash frmSplash = new frmSplash(); var frmLogin = new frmLogin(frmSplash, changePassword: true, validatePermission: true, permission: EnumPermission.MailOutsTexts, permissionLevel: EnumPermisionLevel.ReadOnly); frmSplash.Show(); frmSplash.ShowLogin(ref frmLogin); if (frmLogin.IsAuthenticated) { Context.User = frmLogin.UserData; frmMailOutsTexts frmMain = new frmMailOutsTexts(); frmMain.Title = $"{Context.Module} - [{Context.Environment}]"; frmMain.ShowDialog(); frmSplash.Close(); } }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); frmSplash ofrmSplash = new frmSplash(); ofrmSplash.ShowDialog(); frmLogin oFrmLogin = new frmLogin(); oFrmLogin.ShowDialog(); if (Iniciar == true) { Application.Run(new Principal()); } }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.ThreadException += new ThreadExceptionEventHandler(ErrorThread); Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("pt-BR"); Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("pt-BR"); // Leitura de Temas e Paletas BonusSkins.Register(); SkinManager.EnableFormSkins(); var objectoUserSetings = new ObjectoUserSetings(); UserLookAndFeel.Default.SetSkinStyle( objectoUserSetings.DefaultAppSkin, objectoUserSetings.DefaultPalette); WindowsFormsSettings.TouchUIMode = objectoUserSetings.TouchUI == true ? TouchUIMode.True : TouchUIMode.False; WindowsFormsSettings.DefaultFont = objectoUserSetings.DefaultAppFont; WindowsFormsSettings.DefaultPrintFont = objectoUserSetings.DefaultAppFont; var licenceResult = false; // Acessar e verificar a Base de dados using (var frm = new frmSplash(new ILicence())) { frm.Show(); // Licença licenceResult = frm.LecencaOk; Task.Run(async() => { await new BibliotecaContextData(new BiblioteContext()).Seed(); }).Wait(); } if (licenceResult) { Application.Run(new frmLogin(new UserRepository(new BiblioteContext()))); } else { XtraMessageBox.Show("Lamentamos Muito mais o seu Software ainda não foi Registado\nFaçau agora!...\n" , "Licença requerida", MessageBoxButtons.OK, MessageBoxIcon.Warning); Application.Exit(); Application.Run(new frmRegistar(new KeyGenRepository(new BiblioteContext()))); } }
/// <summary> /// Inicializa el modulo con el Login y el Splash /// </summary> protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); frmSplash frmSplash = new frmSplash(); frmLogin frmLogin = new frmLogin(frmSplash, changePassword: true, validatePermission: true, permission: EnumPermission.PRInvitations, permissionLevel: EnumPermisionLevel.Special); frmSplash.Show(); frmSplash.ShowLogin(ref frmLogin); if (frmLogin.IsAuthenticated) { EventManager.RegisterClassHandler(typeof(DataGrid), UIElement.MouseLeftButtonUpEvent, new MouseButtonEventHandler(dataGrid_MouseLeftButtonUp)); Context.User = frmLogin.UserData; frmPRStatistics frmMain = new frmPRStatistics(); frmMain.Title = $"{Context.Module} - [{Context.Environment}]"; frmMain.ShowDialog(); frmSplash.Close(); } }
/// <summary> /// Inicializa el modulo con el Login y el Splash /// </summary> /// <history> /// [erosado] 01/06/2016 Modified. se agrego async /// </history> protected async override void OnStartup(StartupEventArgs e) { base.OnStartup(e); frmSplash frmSplash = new frmSplash(); frmLogin frmLogin = new frmLogin(frmSplash, EnumLoginType.Location, EnumProgram.Inhouse, changePassword: true, autoSign: true, permission: EnumPermission.Register, permissionLevel: EnumPermisionLevel.Standard); await frmLogin.getAllPlaces(); frmSplash.Show(); frmSplash.ShowLogin(ref frmLogin); if (frmLogin.IsAuthenticated) { Context.User = frmLogin.UserData; frmMailOuts frmMain = new frmMailOuts(); frmMain.Title = $"{Context.Module} - [{Context.Environment}]"; frmMain.ShowDialog(); frmSplash.Close(); } }
private void createDatabaseUser(frmSplash splash, DatabaseEngineUtil dbEngineUtil, string superUserPassword, string userName, string userPassword) { try { splash.ChangeText(getDisplayMember("createDatabaseUser{start}", "Creating database users as needed...")); var dnsName = Dns.GetHostName(); if (dbEngineUtil is SqlServerEngineUtil) { var netBIOSName = Toolkit.Cut(dnsName, 0, 15); // SQL Server, Integrated authority -- XP dbEngineUtil.CreateUser(superUserPassword, "gringlobal", "NETWORK SERVICE", netBIOSName, null, false, true); dbEngineUtil.CreateUser(superUserPassword, "gringlobal", "ASPNET", netBIOSName, null, false, true); // SQL Server, Integrated authority -- Vista dbEngineUtil.CreateUser(superUserPassword, "gringlobal", "NETWORK SERVICE", "NT AUTHORITY", null, false, true); dbEngineUtil.CreateUser(superUserPassword, "gringlobal", "SYSTEM", "NT AUTHORITY", null, false, true); // SQL Server, Integrated authority -- Windows 7 dbEngineUtil.CreateUser(superUserPassword, "gringlobal", "DEFAULTAPPPOOL", "IIS AppPool", null, false, true); // SQL Server mixed mode dbEngineUtil.CreateUser(superUserPassword, "gringlobal", userName, netBIOSName, userPassword, false, false); } else if (dbEngineUtil is MySqlEngineUtil) { dbEngineUtil.CreateUser(superUserPassword, "gringlobal", userName, "*", userPassword, false, false); } else if (dbEngineUtil is OracleEngineUtil) { dbEngineUtil.CreateUser(superUserPassword, "gringlobal", userName, null, userPassword, false, false); } else if (dbEngineUtil is PostgreSqlEngineUtil) { dbEngineUtil.CreateUser(superUserPassword, "gringlobal", userName, dnsName, userPassword, false, false); } } catch (Exception exCreateUsers) { //Context.LogMessage("Exception creating users: " + exCreateUsers.Message); //MessageBox.Show("could not create db user: "******"GRIN-Global Search Engine", "Exception creating users: " + exCreateUsers.Message); } }
public static void UninstallExistingMsi(string exeOrMsiFullPath, FileDownloadInfo fdi, Form parentForm, bool silentMode, bool autoLogin, string password, bool useWindowsAuth) { var splash = new frmSplash(); try { var p = new Process(); if (fdi.ProductGuid == Guid.Empty && String.IsNullOrEmpty(fdi.UninstallString)) { // this FileDownloadInfo represents the 'new' installer file, and it was not looked up from the registry. var apps = Utility.ListInstalledApplications(); apps.TryGetValue(fdi.DisplayName, out fdi); // now, fdi represents the currently installed version info, meaning the uninstall info, if any, should be present. } if (fdi.ProductGuid != Guid.Empty) { splash.ChangeText(getDisplayMember("UninstallExistingMsi{start}", "Uninstalling version {0} of {1}, please be patient...", fdi.InstalledVersion, fdi.DisplayName)); //string logFileName = exeOrMsiFullPath + ".uninstall_log"; // "B" format in following line means: // 32 digits separated by hyphens, enclosed in brackets: // {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} //p.StartInfo = new ProcessStartInfo("msiexec.exe", " " + (silentMode ? " /passive " : "") + (autoLogin ? @" AUTOLOGIN=""TRUE"" " : "") + @" USEWINDOWSAUTH=""" + useWindowsAuth.ToString().ToUpper() + @""" PASSWORD=""" + password + @""" /L*v """ + logFileName + @""" /X" + fdi.ProductGuid.ToString("B")); var encPassword = Utility.EncryptText(password); p.StartInfo = new ProcessStartInfo("msiexec.exe", " " + (silentMode ? " /passive " : "") + (autoLogin ? @" AUTOLOGIN=""TRUE"" " : "") + @" USEWINDOWSAUTH=""" + useWindowsAuth.ToString().ToUpper() + @""" PASSWORD=""" + encPassword + @""" /X" + fdi.ProductGuid.ToString("B")); p.Start(); p.WaitForExit(); waitForMsiToFinish(parentForm, "/X" + fdi.ProductGuid.ToString("B")); // waitForMsiToFinish(parentForm, fdi.FileName ?? fdi.ProductGuid.ToString("B")); } else if (!String.IsNullOrEmpty(fdi.UninstallString)) { splash.ChangeText(getDisplayMember("UninstallExistingMsi{start}", "Uninstalling version {0} of {1}, please be patient...", fdi.InstalledVersion, fdi.DisplayName)); p.StartInfo = new ProcessStartInfo("cmd.exe", " /k " + fdi.UninstallString); p.Start(); p.WaitForExit(); } } finally { splash.Close(); } }
/// <summary> /// Inicializa el modulo con el Login y el Splash /// </summary> /// <history> /// [aalcocer] 10/03/2016 Created /// </history> protected override async void OnStartup(StartupEventArgs e) { base.OnStartup(e); frmSplash frmSplash = new frmSplash(); Window frmLS = new frmLS(frmSplash); await((frmLS)frmLS).GetLeadSources(); frmSplash.Show(); frmSplash.ShowLogin(ref frmLS); if (((frmLS)frmLS).IsValidated) { LeadSource leadsource = ((frmLS)frmLS).LeadSource; frmGraph frmMain = new frmGraph(leadsource); frmMain.Title = $"{Context.Module} - [{Context.Environment}]"; frmMain.ShowDialog(); frmSplash.Close(); } }
/// <summary> /// Inicializa el modulo con el Login y el Splash /// </summary> /// [erosado] 23/Mar/2016 Created /// </history> protected async override void OnStartup(StartupEventArgs e) { base.OnStartup(e); frmSplash frmSplash = new frmSplash(); frmLogin frmLogin = new frmLogin(frmSplash, EnumLoginType.SalesRoom, changePassword: true, autoSign: true); await frmLogin.getAllPlaces(); frmSplash.Show(); frmSplash.ShowLogin(ref frmLogin); if (frmLogin.IsAuthenticated) { EventManager.RegisterClassHandler(typeof(DataGrid), UIElement.MouseLeftButtonUpEvent, new MouseButtonEventHandler(dataGrid_MouseLeftButtonUp)); Context.User = frmLogin.UserData; frmSalesCloser frmMain = new frmSalesCloser(); frmMain.Title = $"{Context.Module} - [{Context.Environment}]"; frmMain.ShowDialog(); frmSplash.Close(); } }
/// <summary> /// Inicializa el modulo con el Login y el Splash /// </summary> /// <history> /// [erosado] 01/06/2016 Modified. se agrego async /// </history> protected override async void OnStartup(StartupEventArgs e) { base.OnStartup(e); frmSplash frmSplash = new frmSplash(); frmLogin frmLogin = new frmLogin(frmSplash, EnumLoginType.Warehouse, validatePermission: true, permission: EnumPermission.GiftsReceipts, permissionLevel: EnumPermisionLevel.Standard, changePassword: true); await frmLogin.getAllPlaces(); frmSplash.Show(); frmSplash.ShowLogin(ref frmLogin); if (!frmLogin.IsAuthenticated) { return; } Context.User = frmLogin.UserData; frmInventoryMovements frmMain = new frmInventoryMovements(); frmMain.Title = $"{Context.Module} - [{Context.Environment}]"; frmMain.ShowDialog(); frmSplash.Close(); }
//Analza un mail recibido public void AnalizaMail(Outlook.MailItem mail) { int pos; string elSubject = mail.Subject.ToString(); string[] elBody; //Sincronización if ((pos = Strings.InStr(mail.Subject.ToString(), "Sincronizar:")) > 0) { //Por ahora no hago nada pues el handler del Evento lo copia para la carpeta MailEprende de todos modos... //Si la sincronización es manual no se necesita hacer nada aquí para sincronizar. 19-09-2013 } //Direcciones erróneas if ((pos = Strings.InStr(mail.Subject.ToString(), "Direcciones Erroneas")) > 0) { try { elBody = mail.Body.ToString().Trim().Split('|'); DateTime fecha = mail.ReceivedTime; correosDataSetTableAdapters.bad_mailTableAdapter taBadMail = new correosDataSetTableAdapters.bad_mailTableAdapter(); correosDataSetTableAdapters.usuariosTableAdapter taUsers = new correosDataSetTableAdapters.usuariosTableAdapter(); correosDataSetTableAdapters.accesoTableAdapter taAccess = new correosDataSetTableAdapters.accesoTableAdapter(); int NumBad = Convert.ToInt32(elBody[0]); int NumBorraBad = 0; string elBodyBad = ""; string elBodyBadAccess = ""; string unaDir = ""; string unaDir1 = ""; string unaDir2 = ""; //Consulto si está activo el borrado automático en los settings... Properties.Settings setting = new Properties.Settings(); //Creo variable para acceder a Settings y leer EmailAdmiin //Declaro borrado y preparo el correo para borrar arriba si está establecido el Check de borrado automático for (int i = 0; i < NumBad; i++) { //Tomo la dirección i-esima unaDir = elBody[i + 1]; //Para chequear los usuarios //La arreglo si está en una tupla de direcciones 01-10-2013 tanto de usuarios como de Accesos 08-05-2014 unaDir1 = (taUsers.GetCorreoLikeUnAddress(unaDir).Count > 0)? taUsers.GetCorreoLikeUnAddress(unaDir)[0].correo.ToString() : ""; unaDir2 = (taAccess.GetAccesoSegunCorreo(unaDir).Count > 0)? taAccess.GetAccesoSegunCorreo(unaDir)[0].correo.ToString():""; if (unaDir1 != "" || unaDir2 != "") //Si encontró una dirección { if ((bool)setting["Borrado_Auto_BadMail"])//Si está seteado borrar automático las dir erroneas { //Preparo para mandar a borrar direcciones y declaro borrado en USUARIO if (unaDir1 != "") //Si encontró una dirección en usuarios { taUsers.UpdateEstadoSegunCorreo("Borrado. Dirección rebotada", unaDir); NumBorraBad++; elBodyBad += unaDir + "|"; } //Preparo para mandar a borrar direcciones y declaro borrado en ACCESOS if (unaDir2 != "") //Si encontró una dirección en usuarios { setting = new Properties.Settings(); //Creo variable para acceder a Settings y leer EmailAdmiin string EmailDir = setting["Email_Admin"].ToString(); string EmailSubject = "eliminar-accesos"; taAccess.UpdateEstadoSegunCorreo("Borrado. Dirección rebotada", unaDir); elBodyBadAccess = taAccess.GetAccesoSegunCorreo(unaDir)[0].id_acceso.ToString() + "|"; Globals.ThisAddIn.SendEmailAddressSubjectBody(EmailDir, EmailSubject, elBodyBadAccess); //Si hay más de un acceso con la misma dir de Email se borra solo uno, el otro será en el próximo rebote } } //Escribo en la tabla bad_mail para que sea aconsultada cuando se quiera //Desde aquí se podrá mandar a borrar si se quiere. 07-04-2014 if (taBadMail.GetByCorreo(unaDir).Count == 0) //Si no está ya el correo { //inserto en la tabla bad_mail si el mail está en la tabla USERS if (taUsers.GetDataByUnCorreo(unaDir1).Count > 0 ) { taBadMail.Insert(unaDir, taUsers.GetDataByUnCorreo(unaDir)[0].nombre.ToString(), taUsers.GetDataByUnCorreo(unaDir)[0].apellido1.ToString(), fecha, 1); } //inserto en la tabla bad_mail si el mail está en la tabla ACCESOS if (taAccess.GetAccesoSegunCorreo(unaDir2).Count > 0) { try { taBadMail.Insert(unaDir, taAccess.GetAccesoSegunCorreo(unaDir)[0].nombre.ToString(), taAccess.GetAccesoSegunCorreo(unaDir)[0].apellido1.ToString(), fecha, 1); } catch { //Se captura la excepción de insersión duplicada de registro //Pero no se hace nada con ello, no es necesario } } } else //Si ya está en la tabla BadMail { taBadMail.UpdateNumRebotesSegunCorreo(Convert.ToInt32(taBadMail.GetByCorreo(unaDir)[0]["numrebotes"]) + 1, unaDir); //Sumo uno al número de rebotes taBadMail.UpdateFechaSegunCorreo(fecha, unaDir); //Actualizo la fecha del último rebote } }//Si consiguio la dirección de tupla o simple OK } //For que recorre los NumBad //El Correo if (NumBorraBad > 0 && (bool)setting["Borrado_Auto_BadMail"]) //Si encontré qué borrar y si está activo el borrado automático { setting = new Properties.Settings(); //Creo variable para acceder a Settings y leer EmailAdmiin string EmailDir = setting["Email_Admin"].ToString(); //Preparo y envío string EmailSubject = "eliminar-usuario"; string BodyBorrar = NumBorraBad.ToString() + "|" + elBodyBad; Globals.ThisAddIn.SendEmailAddressSubjectBody(EmailDir, EmailSubject, BodyBorrar); } /* La actual rutina de borrar accesos es borra uno a uno, así que los Emails se generan arriba if (NumBorraBadAccess > 0 && (bool)setting["Borrado_Auto_BadMail"]) //Si encontré qué borrar y si está activo el borrado automático*/ } catch (Exception ex) { if (Strings.InStr(Problemas, "satisfactoria") > 0) Problemas = ""; Problemas += elSubject + ": " + mail.Body.ToString() + ". Registró: " + "\n" + ex.Message.ToString(); } } //Respuesta de comandos if ((pos = Strings.InStr(mail.Subject.ToString(), "Correcto")) > 0) { elSubject = mail.Subject.ToString().Split(' ')[1].Trim(); switch (elSubject) { //Limpiar el Estado en Accesos y Centros porque fue correcta la reconstrucción case "rehacer-bd": try { //Preparo variables de acceso a los TableAdapters correosDataSetTableAdapters.centroTableAdapter taCentrosCl = new correosDataSetTableAdapters.centroTableAdapter(); correosDataSetTableAdapters.accesoTableAdapter taAccesoCl = new correosDataSetTableAdapters.accesoTableAdapter(); correosDataSetTableAdapters.usuariosTableAdapter taUsuarios = new correosDataSetTableAdapters.usuariosTableAdapter(); correosDataSetTableAdapters.listaTableAdapter taListas = new correosDataSetTableAdapters.listaTableAdapter(); correosDataSetTableAdapters.usuario_listaTableAdapter taUsuarioListas = new correosDataSetTableAdapters.usuario_listaTableAdapter(); int ra = Strings.InStr(taCentrosCl.GetData()[0].estado.ToString(), "Rehacer"); if (ra > 0) //Si esta es la BD que mandó a Reahacer { taAccesoCl.LimpiarEstados(); taCentrosCl.LimpiarEstados(); } else //Si no estoy en la BD que mandó a Rehacer, entonces a serruchar { //Preparo separadores y variables numéricas string[] separators = new string[5]; int NumCentros, NumListas, NumAccesos, NumUsuarios, NumUsuarios_listas; string[] BodyCentros, BodyListas, BodyAccesos, BodyUsuarios, BodyUsuarios_listas; separators[0] = "Centros:"; separators[1] = "Listas:"; separators[2] = "Accesos:"; separators[3] = "Usuarios:"; separators[4] = "Usuarios_listas:"; //Obtengo los trozos del Body del mensaje que tienen los comando de creación elBody = mail.Body.ToString().Split(separators, StringSplitOptions.RemoveEmptyEntries); BodyCentros = elBody[0].Split('|'); BodyListas = elBody[1].Split('|'); BodyAccesos = elBody[2].Split('|'); BodyUsuarios = elBody[3].Split('|'); BodyUsuarios_listas = elBody[4].Split('|'); NumCentros = Convert.ToInt32(BodyCentros[0]); NumListas = Convert.ToInt32(BodyListas[0]); NumAccesos = Convert.ToInt32(BodyAccesos[0]); NumUsuarios = Convert.ToInt32(BodyUsuarios[0]); NumUsuarios_listas = Convert.ToInt32(BodyUsuarios_listas[0]); //Elimino las tablas Usuarios y Centros, con esto limpio todo taAccesoCl.DeleteAll(); taCentrosCl.DeleteAll(); taUsuarios.DeleteAll(); //Muestro el Splash (Nueva Instancia) OutlookAddInEmprende.frmSplash theSplashR = new frmSplash(); theSplashR.pbProgress.Step = 1; theSplashR.pbProgress.Value = 1; theSplashR.pbProgress.Maximum = NumAccesos+NumCentros+NumListas+NumUsuarios+NumUsuarios_listas; theSplashR.etAccion.Text = "Reconstruyendo la Base de Datos Local..."; theSplashR.pbProgress.ForeColor = System.Drawing.Color.Brown; theSplashR.Show(); System.Windows.Forms.Application.DoEvents(); //Ejecuto comandos de creación uno por uno //*************************************************** //Crear Centros: id centro|nombre del centro|correo| for (int i = 0; i < NumCentros; i++) { taCentrosCl.InsertUnCentro(Convert.ToInt32(Strings.Replace(BodyCentros[3 * i + 1], " ", "")), Strings.Replace(BodyCentros[3 * i + 2], " ", ""), Strings.Replace(BodyCentros[3 * i + 3], " ", ""), ""); theSplashR.pbProgress.PerformStep(); System.Windows.Forms.Application.DoEvents(); } //Crear Listas: id lista|nombre de la lista|ID del centro| for (int i = 0; i < NumListas; i++) { taListas.Insert(Convert.ToInt32(Strings.Replace(BodyListas[3 * i + 1], " ", "")), Strings.Replace(BodyListas[3 * i + 2], " ", ""), Convert.ToInt32(Strings.Replace(BodyListas[3 * i + 3], " ", "")), ""); theSplashR.pbProgress.PerformStep(); System.Windows.Forms.Application.DoEvents(); } //Crear Accesos: id acceso|correo|clave|nombre|1er apellido|2do apellido|id de la lista|id de tipo de usuario| for (int i = 0; i < NumAccesos; i++) { taAccesoCl.InsertUnAcceso(Convert.ToInt32(Strings.Replace(BodyAccesos[8 * i + 1], " ", "")), Strings.Replace(BodyAccesos[8 * i + 2], " ", ""), Strings.Replace(BodyAccesos[8 * i + 3], " ", ""), BodyAccesos[8 * i + 4], BodyAccesos[8 * i + 5], BodyAccesos[8 * i + 6], Convert.ToInt32(Strings.Replace(BodyAccesos[8 * i + 7], " ", "")), Convert.ToInt32(Strings.Replace(BodyAccesos[8 * i + 8], " ", "")), ""); theSplashR.pbProgress.PerformStep(); System.Windows.Forms.Application.DoEvents(); } //Crear Usuarios for (int i = 0; i < NumUsuarios; i++) { taUsuarios.InsertUnUsuario(Strings.Replace(BodyUsuarios[4 * i + 1]," ",""), BodyUsuarios[4 * i + 2], BodyUsuarios[4 * i + 3], BodyUsuarios[4 * i + 4], ""); theSplashR.pbProgress.PerformStep(); System.Windows.Forms.Application.DoEvents(); } //Crear Usuario-Lista for (int i = 0; i < NumUsuarios_listas ; i++) { try { taUsuarioListas.InsertUsuario_Lista(Convert.ToInt32(Strings.Replace(BodyUsuarios_listas[2 * i + 2]," ","")), Strings.Replace(BodyUsuarios_listas[2 * i + 1]," ",""), ""); theSplashR.pbProgress.PerformStep(); System.Windows.Forms.Application.DoEvents(); } catch { //Evita que explote por un error de no coinsidencia de clave, no se hace nada //Los usuarios quedarían entonces "sueltos" } } theSplashR.Close(); } } catch (Exception ex) { if (Strings.InStr(Problemas, "satisfactoria") > 0) Problemas = ""; Problemas += elSubject + ": " + ". Registró: " + "\n" + ex.Message.ToString(); } break; case "crear-accesos": case "editar-accesos": //id acceso|correo|clave|nombre|1er apellido|2do apellido|id de la lista|id de tipo de usuario| ** try { elBody = mail.Body.ToString().Trim().Split('|'); correosDataSetTableAdapters.accesoTableAdapter taAcceso = new correosDataSetTableAdapters.accesoTableAdapter(); if (taAcceso.GetAccesoSegunCorreo(elBody[1]).Count > 0) //Si ya está lo actualizo { taAcceso.UpdateUnAcceso(elBody[1],elBody[2],elBody[3],elBody[4],elBody[5],Convert.ToInt32(elBody[6]), Convert.ToInt32(elBody[7]),"",elBody[1]); } else //Si no lo inserto { taAcceso.InsertUnAcceso(Convert.ToInt32(elBody[0]), elBody[1], elBody[2], elBody[3], elBody[4], elBody[5], Convert.ToInt32(elBody[6]), Convert.ToInt32(elBody[7]), ""); } } catch (Exception ex) { if (Strings.InStr(Problemas, "satisfactoria") > 0) Problemas = ""; Problemas += elSubject + ": " + mail.Body.ToString() + ". Registró: " + "\n" + ex.Message.ToString(); } break; case "eliminar-accesos": //Cuerpo: id acceso| ** try { elBody = mail.Body.ToString().Trim().Split('|'); correosDataSetTableAdapters.accesoTableAdapter taAcceso = new correosDataSetTableAdapters.accesoTableAdapter(); taAcceso.DeleteUnAccesoByID(Convert.ToInt32(elBody[0])); } catch (Exception ex) { if (Strings.InStr(Problemas, "satisfactoria") > 0) Problemas = ""; Problemas += elSubject + ": " + mail.Body.ToString() + ". Registró: " + "\n" + ex.Message.ToString(); } break; case "enviar-correo": string[] sep = new string[1]; sep[0] = "ID:"; //Extraigo el ID y si no está lo escribo en la tabla string consec = mail.Subject.ToString().Split( sep ,StringSplitOptions.RemoveEmptyEntries)[1].Trim(); correosDataSetTableAdapters.consecutivoTableAdapter taConsecutivo = new correosDataSetTableAdapters.consecutivoTableAdapter(); if (taConsecutivo.CuantosHay(consec) == 0) { taConsecutivo.InserUnConsecutivo(consec); } break; case "crear-centro": case "editar-centro": //cuerpo: id centro|nombre del centro|correo| ** try { elBody = mail.Body.ToString().Trim().Split('|'); correosDataSetTableAdapters.centroTableAdapter taCentros = new correosDataSetTableAdapters.centroTableAdapter(); if (taCentros.GetCentroBySoloID(Convert.ToInt32(elBody[0])).Count > 0) //si ya está el centro { correosDataSetTableAdapters.centroTableAdapter taCentro = new correosDataSetTableAdapters.centroTableAdapter(); taCentro.SetUnCentro(elBody[1], "", elBody[2], Convert.ToInt32(elBody[0])); } else //si no esta el centro { taCentros.InsertUnCentro(Convert.ToInt32(elBody[0]), elBody[1], elBody[2], ""); } } catch (Exception ex) { if (Strings.InStr(Problemas, "satisfactoria") > 0) Problemas = ""; Problemas += elSubject + ": " + mail.Body.ToString() + ". Registró: " + "\n" + ex.Message.ToString(); } break; case "eliminar-centro": //cuerpo: ID del centro|** try { elBody = mail.Body.ToString().Trim().Split('|'); correosDataSetTableAdapters.centroTableAdapter taCentro = new correosDataSetTableAdapters.centroTableAdapter(); taCentro.DeleteUnCentro(Convert.ToInt32(elBody[0])); } catch (Exception ex) { if (Strings.InStr(Problemas, "satisfactoria") > 0) Problemas = ""; Problemas += elSubject + ": " + mail.Body.ToString() + ". Registró: " + "\n" + ex.Message.ToString(); } break; case "crear-lista": case "editar-lista": //cuerpo: id lista|nombre de la lista|ID del centro| ** try { elBody = mail.Body.ToString().Trim().Split('|'); correosDataSetTableAdapters.listaTableAdapter taLista = new correosDataSetTableAdapters.listaTableAdapter(); if (taLista.GetListaByID(Convert.ToInt32(elBody[0])).Count > 0) //Si está la lista { taLista.UpdateUnaLista(elBody[1], "", Convert.ToInt32(elBody[0])); } else //Si no está la lista { taLista.Insert(Convert.ToInt32(elBody[0]), elBody[1], Convert.ToInt32(elBody[2]),""); } } catch (Exception ex) { if (Strings.InStr(Problemas, "satisfactoria") > 0) Problemas = ""; Problemas += elSubject + ": " + mail.Body.ToString() + ". Registró: " + "\n" + ex.Message.ToString(); } break; case "eliminar-lista": //Cuerpo: Id lista| ** try { elBody = mail.Body.ToString().Trim().Split('|'); correosDataSetTableAdapters.listaTableAdapter taLista = new correosDataSetTableAdapters.listaTableAdapter(); taLista.DeleteUnaLista(Convert.ToInt32(elBody[0])); } catch (Exception ex) { if (Strings.InStr(Problemas, "satisfactoria") > 0) Problemas = ""; Problemas += elSubject + ": " + mail.Body.ToString() + ". Registró: " + "\n" + ex.Message.ToString(); } break; case "crear-usuario": //cant_usuarios|correo|nombre|1er apellido|2do apellido| ** //ejem: 2|[email protected]|mario|gles|mtinez|[email protected]|jose|ramirez|prieto| try { string elCorreo = ""; elBody = mail.Body.ToString().Trim().Split('|'); taUsuarios = new correosDataSetTableAdapters.usuariosTableAdapter(); int Num = Convert.ToInt32(elBody[0]); for (int i = 0; i<Num; i++) { elCorreo = elBody[4*i + 1]; if (taUsuarios.GetDataByUnCorreo(elCorreo).Count > 0) //Si está el correo { taUsuarios.UpdateEstadoSegunCorreo("", elCorreo); //Reseteo su estado } else //Si no está lo inserto { taUsuarios.InsertUnUsuario(elCorreo, elBody[4 * i + 2], elBody[4 * i + 3], elBody[4 * i + 4], ""); } } } catch (Exception ex) { if (Strings.InStr(Problemas, "satisfactoria") > 0) Problemas = ""; Problemas += elSubject + ": " + mail.Body.ToString() + ". Registró: " + "\n" + ex.Message.ToString(); } break; case "editar-usuario": //correo_old|correo_new|nombre|1er apellido|2do apellido| ** try { elBody = mail.Body.ToString().Trim().Split('|'); taUsuarios = new correosDataSetTableAdapters.usuariosTableAdapter(); if (taUsuarios.GetDataByUnCorreo(elBody[1]).Count > 0) //Si el correo nuevo está { taUsuarios.UpdateUsuarioSegunCorreo(elBody[2],elBody[3],elBody[4],"",elBody[1]); //Actualizo todo menos el correo } //Si el correo viejo es el que está, y no está el nuevo, actualizo cambiando el correo. if (taUsuarios.GetDataByUnCorreo(elBody[0]).Count > 0 && taUsuarios.GetDataByUnCorreo(elBody[1]).Count ==0) { taUsuarios.UpdateUsuarioSegunCorreoIncCorreo(elBody[1],elBody[2], elBody[3], elBody[4], "", elBody[0]); //Actualizo todo } } catch (Exception ex) { if (Strings.InStr(Problemas, "satisfactoria") > 0) Problemas = ""; Problemas += elSubject + ": " + mail.Body.ToString() + ". Registró: " + "\n" + ex.Message.ToString(); } break; case "editar-usuario-listas": //cuerpo: cant_listas|correo_old|correo_new|nombre|1er apellido|2do apellido|id_lista|id_lista| --** //ejem: 2|[email protected]|[email protected]|Pedro|Pérez|García|7|8| try { elBody = mail.Body.ToString().Trim().Split('|'); taUsuarios = new correosDataSetTableAdapters.usuariosTableAdapter(); correosDataSetTableAdapters.usuario_listaTableAdapter taUsuarioLista = new correosDataSetTableAdapters.usuario_listaTableAdapter(); if(taUsuarios.GetDataByUnCorreo(elBody[1]).Count > 0) //Si el correo_old estaba, lo borro { taUsuarios.DeleteSegunCorreo(elBody[1]); //Borro el correoOld no importa si no está } if (taUsuarios.GetDataByUnCorreo(elBody[2]).Count > 0) //Si ya esta creado el correo_new { taUsuarios.UpdateUsuarioSegunCorreo(elBody[3],elBody[4],elBody[5],"", elBody[2]); //Actualizo los parámetros del usuaro //Ahora actualizo Usuario Lista, actualizando el Estado en este caso int Num = Convert.ToInt32(elBody[0]); //Tomo el número de listas for (int i = 0; i < Num; i++) { if (taUsuarioLista.GetDataByListaYMail(Convert.ToInt32(elBody[i + 6]),elBody[2]).Count > 0 ) //Si el usuario-lista ya está creado { taUsuarioLista.UpdateEstadoSegunIDListaYCorreo("", Convert.ToInt32(elBody[i + 6]), elBody[2]); } else //si el usuario-lista no estaba, lo creo en estado sincronizado { taUsuarioLista.InsertUsuario_Lista(Convert.ToInt32(elBody[i + 6]), elBody[2], ""); } } } else //si no estaba creado el correo_new { taUsuarios.InsertUnUsuario(elBody[2], elBody[3], elBody[4], elBody[5], ""); //Ahora actualizo Usuario Lista, creando en este caso int Num = Convert.ToInt32(elBody[0]); //Tomo el número de listas for (int i = 0; i < Num; i++) { taUsuarioLista.InsertUsuario_Lista(Convert.ToInt32(elBody[i + 6]), elBody[2],""); } } } catch (Exception ex) { if (Strings.InStr(Problemas, "satisfactoria") > 0) Problemas = ""; Problemas += elSubject + ": " + mail.Body.ToString() + ". Registró: " + "\n" + ex.Message.ToString(); } break; case "eliminar-usuario": //Cuerpo: cant_usuarios|correo| y tantos usuarios como cant_usuarios de forma seguida ** //ejem: 2|[email protected]|[email protected]| try { elBody = mail.Body.ToString().Trim().Split('|'); taUsuarios = new correosDataSetTableAdapters.usuariosTableAdapter(); for(int i = 0; i < Convert.ToInt32(elBody[0]); i++) { taUsuarios.DeleteSegunCorreo(elBody[i+1]); } } catch (Exception ex) { if (Strings.InStr(Problemas, "satisfactoria") > 0) Problemas = ""; Problemas += elSubject + ": " + mail.Body.ToString() + ". Registró: " + "\n" + ex.Message.ToString(); } break; case "crear-usuario-lista": //Cuerpo: cant_usuarios|correo|id de la lista| y tantos usuarios como cant_usuarios de forma seguida ** //Implica que los usuarios ya están creados en la BD, sólo se asocian con listas //ejem: 2|[email protected]|1|[email protected]|1| try { elBody = mail.Body.ToString().Trim().Split('|'); correosDataSetTableAdapters.usuario_listaTableAdapter taUsuariosLista = new correosDataSetTableAdapters.usuario_listaTableAdapter(); for (int i = 0; i < Convert.ToInt32(elBody[0]); i++) { if (taUsuariosLista.GetDataByListaYMail(Convert.ToInt32(elBody[2 * i + 2]),elBody[2 * i + 1]).Count > 0) //Si está el usuario lista actualizo el estado { taUsuariosLista.UpdateEstadoSegunIDListaYCorreo("", Convert.ToInt32(elBody[2 * i + 2]), elBody[2 * i + 1]); } else //Si no está lo creo { taUsuariosLista.InsertUsuario_Lista(Convert.ToInt32(elBody[2 * i + 2]), elBody[2 * i + 1], ""); } } } catch (Exception ex) { if (Strings.InStr(Problemas, "satisfactoria") > 0) Problemas = ""; Problemas += elSubject + ": " + mail.Body.ToString() + ". Registró: " + "\n" + ex.Message.ToString(); } break; case "crear-usuario-usuario-lista": //cuerpo: cant_usuarios|correo|nombre|apellido1|apellido2|id lista| y tantos usuarios como cant_usuarios de forma seguida ** //ejem: 2|[email protected]|mario|gles|mtinez|2|[email protected]|jose|ramirez|prieto|1| try { elBody = mail.Body.ToString().Trim().Split('|'); taUsuarios = new correosDataSetTableAdapters.usuariosTableAdapter(); correosDataSetTableAdapters.usuario_listaTableAdapter taUsuariosLista = new correosDataSetTableAdapters.usuario_listaTableAdapter(); for (int i = 0; i < Convert.ToInt32(elBody[0]); i++) { //El usuario if (taUsuarios.GetDataByUnCorreo(elBody[5 * i + 1]).Count > 0) //si está el usuario actualizo el estado { taUsuarios.UpdateEstadoSegunCorreo("", elBody[5 * i + 1]); } else //No está, lo creo { taUsuarios.InsertUnUsuario(elBody[5 * i + 1], elBody[5 * i + 2], elBody[5 * i + 3], elBody[5 * i + 4], ""); } //El usuario-lista if (taUsuariosLista.GetDataByListaYMail(Convert.ToInt32(elBody[5 * i + 5]), elBody[5 * i + 1]).Count > 0) //si está el usuario-lista, actualizo el estado { taUsuariosLista.UpdateEstadoSegunIDListaYCorreo("", Convert.ToInt32(elBody[5 * i + 5]), elBody[5 * i + 1]); } else //Si no está lo creo { taUsuariosLista.InsertUsuario_Lista(Convert.ToInt32(elBody[5 * i + 5]), elBody[5 * i + 1], ""); } } //For que recorre la lista de comandos del body } catch (Exception ex) { if (Strings.InStr(Problemas, "satisfactoria") > 0) Problemas = ""; Problemas += elSubject + ": " + mail.Body.ToString() + ". Registró: " + "\n" + ex.Message.ToString(); } break; case "eliminar-usuario-lista": //Cuerpo: cant_usuarios|correo|id de la lista| y tantos usuarios como cant_usuarios de forma seguida ** //ejem: 2|[email protected]|1|[email protected]|1| try { elBody = mail.Body.ToString().Trim().Split('|'); correosDataSetTableAdapters.usuario_listaTableAdapter taUsuariosLista = new correosDataSetTableAdapters.usuario_listaTableAdapter(); for (int i = 0; i < Convert.ToInt32(elBody[0]); i++) { taUsuariosLista.DeleteUnUsuarioLista(Convert.ToInt32(elBody[2 * i + 2]), elBody[2 * i + 1]); } } catch (Exception ex) { if (Strings.InStr(Problemas, "satisfactoria") > 0) Problemas = ""; Problemas += elSubject + ": " + mail.Body.ToString() + ". Registró: " + "\n" + ex.Message.ToString(); } break; case "mover-usuario-lista": //Cuerpo: cant_usuarios|correo|id de la lista vieja|id lista nueva| y tantos usuarios como cant_usuarios de forma seguida //ejem: 2|[email protected]|1|3|[email protected]|1|4| try { elBody = mail.Body.ToString().Trim().Split('|'); correosDataSetTableAdapters.usuario_listaTableAdapter taUsuariosLista = new correosDataSetTableAdapters.usuario_listaTableAdapter(); for (int i = 0; i < Convert.ToInt32(elBody[0]); i++) { if (taUsuariosLista.EstaEnLista(Convert.ToInt32(elBody[3 * i + 3]), elBody[3 * i + 1]) == 0) { taUsuariosLista.MuevePertenenciaALista(Convert.ToInt32(elBody[3 * i + 3]), "", Convert.ToInt32(elBody[3 * i + 2]), elBody[3 * i + 1]); } else { //Si ya estaba en la otra lista reseteo el estado taUsuariosLista.UpdateEstadoSegunIDListaYCorreo("", Convert.ToInt32(elBody[3 * i + 3]), elBody[3 * i + 1]); } } } catch (Exception ex) { if (Strings.InStr(Problemas, "satisfactoria") > 0) Problemas = ""; Problemas += elSubject + ": " + mail.Body.ToString() + ". Registró: " + "\n" + ex.Message.ToString(); } break; }//Switch elSubjec } }
public Form1(string[] args) { frmSplash splash = new frmSplash(); splash.Show(); System.Windows.Forms.Application.DoEvents(); InitializeComponent(); addWizTuneFilePacks(); // Only have this enabled in debug mode until ready this.barButtonItem29.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; try { RegistryKey TempKeyCM = null; TempKeyCM = Registry.ClassesRoot.CreateSubKey(@"SystemFileAssociations\.bin\shell\Edit in T8 Suite\command"); string StartKey = System.Windows.Forms.Application.ExecutablePath + " \"%1\""; TempKeyCM.SetValue("", StartKey); TempKeyCM.Close(); } catch (Exception E) { logger.Debug(E.Message); } try { RegistryKey TempKeyCM = null; TempKeyCM = Registry.ClassesRoot.CreateSubKey(@"SystemFileAssociations\.bin\shell\Auto detect Trionic file type\command"); string StartKey = System.Windows.Forms.Application.StartupPath + "\\SuiteLauncher.exe" + " \"%1\""; TempKeyCM.SetValue("", StartKey); TempKeyCM.Close(); } catch (Exception E) { logger.Debug(E.Message); } if (args.Length > 0) { if (args[0].ToString().ToUpper().EndsWith(".BIN")) { if (File.Exists(args[0].ToString())) { m_startFromCommandLine = true; m_commandLineFile = args[0].ToString(); } } } try { m_DelegateStartReleaseNotePanel = new DelegateStartReleaseNotePanel(this.StartReleaseNotesViewer); m_DelegateUpdateRealTimeValue = new DelegateUpdateRealTimeValue(this.UpdateRealtimeInformationValue); } catch (Exception E) { logger.Debug(E.Message); } try { sndplayer = new System.Media.SoundPlayer(); t8can.onReadProgress += new ITrionic.ReadProgress(t8can_onReadProgress); t8can.onWriteProgress += new ITrionic.WriteProgress(t8can_onWriteProgress); t8can.onCanInfo += new ITrionic.CanInfo(t8can_onCanInfo); } catch (Exception E) { logger.Debug(E.Message); } splash.Close(); }
public void BuscaMailsDeComandos(int dias) { try { Cursor MyCursor = Cursors.WaitCursor; FindComand = false; Outlook.MailItem mail; //Ahí pongo cada Mail Outlook.NameSpace outlookNameSpace = this.Application.GetNamespace("MAPI"); Outlook.MAPIFolder inbox = outlookNameSpace.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderInbox); Outlook.Items items = inbox.Items.Restrict("[Unread]=true"); DateTime hacedias = DateTime.Today - new TimeSpan(dias, 0, 0, 0); //Fecha de hace "dias" días //Muestro el splash OutlookAddInEmprende.frmSplash theSplash = new frmSplash(); theSplash.Show(); theSplash.pbProgress.Step = 1; theSplash.pbProgress.Value = 1; theSplash.pbProgress.Maximum = items.Count; System.Windows.Forms.Application.DoEvents(); //Obtengo la dirección de Email del buzón de comandos Properties.Settings setting = new Properties.Settings(); //Creo variable para acceder a Settings y leer EmailAdmiin string EmailDir = setting["Email_Admin"].ToString(); ////Reviso los Unread de la carpeta MailEmprende, y los analizo foreach (Object m in items) { theSplash.pbProgress.PerformStep(); if ((mail = m as Outlook.MailItem) != null) //si el item es un mail { if (mail.MessageClass == "IPM.Note" && mail.SenderEmailAddress.ToUpper().Contains(EmailDir.ToUpper()) && mail.ReceivedTime > hacedias) { FindComand = true; AnalizaMail(mail); mail.UnRead = false; mail.Move(inbox.Folders["MailEmprende"]); } } } if (FindComand) //Si encontré algo { /* Fue comentada porque ya no tiene sentido al hacerse más robusta la rutina precedente * //09-04-2014 //Muevo los mails encontrados repito la rutina para que no quede nada foreach (Object m in items) { if ((mail = m as Outlook.MailItem) != null) //si el item es un mail { if (mail.MessageClass == "IPM.Note" && mail.SenderEmailAddress.ToUpper().Contains(EmailDir.ToUpper()) && mail.ReceivedTime > hacedias) { mail.Move(inbox.Folders["MailEmprende"]); } } }*/ //Pongo cartel de resultados MessageBox.Show(Problemas, "¡Resultados!", MessageBoxButtons.OK); Problemas = "Ejecución satisfactoria " + "\n" + "de comandos MailEmprende " + "\n" + "recibidos de la Web."; //Limpio la varible que guardaba los mensajes de error. } MyCursor = Cursors.Default; theSplash.Close(); //Cierro el splash } catch (Exception ex) { Cursor MyCursor = Cursors.Default; MessageBox.Show(ex.Message + " Se intentaba revisar los mensajes recibidos", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void DoSplash() { frmSplash sp = new frmSplash(); sp.ShowDialog(); }
public static void showSplash() { frmSplash splashForm = new frmSplash(); splashForm.ShowDialog(); }
static void ShowThread() { MySplashForm = new frmSplash(); Application.Run(MySplashForm); }