Exemplo n.º 1
0
            public override bool Do()
            {
                if (main.my_mutex != me)
                {
                    return(false);
                }


                ModifyUserForm modifyGameForm = new ModifyUserForm(main.showBoxMain1.SelectedValue.ToString());

                modifyGameForm.Show();

                return(true);
            }
Exemplo n.º 2
0
        public JsonResult ModifyUser(ModifyUserForm user)
        {
            var accID = int.Parse(User.Identity.Name);
            var acc   = new AccountDao().FindAccountById(accID);
            var check = new UserDao().ModifyUserBasic(acc.UserId, user);

            if (check)
            {
                return(Json(new
                {
                    status = true
                }));
            }
            return(Json(new
            {
                status = false
            }));
        }
Exemplo n.º 3
0
 public bool ModifyUser(Guid userId, ModifyUserForm user)
 {
     try
     {
         var userModify = db.Users.Find(userId);
         userModify.UserName     = user.userName;
         userModify.UserBirthDay = DateTime.ParseExact(user.userDob, "dd/MM/yyyy", CultureInfo.InvariantCulture);
         userModify.UserEmail    = user.userEmail;
         userModify.UserArea     = user.userArea;
         userModify.UserMobile   = user.userMobile;
         userModify.Sex          = user.userGender;
         if (user.userAddress != null && user.userAddress != "")
         {
             userModify.UserAddress = user.userAddress;
         }
         db.SaveChanges();
         return(true);
     }
     catch (Exception e)
     {
         return(false);
     }
 }
Exemplo n.º 4
0
        private void DrawUsers()
        {
            groupBoxUsers.Controls.Clear();
            using (UserContainer db = new UserContainer())
            {
                foreach (User user in db.UserSet)
                {
                    var   controller = new UserController(user);
                    Panel panel      = new Panel()
                    {
                        Dock        = DockStyle.Top,
                        Height      = 50,
                        BorderStyle = BorderStyle.FixedSingle,
                    };
                    Label login = new Label()
                    {
                        Dock  = DockStyle.Left,
                        Width = 150,
                        Text  = user.Login,
                        Font  = new Font("Verdana", 10.0f),
                    };

                    Label role = new Label()
                    {
                        Dock  = DockStyle.Left,
                        Text  = user.Role,
                        Font  = new Font("Verdana", 10.0f),
                        Width = 150,
                    };
                    Label id = new Label()
                    {
                        Dock  = DockStyle.Left,
                        Text  = user.Id.ToString(),
                        Font  = new Font("Verdana", 10.0f),
                        Width = 50,
                    };

                    Button changeButton = new Button()
                    {
                        Text      = "изменить",
                        ForeColor = Color.White,
                        Font      = new Font("Verdana", 10.0f),
                        BackColor = Color.LightGreen,
                        Dock      = DockStyle.Right,
                        FlatStyle = FlatStyle.Flat,
                        Size      = new Size(100, 10),
                    };

                    Button deleteButton = new Button()
                    {
                        Text      = "удалить",
                        ForeColor = Color.White,
                        Font      = new Font("Verdana", 10.0f),
                        BackColor = Color.DarkRed,
                        Dock      = DockStyle.Right,
                        FlatStyle = FlatStyle.Flat,
                        Size      = new Size(100, 10),
                    };
                    deleteButton.Click += controller.Delete;
                    deleteButton.Click += this.DrawUsers;

                    void change(object s, EventArgs e)
                    {
                        ModifyUserForm form           = new ModifyUserForm(controller);
                        StandaloneView standaloneView = new StandaloneView(this, form);

                        standaloneView.Show();
                    }

                    changeButton.Click += change;
                    changeButton.Click += DrawUsers;

                    panel.Controls.Add(changeButton);
                    panel.Controls.Add(deleteButton);
                    panel.Controls.Add(id);
                    panel.Controls.Add(role);
                    panel.Controls.Add(login);

                    groupBoxUsers.Controls.Add(panel);
                }
            }
        }