//对话框载入 private void OrderForm_Load(object sender, EventArgs e) { dao = new DAO(m_con_str); if (!dao.execute_command("update [Seat] set ordering='True' where text='" + m_Seat.text + "'")) { BathClass.printErrorMsg("手牌状态更新失败!"); return; } m_options = dao.get_options(); if (typeList.Count == 0) { typeList = dao.get_catgories(null); } //typeList = db.Catgory.Select(x => x.name).ToList(); dgvExpense.Columns[11].Visible = MConvert <bool> .ToTypeOrDefault(m_options.启用客房面板, false); inputBillId = MConvert <bool> .ToTypeOrDefault(m_options.录单输入单据编号, false); inputTechType = MConvert <bool> .ToTypeOrDefault(m_options.录单区分点钟轮钟, false); string local_ip = BathClass.get_local_ip(); stock = dao.get_Stock("select * from [Stock] where ips='" + local_ip + "'"); this.Invoke(new no_par_delegate(initial_ui), null); //MessageBox.Show((DateTime.Now - st).TotalMilliseconds.ToString()); }
//构造函数 public OrderCheckForm(CSeat seat, string con_str, COptions options) { m_con_str = con_str; m_Seat = seat; m_options = options; dao = new DAO(con_str); InitializeComponent(); }
/// <summary> /// 创建台位界面 /// </summary> /// <param name="dao">数据库连接</param> /// <param name="options">选项</param> /// <param name="seatPanel">面板</param> /// <param name="seatTab">标签页</param> /// <param name="btn_click">响应回调函数</param> /// <param name="cm">右键菜单</param> /// <param name="department">部门:桑拿部、客房部</param> public static void createSeatByDao(DAO dao, COptions options, Control seatPanel, TabControl seatTab, EventHandler btn_click, EventHandler btn_MouseHover, ContextMenuStrip cm, string department) { if (MConvert <bool> .ToTypeOrDefault(options.台位类型分页显示, false)) //台位类型是否分页显示 { seatPanel.Visible = false; seatTab.Visible = true; seatTab.Dock = DockStyle.Fill; List <CSeatType> seat_types = new List <CSeatType>(); if (department == null) { seat_types = dao.get_seattypes(null, null); } else { seat_types = dao.get_seattypes("department", department); } foreach (var stype in seat_types) { TabPage tp = create_seat_page(stype.name, seatTab); var seats = dao.get_seats("typeId", stype.id).OrderBy(x => x.text).ToList(); creat_seat_per_panel(seats, tp, btn_click, btn_MouseHover, cm); } } else { seatPanel.Visible = true; seatTab.Visible = false; seatPanel.Dock = DockStyle.Fill; //var seatTypes = dao.get_seattypes("department", department).Select(x => x.id).ToList(); List <CSeat> seats = new List <CSeat>(); if (department == null) { seats = dao.get_all_seats().OrderBy(x => x.typeId).ThenBy(x => x.text).ToList(); } else { seats = dao.get_seats("typeid in (select id from seattype where department='" + department + "')"). OrderBy(x => x.typeId).ThenBy(x => x.text).ToList(); } //var seats = dao.get_seats(null, null).OrderBy(x => x.typeId).ThenBy(x => x.text).ToList(); creat_seat_per_panel(seats, seatPanel, btn_click, btn_MouseHover, cm); //if (dao.has_hotel_department()) //{ // seatPanel.Visible = false; // seatTab.Visible = true; // seatTab.Dock = DockStyle.Fill; // TabPage tp = create_seat_page("桑拿部", seatTab); // var seatTypes = dao.get_seattypes("name", "桑拿部").Select(x => x.id).ToList(); // var seats = dao.get_seats("typeId", seatTypes).OrderBy(x => x.typeId).ThenBy(x => x.text).ToList(); // creat_seat_per_panel(seats, tp, btn_click, cm); // tp = create_seat_page("客房部", seatTab); // seatTypes = dao.get_seattypes("department", "客房部").Select(x => x.id).ToList(); // seats = dao.get_seats("typeId", seatTypes).OrderBy(x => x.typeId).ThenBy(x => x.text).ToList(); // //seatTypes = dc.SeatType.Where(x => x.department == "客房部").Select(x => x.id); // //seats = dc.Seat.Where(x => seatTypes.Contains(x.typeId)).OrderBy(x => x.typeId).ThenBy(x => x.text).ToList(); // creat_seat_per_panel(seats, tp, btn_click, cm); //} //else //{ //} } }
//对话框载入 private void Form1_Load(object sender, EventArgs e) { connectionIP = IOUtil.get_config_by_key(ConfigKeys.KEY_CONNECTION_IP); if (connectionIP == "") { PCListForm pCListForm = new PCListForm(); if (pCListForm.ShowDialog() != DialogResult.OK) { this.Close(); return; } connectionIP = pCListForm.ip; IOUtil.set_config_by_key(ConfigKeys.KEY_CONNECTION_IP, connectionIP); } dao = new DAO(connectionString); if (!dao.check_net()) { BathClass.printErrorMsg("连接IP不对或者网络不通,请重试!"); this.Close(); return; } _options = dao.get_options(); m_company = _options.companyName; print_tech_msg = MConvert <bool> .ToTypeOrDefault(options.打印技师派遣单, false); user_card = MConvert <bool> .ToTypeOrDefault(options.启用员工服务卡, false); IPHostEntry ipe = Dns.GetHostEntry(Dns.GetHostName()); foreach (var ip in ipe.AddressList) { m_ip = ip.ToString(); if (System.Text.RegularExpressions.Regex.IsMatch(m_ip, "[0-9]{1,3}//.[0-9]{1,3}//.[0-9]{1,3}//.[0-9]{1,3}")) { break; } } setMax(); //dgv.ColumnHeadersDefaultCellStyle.Font = new Font("宋体", 20); //dgv.RowsDefaultCellStyle.Font = new Font("宋体", 20); //dgv_show(); m_thread = new Thread(new ThreadStart(detect_msg)); m_thread.IsBackground = true; m_thread.Start(); m_thread_tech = new Thread(new ThreadStart(detect_tech_index)); m_thread_tech.IsBackground = true; m_thread_tech.Start(); clock_timer = new System.Timers.Timer(); clock_timer.Interval = 1000; clock_timer.Elapsed += new System.Timers.ElapsedEventHandler(clock_timer_Elapsed); clock_timer.Enabled = true; m_player = new SoundPlayer(); techId.Focus(); m_thread_clearMemory = new Thread(new ThreadStart(clear_Memory)); m_thread_clearMemory.IsBackground = true; m_thread_clearMemory.Start(); SplitGender.SplitterDistance = SplitGender.Width * 2 / 3; create_tech_panel(); }