private void FindLocation_Load(object sender, EventArgs e) { User userAuth = AuthAdapter.GetInstance().getIdentity(); if (!UserFactory.isRoot(userAuth)) { this.button1.Visible = false; } this.dataGridView1.DataSource = DbService.GetAll <Location>(); }
//public TripEdit() //{ // InitializeComponent(); //} public TripEdit(Trip trip) { // TODO: Complete member initialization this.trip = trip; FileAdapter <Trip> t = new FileAdapter <Trip>(); Type x = typeof(Trip); t.ForTrip(trip); destDir = t.GetDataBaseLocation(); InitializeComponent(); if (trip.vid == 0) { trip.vorganizer = AuthAdapter.GetInstance().getIdentity().vid; button1.Visible = false; button3.Visible = false; } }
private void button1_Click(object sender, EventArgs e) { User user = null; NHibernate.ISession session = SessionFactory.GetNewSession(); string login = this.textBox1.Text.ToString(); string pass = UserFactory.EncodePassword(textBox2.Text.ToString()); user = session.CreateQuery("from User u WHERE login=:login AND password=:password").SetParameter("login", login).SetParameter("password", pass).List <User>().FirstOrDefault(); if (user != null) { AuthAdapter adapter = AuthAdapter.GetInstance(); adapter.WriteIdentity(user); new UserEditorForm().Visible = true; this.Visible = false; label3.Text = ""; } else { label3.Text = "Nie poprawny login lub hasło"; } }
private void button2_Click(object sender, EventArgs e) { Trip t; if (trip.vid == 0) { t = new Trip(); t.vorganizer = AuthAdapter.GetInstance().getIdentity().vid; } else { t = trip; } t.SetName(textBox1.Text); t.SetLength(float.Parse(textBox2.Text.ToString())); t.SetPrice(double.Parse(textBox3.Text)); t.SetTransport(textBox4.Text); t.SetDescription(richTextBox1.Text); t.vattraction = comboBox1.SelectedIndex; t.vlocation = comboBox2.SelectedIndex; TripsService.AppFiles.Database.DbService.Update <Trip>(t); }
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; }