Esempio n. 1
0
        public ActionResult Books(int AuthorID)
        {
            #region Prep Utilities

            myHandler = new BusinessLogicHandler();
            AddNewBookViewModel model = new AddNewBookViewModel();

            #endregion

            #region Get Books

            model.bookList = new List<Book>();
            model.bookList = myHandler.GetBooksByAuthor(AuthorID);

            #endregion

            #region Get Author Data

            model.author = new Author();
            model.author = myHandler.GetAuthorDetails(AuthorID);

            #endregion

            return View(model);
        }
Esempio n. 2
0
 public bool AddToCartAsync(int cartId, int ProductID)
 {
     myHandler = new BusinessLogicHandler();
     item = new CartItem();
     item = myHandler.CheckIfExist(cartId, ProductID);
     if(item == null)
     {
         item = new CartItem();
         item.CartID = cartId;
         item.ProductID = ProductID;
         item.DateAdded = DateTime.Now;
         item.Quantity = 1;
         if (myHandler.AddCartItem(item))
         { return true; }
         else
             return false;
     }
     else
     {
         item.Quantity += 1;
         if (myHandler.UpdateCartItem(item))
         { return true; }
         else
             return false;
     }
 }
Esempio n. 3
0
        public ActionResult ByCategory(string name, int CategoryID)
        {
            #region Init

            BusinessLogicHandler myHandler = new BusinessLogicHandler();
            SearchViewModel model = new SearchViewModel();
            Book helper = new Book();
            #endregion

            #region Get Books By Category

            if (name != null)
            {
                model.BookResults = myHandler.CategoryBookSearch(name);
                model.BCategory = new BookCategory();
                helper = (Book)model.BookResults.Take(1).FirstOrDefault();
                model.BCategory = myHandler.GetBookType(helper.BookCategoryID);

            }
            else if (CategoryID != 0)
            {
                model.BookResults = myHandler.GetBooksByCategory(CategoryID);
                model.BCategory = new BookCategory();
                model.BCategory = myHandler.GetBookType(CategoryID);
            }

            #endregion

            return View(model);
        }
Esempio n. 4
0
 public ActionResult AdminDetails(int ProductID)
 {
     myHandler = new BusinessLogicHandler();
     gadget = new Technology();
     gadget = myHandler.GetTechnologyDetails(ProductID);
     return View(gadget);
 }
Esempio n. 5
0
 public ActionResult Edit()
 {
     Company company = new Company();
     BusinessLogicHandler myHandler = new BusinessLogicHandler();
     company = myHandler.GetCompanyDetail();
     return View(company);
 }
Esempio n. 6
0
        public ActionResult Home()
        {
            #region Prep Utilities

            myHandler = new BusinessLogicHandler();
            Supplier supplier = new Supplier();
            RangeViewModel model = new RangeViewModel();

            #endregion

            #region Get User(Supplier)

            string userName = User.Identity.GetUserName();
            ApplicationDbContext dataSocket = new ApplicationDbContext();
            UserStore<ApplicationUser> myStore = new UserStore<ApplicationUser>(dataSocket);
            _userManager = new ApplicationUserManager(myStore);
            var user = _userManager.FindByEmail(userName);

            #endregion

            #region Get Supplier Details

            supplier = myHandler.GetSupplier(user.Id);

            #endregion

            #region Get Orders For Supplier

            model.Orders = myHandler.GetSupplierOrders(supplier.SupplierID);
            if(model.Orders != null)
            { model.Orders.OrderBy(m => m.DateCreated); }
            #endregion

            return View(model);
        }
Esempio n. 7
0
        public ActionResult AdminDeviceSearch(FormCollection collection)
        {
            #region Get Search Query

            string query = collection.GetValue("query").AttemptedValue;

            #endregion

            #region Prep Utilities

            BusinessLogicHandler myHandler = new BusinessLogicHandler();
            SearchViewModel model = new SearchViewModel();

            #endregion

            #region Execute Search

            model.Query = query;
            model.GadgetResults = myHandler.TechnologyGlobalSearch(query);
            model.GadgetCategoryResults = myHandler.DeviceGlobalSearch(query);
            model.ManufacturerResults = myHandler.ManufacturerGlobalSearch(query);

            #endregion

            return View(model);
        }
