//构造函数 public TableOrderTableForm(string con_str, Employee user) { m_con_str = con_str; m_user = user; db = new BathDBDataContext(m_con_str); InitializeComponent(); }
public EmployeeAuthorityForm(BathDBDataContext dc, Employee employee) { db = dc; m_Employee = employee; InitializeComponent(); }
//确定 private void btnOk_Click(object sender, EventArgs e) { btnOk.Enabled = false; btnOk.Enabled = true; if (text.Text == "") { BathClass.printErrorMsg("需要输入内容!"); return; } var ops = db.Options.FirstOrDefault(); var use_card = MConvert<bool>.ToTypeOrDefault(ops.启用员工服务卡, false); if (use_card) employee = db.Employee.FirstOrDefault(x => x.cardId == text.Text); else employee = db.Employee.FirstOrDefault(x => x.id == text.Text); if (employee == null) { text.SelectAll(); BathClass.printErrorMsg("输入工号不存在"); return; } this.DialogResult = DialogResult.OK; }
//构造函数 public CheckForm(Employee user) { m_User = user; db = new BathDBDataContext(MainForm.connectionString); InitializeComponent(); btnPwd.Text = "修改\n密码"; }
//构造函数 public OrderForm(Seat seat, Employee employee) { db = new BathDBDataContext(MainWindow.connectionString); m_Seat = db.Seat.FirstOrDefault(x => x == seat); m_Employee = employee; read_File(); if (typeList.Count == 0) typeList = db.Catgory.Select(x => x.name).ToList(); InitializeComponent(); createMenuTypePanel(); }
//构造函数 public OrderForm(CSeat seat, Employee user, string con_str, bool has_user) { //st = DateTime.Now; //db = new BathDBDataContext(con_str); //m_Seat = db.Seat.FirstOrDefault(x => x.systemId == seat.systemId); m_Seat = seat; m_user = user; m_has_user = has_user; m_con_str = con_str; InitializeComponent(); abcOrderPanel.Dock = DockStyle.Fill; touchOrderPanel.Dock = DockStyle.Fill; abcOrderPanel.Visible = false; }
private void id_TextChanged(object sender, EventArgs e) { if (id.Text == "") return; employee = db.Employee.FirstOrDefault(x => x.id.ToString() == id.Text); if (employee != null) { name.Text = employee.name; job.Text = db.Job.FirstOrDefault(x => x.id == employee.jobId).name; } else { name.Text = ""; job.Text = ""; } }
//确定 private void btnOk_Click(object sender, EventArgs e) { btnOk.Enabled = false; btnOk.Enabled = true; if (text.Text == "") { BathClass.printErrorMsg("需要输入内容!"); return; } employee = db.Employee.FirstOrDefault(x => x.id.ToString() == text.Text); if (employee == null) { text.SelectAll(); BathClass.printErrorMsg("输入工号不存在"); return; } this.DialogResult = DialogResult.OK; }
public RepayActListForm(HotelRoom seat, Employee user) { m_user = user; m_seat_text = seat.text; InitializeComponent(); }
private void lock_unlock(HotelRoom seat, BathDBDataContext db_new, Employee employee) { if (seat.status == 1 || seat.status == 2) seat.status = 4; else if (seat.status == 4) { Operation op = new Operation(); op.employee = employee.name; op.seat = seat.text; op.openEmployee = seat.openEmployee; op.openTime = seat.openTime; op.explain = "解锁手牌"; op.opTime = BathClass.Now(LogIn.connectionString); db_new.Operation.InsertOnSubmit(op); if (seat.systemId == null) seat.status = 1; else seat.status = 2; } db_new.SubmitChanges(); }
//获取员工权限 public bool get_authority(Employee user, string property) { bool? authority = get_authority("emplyeeid", user.id, property); if (authority == null) { var cjob = get_job("id", user.jobId); authority = get_authority("jobId", cjob.id, property); } return MConvert<bool>.ToTypeOrDefault(authority, false); }
//生成按钮状态 private void btn_status(Button btn, Employee tech) { if (tech.techStatus == "下班") btn.BackColor = off_color; else if (tech.techStatus == "空闲" || tech.techStatus == null) btn.BackColor = avi_color; else if (tech.techStatus == "上钟" || tech.techStatus.Trim() == "轮钟") btn.BackColor = on_color; else if (tech.techStatus == "点钟") btn.BackColor = order_color; else if (tech.techStatus == "加钟") btn.BackColor = plus_color; else if (tech.techStatus == "待钟") btn.BackColor = wait_color; }
partial void DeleteEmployee(Employee instance);
partial void UpdateEmployee(Employee instance);
private void change_btn_status(Employee tech, Button btn, Color color) { btn.BackColor = color; btn.Text = getBtnString(tech); }
private void lock_unlock(CSeat seat, Employee employee) { if (seat.status == SeatStatus.AVILABLE || seat.status == SeatStatus.USING) { string cmd_str = @"update [Seat] set status=4 where text='" + seat.text + "'"; if (!dao.execute_command(cmd_str)) { BathClass.printErrorMsg("手牌锁定失败"); return; } //seat.status = seat; } else if (seat.status == SeatStatus.LOCKING) { StringBuilder sb = new StringBuilder(); sb.Append(@"insert into [Operation](employee,seat,openEmployee,openTime,explain,opTime) values('"); sb.Append(employee.name + "','" + seat.text + "','" + seat.openEmployee + "','" + seat.openTime + "','解锁手牌',getdate())"); //Operation op = new Operation(); //op.employee = employee.name; //op.seat = seat.text; //op.openEmployee = seat.openEmployee; //op.openTime = seat.openTime; //op.explain = "解锁手牌"; //op.opTime = BathClass.Now(LogIn.connectionString); //db_new.Operation.InsertOnSubmit(op); if (seat.systemId == null || seat.systemId == "") sb.Append(@" update [Seat] set status=1 where text='" + seat.text + "'"); //s#eat.status = 1; else sb.Append(@" update [Seat] set status=2 where text='" + seat.text + "'"); //seat.status = 2; if (!dao.execute_command(sb.ToString())) { BathClass.printErrorMsg("手牌解锁失败!"); return; } } //db_new.SubmitChanges(); }
//获取技师字符串 private void btn_status(Button btn, Employee tech) { StringBuilder sb = new StringBuilder(); sb.Append("技师:").Append(tech.id).Append("\n"); if (tech.techStatus == "待钟") { sb.Append("房间:").Append(tech.room).Append("\n"); sb.Append("手牌:").Append(tech.seat).Append("\n"); sb.Append(tech.techMenu).Append("\n"); } btn.Text = sb.ToString(); if (tech.techStatus == "下班") btn.BackColor = off_color; else if (tech.techStatus == "待钟") btn.BackColor = wait_color; else if (tech.techStatus == "空闲" || tech.techStatus == null) btn.BackColor = avi_color; else if (tech.techStatus == "上钟" || tech.techStatus.Trim() == "轮钟") btn.BackColor = on_color; else if (tech.techStatus == "点钟") btn.BackColor = order_color; else if (tech.techStatus == "加钟") btn.BackColor = plus_color; }
//构造函数 public MonthOnForm(Employee user) { m_User = user; db = new BathDBDataContext(MainForm.connectionString); InitializeComponent(); }
//检验员工号 private void id_TextChanged(object sender, EventArgs e) { if (id.Text == "") return; var dc = new BathDBDataContext(connectionString); m_User = dc.Employee.FirstOrDefault(x => x.id.ToString() == id.Text); if (m_User != null) { name.Text = m_User.name; job.Text = dc.Job.FirstOrDefault(x => x.id == m_User.jobId).name; } else { name.Text = ""; job.Text = ""; } }
//获取员工权限 public static bool getAuthority(BathDBDataContext db, Employee employee, string pro) { var authority = db.Authority.FirstOrDefault(x => x.emplyeeId == employee.id); if (authority == null) authority = db.Authority.FirstOrDefault(x => x.jobId == employee.jobId); var proVal = authority.GetType().GetProperty(pro); if (proVal == null) return false; return Convert.ToBoolean(proVal.GetValue(authority, null)); }
//获取button显示字符串 //房间号、技师号、手牌、服务项目、服务时间 private string getBtnString(Employee tech) { string techId = tech.id; string str = "技师:" + techId; try { if (tech.techStatus == null || tech.techStatus == "空闲" || tech.techStatus == "下班") return str; if (tech.room != null) str += "\n房间:" + tech.room; if (tech.seat != null) str += "\n手牌:" + tech.seat; if (tech.startTime != null) { str += "\n起钟:" + tech.startTime.Value.ToString("HH:mm"); if (tech.serverTime != null) { int m = (int)(tech.serverTime - (DateTime.Now - tech.startTime.Value).TotalMinutes); str += "\n剩:" + m.ToString() + "分钟"; } } } catch (System.Exception e) { BathClass.printErrorMsg("获取技师字符串出错:" + e.Message); } return str; }
//构造函数 public ModifyPwdForm() { db = new BathDBDataContext(LogIn.connectionString); m_User = db.Employee.FirstOrDefault(x => x.id == LogIn.m_User.id); InitializeComponent(); }
private void lock_unlock(CSeat seat, Employee employee) { if (seat.status == SeatStatus.AVILABLE || seat.status == SeatStatus.USING) { string cmd_str = @"update [Seat] set status=4 where text='" + seat.text + "'"; if (!dao.execute_command(cmd_str)) { BathClass.printErrorMsg("手牌锁定失败"); return; } //seat.status = seat; } else if (seat.status == SeatStatus.LOCKING) { string cmd_str = @"insert into [Operation](employee,seat,openEmployee,openTime,explain,opTime) values('" + employee.name + "','" + seat.text + "','" + seat.openEmployee + "','" + seat.openTime + "','解锁手牌',getdate())"; if (seat.systemId == null || seat.systemId == "") cmd_str += @" update [Seat] set status=1 where text='" + seat.text + "'"; else cmd_str += @" update [Seat] set status=2 where text='" + seat.text + "'"; if (!dao.execute_command(cmd_str)) { BathClass.printErrorMsg("手牌解锁失败!"); return; } } //db_new.SubmitChanges(); }
//创建单个台位按钮 private void createButton(int x, int y, Employee tech, Control sp) { Button btn = new Button(); btn.Font = new Font("SimSun", 14F, FontStyle.Bold); btn.Location = new System.Drawing.Point(x, y); btn.Name = tech.id; btn_status(btn, tech); btn.TextAlign = System.Drawing.ContentAlignment.TopLeft; btn.Size = new System.Drawing.Size(140, 110); btn.FlatStyle = FlatStyle.Popup; btn.UseVisualStyleBackColor = true; btn.ContextMenuStrip = ctx; //btn.ImageList = imageList1; btn.ImageAlign = ContentAlignment.TopRight; //btn.Click += btn_Click; sp.Controls.Add(btn); }
partial void InsertEmployee(Employee instance);
//退单 private void return_order(string orderId, Employee del_employee) { var form = new DeleteExplainForm(); if (form.ShowDialog() != DialogResult.OK) return; string deleteExpalin = form.txt; string cmd_str = @"update [Orders] set deleteEmployee='" + del_employee.id + "', deleteExplain='" +deleteExpalin + "', deleteTime=getdate() where id=" + orderId; if (!dao.execute_command(cmd_str)) { BathClass.printErrorMsg("退单失败!"); return; } BathClass.find_combo(m_con_str, m_Seat.systemId, m_Seat.text); dgvExpense_show(); if (!dao.execute_command("update [OrderStockOut] set deleteEmployee='" + del_employee.id + "' where orderId=" + orderId)) { BathClass.printErrorMsg("退换消耗品失败!"); } }
//构造函数 public ModifyPwdForm(string con_str, Employee user) { db = new BathDBDataContext(con_str); m_User = db.Employee.FirstOrDefault(x => x.id == user.id); InitializeComponent(); }