Ejemplo n.º 1
0
 public Options()
 {
     _db = new dbDataContext();
     _plstTimeZonesTables = _db.GetTable<playstation_timezone>();
     _timeZonesTable = _db.GetTable<timezones_t>();
     CacheDataFromDb();
 }
Ejemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            //              pers.AddNewPerson(personIdTextBox.Text, nameTextBox2.Text, loginTextBox3.Text,
            //                passwordTextBox4.Text, positionTextBox5.Text, phoneTextBox6.Text,
            //                additionalPhoneTextBox7.Text, birthdayDateTimePicker1.Value, homeAddressTextBox9.Text,
            //                int.Parse(salaryTextBox10.Text));

            var db = new dbDataContext();
            Table<personal_info_t> t = db.GetTable<personal_info_t>();

            var id = (from a in db.GetTable<personal_info_t>()
                orderby a.person_id ascending
                //select a.person_id).First();
                select new {a.person_id});
            dataGridView1.DataSource = id; //pers.GetAllPersonalInfos();
        }
Ejemplo n.º 3
0
        public void GetPricesFromDb()
        {
            db = new dbDataContext();
            CurrentPlaystationPrice = new Dictionary<string, double>();
            var timezone = (from t in db.GetTable<timezones_t>()
                where t.timezone_start <= DateTime.Now.TimeOfDay
                where t.timezone_end > DateTime.Now.TimeOfDay
                select t.timezone_name).Single();

            var playstationPrice = (from pp in db.GetTable<timezones_t>()
                where pp.timezone_name == timezone
                select new
                {
                    pp.timezone_name
            //                    pp.timezone_cost_per_hour
                }).ToList();

            //            for (int i = 0; i < playstationPrice.Count; i++)
            //            {
            //                CurrentPlaystationPrice.Add(playstationPrice[i].timezone_name,
            //                    playstationPrice[i].timezone_cost_per_hour);
            //            }
            //            MessageBox.Show(CurrentPlaystationPrice.ToString());
        }
Ejemplo n.º 4
0
        public void AddNewPerson(string personID, string name, string login,
                                        string password, string position, string phone, string additionalPhone,
                                        DateTime birthday, string homeAddress, int salaryPerDay)
        {
            _dataContext = new dbDataContext();
            _personalInfoTables = _dataContext.GetTable<personal_info_t>();

            //var persons = personalInfoTables.Where(person => person.additional_phone == "000000").ToList();

            personal_info_t myPerson = new personal_info_t();
            myPerson.person_id = personID;
            myPerson.name = name;
            myPerson.staff_login = login;
            myPerson.staff_password = password;
            myPerson.position = position;
            myPerson.phone = phone;
            myPerson.additional_phone = additionalPhone;
            myPerson.birthday = birthday;
            myPerson.home_address = homeAddress;
            myPerson.salary_per_day = salaryPerDay;

            _personalInfoTables.InsertOnSubmit(myPerson);
            _dataContext.SubmitChanges();
        }