Exemple #1
0
        private void HelpButton_Click(object sender, EventArgs e)
        {
            TermsOfService f = new TermsOfService();

            f.Setup();
            f.Show(ParentForm);
        }
Exemple #2
0
        static int Main()
        {
            if (!File.Exists("XPlugin.dll"))
            {
                File.WriteAllBytes("XPlugin.dll", Net_Weave_R.Properties.Resources.XPlugin);
                File.WriteAllBytes("Mono.Cecil.dll", Net_Weave_R.Properties.Resources.Mono_Cecil);
                Application.Restart();
                return(1);
            }

            if (!File.Exists("Mono.Cecil.dll"))
            {
                File.WriteAllBytes("Mono.Cecil.dll", Net_Weave_R.Properties.Resources.Mono_Cecil);
                Application.Restart();
                return(1);
            }

            xMutex mutex = xMutex.CreateMutex("Net-Weave R");

            if (mutex == null)
            {
                MessageBox.Show("An instance of Net-Weave R is already running.", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(-1);
            }

            if (!SOCKET.Startup())
            {
                MessageBox.Show("Unable to start winsock. Please try again", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(-1);
            }

            GlobalProperties.ConsoleHandle = Process.GetCurrentProcess().MainWindowHandle;
            User32.ShowWindow(GlobalProperties.ConsoleHandle, 0);
            GlobalProperties.ApplicationIcon = Icon.ExtractAssociatedIcon(Application.ExecutablePath);
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            if (!Settings.ReadToS())
            {
                MessageBox.Show("This appears to be your first time running Net-Weave R. Please agree to the Terms of Service before continuing.", "First time running", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

                if (!TermsOfService.Show())
                {
                    SOCKET.Cleanup();
                    Environment.Exit(0);
                }
            }

            Application.Run(new Login());
            //SOCKET.Cleanup();

            return(0);
        }
Exemple #3
0
        private void AddTOS(ParkingMaster.DataAccess.UserContext context)
        {
            var tosGateway = new TosGateway(context);

            // Add TOS
            string         filepath = "C:\\TOS\\default.txt";
            string         text     = File.ReadAllText(filepath);
            TermsOfService tos      = new TermsOfService()
            {
                Content = text,
                TosName = "Initial TOS"
            };

            tosGateway.AddAndSetNewTos(tos);
        }
        public ResponseDTO <bool> AddAndSetNewTos(TermsOfService newTOS)
        {
            using (var dbContextTransaction = context.Database.BeginTransaction())
            {
                try
                {
                    var currentTOS = (from tos in context.TOS
                                      where tos.IsActive
                                      select tos).FirstOrDefault();

                    if (currentTOS == null)
                    {
                        // If there is currently no active TOS, only add new TOS
                        newTOS.IsActive = true;
                        context.TOS.Add(newTOS);
                        context.SaveChanges();

                        dbContextTransaction.Commit();
                    }
                    else
                    {
                        // If there is a current TOS, disable it then add new active TOS
                        currentTOS.IsActive = false;
                        newTOS.IsActive     = true;
                        context.TOS.Add(newTOS);
                        context.SaveChanges();

                        dbContextTransaction.Commit();
                    }

                    return(new ResponseDTO <bool>()
                    {
                        Data = true
                    });
                }
                catch (Exception e)
                {
                    dbContextTransaction.Rollback();

                    return(new ResponseDTO <bool>()
                    {
                        Data = false,
                        Error = ErrorStrings.DATA_ACCESS_ERROR
                    });
                }
            }
        }
Exemple #5
0
        public ActionResult TermsOfServiceObject(string id)
        {
            var tos = tosProvider.GetTermsOfService(id);

            if (tos == null)
            {
                return(HttpNotFound());
            }

            var model = new TermsOfService
            {
                Id    = tos.Id,
                Name  = tos.Name,
                Terms = tos.Terms,
                Link  = tos.Link
            };

            return(Json(model));
        }
        /// <summary>
        /// Get terms of service for products in current cart from resource provider.
        /// Terms of service name should have key "{id}_Name", and description should have key "{id}_Description".
        /// </summary>
        /// <returns>The terms of service applicable to products in current cart.</returns>
        public IEnumerable <TermsOfService> GetTermsOfService()
        {
            var termsOfService = new HashSet <TermsOfService>();
            var cart           = cartProvider.GetCart();
            var articleNumbers = new HashSet <string>(cart.CartItems.Select(c => c.ArticleNumber));
            var isReseller     = resellerProvider.GetReseller().IsSubReseller;
            var tosResources   = new HashSet <string>();

            foreach (var articleNumber in articleNumbers)
            {
                var product = productProvider.GetProduct(articleNumber);

                if (product != null)
                {
                    string tosNoSplit = null;

                    if (isReseller && product.CustomAttributes.Any(ca => ca.Name == "resellertos"))
                    {
                        tosNoSplit = product.CustomAttributes.First(ca => ca.Name == "resellertos").Value;
                    }
                    else if (product.CustomAttributes.Any(ca => ca.Name == "tos"))
                    {
                        tosNoSplit = product.CustomAttributes.First(ca => ca.Name == "tos").Value;
                    }

                    if (!string.IsNullOrEmpty(tosNoSplit))
                    {
                        tosResources.UnionWith(tosNoSplit.Split('|'));
                    }
                }
            }

            foreach (var resource in tosResources)
            {
                TermsOfService tosResource = this.GetTermsOfService(resource);
                termsOfService.Add(tosResource);
            }

            return(termsOfService);
        }
 public ResponseDTO <bool> AddAndSetNewTos(TermsOfService tos)
 {
     return(_tosGateway.AddAndSetNewTos(tos));
 }
Exemple #8
0
        public TermsOfService GetLatestTOS()
        {
            TermsOfService tos = Query <TermsOfService>(null, _dbConnName, StoredProcedure.GetLatestTOS, TermsOfService.Build);

            return(tos);
        }