Ejemplo n.º 1
0
 /// <summary>
 /// Method to initialize the AOP Container of application
 /// </summary>
 public static void InitializeAopContainer()
 {
     AccuIT.CommonLayer.AopContainer.AopEngine.Initialize();
     InitializeLibrary();
     AopEngine.Container.RegisterType <IMapper, Mapper>(new InjectionMember[] { });
     MapEntities();
     InitializeTransactionInterceptor();
     ExceptionEngine.InitializeExceptionAopFramework();
 }
 /// <summary>
 /// Occurs when the Explore Current Users Path menu item is clicked
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void OnExploreCurrentUsersPathClicked(object sender, EventArgs e)
 {
     if (Directory.Exists(SnapInHostingEngine.LocalUserDataPath))
     {
         System.Diagnostics.Process p = new System.Diagnostics.Process();
         p.StartInfo.UseShellExecute = true;
         p.StartInfo.Verb            = "EXPLORE";
         p.StartInfo.FileName        = SnapInHostingEngine.LocalUserDataPath;
         p.Start();
     }
     else
     {
         ExceptionEngine.DisplayException(this, "Directory does not exist", MessageBoxIcon.Information, MessageBoxButtons.OK, null, "The path '" + SnapInHostingEngine.LocalUserDataPath + "' could not be found.");
     }
 }
Ejemplo n.º 3
0
        public ActionResult ChangePassword(ManageUserViewModel model, FormCollection collection)
        {
            ExceptionEngine.ProcessAction(() =>
            {
                //lblError.Text = "";
                string uniqueid = collection["hdnUniqueID"].ToString();

                String NewPassword = model.NewPassword;

                List <string> ErrorMessage = new List <string>();

                if (model.NewPassword != model.ConfirmPassword)
                {
                    ViewBag.Message  = "New Password & Retype Password did not match";
                    ViewBag.ShowForm = true;
                    return;
                }

                NewPassword.IsComplexPassword(ref ErrorMessage);

                if (ErrorMessage.Count > 0)
                {
                    ViewBag.Message  = ErrorMessage.Select(k => k).Aggregate((a, b) => a + "\n" + b);
                    ViewBag.ShowForm = true;
                    return;
                }
                else if (SecurityBusinessInstance.ChangePassword(uniqueid, NewPassword))
                {
                    ViewBag.ShowPopUp = true;
                    ViewBag.Message   = "Password Changed Successfully";
                    return;
                }
                else
                {
                    ViewBag.ShowPopup = true;
                    ViewBag.Message   = "You are not authorized to change password.";
                    return;
                }
            }, AspectEnums.ExceptionPolicyName.AssistingAdministrators.ToString());

            return(View());
        }
Ejemplo n.º 4
0
        public ActionResult ForgetPassword(LoginViewModel model)
        {
            ExceptionEngine.ProcessAction(() =>
            {
                string loginName = model.UserName.Trim();
                int?UserId       = userBusinessInstance.GetUserByLoginName(loginName).UserID;

                if (!ValidateUser(UserId))
                {
                    ViewBag.ShowPopup = true;
                    ViewBag.Message   = "User does not exist. Please write correct email/userId.";
                    return;
                }

                if (SendOTPAndEmail(UserId.Value))
                {
                    ViewBag.ShowPopup = true;
                    ViewBag.Message   = "Password reset link has been sent to your email.";
                }
            }, AspectEnums.ExceptionPolicyName.AssistingAdministrators.ToString());
            return(View());
        }
Ejemplo n.º 5
0
        public void Run(string[] args, System.Reflection.Assembly executable)
        {
            bool tracedExceptionThrown = false;

            try
            {
                using (SplashWindowThread splashThread = new SplashWindowThread(executable, false))
                {
                    splashThread.ShowAsynchronously();
                    splashThread.Window.SetMarqueeMoving(true, true);

                    ProgressViewer.SetExtendedDescription(splashThread.Window, "Bootstrap: Parsing command line...");

                    // create a new command line parsing engine
                    CommandLineParsingEngine pe = new CommandLineParsingEngine(args);

                    // determine if we are going to keep the old versions
                    bool keepOld = pe.ToBoolean("keepold");

                    // the process id of an app
                    int pid = pe.ToInt32("pid");

                    // whether we should wait on the specified pid to die before launching new version
                    bool wait = pe.ToBoolean("wait");

                    ProgressViewer.SetExtendedDescription(splashThread.Window, "Bootstrap: Searching for runnable version...");

                    // create a search for all of the subdirectories
                    Search search = new Search("Versions", Application.StartupPath, "*", false, false);

                    // find all of the directories
                    DirectoryInfo[] directories = search.GetDirectories();

                    // create versioned files around each directory that can be parsed to a version
                    VersionedDirectory[] versionedDirectories = this.CreateVersionedFiles(directories);

                    // if we have been instructed to wait on the process specified by pid to die, do it now
                    if (wait && pid != 0)
                    {
                        try
                        {
                            // snag it and wait on it to exit
                            Process p = Process.GetProcessById(pid);
                            if (p != null)
                            {
                                ProgressViewer.SetExtendedDescription(splashThread.Window, "Bootstrap: Closing previous instance...");
                                p.WaitForExit();
                            }
                        }
                        catch (System.Exception systemException)
                        {
                            System.Diagnostics.Trace.WriteLine(systemException);
                        }
                    }

                    ProgressViewer.SetExtendedDescription(splashThread.Window, "Bootstrap: Selecting latest runnable version...");

                    // try and start the newest version
                    VersionedDirectory versionStarted;
                    bool startedVersion = this.StartNewestVersion(executable, versionedDirectories, out versionStarted, splashThread.Window);
                    // this will fall back upon older versions until it runs out of versions or one of the versions starts
                    if (!startedVersion)
                    {
                        string exeName = string.Format("{0}.exe", executable.GetName().Name);
                        ExceptionEngine.DisplayException(null, "BootStrap failed for " + exeName, MessageBoxIcon.Stop, MessageBoxButtons.OK, null,
                                                         "No suitable executable was found or able to be started.");
                    }

                    // if we're not keeping the old versions
                    if (!keepOld)
                    {
                        // delete the older versions
                        if (!this.DeleteOlderVersions(versionedDirectories, versionStarted, splashThread.Window))
                        {
                            // um, who cares if we can't delete the older versions
                            // also we need to see about security rights to the directories
                        }
                    }

                    // if we started a version
                    if (startedVersion)
                    {
                        // notify that we are transferring control now to it...
                        ProgressViewer.SetExtendedDescription(splashThread.Window, "Bootstrap: Transferring control to version " + versionStarted.Version.ToString() + "...");
                    }
                }
            }
            catch (System.Exception systemException)
            {
                tracedExceptionThrown = true;
                System.Diagnostics.Trace.WriteLine(systemException);
                System.Windows.Forms.MessageBox.Show(null, systemException.ToString(), "Application Exiting");
                Application.ExitThread();
            }
            finally
            {
                System.Diagnostics.Trace.WriteLine("'" + Application.ProductName + (tracedExceptionThrown ? "' has terminated because of an exception." : "' has exited gracefully."));
            }
        }