Esempio n. 8
0
        public ActionResult AdminBookSearch(FormCollection collection)
        {
            #region Get Search Query

            string query = collection.GetValue("query").AttemptedValue;

            #endregion

            #region Prep Utilities

            BusinessLogicHandler myHandler = new BusinessLogicHandler();
            SearchViewModel model = new SearchViewModel();

            #endregion

            #region Execute Search

            model.Query = query;
            model.BookResults = myHandler.BookGlobalSearch(query);
            model.BookCategoryResults = myHandler.BookCategoryGlobalSearch(query);
            model.AuthorResults = myHandler.AuthorGlobalSearch(query);
            model.PublisherResults = myHandler.PublisherGlobalSearch(query);

            #endregion

            return View(model);
        }
Esempio n. 9
0
 public double GetTotalAsync(int cartId)
 {
     myHandler = new BusinessLogicHandler();
     IEnumerable<Book> myBooks = myHandler.GetBooks();
     IEnumerable<Technology> myGadget = myHandler.GetTechnology();
     IEnumerable<CartItem> myItems;
     double final = 0;
     myItems = GetCartItemsAsync(cartId);
     if (myItems != null)
     {
         if (myBooks != null )
         {
             var totalBook = from item in myItems
                         join bi in myBooks on item.ProductID equals bi.ProductID
                         where item.ProductID == bi.ProductID
                         select (item.Quantity * bi.SellingPrice);
             final = (double)totalBook.Sum();
             if (myGadget != null)
             {
                 var total = from item in myItems
                             join gadget in myGadget on item.ProductID equals gadget.ProductID
                             where gadget.ProductID == item.ProductID
                             select (item.Quantity * gadget.SellingPrice);
                 final += (double)total.Sum();
             }
         }
         return Math.Round(final, 2);
     }
     else
         return 0.00;
 }
Esempio n. 10
0
        public ActionResult Details(int id)
        {
            myHandler = new BusinessLogicHandler();
            mySpecial = myHandler.GetSpecialsList().Single(sp => sp.SpecialID == id);

            return View(mySpecial);
        }
Esempio n. 11
0
 public ActionResult Delete(int ManufacturerID)
 {
     myHandler = new BusinessLogicHandler();
     manufacturer = new Manufacturer();
     manufacturer.ManufacturerID = ManufacturerID;
     manufacturer = myHandler.GetManufacturer(ManufacturerID);
     return View(manufacturer);
 }
Esempio n. 12
0
 public ActionResult Delete(int BookCategoryID)
 {
     myHandler = new BusinessLogicHandler();
     typeOf = new BookCategory();
     typeOf.BookCategoryID = BookCategoryID;
     typeOf = myHandler.GetBookCategory(BookCategoryID);
     return View(typeOf);
 }
Esempio n. 13
0
 public ActionResult Delete(int TechCategoryID)
 {
     myHandler = new BusinessLogicHandler();
     tech = new TechCategory();
     tech.TechCategoryID = TechCategoryID;
     tech = myHandler.GetTechnologyType(TechCategoryID);
     return View(tech);
 }
Esempio n. 14
0
 public ActionResult Delete(int PublisherID)
 {
     myHandler = new BusinessLogicHandler();
     publisher = new Publisher();
     publisher.PublisherID = PublisherID;
     publisher = myHandler.GetPublisher(PublisherID);
     return View(publisher);
 }
Esempio n. 15
0
        public ActionResult Index()
        {
            #region Cart and wishlist actions
            if (User.Identity.IsAuthenticated)
            {
                #region Check iDentity
                if (HttpContext.User.IsInRole("admin"))
                {
                   return  RedirectToAction("Index", "Admin");
                }
                else if (HttpContext.User.IsInRole("supplier"))
                {
                  return  RedirectToAction("Home", "Supplier");
                }
                else if (HttpContext.User.IsInRole("employee"))
                {
                  return  RedirectToAction("Index", "Employee");
                }
                #endregion

                #region Getting cart total
                CartActions act = new CartActions();
                WishlistActions wish = new WishlistActions();
                ApplicationDbContext mycontext = new ApplicationDbContext();
                UserStore<ApplicationUser> myStore = new UserStore<ApplicationUser>(mycontext);
                ApplicationUserManager mgr = new ApplicationUserManager(myStore);
                var thisUser = mgr.FindByNameAsync(User.Identity.Name);
                int cartId = Convert.ToInt32(thisUser.Result.Carts.CartID);
                //
                try
                {
                    double nm = GetCartTotal(cartId); string[] xn = nm.ToString().Split('.'); Session["cartTotal"] = xn[0] + "," + xn[1];
                }
                catch
                { Session["cartTotal"] = (double)GetCartTotal(cartId); }
                Session["wishlistTotal"] = wish.GetWishlistTotal(thisUser.Result.Wishlists.WishlistID);
                #endregion
            }
            else
            { Session["cartTotal"] = "0,00"; Session["wishlistTotal"] = 0; }
            #endregion

            #region Prep utilities
            BusinessLogicHandler myHandler = new BusinessLogicHandler();
            SearchViewModel model = new SearchViewModel();
            #endregion

            #region Get New Books
            model.BookResults = myHandler.GetNewBooks();
            #endregion

            #region Get Devices
            model.GadgetResults = myHandler.GetNewDevices();
            #endregion

            return View(model);
        }
