private void simpleButton1_Click(object sender, EventArgs e) { var Baza = new AbacusSUPEntities(); OperaterLogin.operater = Baza.Login.FirstOrDefault(qq => qq.username == textEdit1.Text && qq.pass == textEdit2.Text); //OperaterLogin.podesavanja = new Settings(); if (OperaterLogin.operater != null) { if (OperaterLogin.operater.Podesavanja == null) { Podesavanja pod = new Podesavanja { minimize_notif = false, minimize_tray = true, novitask_notif = true, }; Baza.Podesavanja.Add(pod); Baza.SaveChanges(); Baza.Login.FirstOrDefault(qq => qq.username == textEdit1.Text && qq.pass == textEdit2.Text).id_podesavanja = pod.id_podesavanja; Baza.SaveChanges(); } FormMain frmmain = Program.MainForm = new FormMain(OperaterLogin.operater, progressBarControl1); frmmain.Show(); OperaterLogin.loginforma = this; OperaterLogin.NE_IZLAZI_AOAO = false; this.Hide(); } else { MessageBox.Show("Neispravan korisnik ili lozinka!", "Greska", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public FormSettings(Podesavanja _podesavanja, GridView gridView) { InitializeComponent(); #region staro xml //STARO XML /* * string putanja = System.IO.Path.Combine(Application.StartupPath, "Settings.xml"); * XmlReader reader = XmlReader.Create(putanja); * //dok.Load(putanja); * * * while (reader.Read()) * { * if ((reader.NodeType == XmlNodeType.Element) && (reader.Name == "Setting")) * { * if (reader.HasAttributes) * { * * checkEdit1.Checked = Convert.ToBoolean(reader.GetAttribute("Tray")); * checkEdit2.Checked = Convert.ToBoolean(reader.GetAttribute("MinimizeNotif")); * * * } * } * } * reader.Close(); */ #endregion Baza = new AbacusSUPEntities(); podesavanja = Baza.Podesavanja.First(qq => qq.id_podesavanja == _podesavanja.id_podesavanja); PodesavanjaBindingSource.Add(podesavanja); checkEdit1.Checked = podesavanja.minimize_tray; if (!checkEdit1.Checked) { checkEdit2.Checked = false; checkEdit2.Enabled = false; } else { checkEdit2.Checked = podesavanja.minimize_notif; } checkEdit3.Checked = podesavanja.novitask_notif; checkEdit4.Checked = podesavanja.minimize_tray; checkEdit5.Checked = podesavanja.task_novi_prozor; foreach (SkinContainer cnt in SkinManager.Default.Skins) { List <string> listaskinova = new List <string>(); listaskinova.Add(cnt.SkinName); comboBoxEdit1.Properties.Items.AddRange(listaskinova); } skinName_old = DevExpress.LookAndFeel.UserLookAndFeel.Default.SkinName; gridView1 = gridView; }
private void barButtonItem11_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { settings: if (OperaterLogin.operater.id_podesavanja != 0 && OperaterLogin.operater.id_podesavanja != null) { FormSettings frmsett = new FormSettings(OperaterLogin.operater.Podesavanja, gridView1); var res = frmsett.ShowDialog(); if (res == DialogResult.OK) { var Baza = new AbacusSUPEntities(); OperaterLogin.operater = Baza.Login.First(qq => qq.id == OperaterLogin.operater.id); } } else { Podesavanja pod = new Podesavanja { minimize_notif = false, minimize_tray = true, novitask_notif = true, novikom_notif = true, task_novi_prozor = false, pixel_scr = false, task_github_upload = false, kom_github_upload = false, }; var db = new AbacusSUPEntities(); db.Podesavanja.Add(pod); db.SaveChanges(); var op = db.Login.First(qq => qq.id == OperaterLogin.operater.id); op.id_podesavanja = pod.id_podesavanja; db.SaveChanges(); var log = db.Login.First(qq => qq.id == OperaterLogin.operater.id); OperaterLogin.operater = log; goto settings; } /*frmsett.FormClosed += (ss, ee) => //NOVO** * { * Baza = new AbacusSUPEntities(); * OperaterLogin.operater = Baza.Login.First(qq => qq.id == OperaterLogin.operater.id); * };*/ }