Example #1
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            if (textBoxTimeZoneName.Text == "" || textBoxTimeZoneName.Text.Length < 4)
            {
                MessageBox.Show(
                    "Length of the name of timeZone not suit to requirments. Please inout name containing more than 4 symbols");
            }
            else if (end_dateTimePicker.Value.Hour == start_datetimepicker.Value.Hour)
            {
                //change length
                MessageBox.Show("change time length ");
            }
            else
            {
            //                string timeZoneName = "";
                string name = textBoxTimeZoneName.Text;
                TimeSpan startTime = TimeSpan.Parse(start_datetimepicker.Value.Hour + ":00");
                TimeSpan endTime = TimeSpan.Parse(end_dateTimePicker.Value.Hour + ":00");

                try
                {
                    Table<timezones_t> timeZonesT = db.GetTable<timezones_t>();
                    timezones_t timezones = new timezones_t();
                    timezones.timezone_name = name;
                    timezones.timezone_start = startTime;
                    timezones.timezone_end = endTime;
                    timeZonesT.InsertOnSubmit(timezones);
                    db.SubmitChanges();
                    RefreshTable();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }

                try
                {
                    var playstations = (from q in db.GetTable<tables_t>()
                        select new
                        {
                            q.playstation_id
                        }).ToList();

                    Table<playstation_timezone> timeZoneTable;
                    playstation_timezone playstationTimezone;

                    for (int i = 0; i < playstations.Count; i++)
                    {
                        timeZoneTable = db.GetTable<playstation_timezone>();
                        playstationTimezone = new playstation_timezone
                        {
                            playstation_id = playstations[i].playstation_id,
                            timezone_name = name
                        };

                        timeZoneTable.InsertOnSubmit(playstationTimezone);
                        db.SubmitChanges();
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
                textBoxTimeZoneName.Text = "";
                ComboBoxTimeZOne.Items.Add(name);
            }
        }
Example #2
0
 partial void Updatetimezones_t(timezones_t instance);
Example #3
0
 partial void Deletetimezones_t(timezones_t instance);
Example #4
0
 partial void Inserttimezones_t(timezones_t instance);