//确定 private void btnOk_Click(object sender, EventArgs e) { var m_options = db.Options.FirstOrDefault(); bool newOptions = false; if (m_options == null) { newOptions = true; m_options = new Options(); } foreach (Control c in this.Controls) { if (c.GetType() == typeof(ComboBox)) { if (c.Text == "") continue; var pro = m_options.GetType().GetProperty(c.Name); if (pro == null) continue; var proVal = TypeDescriptor.GetConverter(pro.PropertyType).ConvertFrom(c.Text); pro.SetValue(m_options, proVal, null); } } if (newOptions) db.Options.InsertOnSubmit(m_options); db.SubmitChanges(); this.DialogResult = DialogResult.OK; }
//对话框载入 private void SeatExpenseForm_Load(object sender, EventArgs e) { dgvExpense.ColumnHeadersDefaultCellStyle.Font = new Font("宋体", 20); dgvExpense.RowsDefaultCellStyle.Font = new Font("宋体", 20); dgvChain.ColumnHeadersDefaultCellStyle.Font = new Font("宋体", 17); dgvChain.RowsDefaultCellStyle.Font = new Font("宋体", 17); var db = new BathDBDataContext(LogIn.connectionString); m_Options = db.Options.FirstOrDefault(); printBill = BathClass.ToBool(m_Options.结账打印结账单); printShoe = BathClass.ToBool(m_Options.结账打印取鞋小票); printStubBill = BathClass.ToBool(m_Options.结账打印存根单); inputBillId = BathClass.ToBool(m_Options.录单输入单据编号); companyName = m_Options.companyName; //manul_pay = BathClass.ToBool(ops.允许手工输入手牌号结账); use_oyd = BathClass.ToBool(m_Options.启用手牌锁); if (use_oyd) { dgvChain.ReadOnly = true; btnReload.Text = "留牌"; //btnChain.Visible = false; //seatText.ReadOnly = true; //btnReload.Visible = false; } dgvExpense.Columns[1].Visible = inputBillId; m_Seat = m_Seats[0]; dgvChain_show(); dgvChain.CurrentCell = dgvChain[0, 0]; //chain = true; order_guoye(m_Seat, db); dgvExpense_show(db); setStatus(db); }
//对话框载入 private void RegionForm_Load(object sender, EventArgs e) { foreach(TabPage tp in tabControl1.TabPages) { foreach (Control c in tp.Controls) { if (c.GetType() == typeof(TextBox) || c.GetType() == typeof(CheckBox) || c.GetType() == typeof(ComboBox)) { ctList.Add(c); } } } m_options = db.Options.FirstOrDefault(); if (m_options != null) { foreach (Control c in ctList) { var pro = m_options.GetType().GetProperty(c.Name); if (pro == null) continue; var proVal = pro.GetValue(m_options, null); if (proVal == null) continue; if (c.GetType() == typeof(CheckBox)) { CheckBox cb = c as CheckBox; cb.Checked = Convert.ToBoolean(proVal); } else c.Text = proVal.ToString(); } 手牌锁类型.Enabled = 启用手牌锁.Checked; 过夜费起点.Enabled = 自动加收过夜费.Checked; 过夜费终点.Enabled = 自动加收过夜费.Checked; 启用分单结账.Enabled = !启用手牌锁.Checked; 允许手工输入手牌号结账.Enabled = !启用手牌锁.Checked; 允许手工输入手牌号开牌.Enabled = !启用手牌锁.Checked; 启用ID手牌锁.Enabled = !启用手牌锁.Checked; 自动感应手牌.Enabled = 启用手牌锁.Checked; 会员卡密码类型.Enabled = 启用会员卡密码.Checked; } }
partial void DeleteOptions(Options instance);
partial void UpdateOptions(Options instance);
partial void InsertOptions(Options instance);
//对话框载入 private void ReceptionSeatForm_Load(object sender, EventArgs e) { var db = new BathDBDataContext(LogIn.connectionString); this.Text = "咱家店小二-吧台V2.1 欢迎使用:" + LogIn.m_User.id; currentUser.Text = "当前用户:" + LogIn.m_User.id + " " + LogIn.m_User.name; ops = db.Options.FirstOrDefault(); createRooms(db, roomPanel); roomL.Visible = false; btnRoom.Visible = false; callL.Visible = false; toolCall.Visible = false; toolMsg.Visible = false; msgL.Visible = false; toolWarn.Visible = false; all_rooms = db.HotelRoom.Select(x => x.status).ToList(); all_rooms_id = db.HotelRoom.Select(x => x.id).ToList(); m_thread_update_room = new Thread(new ThreadStart(update_rooms_ui)); m_thread_update_room.Start(); }