Esempio n. 1
0
        public ActionResult UpdateAD(HomeData data)
        {
            string status = "-1";
            string msg    = "保存失败!";

            if (data != null)
            {
                msg = Validate.ValidateString(new CustomValidate()
                {
                    FieldName  = "广告标题",
                    FieldValue = data.Title,
                    IsRequired = true,
                    MaxLength  = 100
                }, new CustomValidate()
                {
                    FieldName  = "广告图片",
                    FieldValue = data.ImgUrl,
                    IsRequired = true
                });

                if (msg == null)
                {
                    int result = OperateContext.Current.BLLSession.IHomeDataBLL.Modify(data);

                    if (result == 1)
                    {
                        status = "ok";
                        msg    = "保存成功!";
                    }
                }
            }

            return(OperateContext.Current.RedirectAjax(status, msg, null, null));
        }
        ////////////////////////////////////////////////////////////////////

        // Helper test function to perform common Direction routine
        private HomePage GetDirection(HomeData p_HomeData, HomePage.DirectionTypes p_DirectionType)
        {
            // Verify driver is initialized
            Assert.IsNotNull(driver, "Driver initialization FAILED");

            // Verify input SignInData
            Assert.IsNotNull(p_HomeData, "TestData load FAILED");

            // Verify Home page is loaded
            HomePage homePage = new HomePage(driver);

            Assert.IsTrue(homePage.VerifyPage(), "HomePage VerifyPage() FAILED");

            homePage.ClickDirection();
            Assert.IsTrue(homePage.VerifyDirection(), "HomePage VerifyDirection() FAILED");

            // Verify test data are set
            Assert.IsTrue(homePage.SetSourceLocation(p_HomeData.source), "SetSourceLocation() FAILED");
            Assert.IsTrue(homePage.SetDestination(p_HomeData.destination), "SetDestination() FAILED");
            Assert.IsTrue(homePage.SetTrafficAware(p_HomeData.trafficAware), "SetTrafficAware() FAILED");
            Assert.IsTrue(homePage.SetTollAware(p_HomeData.tollAware), "SetTollAware() FAILED");
            Assert.IsTrue(homePage.SetFastest(p_HomeData.fastest), "SetFastest() FAILED");
            Assert.IsTrue(homePage.SetShortest(p_HomeData.shortest), "SetShortest() FAILED");

            // Verify Get Directions button is clicked
            Assert.IsTrue(homePage.ClickGetDirection(p_DirectionType), "ClickGetDirection() FAILED");

            return(homePage);
        }
        public ActionResult Index()
        {
            HomeData h = Home.GetHomeData(this.UserData.UserId, this.Language.Id, this.ProductId);

            return(View(h));
            //return RedirectToAction("Index", "RecentDocuments");
        }
Esempio n. 4
0
    public static HomeData GenerateRandom(int maxTier, int floors, float roomChance = 50)
    {
        List <FloorData> floorDataList = new List <FloorData>();

        for (int i = 0; i < floors; i++)
        {
            FloorData floorData = new FloorData(
                ContentManager.Instance.GetRandomFloorType(Random.Range((int)1, (int)maxTier)),
                ContentManager.Instance.GetRandomWallType(Random.Range((int)1, (int)maxTier))
                );
            for (int j = 0; j < 4; j++)
            {
                if (Random.Range(0, 100) < roomChance)
                {
                    floorData.HomeUpgrades[j] = ContentManager.Instance.GetRandomHomeUpgrade(Random.Range((int)1, (int)maxTier), Random.Range((int)1, (int)maxTier));
                }
            }
            floorDataList.Add(floorData);
            floorData.UpdateStats();
        }
        HomeData home = new HomeData();

        home.Floors = floorDataList;
        return(home);
    }
