Esempio n. 1
0
 public void add(DomainModel.Models.ConnectionDefinition cd)
 {
     if (cd != null)
     {
         _l.Add(cd);
     }
     _result.Rows.Clear();
     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);
     }
 }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
 public System.Threading.Tasks.Task <bool> AddNewConnectionsAsync(DomainModel.Models.ConnectionDefinition connectionDefinition, System.DateTime value, System.DateTime dateTime, int days, int h, int m)
 {
     return(base.Channel.AddNewConnectionsAsync(connectionDefinition, value, dateTime, days, h, m));
 }
Esempio n. 4
0
 public bool AddNewConnections(DomainModel.Models.ConnectionDefinition connectionDefinition, System.DateTime value, System.DateTime dateTime, int days, int h, int m)
 {
     return(base.Channel.AddNewConnections(connectionDefinition, value, dateTime, days, h, m));
 }
Esempio n. 5
0
 public System.Threading.Tasks.Task <bool> MakeArchivalAsync(DomainModel.Models.ConnectionDefinition cd)
 {
     return(base.Channel.MakeArchivalAsync(cd));
 }
Esempio n. 6
0
 public bool MakeArchival(DomainModel.Models.ConnectionDefinition cd)
 {
     return(base.Channel.MakeArchival(cd));
 }
Esempio n. 7
0
 public System.Threading.Tasks.Task <bool> UpdateConnectionAsync(DomainModel.Models.ConnectionDefinition cd, DomainModel.Models.Station d, DomainModel.Models.Station a, int p, System.TimeSpan ts)
 {
     return(base.Channel.UpdateConnectionAsync(cd, d, a, p, ts));
 }
Esempio n. 8
0
 public bool UpdateConnection(DomainModel.Models.ConnectionDefinition cd, DomainModel.Models.Station d, DomainModel.Models.Station a, int p, System.TimeSpan ts)
 {
     return(base.Channel.UpdateConnection(cd, d, a, p, ts));
 }
Esempio n. 9
0
        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;
        }