Esempio n. 16
0
 public bool InsertWishlistItem(WishlistItem wish)
 {
     myHandler = new BusinessLogicHandler();
     if (myHandler.AddWishlistItem(wish))
     {
         return true;
     }
     else
         return false;
 }
Esempio n. 17
0
 public ActionResult AdminIndex(int? page)
 {
     myHandler = new BusinessLogicHandler();
     List<Book> myBookList = new List<Book>();
     myBookList = myHandler.GetBooks();
     myBookList.OrderBy(m => m.DateAdded);
     IEnumerable<BookCategory> myType = myHandler.GetBookCategoryList();
     ViewBag.BookTypeBag = myType;
     return View(myBookList.ToList().ToPagedList(page ?? 1, 20));
 }
Esempio n. 18
0
        public ActionResult AddOrderItems(OrderItem item)
        {
            List<Order> myOrderList = new List<Order>();
            //  await order = myHandler.GetOrdersList().Single(ord => ord.DataModified == DateTime.Now);
            TryUpdateModel(item);
            myHandler = new BusinessLogicHandler();
            myHandler.AddOrderItem(item);

            return Json(new { success = true });
        }
Esempio n. 19
0
        public ActionResult Technology(int? page)
        {
            #region Prep Utilities
            myHandler = new BusinessLogicHandler();
            #endregion

            #region Get data
            IEnumerable<Supplier> suppliers = myHandler.GetTechSuppliers();
            #endregion

            return View(suppliers.ToList().ToPagedList(page ?? 1, 10));
        }
Esempio n. 20
0
        public ActionResult AdminIndex(int? page)
        {
            myHandler = new BusinessLogicHandler();
            List<Technology> myTechList = new List<Technology>();
            myTechList = myHandler.GetTechnology();
            IEnumerable<TechCategory> myType = myHandler.GetTechnologyTypeList();
            ViewBag.TechTypeBag = myType;

            TempData["Alert Message"] = "Device Successfully Deleted";

            return View(myTechList.ToList().ToPagedList(page ??1,20));
        }
Esempio n. 21
0
        public ActionResult Books(int PublisherID)
        {
            #region Prep Utilities
            BusinessLogicHandler myHandler = new BusinessLogicHandler();
            SearchViewModel model = new SearchViewModel();
            #endregion

            #region Get Publisher Books
            model.BookResults = myHandler.GetBooksByPublisher(PublisherID);
            #endregion
            return View(model);
        }
Esempio n. 22
0
 public ActionResult Create(Manufacturer manufacturer)
 {
     try
     {
         BusinessLogicHandler myHandler = new BusinessLogicHandler();
         myHandler.AddManufacturer(manufacturer);
         return RedirectToAction("Index");
     }
     catch
     {
         return View();
     }
 }
Esempio n. 23
0
 public ActionResult Create(TechCategory techCategory)
 {
     try
     {
         BusinessLogicHandler myHandler = new BusinessLogicHandler();
         myHandler.AddTechnologyType(techCategory);
         return RedirectToAction("Index");
     }
     catch
     {
         return View();
     }
 }
Esempio n. 24
0
 public ActionResult Create(FormCollection collection)
 {
     myHandler = new BusinessLogicHandler();
     list = new Wishlist();
     try
     {
         return View();
     }
     catch
     {
         return View();
     }
 }
Esempio n. 25
0
 public ActionResult Create(Publisher publisher)
 {
     try
     {
         BusinessLogicHandler myHandler = new BusinessLogicHandler();
         myHandler.AddPublisher(publisher);
         return RedirectToAction("Index");
     }
     catch
     {
         return View();
     }
 }