Esempio n. 5
0
        public async Task <IActionResult> LogIn(HomeData userModel)
        {
            if (!ModelState.IsValid)
            {
                return(View("Welcome"));
            }
            var currentUser = _dbContext.Users.SingleOrDefault(i => i.UEmail.Equals(userModel.currentUser.Email));

            if (currentUser == null)
            {
                //Will Change Soon

                //throw new Exception("User does not exist.");
            }
            var hasher         = new PasswordHasher <Users>();
            var passwordResult = hasher.VerifyHashedPassword(currentUser, currentUser.UPassword, userModel.currentUser.Password);

            if (passwordResult != PasswordVerificationResult.Success)
            {
                //Will Change Soon
                //throw new Exception("The password is wrong.");
                return(View("Welcome"));
            }

            await LogInUserAsync(currentUser.UId);

            await _dbContext.SaveChangesAsync();

            return(RedirectToAction(nameof(Welcome)));
        }
        public HomeDataFixture()
        {
            // Set the default culture.
            CultureInfo.CurrentCulture = new CultureInfo("en-US");

            var loggerFactory = new LoggerFactory();
            var logger        = loggerFactory.CreateLogger <HomeData>();

            var configuration = new ConfigurationBuilder()
                                .SetBasePath(AppContext.BaseDirectory)
                                .AddJsonFile("appsettings.json", false, false)
                                .AddUserSecrets <Startup>(true)
                                .Build();

            configuration.GetSection("AppSettings").Bind(Settings);

            var client1 = new HomeDataClient1(new HttpClient()
            {
                BaseAddress = new Uri(Settings.Meter1Address),
                Timeout     = TimeSpan.FromSeconds(Settings.Timeout)
            }, loggerFactory.CreateLogger <HomeDataClient1>());

            var client2 = new HomeDataClient2(new HttpClient()
            {
                BaseAddress = new Uri(Settings.Meter1Address),
                Timeout     = TimeSpan.FromSeconds(Settings.Timeout)
            }, loggerFactory.CreateLogger <HomeDataClient2>());

            HomeData = new HomeData(logger, client1, client2, Settings);

            HomeData.ReadAllAsync().Wait();
        }
 public void Load()
 {
     homedata = io.Load <HomeData>(GetStringPath());
     if (homedata == null)
     {
         homedata = new HomeData(false);
     }
 }
        public void UnExecute(DomainModelMsSqlServerContext context)
        {
            _homeData = _commandDto.Payload.ToObject <HomeData>();
            var entity = context.HomeData.First(t => t.Id == _homeData.Id);

            entity.Deleted = true;
            _logger.LogDebug("Unexecuted");
        }
Esempio n. 9
0
        public string Print()
        {
            HomeData hd   = new HomeData();
            Home     home = hd.GetHomeData();
            string   s    = new PageOrientations().RenderRazorViewToString(this, "Print", home);

            return(s);
        }
 /// <summary>
 /// Create new instance of FileManger, whre datHolder is set to <paramref name="data"/>.
 /// </summary>
 /// <param name="noSyncManager">Detemine if synchronization manager shoud be created. If true the <see cref="FileManager.syncManager"/> is null.</param>
 public FileManager(HomeData data, bool noSyncManager)
 {
     dataHolder = data;
     if (!noSyncManager)
     {
         syncManager = new Synchronization();
     }
 }
        /// <summary>
        /// Do all neseseary thinks to step in running network
        /// </summary>
        /// <returns></returns>
        public async Task ConnectingToNetwork(HomeData data)
        {
            //UdpClient listener = new UdpClient(Properties.Settings.Default.broadcastPort,AddressFamily.InterNetwork);
            UdpClient listener = new UdpClient();

            listener.Client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
            listener.EnableBroadcast       = true;
            listener.ExclusiveAddressUse   = false;
            listener.Client.ReceiveTimeout = 5000;
            listener.Client.Bind(new IPEndPoint(IPAddress.Any, Properties.Settings.Default.broadcastPort));
            while (!shouldEnd.IsCancellationRequested)
            {
                var    end  = new IPEndPoint(IPAddress.Any, 0);
                byte[] mess = new byte[0];
                try
                {
                    mess = listener.Receive(ref end);
                    string   m  = Communicator.coding.GetString(mess);
                    string[] mS = m.Split(new char[] { ';', '=' });
                    if (mS[0] == "v1.MFO.MFF.works.bubyx" && mS[1] == "id" && mS[3] == "ip" && mS[5] == "port")
                    {
                        int      port = int.Parse(mS[6]);
                        string[] ips  = mS[4].Split(new char[] { ',' });
                        for (int i = 0; i < ips.Length; i++)
                        {
                            try
                            {
                                var d = new MyDevice(0, device.Name, Communication.Network, "0", "0", "");
                                if (await TaskTryConnect(d, ips[i], port))//Zkusi navazat spojeni se zarizenim, pokud se zdari tak jej uvede do device
                                {
                                    Properties.Settings.Default.localDevId = d.Id;
                                    Properties.Settings.Default.Save();
                                    await downLoadStartFile(d.Connection, data);

                                    shouldEnd = new System.Threading.CancellationToken(true);

                                    Managers.Connections.logger.WriteLine("Connected to network");
                                    break;
                                }
                            }
                            catch (SocketException e) {
                            }
                            catch (FormatException e) {  }
                        }
                    }
                }
                catch (SocketException e)
                {
                    Managers.Connections.logger.WriteLine("Conection failed (will try again): {0} try", e);
                    listener.Send(new byte[] { 0 }, 0, new IPEndPoint(IPAddress.Broadcast, 12200)); //Zajisti ze funguje doma
                }
                catch (Exception e)                                                                 //vsechny chyby co se muzou vyskytnout krome nuceneho ukonceni prace
                {
                    Managers.Connections.logger.WriteLine("Conection failed (fatal): {0}", e);
                    throw;
                }
            }
        }
        public ActionResult Index()
        {
            var model = new HomeData();

            model.AppName  = this.AppName;
            model.MyTasks  = this.db.GetAllTasks();
            model.UserName = HttpContext.Request.QueryString["uname"] ?? "Anonymous User";
            return(View(model));
        }
