public ArchiveStation(Size s, Panel returnP, Admin.AdminClient ac, Task <List <DomainModel.Models.Station> > l) : base(s, returnP, ac, l) { SaveButton.Text = "Usuń"; SelectStation = Program.MakeStylishButton(SaveButton.Size, new Point(SaveButton.Location.X, SaveButton.Location.Y + SaveButton.Size.Height + Program.Padding), "Wybierz stacje"); SelectStation.Click += new System.EventHandler(SelectStationClick); Background.Controls.Add(SelectStation); ReturnButton.Width *= 2; ListOfStations = new ListBox(); ListOfStations.Location = new Point(ReturnButton.Location.X, ReturnButton.Location.Y + ReturnButton.Height + Program.Padding); ListOfStations.Size = new Size(ReturnButton.Width, Background.Height - 4 * Program.Padding - ReturnButton.Height); Background.Controls.Add(ListOfStations); Archival = new CheckBox(); Archival.Checked = false; Archival.Size = SaveButton.Size; Archival.Text = "Stacja archiwalna"; Archival.Font = Program.DefaultFont; Archival.Location = new Point(SaveButton.Location.X, SelectStation.Location.Y + SelectStation.Height + Program.Padding); Background.Controls.Add(Archival); // sm = new StationManagment(); // stationsList = sm.AllStations();= this.VisibleChanged += new EventHandler(Loading); }
public ControlTemplete(Size s, Panel returnP, Admin.AdminClient ac, Task <List <DomainModel.Models.Station> > l) { InitializeComponent(); AC = ac; _stationList = l; this.Size = s; this._returnPanel = returnP; this.Controls.Add(Background = new Panel()); Background.BackColor = Program.BackGroundColor; int margin = 60; Background.Size = new Size(s.Width - margin, s.Height - margin); Background.Top = (s.Height - Background.Height) / 2; Background.Left = (s.Width - Background.Width) / 2; int padding = 10; ReturnButton = Program.MakeStylishButton(new System.Drawing.Size(Background.Width / 3 - padding, 100), new System.Drawing.Point(padding, padding), "Powrót"); SaveButton = Program.MakeStylishButton(ReturnButton.Size, new System.Drawing.Point(Background.Width - padding - ReturnButton.Size.Width, padding), "Zapisz"); SaveButton.Enabled = false; Background.Controls.Add(ReturnButton); Background.Controls.Add(SaveButton); ReturnButton.Click += new System.EventHandler(ReturnPanelClick); SaveButton.Click += new System.EventHandler(SaveClick); }
public SearchResult(Size s, Panel returnP, Admin.AdminClient ac, Task <List <DomainModel.Models.Station> > l, Mode mode = Mode.Edit) : base(s, returnP, ac, l) { InitializeComponent(); SaveButton.Text = "Wybierz"; _result = new DataGridView(); _result.Size = new Size(Background.Width, Background.Height - SaveButton.Height - 2 * Program.Padding); _result.Location = new Point(0, SaveButton.Height + 2 * Program.Padding); DataGridViewColumn c1 = new DataGridViewColumn(); c1.Name = "name"; c1.HeaderText = "Nazwa"; c1.CellTemplate = new DataGridViewTextBoxCell(); DataGridViewColumn c2 = new DataGridViewColumn(); c2.Name = "stationdeparture"; c2.HeaderText = "Stacja odjazdu"; c2.CellTemplate = new DataGridViewTextBoxCell(); DataGridViewColumn c3 = new DataGridViewColumn(); c3.Name = "stationArrival"; c3.HeaderText = "Stacja przyjazdu"; c3.CellTemplate = new DataGridViewTextBoxCell(); DataGridViewColumn c4 = new DataGridViewColumn(); c4.Name = "price"; c4.HeaderText = "Cena"; c4.CellTemplate = new DataGridViewTextBoxCell(); DataGridViewColumn c5 = new DataGridViewColumn(); c5.Name = "TravelSpan"; c5.HeaderText = "Czas przejazdu"; c5.CellTemplate = new DataGridViewTextBoxCell(); _result.Columns.Add(c1); _result.Columns.Add(c2); _result.Columns.Add(c3); _result.Columns.Add(c4); _result.Columns.Add(c5); _result.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; _result.AllowUserToAddRows = _result.AllowUserToDeleteRows = _result.AllowUserToResizeColumns = _result.AllowUserToResizeRows = false; _result.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing; _result.EditMode = DataGridViewEditMode.EditProgrammatically; _result.SelectionMode = DataGridViewSelectionMode.FullRowSelect; _result.MultiSelect = false; //l = m.Find(departureStation, arivalStation, price, hour); //for (int i=0;i<l.Count;i++) //{ // result.Rows.Add(l[i].Name, l[i].Departure.Name, l[i].Arrival.Name, l[i].Price, l[i].TravelTime); //} SaveButton.Enabled = true; Background.Controls.Add(_result); Background.Visible = false; Background.VisibleChanged += new EventHandler(Loading); this._mode = mode; }
private void InitializeConnector(string url, X509Certificate2 clientCertificate) { HttpClientHandler handler = new HttpClientHandler(); handler.ClientCertificateOptions = ClientCertificateOption.Manual; handler.ClientCertificates.Add(clientCertificate); handler.SslProtocols = SslProtocols.Tls13 | SslProtocols.Tls12; handler.AllowAutoRedirect = true; handler.ServerCertificateCustomValidationCallback = delegate { return(true); }; var channel = GrpcChannel.ForAddress(url, new GrpcChannelOptions() { HttpHandler = handler, }); _adminClient = new Admin.AdminClient(channel); }
public AddStation(Size s, Panel returnP, Admin.AdminClient ac, Task <List <DomainModel.Models.Station> > l, Form1 LO) : base(s, returnP, ac, l) { p = LO; SaveButton.Text = "Dodaj"; _name = new Label(); _name.Location = new Point(SaveButton.Location.X - SaveButton.Width - Program.Padding, SaveButton.Location.Y + 2 * SaveButton.Height); _name.Font = Program.DefaultFont; _name.Size = SaveButton.Size; _name.Text = "Podaj nową stacje"; Background.Controls.Add(_name); _newStation = new TextBox(); _newStation.Font = Program.DefaultFont; _newStation.Size = SaveButton.Size; _newStation.Location = new Point(_name.Location.X, _name.Location.Y + _name.Size.Height); Background.Controls.Add(_newStation); SaveButton.Enabled = true; }
// private StationManagment sm; public EditStation(Size s, Panel returnP, Admin.AdminClient ac, Task <List <DomainModel.Models.Station> > l) : base(s, returnP, ac, l) { _selectStation = Program.MakeStylishButton(SaveButton.Size, new Point(SaveButton.Location.X, SaveButton.Location.Y + SaveButton.Size.Height + Program.Padding), "Wybierz stacje"); _selectStation.Click += new System.EventHandler(SelectStationClick); Background.Controls.Add(_selectStation); ReturnButton.Width *= 2; _listOfStations = new ListBox(); _listOfStations.Location = new Point(ReturnButton.Location.X, ReturnButton.Location.Y + ReturnButton.Height + Program.Padding); _listOfStations.Size = new Size(ReturnButton.Width, Background.Height - 4 * Program.Padding - ReturnButton.Height); Background.Controls.Add(_listOfStations); _newNameStation = new TextBox(); _newNameStation.Font = Program.DefaultFont; _newNameStation.Size = SaveButton.Size; _newNameStation.Location = new Point(SaveButton.Location.X, _selectStation.Location.Y + _selectStation.Height + Program.Padding); Background.Controls.Add(_newNameStation); // sm=new StationManagment(); // ListOfStations.DataSource = sm.AllStations(); _listOfStations.DisplayMember = "Name"; DoubleBuffered = true; this.VisibleChanged += new EventHandler(Loading); }
public EditConnectionDefinition(Size s, Panel returnP, Admin.AdminClient ac, Task <List <DomainModel.Models.Station> > l, SearchResult.Mode mode = SearchResult.Mode.Edit) : base(s, returnP, ac, l) { _departureCheckbox = new CheckBox() { Location = new Point(SaveButton.Location.X, SaveButton.Location.Y + SaveButton.Height), Size = new Size(SaveButton.Width, SaveButton.Height / 2), Text = "Uwzględnij stację odjazdu", }; Background.Controls.Add(_departureCheckbox); _arrivalCheckbox = new CheckBox() { Location = new Point(SaveButton.Location.X, _departureCheckbox.Location.Y + _departureCheckbox.Height), Size = new Size(SaveButton.Width, SaveButton.Height / 2), Text = "Uwzględnij stację docelową" }; Background.Controls.Add(_arrivalCheckbox); _priceCheckBox = new CheckBox() { Location = new Point(SaveButton.Location.X, _arrivalCheckbox.Location.Y + _arrivalCheckbox.Height), Size = new Size(SaveButton.Width, SaveButton.Height / 2), Text = "Uwzględnij cenę biletu" }; Background.Controls.Add(_priceCheckBox); _time = new CheckBox() { Location = new Point(SaveButton.Location.X, _priceCheckBox.Location.Y + _priceCheckBox.Height), Size = new Size(SaveButton.Width, SaveButton.Height / 2), Text = "Uwzględnij długość przejazdu" }; Background.Controls.Add(_time); SaveButton.Enabled = true; SaveButton.Text = "Szukaj"; _selectStationDeparture = Program.MakeStylishButton(new Size(Background.Width - 2 * Program.Padding * 2 - SaveButton.Width, SaveButton.Height), new Point(Program.Padding, SaveButton.Location.Y + SaveButton.Size.Height + Program.Padding), "Wybierz stacje początkową"); _selectStationDeparture.Click += new System.EventHandler(SelectStationDepartureClick); Background.Controls.Add(_selectStationDeparture); _selectStationArrival = Program.MakeStylishButton(new Size(Background.Width - 2 * Program.Padding * 2 - SaveButton.Width, SaveButton.Height), new Point(Program.Padding, _selectStationDeparture.Location.Y + SaveButton.Size.Height + Program.Padding), "Wybierz stacje końcową"); _selectStationArrival.Click += new System.EventHandler(SelectStationArrivalClick); Background.Controls.Add(_selectStationArrival); Label travelTime; travelTime = new Label(); travelTime.Location = new Point(Program.Padding, SaveButton.Location.Y + 4 * SaveButton.Height); travelTime.Font = Program.DefaultFont; travelTime.Size = SaveButton.Size; travelTime.Text = "Podaj długość przejazdu hh:mm"; Background.Controls.Add(travelTime); _hourTimePicker = new DateTimePicker(); _hourTimePicker.Format = DateTimePickerFormat.Custom; _hourTimePicker.ShowUpDown = true; _hourTimePicker.CustomFormat = "HH"; _hourTimePicker.Location = new Point(travelTime.Location.X + travelTime.Size.Width, travelTime.Location.Y); _hourTimePicker.Font = Program.DefaultFont; _hourTimePicker.Size = new Size(55, 20); Background.Controls.Add(_hourTimePicker); Label Price; Price = new Label(); Price.Location = new Point(Background.Width - 3 * SaveButton.Width / 2, SaveButton.Location.Y + 4 * SaveButton.Height); Price.Font = Program.DefaultFont; Price.Size = new Size(150, 70); Price.Text = "Podaj cenę (PLN)"; Background.Controls.Add(Price); _priceBox = new TextBox(); _priceBox.Font = Program.DefaultFont; _priceBox.TextChanged += new System.EventHandler(TextChanged); _priceBox.Location = new Point(Price.Location.X + Price.Width, Price.Location.Y); _priceBox.Size = Price.Size; Background.Controls.Add(_priceBox); _ok = new Button() { Size = new Size(100, 25), Text = "Wybierz stacje", Location = new Point(Width / 2 - 50, Height - 30), }; Controls.Add(_ok); _ok.Click += new System.EventHandler(AcceptStationClick); _ok.Visible = false; ReturnButton.Width *= 2; _listOfStations = new ListBox(); _listOfStations.Location = Background.Location; _listOfStations.Size = Background.Size; this.Controls.Add(_listOfStations); // sm = new StationManagment(); // ListOfStations.DataSource = sm.AllStations(); _listOfStations.DisplayMember = "Name"; DoubleBuffered = true; _searchResult = new SearchResult(Size, Background, AC, _stationList, mode); this.Controls.Add(_searchResult); this.Visible = false; this.VisibleChanged += new EventHandler(Loading); }
public ArchiveConnectionDefiniton(Size s, Panel returnP, Admin.AdminClient ac, Task <List <DomainModel.Models.Station> > l) : base(s, returnP, ac, l) { }
public AddNewConnection(Size s, Panel returnP, DomainModel.Models.ConnectionDefinition connectionDefinition, Admin.AdminClient ac, Task <List <DomainModel.Models.Station> > l) : this(s, returnP, ac, l) { this._connectionDefinition = connectionDefinition; StringBuilder sb = new StringBuilder(); sb.Append(connectionDefinition.Name) .Append(Environment.NewLine) .Append("Z:") .Append(Environment.NewLine) .Append(connectionDefinition.Departure.Name) .Append(Environment.NewLine) .Append("Do:") .Append(Environment.NewLine) .Append(connectionDefinition.Arrival.Name) .Append(Environment.NewLine) .Append("Cena:") .Append(Environment.NewLine) .Append(connectionDefinition.Price) .Append(Environment.NewLine) .Append("Czas Przejazdu:") .Append(Environment.NewLine) .Append(connectionDefinition.TravelTime); _connection = new Label() { Location = new Point(ReturnButton.Location.X, ReturnButton.Height + Program.Padding + ReturnButton.Location.Y), Size = new Size(ReturnButton.Width, ReturnButton.Height * 3), Font = Program.DefaultFont, Text = sb.ToString() }; Background.Controls.Add(_connection); _starTimePicker = new DateTimePicker() { Location = new Point(SaveButton.Location.X, SaveButton.Location.Y + SaveButton.Height + Program.Padding), MinDate = DateTime.Today, MaxDate = DateTime.Today.AddMonths(3), }; Background.Controls.Add(_starTimePicker); _toTimePicker = new DateTimePicker() { Location = new Point(_starTimePicker.Location.X, _starTimePicker.Location.Y + _starTimePicker.Height + Program.Padding), MinDate = DateTime.Today, MaxDate = DateTime.Today.AddMonths(12), }; Background.Controls.Add(_toTimePicker); _from = new Label() { Location = new Point(_starTimePicker.Location.X, _toTimePicker.Location.Y + _toTimePicker.Height + Program.Padding), Size = new Size(_starTimePicker.Width - Program.Padding, 60), Font = Program.DefaultFont, Text = "Zakres dat przejazdów" }; Background.Controls.Add(_from); _freqTextBox = new TextBox() { Location = new Point(_from.Location.X, _from.Location.Y + _from.Height + Program.Padding), Size = new Size(_from.Width - Program.Padding, 40), Font = Program.DefaultFont }; _frequency = new Label() { Location = new Point(_freqTextBox.Location.X, _freqTextBox.Location.Y + _freqTextBox.Height + Program.Padding), Size = new Size(ReturnButton.Width, ReturnButton.Height), Font = Program.DefaultFont, Text = "Częstotliwość w dniach" }; Background.Controls.Add(_freqTextBox); Background.Controls.Add(_frequency); _freqTextBox.TextChanged += new EventHandler(TextChanged); Label travelTime; travelTime = new Label(); travelTime.Location = new Point(Program.Padding + _connection.Width, SaveButton.Location.Y + 4 * SaveButton.Height); travelTime.Font = Program.DefaultFont; travelTime.Size = SaveButton.Size; travelTime.Text = "Podaj godzinę odjazdu"; Background.Controls.Add(travelTime); _hourTimePicker = new DateTimePicker(); _hourTimePicker.Format = DateTimePickerFormat.Custom; _hourTimePicker.ShowUpDown = true; _hourTimePicker.CustomFormat = "HH"; _hourTimePicker.Location = new Point(travelTime.Location.X + travelTime.Size.Width, travelTime.Location.Y); _hourTimePicker.Font = Program.DefaultFont; _hourTimePicker.Size = new Size(55, 20); Background.Controls.Add(_hourTimePicker); _minDateTimePicker = new DateTimePicker(); _minDateTimePicker.Format = DateTimePickerFormat.Custom; _minDateTimePicker.ShowUpDown = true; _minDateTimePicker.CustomFormat = "mm"; _minDateTimePicker.Location = new Point(travelTime.Location.X + travelTime.Size.Width + 60, travelTime.Location.Y); _minDateTimePicker.Font = Program.DefaultFont; _minDateTimePicker.Size = new Size(55, 20); Background.Controls.Add(_minDateTimePicker); }
public AddNewConnection(Size s, Panel returnP, Admin.AdminClient ac, Task <List <DomainModel.Models.Station> > l) : base(s, returnP, ac, l) { InitializeComponent(); }
public AddConectionDefinition(Size s, Panel returnP, Admin.AdminClient ac, Task <List <DomainModel.Models.Station> > l) : base(s, returnP, ac, l) { SaveButton.Text = "Dodaj"; _selectStationDeparture = Program.MakeStylishButton(new Size(Background.Width - Program.Padding * 2, SaveButton.Height), new Point(Program.Padding, SaveButton.Location.Y + SaveButton.Size.Height + Program.Padding), "Wybierz stacje początkową"); _selectStationDeparture.Click += new System.EventHandler(SelectStationDepartureClick); Background.Controls.Add(_selectStationDeparture); _selectStationArrival = Program.MakeStylishButton(new Size(Background.Width - Program.Padding * 2, SaveButton.Height), new Point(Program.Padding, _selectStationDeparture.Location.Y + SaveButton.Size.Height + Program.Padding), "Wybierz stacje końcową"); _selectStationArrival.Click += new System.EventHandler(SelectStationArrivalClick); Background.Controls.Add(_selectStationArrival); _selectStationArrival.Enabled = false; Label travelTime; travelTime = new Label(); travelTime.Location = new Point(Program.Padding, SaveButton.Location.Y + 4 * SaveButton.Height); travelTime.Font = Program.DefaultFont; travelTime.Size = SaveButton.Size; travelTime.Text = "Podaj długość przejazdu hh:mm"; Background.Controls.Add(travelTime); _hourTimePicker = new DateTimePicker(); _hourTimePicker.Format = DateTimePickerFormat.Custom; _hourTimePicker.ShowUpDown = true; _hourTimePicker.CustomFormat = "HH"; _hourTimePicker.Location = new Point(travelTime.Location.X + travelTime.Size.Width, travelTime.Location.Y); _hourTimePicker.Font = Program.DefaultFont; _hourTimePicker.Size = new Size(55, 20); Background.Controls.Add(_hourTimePicker); _minutesTimePicker = new DateTimePicker(); _minutesTimePicker.Format = DateTimePickerFormat.Custom; _minutesTimePicker.ShowUpDown = true; _minutesTimePicker.CustomFormat = "mm"; _minutesTimePicker.Location = new Point(_hourTimePicker.Location.X + _hourTimePicker.Size.Width, travelTime.Location.Y); _minutesTimePicker.Font = Program.DefaultFont; _minutesTimePicker.Size = new Size(55, 20); Background.Controls.Add(_minutesTimePicker); Label Price; Price = new Label(); Price.Location = new Point(Background.Width - 3 * SaveButton.Width / 2, SaveButton.Location.Y + 4 * SaveButton.Height); Price.Font = Program.DefaultFont; Price.Size = new Size(150, 40); Price.Text = "Podaj cenę"; Background.Controls.Add(Price); _priceBox = new TextBox(); _priceBox.Font = Program.DefaultFont; _priceBox.TextChanged += new System.EventHandler(TextChanged); _priceBox.Location = new Point(Price.Location.X + Price.Width, Price.Location.Y); _priceBox.Size = Price.Size; Background.Controls.Add(_priceBox); _ok = new Button() { Size = new Size(100, 25), Text = "Wybierz stacje", Location = new Point(Width / 2 - 50, Height - 30), }; Controls.Add(_ok); _ok.Click += new System.EventHandler(AcceptStationClick); _ok.Visible = false; ReturnButton.Width *= 2; _listOfStations = new ListBox(); _listOfStations.Location = Background.Location; _listOfStations.Size = Background.Size; this.Controls.Add(_listOfStations); // sm=new StationManagment(); // ListOfStations.DataSource = sm.AllStations(); _listOfStations.DisplayMember = "Name"; DoubleBuffered = true; this.VisibleChanged += new EventHandler(Loading); }
public ModifyResult(Size s, Panel returnP, DomainModel.Models.ConnectionDefinition cd, Admin.AdminClient ac, Task <List <DomainModel.Models.Station> > l, SearchResult sr) : base(s, returnP, ac, l) { InitializeComponent(); ss = sr; this._cd = cd; _departureStation = cd.Departure; _arrivalStation = cd.Arrival; // sm=new StationManagment(); SaveButton.Text = "Zapisz"; _selectStationDeparture = Program.MakeStylishButton(new Size(Background.Width - Program.Padding * 2, SaveButton.Height), new Point(Program.Padding, SaveButton.Location.Y + SaveButton.Size.Height + Program.Padding), "Stacja początkowa: " + cd.Departure.Name); _selectStationDeparture.Click += new System.EventHandler(SelectStationDepartureClick); Background.Controls.Add(_selectStationDeparture); _selectStationArrival = Program.MakeStylishButton(new Size(Background.Width - Program.Padding * 2, SaveButton.Height), new Point(Program.Padding, _selectStationDeparture.Location.Y + SaveButton.Size.Height + Program.Padding), "Stacja końcowa: " + cd.Arrival.Name); _selectStationArrival.Click += new System.EventHandler(SelectStationArrivalClick); Background.Controls.Add(_selectStationArrival); Label travelTime; travelTime = new Label(); travelTime.Location = new Point(Program.Padding, SaveButton.Location.Y + 4 * SaveButton.Height); travelTime.Font = Program.DefaultFont; travelTime.Size = SaveButton.Size; travelTime.Text = "Podaj długość przejazdu hh:mm"; Background.Controls.Add(travelTime); _hourTimePicker = new DateTimePicker(); _hourTimePicker.Format = DateTimePickerFormat.Custom; _hourTimePicker.ShowUpDown = true; _hourTimePicker.CustomFormat = "HH"; _hourTimePicker.Location = new Point(travelTime.Location.X + travelTime.Size.Width, travelTime.Location.Y); _hourTimePicker.Font = Program.DefaultFont; _hourTimePicker.Size = new Size(55, 20); _hourTimePicker.Value = new DateTime(1970, 1, 1, cd.TravelTime.Hours, 0, 0); Background.Controls.Add(_hourTimePicker); _minutesTimePicker = new DateTimePicker(); _minutesTimePicker.Format = DateTimePickerFormat.Custom; _minutesTimePicker.ShowUpDown = true; _minutesTimePicker.CustomFormat = "mm"; _minutesTimePicker.Location = new Point(_hourTimePicker.Location.X + _hourTimePicker.Size.Width, travelTime.Location.Y); _minutesTimePicker.Font = Program.DefaultFont; _minutesTimePicker.Size = new Size(55, 20); _minutesTimePicker.Value = new DateTime(1970, 1, 1, 0, cd.TravelTime.Minutes, 0); Background.Controls.Add(_minutesTimePicker); Label Price; Price = new Label(); Price.Location = new Point(Background.Width - 3 * SaveButton.Width / 2, SaveButton.Location.Y + 4 * SaveButton.Height); Price.Font = Program.DefaultFont; Price.Size = new Size(150, 40); Price.Text = "Podaj cenę"; Background.Controls.Add(Price); _priceBox = new TextBox(); _priceBox.Font = Program.DefaultFont; _priceBox.TextChanged += new System.EventHandler(TextChanged); _priceBox.Location = new Point(Price.Location.X + Price.Width, Price.Location.Y); _priceBox.Size = Price.Size; _priceBox.Text = cd.Price.ToString(); Background.Controls.Add(_priceBox); _ok = new Button() { Size = new Size(100, 25), Text = "Wybierz stacje", Location = new Point(Width / 2 - 50, Height - 30), }; Controls.Add(_ok); _ok.Click += new System.EventHandler(AcceptStationClick); _ok.Visible = false; _removeButton = Program.MakeStylishButton(new Size(SaveButton.Width - Program.Padding, SaveButton.Height), new Point(SaveButton.Location.X - SaveButton.Width, SaveButton.Location.Y), "Usuń"); Background.Controls.Add(_removeButton); _removeButton.Click += new System.EventHandler(RemoveClick); _listOfStations = new ListBox(); _listOfStations.Location = Background.Location; _listOfStations.Size = Background.Size; this.Controls.Add(_listOfStations); // sm=new StationManagment(); _listOfStations.DataSource = l.Result; _listOfStations.DisplayMember = "Name"; DoubleBuffered = true; }