public MainFrame(User user) { User = user; Data = new SgllData(user); SgController = new SgllController(Data); MultipleUserCtl.RegisterController(user.GetMultiCtrlKey(), SgController); InitializeComponent(); }
public static void InsertUser(User user) { using (SgllEntities db = new SgllEntities()) { try { db.Users.Add(user); db.SaveChanges(); } catch (Exception) { } } }
public static void InsertOrUpdate(User user) { using (SgllEntities db = new SgllEntities()) { try { db.Entry(user).State = user.Id == 0 ? EntityState.Added : EntityState.Modified; db.SaveChanges(); } catch (Exception) { } } }
private void Btn_OK_Click(object sender, EventArgs e) { var role = txtRole.Text; if (string.IsNullOrEmpty(role)) { MessageBox.Show("角色不能为空!"); DialogResult = DialogResult.None; return; } if (User == null) { User = new User { CreateTime = DateTime.Now, Id = 0 }; } User.Account = txtAccount.Text; User.Password = txtPassword.Text; User.Role = role; User.Server = comboBoxServer.SelectedItem.ToString(); User.Description = txtDescription.Text; User.UpdateTime = DateTime.Now; }
public SgllData(User user) { this.User = user; }
private void newtab(User user) { // check if repeat login for (int i = 1; i < tabControl1.TabCount; i++) { if (!(tabControl1.TabPages[i].Controls[0] is MainFrame)) continue; MainFrame mf = tabControl1.TabPages[i].Controls[0] as MainFrame; if (mf.User.GetMultiCtrlKey() == user.GetMultiCtrlKey()) { textLog.AppendText(string.Format("[{0}][{1}] {2}{3}", DateTime.Now.ToString(), "Info", "重复登录" + user.GetMultiCtrlKey(), Environment.NewLine)); return; } } TabPage tp = new TabPage(); MainFrame uc1 = new MainFrame(user); uc1.TP = tp; uc1.Dock = DockStyle.Fill; tp.Controls.Add(uc1); tabControl1.TabPages.Add(tp); tabControl1.SelectTab(tp); uc1.Login(); }
string GetFeatureDisplayNames(User user) { // TODO show something return ""; }