Exemple #1
0
 partial void Deletedevices_t(devices_t instance);
Exemple #2
0
 partial void Insertdevices_t(devices_t instance);
Exemple #3
0
 partial void Updatedevices_t(devices_t instance);
Exemple #4
0
        //        public List<timezones_t> GetAllTimezones()
        //        {
        //            var db = new dbDataContext();
        //            lock (db)
        //            {
        //                var timeZoneTable = (from q in db.GetTable<timezones_t>()
        //                    orderby q.timezone_start
        //                    select q).ToList();
        //                return timeZoneTable;
        //            }
        //            
        //        }
        public void AddNewDevice(int deviceId, string ipAddress)
        {
            var db = new dbDataContext();
            lock (db)
            {
                for (int i = 0; i < 5; i++)
                {
                    try
                    {
                        Table<devices_t> devicesTable = db.GetTable<devices_t>();
                        var device = new devices_t
                        {
                            device_id = deviceId,
                            ip_address = ipAddress
                        };
                        devicesTable.InsertOnSubmit(device);
                        db.SubmitChanges();
            //                        break;
            //                List<string> allConsoles = GetAllTables().Select(t => t.playstation_id).ToList();

                        for (int j = 1; j <= 16; j++)
                        {
                            InsertNewEndPoint(deviceId, j);
                        }
                    }
                    catch (Exception)
                    {
                        if (i <= 0)
                        {
                            MessageBox.Show(ErrorsAndWarningsMessages.ErrorsAndWarningsInstance()
                                .GetErrorWithLine(1, 88));
                        }
                        else
                        {
                            MessageBox.Show(ErrorsAndWarningsMessages.ErrorsAndWarningsInstance().GetError(39));
                        }
                    }
                }
            }
        }