Esempio n. 13
0
    private void Init()
    {
        PlayerHome = HomeData.GenerateRandom(1, 2, 15);
        EnemyHome  = HomeData.GenerateRandom(2, 2, 15);
        State      = GameState.MainMenu;
        Transition = SceneTransition.InScene;
        InitScene();

        SceneManager.sceneLoaded += OnSceneLoaded;
    }
Esempio n. 14
0
        public HomeData GetHmeDate()
        {
            HomeData homeData = new HomeData();

            homeData.ParentChildOne = Config["Parent:ChildOne"];
            homeData.ParentChildTwo = Config["Parent:ChildTwo"];


            return(homeData);
        }
Esempio n. 15
0
        public ActionResult DisplayFooter()
        {
            var Model = new HomeData
            {
                FooterText  = "This is not for copy",
                CompanyName = "LBI"
            };

            return(PartialView("_HomeData", Model));
        }
Esempio n. 16
0
        public HomeData SetHomeDataAwait()
        {
            HomeData homeData = new HomeData
            {
                ParentChildOne = Config["Parent:ChildOne"],
                ParentChildTwo = Config["Parent:ChildTwo"]
            };

            return(homeData);
        }
Esempio n. 17
0
        // GET: Home/Home
        public ActionResult Index()
        {
            HomeData  data  = new HomeData();
            HomeModel model = new HomeModel();

            data.Slides            = model.LaySlide();
            data.WhyUs             = model.GetWhyUs();
            data.Course            = model.GetCourse();
            data.NhungDieuDatDuocs = model.GetNhungDieuDatDuoc();
            return(View("Home", data));
        }
Esempio n. 18
0
 private void StartBattle()
 {
     BattleStatus       = BattleState.Active;
     battleSkillHandler = FindObjectOfType <BattleSkillHandler>();
     ui.ActivateBattleSkills(true);
     battleSkillHandler.Init();
     EnemyHome = HomeData.GenerateRandom(
         regionNum,
         Random.Range(2, regionNum + 2),
         Mathf.Min(60, 20 + 5 * regionNum));
     MusicPlayer.Instance.Play(1, true);
 }
Esempio n. 19
0
        private async Task <AXFContent> GetSingleDicData(string key)
        {
            HomeData hd = new HomeData();

            if (_dic.ContainsKey(key))
            {
                _dic[key] = await hd.GetSingleData((_dic[key].Id), key);

                return(_dic[key]);
            }
            return(null);
        }
Esempio n. 20
0
 public void Awake()
 {
     if (PlayerHome)
     {
         homeData = GameManager.Instance.PlayerHome;
         homeData.Prune();
     }
     else
     {
         homeData = GameManager.Instance.EnemyHome;
     }
 }
