示例#1
0
 public MainFrame(User user)
 {
     User = user;
     Data = new SgllData(user);
     SgController = new SgllController(Data);
     MultipleUserCtl.RegisterController(user.GetMultiCtrlKey(), SgController);
     InitializeComponent();
 }
示例#2
0
 public static void InsertUser(User user)
 {
     using (SgllEntities db = new SgllEntities())
     {
         try
         {
             db.Users.Add(user);
             db.SaveChanges();
         }
         catch (Exception)
         {
         }
     }
 }
示例#3
0
 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)
         {
         }
     }
 }
示例#4
0
        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;
        }
示例#5
0
文件: SgllData.cs 项目: juniwang/rasg
 public SgllData(User user)
 {
     this.User = user;
 }
示例#6
0
文件: MainForm.cs 项目: juniwang/rasg
        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();
        }
示例#7
0
文件: MainForm.cs 项目: juniwang/rasg
 string GetFeatureDisplayNames(User user)
 {
     // TODO show something
     return "";
 }