public bool AddUser(string username, string password, string surname, UserType usertype) { var duUsers = new DRUsers(); duUsers.Find(username); var row = duUsers.AddRecord(); row.SetValue <string>(EF_Users.Username, username); row.SetValue <string>(EF_Users.Password, Cryption.Encrypt(password)); row.SetValue <string>(EF_Users.Surname, surname); row.SetValue <UserType>(EF_Users.UserType, usertype); row.SetValue <bool>(EF_Users.Expired, false); row.SetValue <DateTime>(EF_Users.ExpireDate, DateTime.Today); row.SetValue <bool>(EF_Users.ChangePassword, true); row.SetValue <bool>(EF_Users.Blocked, false); return(duUsers.Update()); }
public void WriteConfigFile() { if (!System.IO.Directory.Exists(ConfigDirectory)) { System.IO.Directory.CreateDirectory(ConfigDirectory); } TextWriter stream = new StreamWriter(ConfigFilename); var xmlSer = new XmlSerializer(typeof(LoginInfo)); GlobalInfo.LoginInfo.LastPassword = GlobalInfo.LoginInfo.RememberLastLogin ? Cryption.Encrypt(GlobalInfo.LoginInfo.LastPassword) : string.Empty; xmlSer.Serialize(stream, GlobalInfo.LoginInfo); if (GlobalInfo.LoginInfo.RememberLastLogin) { GlobalInfo.LoginInfo.LastPassword = Cryption.Decrypt(GlobalInfo.LoginInfo.LastPassword); } stream.Close(); }