Inheritance: ISerializable
Example #1
0
        /// <summary>
        /// Sprawdza czy dany użytkownik ma rozszerzone uprawnienia
        /// </summary>
        public static bool isRoot(User user)
        {
            if (user.vname == "system")
            {
                return true;
            }

            return false;
        }
Example #2
0
 /// <summary>
 /// Tworzy nowego użytkownika i umieszcza rekord w bazie danych
 /// </summary>
 public static User createUser(String name, String surname, DateTime birthDate, UserRole role, SexEnum sex, String login, String pass)
 {
     User user = new User();
     List<User> list = SessionFactory.GetNewSession().CreateQuery("from User u WHERE u.login = :login").SetParameter("login", login).List<User>().ToList<User>();
     if (list.Count > 0)
     {
         throw new Exception("User with given login exists");
     }
     user.vlogin = login;
     user.vpassword = EncodePassword(pass);
     user.vRole = role.vid;
     user.vsex = sex;
     user.vname = name;
     user.vSureName = surname;
     user.vDateOfBirth = birthDate;
     return user;
 }
Example #3
0
 /// <summary>
 /// Dodajemy dane do przechowywania sesji
 /// </summary>
 /// <param name="identity">Zalogowany user</param>
 public void WriteIdentity(User identity)
 {
     this.identity = identity;
 }
Example #4
0
 /// <summary>
 /// Czyœcimy dane o u¿ytkowniku
 /// </summary>
 public void ClearIdentity()
 {
     this.identity = null;
 }
Example #5
0
 public virtual void SetOrganizer(User organizer)
 {
     this.organizer = organizer.vid;
 }
Example #6
0
 public void SetOrganizer(User organizer)
 {
     this.organizer = organizer;
 }
Example #7
0
 public bool SaveFileForUser(User user, String filename)
 {
     throw new System.Exception("Not implemented");
 }
Example #8
0
 public String[] GetFilesForUser(User user)
 {
     throw new System.Exception("Not implemented");
 }
Example #9
0
 public void SetOrganizer(User organizer)
 {
     throw new System.Exception("Not implemented");
 }
Example #10
0
 public void WriteIdentity(User identity)
 {
     throw new System.Exception("Not implemented");
 }
Example #11
0
 /// <summary>
 /// Zapisuje plik z danymi u¿ytkownika na dysk
 /// </summary>
 public bool SaveFileForUser(User user, String filename)
 {
     FileAdapter<User> forUser = new FileAdapter<User>();
     return true;
 }
Example #12
0
 /// <summary>
 /// Zwraca nazwy plików dla danego u¿ytkownika
 /// </summary>
 public String[] GetFilesForUser(User user)
 {
     return new string[] { };
 }
Example #13
0
        private void UserEditorForm_Load(object sender, EventArgs e)
        {
            ICollection<UserRole> userRoles = DbService.GetAll<UserRole>();

            this.comboBoxRole.Items.Clear();
            this.comboBoxRole.Items.Insert(0, "");
            foreach (UserRole ur in userRoles) {
                this.comboBoxRole.Items.Insert(ur.vid, ur.vname);
            }
            userAuth = AuthAdapter.GetInstance().getIdentity();
            if (!UserFactory.isRoot(userAuth))
            {
                this.button2.Visible = false;
                this.comboBoxRole.Visible = false;

            }
            this.plec.Items.Insert((int)SexEnum.Male, "mężczyzna");
            this.plec.Items.Insert((int)SexEnum.Female, "kobieta");
            this.textBoxName.Text = userAuth.GetName();
            this.textBoxSureName.Text = userAuth.GetSureName();
            this.dateOfBirthTimePicker.Value = userAuth.GetDateOfBirth();
            this.plec.SelectedIndex = (int) userAuth.GetSex();
            this.comboBoxRole.SelectedIndex = userAuth.vRole;
        }