Esempio n. 21
0
        public async Task <IActionResult> SignUp(HomeData userModel)
        {
            if (!ModelState.IsValid)
            {
                return(View("Welcome"));
            }
            userModel.newUser.firstName = userModel.newUser.firstName.Trim();
            userModel.newUser.lastName  = userModel.newUser.lastName.Trim();
            userModel.newUser.Email     = userModel.newUser.Email.Trim();
            userModel.newUser.Password  = userModel.newUser.Password.Trim();
            var newUser = _dbContext.Users.SingleOrDefault(i => i.UEmail.Equals(userModel.newUser.Email));

            if (newUser != null)
            {
                return(View("Welcome"));
            }

            var hasher = new PasswordHasher <Users>();

            newUser = new Users
            {
                UId          = "U_" + Convert.ToString(_dbContext.Users.ToList().Count + 1),
                UEmail       = userModel.newUser.Email,
                UFirstName   = userModel.newUser.firstName,
                ULastName    = userModel.newUser.lastName,
                ULogIn       = DateTime.Today,
                USignUp      = DateTime.Today,
                UBirthDay    = userModel.newUser.birthDay + "-" + userModel.newUser.birthMonth + "-" + userModel.newUser.birthYear,
                Channel      = new List <Channel>(),
                Comment      = new List <Comment>(),
                FileReact    = new List <FileReact>(),
                RelationShip = new List <RelationShip>(),
            };
            newUser.UPassword = hasher.HashPassword(newUser, userModel.newUser.Password);

            var userImg = new UsersImg
            {
                UId  = newUser.UId,
                UImg = ImageConverter.convertToByte(userModel.newUser.Pic)
            };



            await _dbContext.Users.AddAsync(newUser);

            await _dbContext.UsersImg.AddAsync(userImg);

            await _dbContext.SaveChangesAsync();

            await LogInUserAsync(newUser.UId);

            return(RedirectToAction("MyFeed", "User"));
        }
Esempio n. 22
0
        /// <summary>
        /// Helper method to check options.
        /// </summary>
        /// <param name="app"></param>
        /// <returns>True if options are OK.</returns>
        private bool CheckOptions(CommandLineApplication app)
        {
            if (Property.Length > 0)
            {
                if (!HomeData.IsProperty(Property))
                {
                    _logger?.LogError($"The property '{Property}' has not been found.");
                    return(false);
                }
            }

            return(true);
        }
 public new void SetupTest()
 {
     _homePage = new HomePage(AutomatedBrowser.WebDriverInstance);
     _homeData = new HomeData();
     _resturantSelectionData  = new ResturantSelectionData();
     _resturantSelectionPage  = new ResturantSelectionPage(AutomatedBrowser.WebDriverInstance);
     _orderCreationPage       = new OrderCreationPage(AutomatedBrowser.WebDriverInstance);
     _orderCreationData       = new OrderCreationData();
     _paymentDetailsData      = new PaymentDetailsData();
     _paymentDetailsPage      = new PaymentDetailsPage(AutomatedBrowser.WebDriverInstance);
     _paymentConfirmationPage = new PaymentConfirmationPage(AutomatedBrowser.WebDriverInstance);
     _orderVerificationPage   = new OrderVerificationPage(AutomatedBrowser.WebDriverInstance);
 }
