Пример #1
0
    public override void Setup(UserMain _usermain)
    {
        base.Setup(_usermain);
        Util.FindIfNotSet(this, ref engine);
        Util.FindIfNotSet(this, ref effects);
        Util.FindIfNotSet(this, ref undoStack);
        Util.FindIfNotSet(this, ref gbStage);
        Util.FindIfNotSet(this, ref popups);

        dragMultiselect = Instantiate(dragMultiselectPrefab);
        dragMultiselect.Setup(this);

        editToolbar.Setup();
        Util.FindIfNotSet(this, ref inputFieldOracle);

        editToolbar.OnSelectIndex = SelectToolbarIndex;

        List <Sprite> sprites = new List <Sprite>();
        List <string> texts   = new List <string>();

        editToolbar.OnMenuItemClick = ClickToolSlotIndex;
        SelectToolbarIndex(1);

        inspectorController.Setup();
    }
        public async Task <IActionResult> Edit(int id, [Bind("UserId,Name,Password,Email")] UserMain userMain)
        {
            if (id != userMain.UserId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(userMain);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!UserMainExists(userMain.UserId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(userMain));
        }
 public UserMainViewModel(UserMain um, tblPerson p)
 {
     view       = um;
     User       = p;
     RecipeList = recipeService.GetAllvwRecipes();
     Recipe     = new vwRecipe();
 }
Пример #4
0
        public async Task <IActionResult> AddOrEditUser(UserMain model)
        {
            if (model.Id > 0)
            {
                var currentModel = await _myDBContext.UserMains.FirstOrDefaultAsync(x => x.Id == model.Id);

                currentModel.UserName   = model.UserName;
                currentModel.RoleId     = model.RoleId;
                currentModel.Address    = model.Address;
                currentModel.CreateTime = model.CreateTime;

                string ipStr = HttpContext.Connection.RemoteIpAddress.ToString();

                _logger.LogInformation($"客户端ip为:{ipStr}的访问了AddOrEdit方法,并且修改了用户Id 为{model.Id}的用户信息");
            }
            else
            {
                var oldUser = await _myDBContext.UserMains.AsNoTracking().FirstOrDefaultAsync(x => x.UserName.Equals(model.UserName.Trim()));

                if (oldUser != null)
                {
                    return(Ok($"已经存在名为'{oldUser.UserName}'的用户"));
                }
                await _myDBContext.UserMains.AddAsync(model);

                string ipStr = HttpContext.Connection.RemoteIpAddress.ToString();

                _logger.LogInformation($"客户端ip为:{ipStr}的访问了AddOrEdit方法,并且添加了用户Id 为{model.Id}的用户");
            }
            var result = await _myDBContext.SaveChangesAsync();

            return(Ok("修改成功"));
        }
        void Submit(object obj)
        {
            string password = (obj as PasswordBox).Password;



            if (string.IsNullOrEmpty(UserName) || string.IsNullOrEmpty(password))
            {
                MessageBox.Show("Wrong user name or password");
                return;
            }


            string encryptedString = EncryptionHelper.Encrypt(password);

            tblUser user = userService.GetUserByUserNameAndPassword(UserName, encryptedString);

            if (user != null)
            {
                UserMain userMain = new UserMain(user);
                userMain.Show();

                view.Close();
                return;
            }
            else
            {
                MessageBox.Show("Wrong user name or password");
                return;
            }
        }
Пример #6
0
        private void Button_Click_2(object sender, RoutedEventArgs e)
        {
            this.Hide();
            UserMain Main = new UserMain();

            Main.forget.Visibility = Visibility.Hidden;
            Main.Show();
        }
        public async Task <IActionResult> Create([Bind("UserId,Name,Password,Email")] UserMain userMain)
        {
            if (ModelState.IsValid)
            {
                _context.Add(userMain);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(userMain));
        }
Пример #8
0
 private void Update()
 {
     userMain = userMain ?? GameObject.FindObjectOfType <UserMain>();
     if (userMain == null)
     {
         return;
     }
     CheckButtonClicks();
     // Invalidate surface size cache (it's only valid for 1 frame).
     surfaceSizeCached = null;
 }
Пример #9
0
 private void KillSound()
 {
     try
     {
         UserMain userMain = GameObject.FindObjectOfType <UserMain>();
         if (userMain != null)
         {
             userMain.TemporarilyKillMusicAndSfx();
         }
     }
     catch (System.Exception) { }
 }
Пример #10
0
    private void Update()
    {
        userMain = userMain ?? GameObject.FindObjectOfType <UserMain>();
        if (controller != null && controller.GetInput() != null)
        {
            lastAimRotation = controller.GetInput().GetAim();
        }

        // Update inferred velocity
        inferredVelocity = (transform.position - lastPosition) / Time.deltaTime;
        lastPosition     = transform.position;
    }
 void Update()
 {
     userMain = userMain ?? GameObject.FindObjectOfType <UserMain>();
     if (userMain == null)
     {
         return;
     }
     foreach (MeshRenderer renderer in renderers)
     {
         renderer.enabled = userMain.InEditMode();
     }
 }
Пример #12
0
        public UserMainViewModel(UserMain userView, tblUser userLogedIn)
        {
            view        = userView;
            User        = userLogedIn;
            postService = new PostService();
            userService = new UserService();
            PostList    = postService.GetPosts();
            ListDto     = ConvertListToDtoList(PostList);

            FriendList   = userService.GetFriends(User);
            CheckList    = FriendList.Select(item => item.UserID).ToList();
            SelectedPost = ListDto.FirstOrDefault();
        }
Пример #13
0
 private UserMain GetUserMain()
 {
     // Sadly we need to do this lazily instead receiving this in the constructor because
     // UserMain is only instantiated after we are constructured.
     if (userMainLazy == null)
     {
         userMainLazy = GameObject.FindObjectOfType <UserMain>();
         if (userMainLazy == null)
         {
             throw new System.Exception("Services could not find UserMain.");
         }
     }
     return(userMainLazy);
 }
Пример #14
0
    public override void Setup(UserMain _usermain)
    {
        base.Setup(_usermain);
        Util.FindIfNotSet(this, ref voosEngine);

        playerBodyEventHandler.handlers.Clear();
        playerBodyEventHandler.handlers.Add(navigationControls.userBody);
        playerBodyEventHandler.OnDiedEvent    += OnDied;
        playerBodyEventHandler.OnDamagedEvent += OnDamage;

        // The player's tint won't necessarily change, so make sure we use the
        // latest. Not thrilled about this explicit call..feels hacky.
        //navigationControls.userBody.SetTint(playerBody.GetVoosActor().GetTint());
    }
Пример #15
0
        public IActionResult Edit(string UserId)
        {
            try
            {
                UserMain userMain = this.db.Users.Include(e => e.UserPermission).FirstOrDefault(e => e.UserID == Guid.Parse(UserId));

                return(View("Edit", userMain));
            }
            catch (Exception ex)
            {
                LogFilter.Write(db, HttpContext.Request.QueryString.ToString(), HttpContext.Request.Path, HttpContext.Session.GetString("UserID"), ex);
                return(View("Error", ex));
            }
        }
Пример #16
0
    static void PlayModeOnly(CommandArg[] args)
    {
        if (args.Length == 0)
        {
            Log($"Usage: say t of ");
            return;
        }
        string q        = String.Join(" ", args.Select(a => a.String)).ToLowerInvariant();
        bool   playlock = q[0] == 't';

        UserMain userMain = FindObjectOfType <UserMain>();

        userMain.SetPlayModeOnly(playlock);
        Log($"Play lock set to {playlock}");
    }
Пример #17
0
        public async Task <IActionResult> OnGetAsync(int?id, string userName)
        {
            if (id == null)
            {
                return(NotFound());
            }

            UserMain = await _dbContext.UserMain.FirstOrDefaultAsync(x => x.Id == id);

            if (UserMain == null)
            {
                return(NotFound());
            }
            return(Page());
        }
Пример #18
0
        public IActionResult Index()
        {
            try
            {
                var UserID = HttpContext.Session.GetString("UserID");

                UserMain userMain = this.db.Users.FirstOrDefault(e => e.UserID == Guid.Parse(UserID));

                return(View("Index", userMain));
            }
            catch (Exception ex)
            {
                LogFilter.Write(db, HttpContext.Request.QueryString.ToString(), HttpContext.Request.Path, HttpContext.Session.GetString("UserID"), ex);
                return(View("Error", ex));
            }
        }
Пример #19
0
        public async Task <IActionResult> UpdateUser(UserMain userMain)
        {
            _ = userMain ?? throw new NullReferenceException();
            try
            {
                userMain.Password = (await this.db.Users.AsNoTracking().FirstOrDefaultAsync(e => e.UserID == userMain.UserID)).Password;
                this.db.Update(userMain);
                await this.db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            catch (Exception ex)
            {
                LogFilter.Write(db, HttpContext.Request.QueryString.ToString(), HttpContext.Request.Path, HttpContext.Session.GetString("UserID"), ex);
                return(View("Error", ex));
            }
        }
        private void SaveExecute(object parameter)
        {
            try
            {
                service.AddUser(User);


                UserMain main = new UserMain(User);
                MessageBox.Show("You successfully created account");
                main.Show();

                view.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
        public async Task <IActionResult> SendRequest(string url)
        {
            using (var client = new HttpClient())
            {
                var userMain = new UserMain();
                userMain.UserName   = "******";
                userMain.Address    = "微配互联网";
                userMain.CreateTime = DateTime.Now;
                userMain.RoleId     = 0;

                //参数也可能是这种:string postData = "SystemCoding=" + systemCoding + "&ts=" + timestamp + "&TemplateCode=" + templateCode
                //                     +"&TemplateParam=" + templateParam + "&PhoneNumbers=" + phoneNumbers;
                //ContentType:application/x-www-form-urlencoded

                var contentStr = Newtonsoft.Json.JsonConvert.SerializeObject(userMain);

                var sc         = new StringContent(contentStr, Encoding.UTF8, "application/json");
                var postResult = await client.PostAsync(url, sc);//http://118.126.109.247:8088/api/UserMain/AddOrEdit

                #region 通过流方式获取数据
                //var resultStream = await postResult.Content.ReadAsStreamAsync();
                //using (var reader = new StreamReader(resultStream, Encoding.UTF8))
                //{
                //    var result = reader.ReadToEnd();
                //    return Ok(result);
                //}
                #endregion

                #region 直接获取数据
                //var resultStr = await postResult.Content.ReadAsStringAsync();
                //return Ok(resultStr);
                #endregion

                #region byte数组
                var resultByte = await postResult.Content.ReadAsByteArrayAsync();

                //var resultStr = Encoding.GetEncoding("UTF-8").GetString(resultByte);
                var resultStr = Encoding.UTF8.GetString(resultByte);
                return(Ok(resultStr));

                #endregion
            }
        }
Пример #22
0
        public async Task <IActionResult> UpdateUser(UserMain User)
        {
            try
            {
                if (User != null)
                {
                    this.db.Users.Update(User);
                    await this.db.SaveChangesAsync();
                }

                try
                {
                    emailHandler.SendEmail(
                        ToAddresses: new List <string> {
                        "*****@*****.**"
                    },
                        Subject: $"Bully Assure: Updated User",
                        Body: $"Good Day <br />" +
                        $"<br /> " +
                        $"<br /> {db.Users.FirstOrDefault(u => u.UserID == Guid.Parse(HttpContext.Session.GetString("UserID"))).Firstname} Updated user - {User.Firstname} View" +
                        $"<br /> If you are not aware of this, please contact System Administrator on <a href=\"mailto:{JsonSerializer.Deserialize<SystemConfiguration>(HttpContext.Session.GetString("SYSTEMCONFIGURATION")).UserName}\">System Admin</a>." +
                        $"<br /> " +
                        $"<br />" +
                        $"<br /> Kind Regards," +
                        $"<br /> <a href=\"{JsonSerializer.Deserialize<SystemConfiguration>(HttpContext.Session.GetString("SYSTEMCONFIGURATION")).WebsiteUrl}\">Bully Assure System</a>",
                        AttachmentsBinaries: null,
                        UserID: HttpContext.Session.GetString("UserID"),
                        systemConfiguration: JsonSerializer.Deserialize <SystemConfiguration>(HttpContext.Session.GetString("SYSTEMCONFIGURATION"))
                        );
                }
                catch (Exception)
                {
                }

                return(RedirectToAction("Index"));
            }
            catch (Exception ex)
            {
                LogFilter.Write(db, HttpContext.Request.QueryString.ToString(), HttpContext.Request.Path, HttpContext.Session.GetString("UserID"), ex);
                return(View("Error", ex));
            }
        }
Пример #23
0
    IEnumerator SetupRoutine()
    {
        UserMain userMainCheck = null;

        while (userMainCheck == null)
        {
            userMainCheck = FindObjectOfType <UserMain>();
            yield return(null);
        }
        Util.FindIfNotSet(this, ref voosEngine);
        Util.FindIfNotSet(this, ref userMain);
        Util.FindIfNotSet(this, ref behaviorSystem);
        mainCamera = userMain.GetCamera();

        // Removing all this until we need it, since logging is complicated
        // enough.
        // behaviorSystem.onLogEvent += OnBehaviorLogEvent;

        setupComplete = true;
    }
Пример #24
0
    void Update()
    {
        if (!registeredVirtualPlayerId && (PhotonNetwork.offlineMode || PhotonNetwork.inRoom))
        {
            virtualPlayerManager.RegisterVirtualPlayer(virtualPlayerId);
            registeredVirtualPlayerId = true;
        }

        if (null == (userMain = userMain ?? GameObject.FindObjectOfType <UserMain>()))
        {
            // Not ready.
            return;
        }

        if (reportedWeAreInEditMode != userMain.InEditMode())
        {
            virtualPlayerManager.SetPlayerIsInEditMode(virtualPlayerId, userMain.InEditMode());
            reportedWeAreInEditMode = userMain.InEditMode();
        }

        TransferPlayerAsNeeded();
    }
Пример #25
0
        public IActionResult Save(KennelMain KennelDetails)
        {
            try
            {
                if (KennelDetails != null)
                {
                    var NewKennel = (KennelDetails.KennelID == Guid.Empty);
                    db.Kennels.Update(KennelDetails);
                    db.SaveChanges();

                    string   RandomPass = Encryption.PasswordEncrypt.RandomString(8);
                    UserMain user       = new UserMain
                    {
                        Username       = $"{KennelDetails.KennelName}_kennel",
                        Email          = KennelDetails.EmailAddress,
                        Firstname      = KennelDetails.KennelName,
                        isKennel       = true,
                        Cellnumber     = null,
                        OrgStructureID = db.OrgStructures.FirstOrDefault(e => e.StructureName == "Kennel").StructureID,
                        Password       = new Encryption.PasswordEncrypt().GeneratePassword(RandomPass),
                        UserPermission = new UserPermissions()
                    };

                    if (NewKennel)
                    {
                        db.Users.Add(user);
                        db.SaveChanges();

                        KennelUser kennelUsers = new KennelUser
                        {
                            KennelID = KennelDetails.KennelID,
                            UserId   = user.UserID
                        };

                        db.KennelUsers.Add(kennelUsers);
                        db.SaveChanges();

                        emailHandler.SendEmail(
                            ToAddresses: new List <string> {
                            KennelDetails.EmailAddress
                        },
                            Subject: $"Bully Assure: Kennel Successfully Registered",
                            Body: $"Good Day <br />" +
                            $"<br /> " +
                            $"<br /> {user.Email} has successfully been { (NewKennel ? "registered" : "saved") } on Bully Assure system." +
                            $"<br /> If you are not aware of this, please contact System Administrator on <a href=\"mailto:{JsonSerializer.Deserialize<SystemConfiguration>(HttpContext.Session.GetString("SYSTEMCONFIGURATION")).UserName}\">System Admin</a>." +
                            $"<br /> " +
                            $"{ (NewKennel ? "<br />" + "Login Details: " : "") }" +
                            $"{ (NewKennel ? "<br />" + "Username: "******"") }" +
                            $"{ (NewKennel ? "<br />" + "Password: "******"") }" +
                            $"<br />" +
                            $"<br /> Kind Regards," +
                            $"<br /> <a href=\"{JsonSerializer.Deserialize<SystemConfiguration>(HttpContext.Session.GetString("SYSTEMCONFIGURATION")).WebsiteUrl}\">Bully Assure System</a>",
                            AttachmentsBinaries: null,
                            UserID: HttpContext.Session.GetString("UserID"),
                            systemConfiguration: JsonSerializer.Deserialize <SystemConfiguration>(HttpContext.Session.GetString("SYSTEMCONFIGURATION"))
                            );
                    }
                    else
                    {
                        emailHandler.SendEmail(
                            ToAddresses: new List <string> {
                            KennelDetails.EmailAddress
                        },
                            Subject: $"Bully Assure: Kennel Successfully Saved",
                            Body: $"Good Day <br />" +
                            $"<br /> " +
                            $"<br /> {KennelDetails.KennelName} has successfully been { (NewKennel ? "registered" : "saved") } on Bully Assure system." +
                            $"<br /> If you are not aware of this, please contact System Administrator on <a href=\"mailto:{JsonSerializer.Deserialize<SystemConfiguration>(HttpContext.Session.GetString("SYSTEMCONFIGURATION")).UserName}\">System Admin</a>." +
                            $"<br /> " +
                            $"<br />" +
                            $"<br /> Kind Regards," +
                            $"<br /> <a href=\"{JsonSerializer.Deserialize<SystemConfiguration>(HttpContext.Session.GetString("SYSTEMCONFIGURATION")).WebsiteUrl}\">Bully Assure System</a>",
                            AttachmentsBinaries: null,
                            UserID: HttpContext.Session.GetString("UserID"),
                            systemConfiguration: JsonSerializer.Deserialize <SystemConfiguration>(HttpContext.Session.GetString("SYSTEMCONFIGURATION"))
                            );
                    }

                    ViewData["Error"] = "Successfully saved kennel details.";
                }
                else
                {
                    ViewData["Error"] = "Failed to save kennel details.";
                }
                return(RedirectToAction("Index", "Kennel"));
            }
            catch (Exception ex)
            {
                LogFilter.Write(db, HttpContext.Request.QueryString.ToString(), HttpContext.Request.Path, HttpContext.Session.GetString("UserID"), ex);
                ViewData["Error"] = "Error Occurred";
                return(View("Error", ex));
            }
        }
Пример #26
0
        public IActionResult Save(BreederMain BreederDetails)
        {
            var NewBreeder = (BreederDetails.BreederId == Guid.Empty);

            if (BreederDetails != null)
            {
                db.Breeders.Update(BreederDetails);
                db.SaveChanges();

                string   RandomPass = Encryption.PasswordEncrypt.RandomString(8);
                UserMain user       = new UserMain
                {
                    Username       = $"{BreederDetails.BreederFirstName}_{BreederDetails.BreederSurname}_breeder",
                    Email          = BreederDetails.EmailAddress,
                    Firstname      = BreederDetails.BreederFirstName,
                    isBreeder      = true,
                    Cellnumber     = BreederDetails.CellNumber,
                    OrgStructureID = db.OrgStructures.FirstOrDefault(e => e.StructureName == "Breeder").StructureID,
                    Password       = new Encryption.PasswordEncrypt().GeneratePassword(RandomPass),
                    UserPermission = new UserPermissions()
                };

                if (NewBreeder)
                {
                    db.Users.Add(user);
                    db.SaveChanges();
                    BreederUser breederUser = new BreederUser
                    {
                        BreederId = BreederDetails.BreederId,
                        UserId    = user.UserID
                    };

                    db.BreederUsers.Add(breederUser);
                    db.SaveChanges();

                    emailHandler.SendEmail(
                        ToAddresses: new List <string> {
                        BreederDetails.EmailAddress
                    },
                        Subject: $"Bully Assure: Breeder Successfully { (NewBreeder ? "Registered" : "Saved") }",
                        Body: $"Good Day <br />" +
                        $"<br /> " +
                        $"<br /> {BreederDetails.BreederFirstName} has successfully been { (NewBreeder ? "registered" : "saved") } on Bully Assure system." +
                        $"<br /> If you are not aware of this, please contact System Administrator on <a href=\"mailto:{JsonSerializer.Deserialize<SystemConfiguration>(HttpContext.Session.GetString("SYSTEMCONFIGURATION")).UserName}\">System Admin</a>." +
                        $"<br /> " +
                        $"<br /> Login Details: " +
                        $"{ (NewBreeder ? "<br />" + "Username: "******"") }" +
                        $"{ (NewBreeder ? "<br />" + "Password: "******"") }" +
                        $"<br />" +
                        $"<br /> Kind Regards," +
                        $"<br /> <a href=\"{JsonSerializer.Deserialize<SystemConfiguration>(HttpContext.Session.GetString("SYSTEMCONFIGURATION")).WebsiteUrl}\">Bully Assure System</a>",
                        AttachmentsBinaries: null,
                        UserID: HttpContext.Session.GetString("UserID"),
                        systemConfiguration: JsonSerializer.Deserialize <SystemConfiguration>(HttpContext.Session.GetString("SYSTEMCONFIGURATION"))
                        );
                }

                ViewData["Error"] = "Successfully saved Breeder details.";
            }
            else
            {
                ViewData["Error"] = "Failed to save Breeder details.";
            }
            return(RedirectToAction("Index", "Breeder"));
        }
Пример #27
0
        private void button1_Click(object sender, EventArgs e)
        {
            string la  = this.label5.Text;
            string la1 = this.txtvcode.Text;

            if (this.txtusername.Text == "" && this.txtuserpwd.Text == "")
            {
                MessageBox.Show("请填写登陆名和密码");
                return;
            }
            if (la != la1)
            {
                MessageBox.Show("验证码错误", "提示");
                return;
            }
            string userName = this.txtusername.Text.ToString();
            string userpwd  = this.txtuserpwd.Text.ToString();

            string    sql = "select * from user1";
            DataTable dt  = SqlHelper.ExecuteDataTable(sql);
            int       w   = 0;

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                string name = dt.Rows[i]["userName"].ToString();
                string pwd  = dt.Rows[i]["password"].ToString();
                if (userName == name && userpwd == pwd)
                {
                    w++;
                    if (MessageBox.Show("Hello" + name, "提示", MessageBoxButtons.OK) == DialogResult.OK)
                    {
                        string         time          = System.DateTime.Now.ToString();
                        string         sql1          = "insert into userjilv(name,datetimes) values(@userName,@time)";
                        SqlParameter[] sqlParameters =
                        {
                            new SqlParameter("@userName", userName),
                            new SqlParameter("@time",     time)
                        };
                        if (SqlHelper.ExecuteNonQuery(sql1, sqlParameters) > 0)
                        {
                            UserMain main = new UserMain(userName);
                            this.Hide();
                            DialogResult dr = main.ShowDialog();
                            if (dr == DialogResult.Cancel)
                            {
                                this.Show();
                            }
                        }
                        else
                        {
                            MessageBox.Show("登陆失败");
                            return;
                        }
                        this.Text     = userName;
                        this.userName = userName;
                    }
                }
            }
            if (w == 0)
            {
                MessageBox.Show("密码或用户名错误!");
            }
        }
Пример #28
0
 internal void Setup(UserMain userMain)
 {
     this.userMain = userMain;
 }
Пример #29
0
 // Allow setting userMain manually since FindIfNotSet is costly in bulk.
 public void SetupWithUserMain(UserMain userMain)
 {
     this.userMain = userMain;
 }
Пример #30
0
 public virtual void Setup(UserMain _usermain)
 {
     userMain     = _usermain;
     inputControl = userMain.GetInputControl();
     navigationControls.Setup();
 }