internal void WhenAuthenticated(UserModel um) { UserController CntrlUS = DBControllersFactory.User(); var menu = CntrlUS.GetMenu(um); var megs = new Dictionary <string, TreeViewItem>(); foreach (var t in menu) { if (megs.ContainsKey(t.Item1) == false) { megs[t.Item1] = new TreeViewItem { Name = t.Item1, Header = t.Item1 }; Tree.Items.Add(megs[t.Item1]); } TreeViewItem mitem = new TreeViewItem { Name = t.Item3, Header = t.Item2 }; megs[t.Item1].Items.Add(mitem); if ("Word".Equals(mitem.Header)) { mitem.Foreground = Brushes.Red; mitem.MouseDoubleClick += (s, e) => { TabItem tabItem = new TabItem() { Content = new DictionaryUC() }; Tab.Items.Add(tabItem); tabItem.Header = "Word"; tabItem.IsSelected = true; }; } } }
private MainView() { InitializeComponent(); if (DesignMode || (Site != null && Site.DesignMode)) { return; } CntrlLG = DBControllersFactory.Language(); CntrlWD = DBControllersFactory.Word(); CntrlEG = DBControllersFactory.EntitlementGroup(); CntrlEN = DBControllersFactory.Entitlement(); CntrlET = DBControllersFactory.Entity(); CntrlPE = DBControllersFactory.ProfileEntitlement(); CntrlUS = DBControllersFactory.User(); }
private void Button_Click(object sender, RoutedEventArgs e) { UserModel um = new UserModel { UserName = txtUserName.Text, UserPassword = txtPassword.Password }; UserController controller = DBControllersFactory.User(); if (controller.Autheniticate(um) == null) { MessageBox.Show("Access Denied"); } else { //MessageBox.Show("Successful"); MainWindow.Instance.WhenAuthenticated(um); } }
protected void Page_Load(object sender, EventArgs e) { CntrlUS = DBControllersFactory.User(); CntrlPE = DBControllersFactory.ProfileEntitlement(); MVCHIS.Common.MVCHISSession.Instance.Initialize(); Login1.Visible = MVCHISSession.Instance.CurrentUser == null; //DictionaryUC1.Visible = false; Login1.GoClicked += (um) => { UserController uc = DBControllersFactory.User(); um = uc.Autheniticate(um); if (um == null) { ScriptManager.RegisterStartupScript(this, GetType(), "error", "alert('Login denied')", true); } else { WhenAuthenticated(um); } }; }
private void RequeryUsers() { lstUsers.LoadData("", DBControllersFactory.User().Select(new UserModel { ProfileId = Model.Id }, "UserName,FullName", false, "ProfileId"), "UserName", "FullName"); }