예제 #1
0
        private void add_client_button_Click(object sender, EventArgs e)
        {
            TimeSpan currentTime = DateTime.Now.TimeOfDay;
            TimeSpan ct = DateTime.Now.TimeOfDay;

            if (!String.IsNullOrWhiteSpace(table_numComboBox.Text))
            {
                var q = (from days in db.GetTable<days_sessions_t>()
                         where days.daily_id == _dailyId
                         orderby days.client_num descending
                         select days.client_num).FirstOrDefault();

                var table = (from t in db.GetTable<tables_t>()
                             where t.playstation_id == table_numComboBox.Text
                             select t).Single();
                if (textBoxDiscounts.Text == "0")
                {
                    TimeSpan paidTime =
                        TimeSpan.FromMinutes(
                            (double) ((numericUpDownHoursLeft.Value*60) + numericUpDownMinutesLeft.Value));

                    Table<days_sessions_t> daysT = db.GetTable<days_sessions_t>();
                    var daysSessionT = new days_sessions_t();
                    Table<clents_per_session_t> clientsPersessionTable = db.GetTable<clents_per_session_t>();
                    clents_per_session_t clientsPerSessionT = new clents_per_session_t();

                    daysSessionT.daily_id = _dailyId;
                    daysSessionT.client_num = (int) q + 1;
                    daysSessionT.start_game = new TimeSpan(currentTime.Hours, currentTime.Minutes, currentTime.Seconds);
                    daysSessionT.end_game = new TimeSpan(ct.Add(paidTime).Hours, ct.Add(paidTime).Minutes, ct.Add(paidTime).Seconds);
                    daysSessionT.playstation_id = table_numComboBox.Text;
            //                    daysSessionT.client_id = combo_box_client_discount_card.Text;
                    daysSessionT.session_state = "opened";
                    //
                    clientsPerSessionT.session_id = daysSessionT.session_id;
                    clientsPerSessionT.client_id = textBoxDiscounts.Text;//------------------------------------------------------------------------------NEED OT FIXED
                    //
                    daysSessionT.payed_sum = (double) (paid_price_numeric_up_down.Value);
                    daysSessionT.money_left = (double) (paid_price_numeric_up_down.Value);
                    daysSessionT.session_discount = 0;
                    daysSessionT.session_id = daysSessionT.session_id;
                    try
                    {
                        daysT.InsertOnSubmit(daysSessionT);
            //                        db.SubmitChanges();
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.ToString());
                    }

                    if (table.playstation_id != null)
                    {
                        table.playstation_state = "busy";
                        try
                        {
                            db.SubmitChanges();
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show(ex.Message);
                        }
                    }
                    else
                    {
                        MessageBox.Show("Can't find a playstation " + table.playstation_id);
                    }
                }
            }

            Close();
        }
예제 #2
0
 partial void Deletedays_sessions_t(days_sessions_t instance);
예제 #3
0
 partial void Updatedays_sessions_t(days_sessions_t instance);
예제 #4
0
 partial void Insertdays_sessions_t(days_sessions_t instance);
예제 #5
0
		private void detach_days_sessions_ts(days_sessions_t entity)
		{
			this.SendPropertyChanging();
			entity.tables_t = null;
		}
예제 #6
0
		private void attach_days_sessions_ts(days_sessions_t entity)
		{
			this.SendPropertyChanging();
			entity.global_session_t = this;
		}