Esempio n. 24
0
        public async Task <IActionResult> GetHomeData()
        {
            HomeData homeData = new HomeData();
            User     user     = await _userService.GetUserByNameAsync(User.Identity.Name);

            if (null == user)
            {
                user = await _userService.SaveUser(User.Identity.Name);
            }

            homeData.PastMatches = (await _matchService.GetPastMatches(user.Id)).Select(m => {
                Result result = m.Result.SingleOrDefault(r => r.MatchId == m.Id && r.UserId == user.Id);
                return(new MatchData
                {
                    Team1Id = m.Team1Id,
                    Team2Id = m.Team2Id,
                    Team1 = m.Team1.Name,
                    Team2 = m.Team2.Name,
                    Goals1 = m.Team1Goals.GetValueOrDefault(),
                    Goals2 = m.Team2Goals.GetValueOrDefault(),
                    MatchTime = m.MatchTime,
                    Points = result != null ? result.PointsEarned.GetValueOrDefault():0,
                    Bet1 = result != null ? result.Team1Goals : (int?)null,
                    Bet2 = result != null ? result.Team2Goals : (int?)null,
                    IsPlaceHolder = false
                });
            }).ToList();
            homeData.NextMatches = (await _matchService.GetNextMatches(user.Id)).Select(m => {
                Result result       = m.Result.SingleOrDefault(r => r.MatchId == m.Id && r.UserId == user.Id);
                MatchData matchData = new MatchData
                {
                    Team1Id       = m.Team1Id,
                    Team2Id       = m.Team2Id,
                    Team1         = m.Team1.Name,
                    Team2         = m.Team2.Name,
                    Goals1        = m.Team1Goals.GetValueOrDefault(),
                    Goals2        = m.Team2Goals.GetValueOrDefault(),
                    MatchTime     = m.MatchTime,
                    Points        = result != null ? result.PointsEarned.GetValueOrDefault() : 0,
                    IsPlaceHolder = m.Team1.IsPlaceholder.GetValueOrDefault() || m.Team2.IsPlaceholder.GetValueOrDefault()
                };
                if (result != null)
                {
                    matchData.Bet1 = result.Team1Goals;
                    matchData.Bet2 = result.Team2Goals;
                }
                return(matchData);
            }).ToList();
            return(new OkObjectResult(homeData));
        }
        public void Execute(DomainModelMsSqlServerContext context)
        {
            _homeData = _commandDto.Payload.ToObject <HomeData>();
            if (_homeData.Id > 0)
            {
                _homeData.Deleted = false;
                context.HomeData.Update(_homeData);
            }
            else
            {
                context.HomeData.Add(_homeData);
            }

            _logger.LogDebug("Executed");
        }
        public TargetDeviceSelect(Classes.HomeData dat)
        {
            DialogResult = DialogResult.Cancel;
            data         = dat;
            InitializeComponent();
            ulong deviceId = Properties.Settings.Default.localDevId;

            foreach (var dev in dat.devices)
            {
                if (dev.Id != deviceId)
                {
                    listBox1.Items.Add(dev);
                }
            }
        }
Esempio n. 27
0
        public void Execute(DomainModelMsSqlServerContext context)
        {
            _previousHomeData = new HomeData();

            var homeData = _commandDto.Payload.ToObject <HomeData>();
            var entity   = context.HomeData.First(t => t.Id == homeData.Id);

            _previousHomeData.Name    = entity.Name;
            _previousHomeData.Deleted = entity.Deleted;
            _previousHomeData.Id      = entity.Id;

            entity.Name    = homeData.Name;
            entity.Deleted = homeData.Deleted;
            _logger.LogDebug("Executed");
        }
Esempio n. 28
0
    private void StartNewGame()
    {
        Debug.Log("New game started");
        regionNum = 1;
        money     = 0;
        score     = 0;
        ui.UpdateRegion(regionNum);
        ui.UpdateScore(score);

        PlayerHome = HomeData.GenerateRandom(2, 3, 50);
        home.Init(PlayerHome);
        InitInventory();

        gameRunning = true;
    }
        public JsonResult Data()
        {
            HomeData      homedata = new HomeData();
            List <String> contents = new List <string>();

            contents.Add("This mini-site is a demonstration of a [single-page application](http://en.wikipedia.org/wiki/Single-page_application) I am creating using AngularJS.");
            contents.Add("For a more complex page that illustrates responsive web design, see the [profiles](#/profiles) page.");
            contents.Add("I have listed a bunch of useful [resources](#/resources) I have found along the way.");
            contents.Add("And for further information describing technical capabilities this site illustrates, see [about](#/about).");
            contents.Add("**Note:** this is a work in progress.");

            homedata.markdownParagraphs = string.Join("</p><p>", contents);

            return(Json(homedata, JsonRequestBehavior.AllowGet));
        }
        /// <summary>
        /// Các điều hướng dành cho các trang liên quan đến Trang Bài viết
        /// Author       :   HaLTH - 24/06/2018 - create
        /// </summary>
        /// <remarks>
        /// Package      :   Home
        /// Copyright    :   Team Noname
        /// Version      :   1.0.0
        /// </remarks>
        public ActionResult ChiTietBaiViet(string BeautyId)
        {
            try
            {
                HomeData     data  = new HomeData();
                BaiVietModel model = new BaiVietModel();
                data.CacBaiViet = model.LoadBaiViet();

                return(View("BaiViet"));
            }
            catch (Exception e)
            {
                return(RedirectToAction("Error", "Error", new { area = "error", error = e.Message }));
            }
        }
Esempio n. 31
0
        void SignIn()
        {
            Console.Write ("email: ");
            var email = Console.ReadLine ();
            Console.Write ("password: ");
            var pwd = ReadPassword ();
            Console.WriteLine ();

            api = new Api ();
            data = api.SignIn (email, pwd);

            StreamCommand ();
        }