178 lines
5.5 KiB
C#
178 lines
5.5 KiB
C#
using System;
|
|
using System.Windows.Forms;
|
|
|
|
namespace TracingDB.Forms
|
|
{
|
|
public partial class SettingsDlg : Form
|
|
{
|
|
static readonly DateTime MinTime = new DateTime(1753, 1, 1, 0, 0, 0);
|
|
|
|
|
|
|
|
public string WorkplaceName
|
|
{
|
|
set { workplaceNameTextBox.Text = value; }
|
|
get { return workplaceNameTextBox.Text; }
|
|
}
|
|
|
|
public int ProcessFilter
|
|
{
|
|
set
|
|
{
|
|
if ((value & (int)SubClass.Normal) != 0 &&
|
|
(value & (int)SubClass.FlowTube) != 0 &&
|
|
(value & (int)SubClass.InheritsFlowTube) != 0)
|
|
{
|
|
processFilterComboBox.Text = "všetky";
|
|
}
|
|
else if ((value & (int)SubClass.FlowTube) != 0)
|
|
{
|
|
processFilterComboBox.Text = "flowtuby";
|
|
}
|
|
else if ((value & (int)SubClass.InheritsFlowTube) != 0)
|
|
{
|
|
processFilterComboBox.Text = "vodomery odvodene z flowtuby";
|
|
}
|
|
else /// if ((value & (int)SubClass.Normal) != 0)
|
|
{
|
|
processFilterComboBox.Text = "vodomery";
|
|
}
|
|
}
|
|
|
|
get
|
|
{
|
|
if (processFilterComboBox.Text == "všetky")
|
|
{
|
|
return (int)SubClass.Normal +
|
|
(int)SubClass.NormalWithoutPCB +
|
|
(int)SubClass.FlowTube +
|
|
(int)SubClass.InheritsFlowTube +
|
|
(int)SubClass.InheritsFlowTubeWithoutPCB;
|
|
}
|
|
else if (processFilterComboBox.Text == "flowtuby")
|
|
{
|
|
return (int)SubClass.FlowTube;
|
|
}
|
|
else if (processFilterComboBox.Text == "vodomery odvodene z flowtuby")
|
|
{
|
|
return (int)SubClass.InheritsFlowTube;
|
|
}
|
|
else /// if (processFilterComboBox.Text == "vodomery")
|
|
{
|
|
return (int)SubClass.Normal;
|
|
}
|
|
}
|
|
}
|
|
|
|
public string ConnectionString
|
|
{
|
|
set { connectionStringTextBox.Text = value; }
|
|
get { return connectionStringTextBox.Text; }
|
|
}
|
|
|
|
public string UsersDBConnString
|
|
{
|
|
set { usersDBConnStringTextBox.Text = value; }
|
|
get { return usersDBConnStringTextBox.Text; }
|
|
}
|
|
|
|
public bool OracleBattery
|
|
{
|
|
set { oracleBatteryCheckBox.Checked = value; }
|
|
get { return oracleBatteryCheckBox.Checked; }
|
|
}
|
|
|
|
public bool CheckPcbIsInOracle
|
|
{
|
|
set { checkPcbIsInOracleCheckBox.Checked = value; }
|
|
get { return checkPcbIsInOracleCheckBox.Checked; }
|
|
}
|
|
|
|
public int ExtraBatterLifetime
|
|
{
|
|
get
|
|
{
|
|
int extraLifetime;
|
|
if (int.TryParse(extraBatteryLifetimeTextBox.Text, out extraLifetime) && extraLifetime >= 0) return extraLifetime;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
public TracingDB.Mode Mode
|
|
{
|
|
set
|
|
{
|
|
radioButton1.Checked = (value == TracingDB.Mode.Test);
|
|
radioButton2.Checked = (value == TracingDB.Mode.Production);
|
|
}
|
|
get
|
|
{
|
|
return radioButton1.Checked ? TracingDB.Mode.Test : TracingDB.Mode.Production;
|
|
}
|
|
}
|
|
|
|
public DateTime LogoutTime1
|
|
{
|
|
get { return timePicker1.Value; }
|
|
set { timePicker1.Value = (value.CompareTo(MinTime) < 0) ? MinTime : value; }
|
|
}
|
|
|
|
public DateTime LogoutTime2
|
|
{
|
|
get { return timePicker2.Value; }
|
|
set { timePicker2.Value = (value.CompareTo(MinTime) < 0) ? MinTime : value; }
|
|
}
|
|
|
|
public DateTime LogoutTime3
|
|
{
|
|
get { return timePicker3.Value; }
|
|
set { timePicker3.Value = (value.CompareTo(MinTime) < 0) ? MinTime : value; }
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// Basic configuration dialog
|
|
/// </summary>
|
|
/// <param name="isWorkplace">false = Konfiguracia pracovisk, true = Pracovisko</param>
|
|
public SettingsDlg(bool isWorkplace)
|
|
{
|
|
InitializeComponent();
|
|
|
|
if (isWorkplace)
|
|
{
|
|
oracleGroupBox.Visible = true;
|
|
timeGroupBox.Visible = true;
|
|
processFilterGroupBox.Visible = true;
|
|
|
|
processFilterComboBox.Items.Add("všetky");
|
|
processFilterComboBox.Items.Add("vodomery");
|
|
processFilterComboBox.Items.Add("vodomery odvodene z flowtuby");
|
|
processFilterComboBox.Items.Add("flowtuby");
|
|
}
|
|
|
|
extraBatteryLifetimeTextBox.Text = "0";
|
|
|
|
timePicker1.Format = DateTimePickerFormat.Custom;
|
|
timePicker1.CustomFormat = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.ShortTimePattern;
|
|
|
|
timePicker2.Format = DateTimePickerFormat.Custom;
|
|
timePicker2.CustomFormat = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.ShortTimePattern;
|
|
|
|
timePicker3.Format = DateTimePickerFormat.Custom;
|
|
timePicker3.CustomFormat = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.ShortTimePattern;
|
|
}
|
|
|
|
private void saveButton_Click(object sender, EventArgs e)
|
|
{
|
|
DialogResult = DialogResult.OK;
|
|
Close();
|
|
}
|
|
|
|
private void cancelButton_Click(object sender, EventArgs e)
|
|
{
|
|
DialogResult = DialogResult.Cancel;
|
|
Close();
|
|
}
|
|
}
|
|
}
|