Esempio n. 26
0
        public async Task<ActionResult> Edit()
        {
            if (User.Identity.IsAuthenticated)
            {
                ApplicationDbContext mycontext = new ApplicationDbContext();
                UserStore<ApplicationUser> myStore = new UserStore<ApplicationUser>(mycontext);
                ApplicationUserManager mgr = new ApplicationUserManager(myStore);
                var user = await mgr.FindByNameAsync(User.Identity.Name);

                WishlistActions grantMyWish = new WishlistActions();
                CartActions cart = new CartActions();
                ProductViewModel bridge = new ProductViewModel();
                List<Book> bookList = new List<Book>();
                List<Technology> deviceList = new List<Technology>();
                myHandler = new BusinessLogicHandler();
                bridge.allWishlistItems = new List<WishlistItem>();
                bridge.allWishlistItems =  grantMyWish.GetWishlistItems(user.Wishlists.WishlistID);
                if(bridge.allWishlistItems != null)
                {
                    bridge.allBook = new List<Book>();
                    foreach(var item in bridge.allWishlistItems)
                    {
                        if(myHandler.CheckProductType(item.ProductID))
                        {
                             Book myBook = new Book();
                             myBook = myHandler.GetBook(item.ProductID);
                             bookList.Add(myBook);
                        }
                        else
                        {
                            Technology myDevice = new Technology();
                            myDevice = myHandler.GetTechnologyDetails(item.ProductID);
                            deviceList.Add(myDevice);
                        }
                    }
                    //bridge.allBook = myHandler.GetBooks();
                    bridge.allTechnology = new List<Technology>();
                    //bridge.allTechnology = myHandler.GetTechnology();
                    bridge.allBook = bookList;
                    bridge.allTechnology = deviceList;
                }

                Session["wishlistTotal"] =  grantMyWish.GetWishlistTotal(user.Wishlists.WishlistID);
                Session["cartTotal"] = cart.GetTotalAsync(user.Carts.CartID);
                return View(bridge);
            }
            else
                return RedirectToAction("Login", "Account", null);
        }
Esempio n. 27
0
        public ActionResult Edit(Company company, HttpPostedFileBase file)
        {
            BusinessLogicHandler myHandler = new BusinessLogicHandler();

            if(ModelState.IsValid)
            {
                if (file != null)
                {
                    company.CompanyLogo = file.FileName;
                    file.SaveAs(HttpContext.Server.MapPath("~/Content/Images/") + file.FileName);
                }
                myHandler.UpdateCompany(company);
            }
            return RedirectToAction("CompanyDetails", "Company", null);
        }
Esempio n. 28
0
 public ActionResult Create(Author author)
 {
     try
     {
         myHandler = new BusinessLogicHandler();
         if (ModelState.IsValid)
         {
             myHandler.AddAuthor(author);
         }
         return RedirectToAction("Index");
     }
     catch
     {
         return View();
     }
 }
Esempio n. 29
0
        public ActionResult Categories()
        {
            #region Init Categories

            BusinessLogicHandler myHandler = new BusinessLogicHandler();
            SearchViewModel model = new SearchViewModel();

            #endregion

            #region Get Categories From db

            model.BookCategoryResults = myHandler.GetBookCategoryList();

            #endregion

            return View(model);
        }
Esempio n. 30
0
        public ActionResult Delete(int TechCategoryID, FormCollection collection)
        {
            try
            {
                myHandler = new BusinessLogicHandler();
                tech = new TechCategory();
                tech.TechCategoryID = TechCategoryID;
                myHandler.DeleteTechnologyType(TechCategoryID);

                TempData["Alert Message"] = "Category Successfully Deleted";
                return RedirectToAction("Index", "TechCategory");
            }
            catch
            {
                return View();
            }
        }
Esempio n. 31
0
    public void UpdateCompanyDetails_Click(object sender, EventArgs e)
    {
        var user    = new ApplicationUser();
        var manager = new UserManager {
        };
        BusinessLogicHandler myHandler = new BusinessLogicHandler();

        Company company = new Company();

        List <Company> companyList = new List <Company>();

        companyList = myHandler.GetCompanyDetails(user.Id);

        foreach (var item in companyList)
        {
            CompanyName.Text   = item.Name;
            ContactPerson.Text = item.ContactPerson;
            CellNo.Text        = item.CellNo;
            TellNo.Text        = item.TellNo;
            Address.InnerText  = item.Address;
        }
    }
