/********************************** Constructor **********************************/ public AdminUserForm(UserController parent, Point loc) { InitializeComponent(); SetLoc(loc); my_controller = parent; SetFields(MFranchise.GetThis()); if (string.Equals(MFranchise.isFranchisor(), "true", StringComparison.OrdinalIgnoreCase)) { hqCol.Visible = true; UserGridView.Width += hqCol.Width; this.Width += hqCol.Width; addUserButton.Location = new Point(addUserButton.Location.X + hqCol.Width, addUserButton.Location.Y); BAddrGridView.Location = new Point(BAddrGridView.Location.X + hqCol.Width, BAddrGridView.Location.Y); AddAddrButton.Location = new Point(AddAddrButton.Location.X + hqCol.Width, AddAddrButton.Location.Y); label6.Location = new Point(label6.Location.X + hqCol.Width, label6.Location.Y); } UserGridView.CellContentClick += new DataGridViewCellEventHandler(my_controller.UserGridViewClick); BAddrGridView.CellContentClick += new DataGridViewCellEventHandler(my_controller.BAddrGridViewClick); SaveBtn.Click += new EventHandler(my_controller.SaveBtn_Click); foreach (Control c in this.Controls) { try { c.TextChanged += new EventHandler(somethingChanged); } catch (Exception) { } } noChanges = true; }
public UserController(MaintainUsersForm child, int usrID, int profilePictureID) { userID = usrID; _user = new MUser(userID); picID = profilePictureID; _userForm = child; if (userID == 1) { _user.giveAdmin(); _user.SetHQ(MFranchise.isFranchisor()); } String[] loc = _user.GetLocation(); if (loc[0] != "0") { _userForm.InitializeCombos(loc[0], loc[1], loc[2]); } else { String[] op = MFranchise.GetOpReg(); _userForm.InitializeCombos(op[2], op[3], op[4]); } LoadUserPic(); _userForm.SetButtons(_user.IsAdmin(), _user.IsHQ()); _userForm.SetFields(_user.Get()); /*try { _userForm.SetFields(_user.Get()); } * catch (Exception) { MessageBox.Show("Failed to load User"); _userForm.Close(); }*/ }