private IDictionary <string, string> GetRealValues(string ptname) { // получение данных IDictionary <string, string> rvals = Data.GetRealValues(ptname); if (updater != null) { if (rvals.ContainsKey("UserLevel")) { rvals["UserLevel"] = updater.UserLevel().ToString(); } else { rvals.Add("UserLevel", updater.UserLevel().ToString()); } if (rvals.ContainsKey("UserName")) { rvals["UserName"] = updater.UserLevel().ToString(); } else { rvals.Add("UserName", updater.UserName()); } } if (rvals.ContainsKey("Station")) { rvals["Station"] = Properties.Settings.Default.Station.ToString(); } else { rvals.Add("Station", Properties.Settings.Default.Station.ToString()); } if (rvals.ContainsKey("DisplayTimeout")) { rvals["DisplayTimeout"] = Properties.Settings.Default.DisplayTimeout.ToString(); } else { rvals.Add("DisplayTimeout", Properties.Settings.Default.DisplayTimeout.ToString()); } Entity ent = Data.GetEntity(ptname); if (!ent.Empty) { if (rvals.ContainsKey("PtDesc")) { rvals["PtDesc"] = (string)ent.Values["PtDesc"]; } else { rvals.Add("PtDesc", (string)ent.Values["PtDesc"]); } } return(rvals); }
private void tsbQuitAll_Click(object sender, EventArgs e) { if (updater.UserLevel() >= UserLevel.Оператор) { updater.AlarmShortUp(); Data.SendShortUpCommand(); timerBlink.Enabled = false; try { using (ServerSQL dataSQL = new ServerSQL(DatabaseFrom.Database, true)) // чтение { using (ServerSQL fetchlocalSQL = new ServerSQL(DatabaseFrom.Fetchbase, true)) // чтение { if (dataSQL.Connected && fetchlocalSQL.Connected) { HashSet <string> list = new HashSet <string>(); for (int i = 0; i < lvLogView.Items.Count; i++) { string ptname = lvLogView.Items[i].SubItems[3].Text; if (!list.Contains(ptname)) { list.Add(ptname); Entity ent = Data.GetEntity(ptname, dataSQL); using (ServerSQL fetchSQL = new ServerSQL(DatabaseFrom.Fetchbase)) // запись { if (!ent.Empty && fetchSQL.Connected) { ent.Reals = Data.GetRealValues(ptname, fetchlocalSQL, dataSQL); bool propexists = ent.Reals.ContainsKey("QuitAlarms"); if (propexists && !bool.Parse(ent.Reals["QuitAlarms"]) || !propexists) { ent.QuitAlarms(updater.UserName()); ent.SetRealProp("QuitAlarms", true.ToString()); Data.WriteRealVals(ent, fetchSQL); } } else { Data.RemoveAlarms(ptname, fetchSQL); } } } } } } } } finally { timerBlink.Enabled = true; } } }