public Channel(Server parent, string name) { Server = parent; Name = name; Users = new UserList(); }
public static void Main(string[] args) { //a_admin = new Admin(); a_proxy = new Proxy(); a_userList = new UserList(); a_topicList = new TopicList(); new GUILogin(); }
/// <summary> /// Initializes the controller with a given UserList to control and /// sets up the event handlers. /// </summary> /// <param name="users">The user list to control.</param> public void Initialize(UserList users) { _users = users; ConnectionCallback.Instance.UserSignInEvent += OnUserSignIn; ConnectionCallback.Instance.UserSignOutEvent += OnUserSignOut; MainWindow main = App.Current.MainWindow as MainWindow; if (main != null) main.Disconnected += UsersController_Disconnected; }
public ListProfile(XmlElement element) : base(element) { Users = new UserList(); foreach (XmlElement child in element.GetElementsByTagName("user")) { Users.Add(new User(child)); } }
protected void Page_Load(object sender, EventArgs e) { UserList ul = new UserList(Server.MapPath("~/App_Data/")); if (!Page.IsPostBack) { GetUsers(ul); StatusLabel.Text = "Users Loaded:" + ul.USrs.Count.ToString(); } }
public UserProvider(IChatHubService chatHubService) { _chatHubService = chatHubService; Users = new UserList(); Users.OnAdd += Users_OnAdd; Users.OnRemove += Users_OnRemove; var disconnectedUserTask = new Task(CheckAlive); disconnectedUserTask.Start(); }
public bool Check(string uri,string authorization,ref string authName) { //�F���X�g var authList = new AuthList((Dat)_conf.Get("authList")); //�F���X�g�Ƀq�b�g���Ă��邩�ǂ����̊m�F var oneAuth = authList.Search(uri); if (oneAuth == null) return true;//�F���X�g�Ƀq�b�g�Ȃ� //���M����Ă����F�؏��i���[�U�{�p�X���[�h�j�̎擾 var user = ""; var pass = ""; if (!CheckHeader(authorization, ref user, ref pass)) goto err; //�F���X�g�iAuthList�j�ɓ��Y���[�U�̒�`�����݂��邩�ǂ��� if (!oneAuth.Seartch(user)) { var find = false;//�O���[�v���X�g���烆�[�U�������ł��邩�ǂ��� //�F���X�g�Œ��ڃ��[�U����������Ȃ������ꍇ�A�O���[�v���X�g��������� //�O���[�v���X�g var groupList = new GroupList((Dat)_conf.Get("groupList")); foreach (OneGroup o in groupList){ if (!oneAuth.Seartch(o.Group)) continue; if (!o.Seartch(user)) continue; find = true;//�ꉞ���[�U�Ƃ��ĔF�߂��Ă��� break; } if (!find) { _logger.Set(LogKind.Secure,null,6, string.Format("user:{0} pass:{1}", user, pass));//�F�G���[�i�F���X�g�ɒ�`����Ă��Ȃ����[�U����̃A�N�Z�X�ł��j"; goto err; } } //�p�X���[�h�̊m�F var userList = new UserList((Dat)_conf.Get("userList")); var oneUser = userList.Search(user); if (oneUser == null) { //���[�U���X�g�ɏ���݂��Ȃ� _logger.Set(LogKind.Secure,null,7,string.Format("user:{0} pass:{1}", user, pass));//�F�G���[�i���[�U���X�g�ɓ��Y���[�U�̏����܂���j"; } else { if (oneUser.Pass == pass) {//�p�X���[�h��v _logger.Set(LogKind.Detail,null, 8,string.Format("Authrization success user:{0} pass:{1}", user, pass));//�F�ؐ��� return true; } //�p�X���[�h�s��v _logger.Set(LogKind.Secure,null,9,string.Format("user:{0} pass:{1}", user, pass));//�F�G���[�i�p�X���[�h���Ⴂ�܂��j"; } err: authName = oneAuth.AuthName; return false;//�F�G���[���� }
private void AddUser(UserList usrs, RRSUser u) { string encPwd = Helper.EncryptString(u.Pwd); string decPwd = Helper.DecryptString(encPwd); int uix = usrs.GetUserIndex(u.User); PSUser n = new PSUser(); n.RUser = u.User; n.RPwd = u.Pwd; n.PSUserIds = null; if (uix < 0) // not found { usrs.AddUser(n); addCnt++; } else { usrs.UpdateUser(n); updCnt++; } }
public SyncState(long ssid) { _watchedDrivers = new Dictionary<int, int>(); _liveStatus = new Dictionary<int, bool>(); _penalties = new List<Penalty>(); _events = new List<ReplayEvent>(); _offtrackHistories = new Dictionary<int, List<Offtrack>>(); _users = new UserList(); this.SubsessionId = ssid; this.OfftrackLimit = Properties.Settings.Default.OfftrackLimit; }
/// <summary> /// Gets the list of sub editors and their details and inserts the /// XML representation into this form object. /// </summary> /// <returns>true for success or false for failure</returns> public bool InsertSubEditorList() { RootElement.RemoveAll(); AddElementTag(RootElement, "SUB-EDITORS"); UserList userList = new UserList(InputContext); if (!userList.CreateSubEditorsList()) { return false; } //add to document ImportAndAppend(userList.RootElement.FirstChild, "/DNAROOT/SUB-EDITORS"); return true; }
public static void LoadConfig() { RegistryKey regConfig=Registry.CurrentUser.OpenSubKey("Software\\"+app.name,false); WebCam.id=(int)regConfig.GetValue("WebCamId",0); WebCam.width=(int)regConfig.GetValue("WebCamWidth",320); WebCam.height=(int)regConfig.GetValue("WebCamHeight",240); WebCam.bpp=Convert.ToInt16((int)regConfig.GetValue("WebCamBpp",24)); RegistryKey regUsers=regConfig.OpenSubKey("Users",false); foreach (string s in regUsers.GetSubKeyNames()) { RegistryKey u = regUsers.OpenSubKey(s); UserList temp = new UserList(); temp.id=(int)u.GetValue("id",Users.Count);temp.picture=new Bitmap(app.confdir+"\\images\\"+(string)u.GetValue("image",""));temp.difficulty=(Difficulty)u.GetValue("difficulty",Difficulty.easy);temp.name=(string)u.GetValue("name",""); uint iii=Convert.ToUInt32(u.GetValue("score",0)); temp.score=iii; Users.Insert(temp.id,temp); } }
public void SortTest() { UserList target = new UserList(); target.Add(new User { Nick = "Ortzinator"}); target.Add(new User { Nick = "P90" }); target.Add(new User { Nick = "gparent" }); target.Add(new User { Nick = "DEADBEEF" }); target.Add(new User { Nick = "@ChanServ" }); target.Add(new User { Nick = "+SteveUK" }); target.Add(new User { Nick = "@SpamServ" }); target.Add(new User { Nick = "+HTF" }); target.Add(new User { Nick = "+ninjers" }); Comparison<User> comparison = (user1, user2) => user1.CompareTo(user2); target.Sort(comparison); foreach (User user in target) { Debug.WriteLine(user.Nick); } Assert.Inconclusive("A method that does not return a value cannot be verified."); }
internal static UserList getUserList(HttpResponseMessage response) { var userList = new UserList(); JObject jobject = JObject.Parse(response.Content.ReadAsStringAsync().Result); if(jobject["users"]!=null) { foreach(var userObj in jobject["users"]) { var user = getUserProperties(userObj.ToString()); userList.Add(user); } } if (jobject["page_context"]!=null) { var pageContext = new PageContext(); pageContext = JsonConvert.DeserializeObject<PageContext>(jobject["page_context"].ToString()); userList.page_context = pageContext; } return userList; }
protected void Page_Load(object sender, EventArgs e) { CrystalReportViewer_DownloadFiles.ToolPanelView = CrystalDecisions.Web.ToolPanelViewType.None; ReportDocument rptDoc = new ReportDocument(); TableLogOnInfos crtableLogoninfos = new TableLogOnInfos(); TableLogOnInfo crtableLogoninfo = new TableLogOnInfo(); ConnectionInfo crConnectionInfo = new ConnectionInfo(); // Tables CrTables; crConnectionInfo.ServerName = objDbAccess.strServer; crConnectionInfo.DatabaseName = objDbAccess.strDbName; crConnectionInfo.UserID = objDbAccess.strUser; crConnectionInfo.Password = objDbAccess.strPassword; UserList ds = new UserList(); // .xsd file name DataTable dt = new DataTable(); // Just set the name of data table dt.TableName = "DownloadHistory"; dt = objReports.GetDownloadReports(); //This function is located below this function ds.Tables[0].Merge(dt); // Your .rpt file path will be below rptDoc.Load(Server.MapPath("~/Reports/ListDownload.rpt")); foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in rptDoc.Database.Tables) { crtableLogoninfo = CrTable.LogOnInfo; crtableLogoninfo.ConnectionInfo = crConnectionInfo; CrTable.ApplyLogOnInfo(crtableLogoninfo); } // crtableLogoninfo.ConnectionInfo = crConnectionInfo; //set dataset to the report viewer. rptDoc.SetDataSource(ds); CrystalReportViewer_DownloadFiles.ReportSource = rptDoc; }
public ActionResult TransferAsset(int?id, int category) { UserModel objModel = new UserModel(); UserList objList = new UserList(); objModel.userAssestList = new UserAssest(); objModel.userAssestList.ComputerList = new List <Computer>(); objModel.userAssestList.PhoneDongleList = new List <PhoneDongle>(); objModel.userAssestList.VOIPList = new List <VOIP>(); objList.companyList = new List <Company>(); objModel.userList = new UserList(); objModel.userList.usrList = new List <AutomationTracker.User>(); objModel.user = new AutomationTracker.User(); if (category == 1) { var _computers = _context.Computers.Where(w => w.AUOTID == id).FirstOrDefault(); objModel.userAssestList.ComputerList.Add(_computers); objList.companyList.Add(_computers.Company1); objModel.userList.usrList = _context.Users.Where(w => w.Company == _computers.Company1.CompanyID).ToList(); } else if (category == 2) { var _phones = _context.PhoneDongles.Where(w => w.AUOTID == id).FirstOrDefault(); objList.companyList.Add(_phones.Company1); objModel.userList.usrList = _context.Users.Where(w => w.Company == _phones.Company1.CompanyID).ToList(); } else if (category == 3) { var _voip = _context.VOIPs.Where(w => w.AUTOID == id).FirstOrDefault(); objList.companyList.Add(_voip.Company1); objModel.userList.usrList = _context.Users.Where(w => w.Company == _voip.Company1.CompanyID).ToList(); } return(View(objModel)); }
internal int Save_UserInfo(UserList user) { IDBManager dbManager = CommonConnection.Connectionstring(); int results = 0; DataSet ds = new DataSet(); try { dbManager.Open(); dbManager.CreateParameters(8); dbManager.AddParameters(0, "UserFirstName", user.UserFirstName, ParameterDirection.Input); dbManager.AddParameters(1, "UserMidName", user.UserMidName, ParameterDirection.Input); dbManager.AddParameters(2, "UserLastName", user.UserLastName, ParameterDirection.Input); dbManager.AddParameters(3, "Email", user.UserEmail, ParameterDirection.Input); dbManager.AddParameters(4, "UserApps", user.UserApps, ParameterDirection.Input); dbManager.AddParameters(5, "Mode", user.Mode, ParameterDirection.Input); dbManager.AddParameters(6, "userCode", user.userCode, ParameterDirection.Input); dbManager.AddParameters(7, "eParam", user.EParm, ParameterDirection.Input); string spCall = Helper.Ins.GetSPCall(dbManager.Parameters, "Save_Users"); if (ConfigurationSettings.AppSettings["DataB"] == "SQL") { ds = dbManager.ExecuteDataSet(CommandType.StoredProcedure, "Save_Users"); results = Convert.ToInt16(ds.Tables[0].Rows[0][0]); } return(results); } catch (Exception ex) { throw ex; } finally { dbManager.Dispose(); } }
/// <summary> /// Checks if its possible to login depending on the given username and password and saves the logged in user to a list /// </summary> /// <param name="obj"></param> private void LoginExecute(object obj) { string password = (obj as PasswordBox).Password; bool found = false; if (UserList.Any()) { for (int i = 0; i < UserList.Count; i++) { if (User.Username == UserList[i].Username && password == UserList[i].UserPassword) { Service.LoggedInUser.Add(UserList[i]); MainWindow mw = new MainWindow(); InfoLabel = "Loggedin"; found = true; view.Close(); mw.Show(); break; } } if (found == false) { InfoLabel = "Wrong Username or Password"; } } else { InfoLabel = "Database is empty"; } if (User.Username == "WPFadmin" && password == "WPFadmin") { Admin admin = new Admin(); view.Close(); admin.Show(); } }
private void RequestKit(CommandArgs args) { Player plr = args.sender.player; if (args.Parameters.Count < 1) { PrintKits(args.sender.networkPlayer); return; } String kitName = args.Parameters[0].ToLower(); Kits.SpawnKit kit; if (!kits.TryGetValue(kitName, out kit)) { Reference.Tell(args.sender.networkPlayer, "There's no kit named " + kitName); return; } else { // Checking permission if (kit.Permission <= UserList.getPermission(args.sender.steamid)) { if (plr.credit < kit.Cost) // Not enough credit { Reference.Tell(args.sender.networkPlayer, String.Format("You don't have enough credit. You need {0} more", kit.Cost - plr.credit)); } else { plr.credit -= kit.Cost; this.Spawn(kit.Items, plr.transform.position); // Additional functions for kit kit.Additional(args.sender); } } } }
public void AppendCsvListWithHeader() { ListSerializable <User> users = new UserList(); users.Add(new User("Toto", "Titi")); users.Add(new User("Tata", "Roro")); IWriter <User> writer = new CsvWriter <User>(';', new StringList { "Name", "Firstname" }); writer.Write <UserList>(users, CsvFile); ListSerializable <User> OtherUsers = new UserList(); OtherUsers.Add(new User("lala", "lala")); OtherUsers.Add(new User("test", "test")); writer.Append <UserList>(OtherUsers, CsvFile, "users"); IReader <User> reader = new CsvReader <User>(';', new StringList { "Name", "Firstname" }); Collection <User> usersList = reader.read <UserList>(CsvFile); Assert.AreEqual(4, usersList.Count); for (int i = 0; i < users.Count(); i++) { Assert.AreEqual(users[i].Name, usersList[i].Name); Assert.AreEqual(users[i].Firstname, usersList[i].Firstname); } for (int i = 0; i < OtherUsers.Count(); i++) { Assert.AreEqual(OtherUsers[i].Name, usersList[i + 2].Name); Assert.AreEqual(OtherUsers[i].Firstname, usersList[i + 2].Firstname); } }
public string LoginUser(string UserID, string Password) { //Get user details for the user who is trying to login - JRozario var user = UserList.SingleOrDefault(x => x.USERID == UserID); //Authenticate User, Check if its a registered user in DB - JRozario if (user == null) { return(null); } //If its registered user, check user password stored in DB - JRozario //For demo, password is not hashed. Its just a string comparison - JRozario //In reality, password would be hashed and stored in DB. Before comparing, hash the password - JRozario if (Password == user.PASSWORD) { //Authentication successful, Issue Token with user credentials - JRozario //Provide the security key which was given in the JWToken configuration in Startup.cs - JRozario var key = Encoding.ASCII.GetBytes("YourKey-2374-OFFKDI940NG7:56753253-tyuw-5769-0921-kfirox29zoxv"); //Generate Token for user - JRozario var JWToken = new JwtSecurityToken( issuer: "http://localhost:45092/", audience: "http://localhost:45092/", claims: GetUserClaims(user), notBefore: new DateTimeOffset(DateTime.Now).DateTime, expires: new DateTimeOffset(DateTime.Now.AddDays(1)).DateTime, //Using HS256 Algorithm to encrypt Token - JRozario signingCredentials: new SigningCredentials(new SymmetricSecurityKey(key), SecurityAlgorithms.HmacSha256Signature) ); var token = new JwtSecurityTokenHandler().WriteToken(JWToken); return(token); } else { return(null); } }
/// <summary> /// Checks if its possible to login depending on the given username and password and saves the logged in user to a list /// </summary> /// <param name="obj"></param> private void LoginExecute(object obj) { string password = (obj as PasswordBox).Password; bool found = false; if (UserList.Any()) { for (int i = 0; i < UserList.Count; i++) { if (User.JMBG == UserList[i].JMBG && password == "Gost") { Service.LoggedInUser.Add(UserList[i]); MainWindow mw = new MainWindow(); InfoLabel = "Logged in"; found = true; view.Close(); mw.Show(); break; } } if (found == false) { InfoLabel = "Wrong Username or Password"; } } else { InfoLabel = "Database is empty"; } if (User.JMBG == "Zaposleni" && password == "Zaposleni") { Worker worker = new Worker(); view.Close(); worker.Show(); } }
/// <summary> /// Executes the delete command /// </summary> public void DeleteUserExecute() { // Checks if the user really wants to delete the selected User var result = Xceed.Wpf.Toolkit.MessageBox.Show("Are you sure you want to delete the user?", "Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Question); if (result == MessageBoxResult.Yes) { try { if (User != null) { if (!bgWorker.IsBusy) { // This method will start the execution asynchronously in the background bgWorker.RunWorkerAsync(); } string firstname = User.FirstName; string lastname = User.LastName; int userID = User.UserID; userData.DeleteUser(userID); UserList.Remove(User); UserList = new ObservableCollection <tblUser>(userData.GetAllUsers().ToList()); InfoText = $"Deleted the user {firstname} {lastname}"; InfoColor = "#FFF34A4A"; SnackInfo(); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } else { return; } }
// Host private void HostSendAllRounds() { bool failed = false; var tmpUserList = new List <User>(UserList); foreach (var user in tmpUserList) { if (!user.IsHost) { if (!user.SendRounds(CurrentRound, MaxRound)) { user.Listen = false; UserList.Remove(user); user.Dispose(); failed = true; } } } if (failed) { HostSendAllUserList(); } }
public void AddUserTest985() { User user; User user1; List <User> list; UserList userList; User user2; bool b; user = new User((string)null, (string)null, (string)null); user1 = new User((string)null, "", (string)null); User[] users = new User[3]; users[0] = user; users[1] = user1; users[2] = user1; list = new List <User>((IEnumerable <User>)users); userList = new UserList(); userList.Users = list; user2 = new User((string)null, "", (string)null); b = this.AddUserTest(userList, user2); Assert.AreEqual <bool>(false, b); Assert.IsNotNull((object)userList); }
/// <summary> /// 用户登录 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void sbLogin_Click(object sender, EventArgs e) { UserList user = new UserList(); user.uname = teName.Text.Trim(); user.upwd = tePassword.Text.Trim(); IUserListBAL bal = new ImUserListBAL(); int? perss = bal.UserLogin(user); if (perss < 10) { MessageBox.Show("登录成功" + perss); //第三步准备相关数据 setFormTextVaule(teName.Text, (int)perss); this.Dispose(); } else { MessageBox.Show("登陆失败" + perss); this.Dispose(); } }
private void btnEliminar_Click(object sender, EventArgs e) { try { using (programacionEntities db = new programacionEntities()) { int eliminar = Convert.ToInt32(txtId.Text); UserList userList = db.UserList.Where(x => x.Id == eliminar).Select(x => x).FirstOrDefault(); //userList = db.UserList.Find(eliminar); db.UserList.Remove(userList); db.SaveChanges(); MessageBox.Show("Eliminado"); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } Carga(); clear(); }
public void updateUser(UserList user) { try { using (programacionEntities db = new programacionEntities()) { int update = Convert.ToInt32(user.Id); UserList userList = db.UserList.Where(x => x.Id == update).Select(x => x).FirstOrDefault(); //UserList userList = new UserList(); //userList = db.UserList.Find(1); userList.NombreUsuario = user.NombreUsuario; userList.Apellido = user.Apellido; userList.Edad = user.Edad; userList.Pass = user.Pass; db.SaveChanges(); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
public ActionResult UserInfo(int id) { var userList = db.video_usuarios.FirstOrDefault(a => a.ncodusua == id); var date = String.Format("{0:d/M/yyyy}", userList.DOB); UserList list = new UserList(); id = userList.ncodusua; list.Name = userList.vfullname; list.PhoneNo = userList.vphone; list.Gender = userList.Gender; list.Address = userList.Address; list.NJDL_ = userList.NJDL_; list.state = userList.State; list.city = userList.City; list.Zip = userList.Zip; list.Email = userList.vemail; list.DOB = userList.DOB; list.password = userList.vcon; list.creationDate = userList.vcreation; list.ShowDateOfBirth = date; list.EyeColor = userList.EyeColor; return(View(list)); }
public UserList GetAllUsers() { OperationResult <IList <IUserDto> > resultAllUsers = _userFacade.GetAllUsers(); UserList result = new UserList(); result.UserList = new List <User>(); if (resultAllUsers.IsValid()) { foreach (var item in resultAllUsers.Data) { User temp = new User(); temp.Name = item.Name; temp.EmailId = item.EmailId; temp.AccountBalance = item.AccountBalance; temp.BlockedAmount = item.BlockedAmount; result.UserList.Add(temp); } } else { } return(result); }
private void HostSendAllMessage(string message) { bool failed = false; var tmpUserList = new List <User>(UserList); foreach (var user in tmpUserList) { if (!user.IsHost) { if (!user.SendMessage(TcpConst.TYPE_MESSAGE, message)) { user.Listen = false; UserList.Remove(user); user.Dispose(); failed = true; } } } if (failed) { HostSendAllUserList(); } }
private void HostSendAllHeader(string str) { bool failed = false; var tmpUserList = new List <User>(UserList); foreach (var user in tmpUserList) { if (!user.IsHost) { if (!user.SendHeader(str)) { user.Listen = false; UserList.Remove(user); user.Dispose(); failed = true; } } } if (failed) { HostSendAllUserList(); } }
public ActionResult ViewSharedList(int listId, string message) { UserList userList = DB.UserLists.Find(listId); ViewData["listId"] = userList.ListId; ViewData["rowCount"] = userList.RowCount; ViewData["columnCount"] = userList.ColumnCount; ViewData["message"] = message; ViewBag.Heading = userList.ListName; List <ListInfo> listInfos = new List <ListInfo>(); IEnumerable <ListInfo> listData = listInfos; foreach (var info in DB.ListInfoes) { if (info.ListId == listId) { listInfos.Add(info); } } return(View(listData)); }
private void button2_Click(object sender, EventArgs e) { try { using (programacionEntities db = new programacionEntities()) { int eliminar = Convert.ToInt32(TxtId.Text); UserList userList = db.UserList.Where(x => x.id == eliminar).Select(x => x).FirstOrDefault(); // //userList = db.UserList.Find(eliminar); db.UserList.Remove(userList); db.SaveChanges(); MessageBox.Show("Se ha Eliminado al Usuario con Id = " + TxtId.Text); } } catch (Exception ex) { MessageBox.Show("Error: " + ex); } carga(); Clear(); }
private void HostSendAllDot(byte[] message) { bool failed = false; var tmpUserList = new List <User>(UserList); foreach (var user in tmpUserList) { if (!user.IsHost) { if (!user.SendDot(message)) { user.Listen = false; UserList.Remove(user); user.Dispose(); failed = true; } } } if (failed) { HostSendAllUserList(); } }
private void HostSendAllFillCanvas(Color color) { bool failed = false; var tmpUserList = new List <User>(UserList); foreach (var user in tmpUserList) { if (!user.IsHost) { if (!user.SendFillCanvas(color)) { user.Listen = false; UserList.Remove(user); user.Dispose(); failed = true; } } } if (failed) { HostSendAllUserList(); } }
private void PutUsers(UserList s) { string[] lines = new string[s.N]; for (int i = 0; i < s.N; i++) { string tmp = ""; for (int j = 0; j < s.R; j++) { if (j != s.R - 1) { tmp += s[i, j] + " "; } else { tmp += s[i, j]; } } lines[i] = tmp; } System.IO.File.WriteAllLines(UsersDataBase, lines); }
//public void SaveDatosUser(String Nombre, String Apellido, int Edad, String Pass) //{ // try // { // using (programacionEntities db = new programacionEntities()) // { // UserList userList = new UserList(); // userList.NombreUsuario = Nombre; // userList.Apellido = Apellido; // userList.Edad = Edad; // userList.Pass = Pass; // db.UserList.Add(userList); // db.SaveChanges(); // MessageBox.Show("Save"); // } // } // catch (Exception EX) // { // MessageBox.Show(EX.ToString()); // } //} public void SaveDatosUser(UserList user) { try { using (programacionEntities db = new programacionEntities()) { UserList userList = new UserList(); userList.NombreUsuario = user.NombreUsuario; userList.Apellido = user.Apellido; userList.Edad = user.Edad; userList.Pass = user.Pass; db.UserList.Add(userList); db.SaveChanges(); MessageBox.Show("Save"); } } catch (Exception EX) { MessageBox.Show(EX.ToString()); } }
protected void LoadUserList() { using (var db = CLinq.DataContext.Create()) { var userQuery = from u in db.Users orderby u.UserRef select new { u.UserRef, u.UserName, u.EmailAddress, LastLoginDate = u.LastLogin, Comments = u.Comments.Count, Ratings = u.UserToLinks.Count, PollVotes = u.UserToPollOptions.Count, u.IsAdmin }; UserList.DataSource = userQuery.ToList(); UserList.DataBind(); } }
private async void LoadUserAsync() { IsBusy = true; var result = await App.AccountManager.GetUserAsync(); IsBusy = false; if (!result.IsSuccess) { await DisplayAlert("error", result.Message, "ok"); } if (result.Data == null) { return; } foreach (var item in result.Data) { if (item.UserId == AppSecurity.CurrentUser.UserId) { continue; } UserList.Add(item); } }
public void SaveDatoUser(UserList user) { using (programacionEntities db = new programacionEntities()) { UserList userList = new UserList(); try { userList.NombreUsuario = user.NombreUsuario; userList.Apellido = user.Apellido; userList.Edad = user.Edad; userList.Pass = user.Pass; db.UserList.Add(userList); db.SaveChanges(); MessageBox.Show("Se ha agregado el usuario " + user.NombreUsuario); } catch (Exception ex) { MessageBox.Show("Error: " + ex); } } }
//修改用户 private void button17_Click(object sender, EventArgs e) { UserList userList = new UserList(); if (dataGridView3.SelectedRows.Count > 0) { DataGridViewRow dgvr = dataGridView3.SelectedRows[0]; userList.UserID = Guid.Parse(dgvr.Cells["UserID"].Value.ToString()); userList.Username = dgvr.Cells["用户名"].Value.ToString(); userList.UserPassword = dgvr.Cells["UserPassword"].Value.ToString(); userList.UserPermissionID = Int32.Parse(dgvr.Cells["权限等级"].Value.ToString()); userList.Description = dgvr.Cells["描述"].Value.ToString(); userList.Mark = dgvr.Cells["备注"].Value.ToString(); User_Modify user_Modify = new User_Modify(userList); user_Modify.Show(); } else { MessageBox.Show("请选中一行要修改的数据!"); return; } }
protected void WrightUsers(UserList s) { string[] lines = new string[s.N]; for (int i = 0; i < s.N; i++) { string tmp = ""; for (int j = 0; j < s.R; j++) { if (j != s.R - 1) { tmp += s[i, j] + " "; } else { tmp += s[i, j]; } } lines[i] = tmp; } System.IO.File.WriteAllLines(@"DATA_BASE\Users.txt", lines); }
public static void RemoveUser(int i) { UserList list; try { if (localSettings.Values.ContainsKey(AppConstants.GATEWAY_USERS)) { list = JsonConvert.DeserializeObject <UserList>((string)localSettings.Values[AppConstants.GATEWAY_USERS]); } else { list = new UserList(); } } catch { list = new UserList(); } list.Items.RemoveAt(i); localSettings.Values[AppConstants.GATEWAY_USERS] = JsonConvert.SerializeObject(list); }
public UserLpuAccess() { InitializeComponent(); _regionRRList = RegionRRList.GetUniqueInstance(); _lpuRRList = LpuRRList.GetUniqueInstance(); _userLpuRRList = UserLpuRRList.GetUniqueInstance(); _userList = UserList.GetUniqueInstance(); _lpuRRController = new LpuRRController(_dgv1); _userLpuRRListController = new UserLpuRRListController(_dgv2); globalData.load = false; cbSDiv.SelectedIndex = 0; globalData.Div = cbSDiv.SelectedItem.ToString(); globalData.load = true; fillRegion(); fillUsers(); }
private void RemoveItem() { MessageViewInfo.MessageBoxButtons = MessageBoxButtons.YesNo; MessageViewInfo.MessageBoxIcon = Fwk.Bases.FrontEnd.Controls.MessageBoxIcon.Question; if (MessageViewInfo.Show("Are you sure to remove selected users from current role : " + selectedRol.RolName) == DialogResult.Yes) { UserList removedUsersList = new UserList(); foreach (DataGridViewRow row in grdUsers.SelectedRows) { removedUsersList.Remove(((User)row.DataBoundItem)); } FwkMembership.RemoveUsersFromRole(removedUsersList.GetArraNames(), selectedRol.RolName, frmAdmin.Provider.Name); grdUsers.DataSource = FwkMembership.GetUsersDetailedInRole(selectedRol.RolName, frmAdmin.Provider.Name); grdUsers.Refresh(); } SetMessageViewToDefault(); }
public static void RefreshUsers() { _UserList = GetAllUsers(null); }
//TODO: usar scripts static void RulesRemoveRol(Rol pRol, FwkAuthorizationRuleList pRulesList) { RolList rollistAux = new RolList(); UserList userListAux = new UserList(); foreach (FwkAuthorizationRule rule in pRulesList) { rollistAux.Clear(); userListAux.Clear(); Fwk.Security.FwkMembership.BuildRolesAndUsers_FromRuleExpression(rule.Expression, out rollistAux, out userListAux); ///Agregar el rol a la regla if (rollistAux.Any<Rol>(r => r.RolName.Equals(pRol.RolName))) { rollistAux.Remove(rollistAux.First<Rol>(r => r.RolName.Equals(pRol.RolName))); rule.Expression = Fwk.Security.FwkMembership.BuildRuleExpression(rollistAux, userListAux); } } }
/// <summary> /// Retorba las lista de usuarios y roles desde la expresion de la regla /// </summary> /// <param name="wexpression"></param> /// <param name="assignedRoleList"></param> /// <param name="excludeUserList"></param> public static void BuildRolesAndUsers_FromRuleExpression(string wexpression, out RolList assignedRoleList, out UserList excludeUserList) { Rol wRol; User wUser; assignedRoleList = new RolList(); excludeUserList = new UserList(); StringBuilder exp = new StringBuilder(wexpression); exp.Replace("R:", string.Empty); exp.Replace("I:", string.Empty); exp.Replace("(", string.Empty); exp.Replace(")", string.Empty); exp.Replace("AND", string.Empty); String[] wArray = exp.ToString().Split(new string[] { "NOT" }, StringSplitOptions.RemoveEmptyEntries); if (wArray.Length > 0) { foreach (string str in wArray[0].Split(new string[] { "OR" }, StringSplitOptions.RemoveEmptyEntries)) { wRol = new Rol(str.Trim()); assignedRoleList.Add(wRol); } } if (wArray.Length > 1) { foreach (string str in wArray[1].Split(new string[] { "OR" }, StringSplitOptions.RemoveEmptyEntries)) { wUser = new User(str.Trim()); excludeUserList.Add(wUser); } } }
/// <summary> /// Sends out an email containing a summary of the new allocations made /// to each sub editor. /// </summary> /// <param name="totalSent">total number of emails sent returned</param> /// <returns>True if emails sent okay, false if not</returns> private bool SendNotificationEmails(ref int totalSent) { UserList userList = new UserList(InputContext); userList.CreateSubEditorsList(); int[] userIDs = null; if (!userList.GetUserIDs(ref userIDs)) return false; for (int counter = 0; counter < userIDs.Length; counter++) { string emailAddress = String.Empty, emailSubject = String.Empty, emailText = String.Empty; bool toSend =true; // create their notification email object SubNotificationEmail subnotificationEmail = new SubNotificationEmail(InputContext); subnotificationEmail.CreateNotificationEmail(userIDs[counter], ref toSend, ref emailAddress, ref emailSubject, ref emailText); if(toSend) {// if we have an email to send then send it InputContext.SendMailOrSystemMessage(emailAddress, emailSubject, emailText, InputContext.CurrentSite.EditorsEmail, InputContext.CurrentSite.ShortName, false, userIDs[counter], InputContext.CurrentSite.SiteID); totalSent++; } } if (totalSent == 0) { XmlNode subAllocateForm = RootElement.SelectSingleNode("SUB-ALLOCATION-FORM"); XmlNode notifSent = AddElement(subAllocateForm, "NOTIFICATIONS-SENT","");//, dataReader.GetInt32NullAsZero("Total")); AddAttribute(notifSent, "TOTAL", totalSent); } else { XmlNode subAllocateForm = RootElement.SelectSingleNode("SUB-ALLOCATION-FORM"); XmlNode notifSent = AddElement(subAllocateForm, "NOTIFICATIONS-SENT", "An error occurred whilst trying to send emails");//, dataReader.GetInt32NullAsZero("Total")); AddAttribute(notifSent, "TYPE", "EMAIL-FAILURE"); } return true; }
public FormsAppTab(FormsApp aFormsApp, IBrowserTabProxy aBrowserTabProxy, int aId, UserList aUserList, string aUserId) { iXFTab = new XappFormsBrowserTab(aBrowserTabProxy); var grid = GridControl.Create(iXFTab); grid.TopLeft = ButtonControl.Create(iXFTab, "First"); iTextboxOne = TextboxControl.Create(iXFTab, "Beta"); iButtonThree = ButtonControl.Create(iXFTab, "Charlie"); iButtonFour = ButtonControl.Create(iXFTab, "FOUR"); grid.TopRight = iTextboxOne; grid.BottomRight = iButtonFour; grid.BottomLeft = iButtonThree; iButtonFour.Clicked += OnButtonFourClicked; iTextboxOne.KeyPress += OnTextboxOneKeyPress; iXFTab.Root = grid; iFormsApp = aFormsApp; iBrowserTabProxy = aBrowserTabProxy; iId = aId; }
public FormsApp(UserList aUserList, string aHttpDirectory) { iUserList = aUserList; iHttpDirectory = aHttpDirectory; //iUserList.Updated += OnUserListUpdated; iUrlDispatcher = new AppPathDispatcher(); iUrlDispatcher.MapPath( new string[] { }, ServeAppHtml); iUrlDispatcher.MapPrefixToDirectory(new string[] { }, aHttpDirectory); }
public Penalty() { _driverIds = new ObservableCollection<int>(); _users = new UserList(true); }
internal static UserList getUserList(HttpResponseMessage responce) { var userList = new UserList(); var jsonObj = JsonConvert.DeserializeObject<Dictionary<string, object>>(responce.Content.ReadAsStringAsync().Result); if (jsonObj.ContainsKey("users")) { var usersArray = JsonConvert.DeserializeObject<List<object>>(jsonObj["users"].ToString()); foreach(var userObj in usersArray) { var user = new User(); user = JsonConvert.DeserializeObject<User>(userObj.ToString()); userList.Add(user); } } if (jsonObj.ContainsKey("page_context")) { var pageContext = new PageContext(); pageContext = JsonConvert.DeserializeObject<PageContext>(jsonObj["page_context"].ToString()); userList.page_context = pageContext; } return userList; }
public virtual void UserList(UserList userList) { }
public void TestInitialise() { this.roleList.Add(new Role { Id = "role-1" }); this.roleList.Add(new Role { Id = "role-2" }); this.roleList.Add(new Role { Id = "originator", SystemDefined = true, RoleName = "originator" }); Dictionary<string, string> user1Roles = new Dictionary<string, string> { { "role-2", "role-2" } }; Dictionary<string, string> user2Roles = new Dictionary<string, string> { { "role-2", "role-2" } }; Dictionary<string, string> user3Roles = new Dictionary<string, string> { { "role-1", "role-1" } }; this.userList.Add(new User { Id = "user-1", EmailAddress = "*****@*****.**", Roles = user1Roles }); this.userList.Add(new User { Id = "user-2", EmailAddress = "*****@*****.**", Roles = user2Roles }); this.userList.Add(new User { Id = "user-3", EmailAddress = "*****@*****.**", Roles = user3Roles }); this.action = new EmailWorkflowTransitionAction { AttachPdf = false, Condition = null, Content = "The email body goes here", Recipients = this.recipientList, Subject = "The subject line", EmailLinks = new List<string>() }; this.application = new Application { Id = "123456", FormId = "654321", ApplicationData = new ApplicationData() }; this.systemSettings.Uris[SystemUriType.BaseSite] = "test.iapply.web"; this.emptyPageList = new PageList { new UserPage { Controls = new ControlList() } }; this.getUserFn = criteria => { UserList users = new UserList(); if (criteria.RoleIds != null) { foreach (var role in criteria.RoleIds) { users.AddRange(this.userList.Where(u => u.HasRole(role))); } } if (criteria.UserIds != null) { foreach (var user in criteria.UserIds) { users.AddRange(this.userList.Where(u => u.Id == user)); } } return users; }; }
//TODO: usar scripts static void RulesApendRol(Rol pRol, FwkAuthorizationRuleList pRulesList) { RolList rollistAux = new RolList(); UserList userListAux = new UserList(); ; foreach (FwkAuthorizationRule rule in pRulesList) { rollistAux.Clear(); userListAux.Clear(); Fwk.Security.FwkMembership.BuildRolesAndUsers_FromRuleExpression(rule.Expression, out rollistAux, out userListAux); ///Agregar el rol a la regla rollistAux.Add(pRol); rule.Expression = Fwk.Security.FwkMembership.BuildRuleExpression(rollistAux, userListAux); } }
/// <summary> /// /// </summary> /// <param name="ruleName"></param> public void Populate(string ruleName) { txtRuleName.Text = ruleName; _CurrentRule = FwkMembership.GetRule(ruleName, frmAdmin.Provider.Name); txtRuleExpression.Text = _CurrentRule.Expression; _AssignedRolList = new RolList(); _ExcludeUserList = new UserList(); FwkMembership.BuildRolesAndUsers_FromRuleExpression(_CurrentRule.Expression, out _AssignedRolList, out _ExcludeUserList); txtRuleExpression.Text = FwkMembership.BuildRuleExpression(_AssignedRolList, _ExcludeUserList); grdAssignedRoles.DataSource = null; grdAssignedRoles.DataSource = _AssignedRolList; grdUserExcluded.DataSource = null; grdUserExcluded.DataSource = _AssignedRolList; grdUserExcluded.Refresh(); grdAssignedRoles.Refresh(); }
/// <summary> /// Used to process the current request. /// </summary> public override void ProcessRequest() { //if not an editor then return an error /*if (InputContext.ViewingUser == null || !InputContext.ViewingUser.IsEditor) { AddErrorXml("NOT-EDITOR", "You cannot allocate recommended entries to sub editors unless you are logged in as an Editor.", RootElement); return; }*/ //prepare XML Doc RootElement.RemoveAll(); XmlElement newUsers = AddElementTag(RootElement, "NEWUSERS-LISTING"); //get parameters out int skip = InputContext.GetParamIntOrZero("skip", "the number to skip"); int show = InputContext.GetParamIntOrZero("Show", "the number to Show"); if (show <= 0) show = 20; //get unit type and unit number of the date range int timeUnitsSinceRegistration = InputContext.GetParamIntOrZero("TimeUnits", "the number to units of time"); string unitType = InputContext.GetParamStringOrEmpty("UnitType", "the unit type"); if(unitType.ToUpper() != "MINUTE" && unitType.ToUpper() != "HOUR" && unitType.ToUpper() != "DAY" && unitType.ToUpper() != "WEEK" && unitType.ToUpper() != "MONTH" ) { unitType = "week"; timeUnitsSinceRegistration = 1; } string filterType = InputContext.GetParamStringOrEmpty("filter", "Whether to filter or not"); bool filterUsers = (filterType.ToUpper() != "OFF" && filterType != String.Empty); int showUpdatingUsers = InputContext.GetParamIntOrZero("whoupdatedpersonalspace", "users who updated home page"); //add the attributes to the base element AddAttribute(newUsers, "UNITTYPE", unitType); AddAttribute(newUsers, "TIMEUNITS", timeUnitsSinceRegistration); AddAttribute(newUsers, "SITEID", InputContext.CurrentSite.SiteID); UserList userList = new UserList(InputContext); // Now check to see which type of list we require if (InputContext.DoesParamExist("JoinedUserList", "the type of the list required")) { //get user list if (userList.CreateNewUsersList(timeUnitsSinceRegistration, unitType, show, skip, false, "", InputContext.CurrentSite.SiteID, 0)) {// append the list to the element ImportAndAppend(userList.RootElement.FirstChild, "/DNAROOT/NEWUSERS-LISTING"); } } else { //add elements back to base XML if (filterUsers) { AddAttribute(newUsers, "FILTER-USERS", filterUsers); AddAttribute(newUsers, "FILTER-TYPE", filterType.ToString()); } if (showUpdatingUsers != 0) { AddAttribute(newUsers, "UPDATINGUSERS", showUpdatingUsers.ToString()); } if (userList.CreateNewUsersList(timeUnitsSinceRegistration, unitType, show, skip, filterUsers, filterType, InputContext.CurrentSite.SiteID, showUpdatingUsers)) {// append the list to the element ImportAndAppend(userList.RootElement.FirstChild, "/DNAROOT/NEWUSERS-LISTING"); } } }
void myProgram_GameEnded(Object obj) { if (this.InvokeRequired) { this.Invoke(new MethodInvoker(delegate { this.Visible = true; })); txtPass2.Invoke(new MethodInvoker(delegate { txtPass2.Text = ""; })); String Msg = "At this point ControlPasses back to the main Form, along with an object which represents the updated list of the two players that were playing the game"; MessageBox.Show(Msg); GamePlayers myGame = new GamePlayers(); UserList myUserList = new UserList(); XMLHelper<GamePlayers> myXMLGame = new XMLHelper<GamePlayers>(); XMLHelper<UserList> myXMLUser = new XMLHelper<UserList>(); myXMLGame.Load(ref myGame); myXMLUser.Load(ref myUserList); if (myGame.myPlayers.Length > 0) { int one = myUserList.FindName(myGame.myPlayers[0].UserName); int two = myUserList.FindName(myGame.myPlayers[1].UserName); myUserList.myUsers[one].TotalWins = myUserList.myUsers[one].TotalWins + myGame.myPlayers[0].TotalWins; myUserList.myUsers[one].TotalGames = myUserList.myUsers[one].TotalGames + myGame.myPlayers[0].TotalGames; myUserList.myUsers[two].TotalWins = myUserList.myUsers[two].TotalWins + myGame.myPlayers[1].TotalWins; myUserList.myUsers[two].TotalGames = myUserList.myUsers[two].TotalGames + myGame.myPlayers[1].TotalGames; myXMLUser.Save(myUserList); } } }
public static AssignIndividualAchievementViewModel Populate(UnitOfWork work = null) { if (work == null) work = new UnitOfWork(); List<UserList> userList = new List<UserList>(); var users = work.EntityContext.user.Where(u => u.is_player == true && u.status == (int)JPPConstants.UserStatus.Active).ToList().OrderBy(u => u.first_name); foreach (var user in users) { string userName = user.first_name + " " + user.last_name + "(" + user.display_name + ")"; UserList userToAdd = new UserList(){ FullNameDisplayName = userName, ID = user.id}; userList.Add(userToAdd); } return new AssignIndividualAchievementViewModel() { Users = userList, Achievements = work.EntityContext.achievement_template.Where(at => at.type != (int)JPPConstants.AchievementTypes.UserSubmission && at.state == (int)JPPConstants.AchievementQuestStates.Active).ToList() }; }