Esempio n. 32
0
        private void CreateSubscription()
        {
            ReplicationDatabase replDatabase;
            Server   subServer;
            Database newDatabase;
            MergeSynchronizationAgent syncAgent;
            ReplicationServer         Subscriber;
            BusinessLogicHandler      insertUpdateHandler;
            Boolean isRegistered = false;

            this.Show();
            Application.DoEvents();

            // We need to collect valid Windows credentials to be able to
            //  store Web synchronization information in the database.
            LogonUser    logon    = new LogonUser();
            DialogResult dr       = logon.ShowDialog(this);
            string       username = logon.UserName;
            string       password = logon.Password;

            if (dr == DialogResult.OK)
            {
                //try
                //{
                //    // Create connections to the Publisher and Distributor.
                //    publisherConn = new ServerConnection(publisherServer);
                //    publisherConn.Connect();
                //}
                //catch (Microsoft.SqlServer.Replication.ConnectionFailureException ex)
                //{
                //    ExceptionMessageBox emb = new ExceptionMessageBox(
                //        Properties.Resources.ExceptionCannotConnectPublisher,
                //        Properties.Resources.ExceptionSqlServerError,
                //        ExceptionMessageBoxButtons.OK);
                //    emb.InnerException = ex;
                //    emb.Show(this);

                //    // Shutdown the application because we can't continue.
                //    Application.Exit();
                //}

                try
                {
                    // Make the connection and get the subscription properties.
                    subscriberConn = new ServerConnection(subscriberServer);
                    subscriberConn.Connect();
                }
                catch (Microsoft.SqlServer.Replication.ConnectionFailureException ex)
                {
                    ExceptionMessageBox emb = new ExceptionMessageBox(
                        Properties.Resources.ExceptionCannotConnectLocal,
                        Properties.Resources.ExceptionSqlServerError,
                        ExceptionMessageBoxButtons.OK);
                    emb.InnerException = ex;
                    emb.Show(this);

                    // Shutdown the application because we can't continue.
                    Application.Exit();
                }

                // Instantiate a pull subscription object.
                mergePullSub = new MergePullSubscription();

                // Set the required properties needed to create the subscription.
                mergePullSub.ConnectionContext = subscriberConn;
                mergePullSub.PublicationName   = publicationName;
                mergePullSub.PublisherName     = publisherServer;
                mergePullSub.PublicationDBName = publicationDatabase;
                mergePullSub.DatabaseName      = subscriptionDatabase;
                // Specify an anonymous Subscriber type since we can't
                // register at the Publisher with a direct connection.
                mergePullSub.SubscriberType = MergeSubscriberType.Anonymous;
                // Enable Web synchronization.
                mergePullSub.UseWebSynchronization = true;
                mergePullSub.InternetUrl           = Properties.Settings.Default.WebSynchronizationUrl;

                // Specify the same Windows credentials to use when connecting to the
                // Web server using HTTPS Basic Authentication.
                mergePullSub.InternetSecurityMode = AuthenticationMethod.BasicAuthentication;
                //mergePullSub.InternetLogin = username;
                //mergePullSub.InternetPassword = password;
                mergePullSub.InternetLogin    = internetLogin;
                mergePullSub.InternetPassword = internetPassword;

                // Create the subscription database using SMO if it does not exist.
                subServer = new Server(subscriberConn);

                replDatabase = new ReplicationDatabase(
                    mergePullSub.DatabaseName, subscriberConn);
                newDatabase = subServer.Databases[replDatabase.Name];

                // Create the subscription database.
                if (subServer.Databases.Contains(replDatabase.Name) == false)
                {
                    currentStatusTextBox.Text += statusCreateDatabase
                                                 + Environment.NewLine;
                    Application.DoEvents();
                    newDatabase = new Database(subServer, replDatabase.Name);
                    newDatabase.Create();
                }

                replDatabase.Load();
                replDatabase.EnabledMergePublishing = false;
                replDatabase.CommitPropertyChanges();

                // This is needed so that we can store Web synchronization
                // information in the MSsubscription_properties table and access this
                // information using the MergePullSubscription class. For a SQL Server 2005
                // Subscriber an agent job will be created. For a SQL Server 2005 Express Edition
                // Subscriber, only the meta data will be created because this edition does not
                // support SQL Server Agent.
                mergePullSub.CreateSyncAgentByDefault = true;

                // Set the process security which is required for the agent job.
                mergePullSub.SynchronizationAgentProcessSecurity.Login    = username;
                mergePullSub.SynchronizationAgentProcessSecurity.Password = password;

                // Set the HostName property.
                mergePullSub.HostName = subscriberHostName;

                // 调用 远程接口注册该订阅

                /*DBCenterWebService service = new DBCenterWebService();
                 * SubscriptionInfo info = new SubscriptionInfo();
                 * info.subscriberName = mergePullSub.Name;
                 * info.subscriptionDbName = mergePullSub.DatabaseName;
                 * service.CreateSubscriptionRequest(info);*/

                //if (!mergePub.SnapshotAvailable)
                //{
                //    throw new ApplicationException(
                //        Properties.Resources.ExceptionSalesDataNotAvailable
                //        + Environment.NewLine
                //        + Properties.Resources.ExceptionContactTechSupport);
                //}

                // Define the handler for inserts and updates at the Subscriber.
                Subscriber          = new ReplicationServer(subscriberConn);
                insertUpdateHandler = new BusinessLogicHandler();
                insertUpdateHandler.FriendlyName       = handlerFriendlyName;
                insertUpdateHandler.DotNetAssemblyName = "BusinessLogic.dll";
                insertUpdateHandler.DotNetClassName    = "Microsoft.Samples.SqlServer.CustomBusinessLogicHandler";
                insertUpdateHandler.IsDotNetAssembly   = true;

                try
                {
                    // Create the pull subscription.
                    currentStatusTextBox.Text += statusCreateSubscription
                                                 + Environment.NewLine;
                    Application.DoEvents();
                    mergePullSub.Create();

                    mergePullSub.Refresh();

                    // Get the Merge Agent for synchronous execution.
                    syncAgent = mergePullSub.SynchronizationAgent;

                    // We have to set these because of an RMO bug.
                    // Remove for RTM.
                    syncAgent.DistributorSecurityMode = SecurityMode.Integrated;
                    syncAgent.PublisherSecurityMode   = SecurityMode.Integrated;
                    syncAgent.SubscriberSecurityMode  = SecurityMode.Integrated;

                    // Generate a troubleshooting log file.
                    syncAgent.OutputVerboseLevel = outputLevel;
                    syncAgent.Output             = outputLogFile;

                    // Define the event handler.
                    syncAgent.Status
                        += new AgentCore.StatusEventHandler(Sync_Status);

                    currentStatusTextBox.Text += statusInitialize
                                                 + Environment.NewLine;
                    Application.DoEvents();

                    // Start the Merge Agent synchronously to apply the initial snapshot.
                    syncAgent.Synchronize();

                    // Make sure that the initialization was successful.
                    mergePullSub.Refresh();
                    if (mergePullSub.LastAgentStatus
                        != ReplicationStatus.Succeeded)
                    {
                        throw new SubscriptionInitializationException(
                                  Properties.Resources.ExceptionSubscriptionNotSync);
                    }
                    currentStatusTextBox.Text += statusSuccess.ToString()
                                                 + Environment.NewLine;
                    statusProgressBar.Value = 100;
                }

                catch (Exception ex)
                {
                    currentStatusTextBox.Text += statusFail.ToString()
                                                 + Environment.NewLine;
                    statusProgressBar.Value = 0;

                    // If an exception occurs, undo subscription registration at both
                    // the Publisher and Subscriber and remove the handler registration.
                    mergePullSub.Remove();

                    if (isRegistered)
                    {
                        Subscriber.UnregisterBusinessLogicHandler(insertUpdateHandler);
                        isRegistered = false;
                    }

                    throw new SubscriptionCreationException(
                              Properties.Resources.ExceptionSubscriptionNotCreated,
                              ex);
                }

                finally
                {
                    closeButton.Enabled = true;
                    subscriberConn.Disconnect();
                    //publisherConn.Disconnect();
                }
            }
            else
            {
                // If we can't create the subscription, close the application.
                ExceptionMessageBox emb = new ExceptionMessageBox(
                    Properties.Resources.ExceptionSubscriptionNotCreated);
                emb.Buttons = ExceptionMessageBoxButtons.RetryCancel;
                DialogResult drRetry = emb.Show(this);

                if (drRetry == DialogResult.Retry)
                {
                    this.CreateSubscription();
                }
                else
                {
                    Application.Exit();
                }
            }
        }