public EmployeeAuthorityForm(BathDBDataContext dc, Employee employee) { db = dc; m_Employee = employee; InitializeComponent(); }
//对话框载入 private void BonusTableForm_Load(object sender, EventArgs e) { db = new BathDBDataContext(LogIn.connectionString); var format = db.Options.FirstOrDefault().提成报表格式; if (format == null) { format = FORMAT_ALL_DIANLUN; db.SubmitChanges(); } if (format == FORMAT_ALL_DIANLUN) { CheckerLunDian.Checked = true; CheckerPaid.Checked = true; } else if (format == FORMAT_ALL_NODIANLUN) { CheckerLunDian.Checked = false; CheckerPaid.Checked = true; } else if (format == FORMAT_INPUTTIME_DIANLUN) { CheckerLunDian.Checked = true; CheckerPaid.Checked = false; } else if (format == FORMAT_INPUTTIME_NODIANLUN) { CheckerLunDian.Checked = false; CheckerPaid.Checked = false; } }
//构造函数 public SeatExpenseForm(Seat seat) { db = new BathDBDataContext(LogIn.connectionString); m_Seat = db.Seat.FirstOrDefault(x => x.text == seat.text); InitializeComponent(); }
private void BTRegister_Click(object sender, EventArgs e) { string code = TextCode.Text.Trim(); if (code == "") { BathClass.printErrorMsg("公司代码为空!"); return; } string name = TextName.Text.Trim(); if (name == "") { BathClass.printErrorMsg("公司名称为空!"); return; } string errorDesc = ""; var success = ShopManagement.registerCompany(LogIn.connectionIP, code, name, TextTel.Text.Trim(), TextTel.Text.Trim(), out errorDesc); if (success) { var db = new BathDBDataContext(LogIn.connectionString); db.Options.FirstOrDefault().company_Code = code; db.SubmitChanges(); this.DialogResult = DialogResult.OK; this.Close(); } else { BathClass.printErrorMsg(errorDesc); } }
//构造函数 public MemberPromotionForm(List<HotelRoom> seat, string systemid) { m_systemId = systemid; db = new BathDBDataContext(LogIn.connectionString); m_Seats.AddRange(db.HotelRoom.Where(x => seat.Contains(x))); InitializeComponent(); }
//查询 private void dgv_show() { dgv.Rows.Clear(); var dc = new BathDBDataContext(LogIn.connectionString); var all_his_orders = dc.HisOrders.Where(x => x.inputTime >= lastTime && x.inputTime <= thisTime && x.deleteEmployee == null); var orderLst = dc.Orders.Where(x => x.inputTime >= lastTime && x.inputTime <= thisTime && x.deleteEmployee == null); all_his_orders = all_his_orders.Where(x => x.technician != null); orderLst = orderLst.Where(x => x.technician != null); if (catgory.Text != "所有类别") { var catgoryId = dc.Catgory.FirstOrDefault(x => x.name == catgory.Text).id; var menus = dc.Menu.Where(x => x.technician && x.catgoryId == catgoryId).Select(x => x.name); orderLst = orderLst.Where(x => menus.Contains(x.menu)); all_his_orders = all_his_orders.Where(x => menus.Contains(x.menu)); } foreach (var order in all_his_orders) { dgv.Rows.Add(order.technician, order.text, order.menu, order.number, order.inputTime.ToString("MM-dd HH:mm")); } foreach (var order in orderLst) { dgv.Rows.Add(order.technician, order.text, order.menu, order.number, order.inputTime.ToString("MM-dd HH:mm")); } BathClass.set_dgv_fit(dgv); }
//构造函数 public TableOrderTableForm(string con_str, Employee user) { m_con_str = con_str; m_user = user; db = new BathDBDataContext(m_con_str); InitializeComponent(); }
//重载构造函数 public InputSeatForm(List<int> ss) { db = new BathDBDataContext(MainWindow.connectionString); m_StatusList = ss; InitializeComponent(); }
//重载构造函数 public InputHotelRoomForm(List<int> ss) { db = new BathDBDataContext(LogIn.connectionString); m_StatusList = ss; InitializeComponent(); }
private bool use_card = false; //使用工卡 #endregion Fields #region Constructors //构造函数 public InputEmployee(BathDBDataContext dc) { db = dc; use_card = MConvert<bool>.ToTypeOrDefault(db.Options.FirstOrDefault().启用员工服务卡, false); InitializeComponent(); text.Enabled = !use_card; }
public double getCurrentStock(BathDBDataContext db, string name) { DateTime dt_st = DateTime.Parse(st.Value.Date.ToString("yyyy-MM-dd") + " 00:00:00"); DateTime dt_et = DateTime.Parse(et.Value.Date.ToString("yyyy-MM-dd") + " 23:59:59"); double number_Ins = 0; double number_Outs = 0; double number_OrderOuts = 0; double number_pans = 0; double number_Total = 0; var name_stockIns = db.StockIn.Where(x => x.name == name).Where(x => x.amount != null).Where(x=>x.date>=dt_st&&x.date<=dt_et); if (name_stockIns.Any()) number_Ins = name_stockIns.Sum(x => x.amount).Value; var name_stockOuts = db.StockOut.Where(x => x.name == name).Where(x => x.amount != null).Where(x=>x.date>=dt_st&&x.date<=dt_et); if (name_stockOuts.Any()) number_Outs = MConvert<double>.ToTypeOrDefault(name_stockOuts.Sum(x => x.amount), 0); var name_orderStockOuts = db.OrderStockOut.Where(x => x.name == name).Where(x => x.amount != null).Where(x => x.date >= dt_st && x.date <= dt_et); if (name_orderStockOuts.Any()) number_OrderOuts = MConvert<double>.ToTypeOrDefault(name_orderStockOuts.Sum(x => x.amount), 0); var name_pans = db.Pan.Where(x => x.name == name).Where(x => x.amount != null).Where(x => x.date >= dt_st && x.date <= dt_et); if (name_pans.Any()) number_pans = MConvert<double>.ToTypeOrDefault(name_pans.Sum(x => x.amount), 0); number_Total = number_Ins + number_pans - number_Outs - number_OrderOuts; return Math.Round(number_Total,2); }
public EditForm(BathDBDataContext dc, StockIn stockin) { db = dc; inStock = stockin; InitializeComponent(); stock.Items.AddRange(db.Stock.Select(x => x.name).ToArray()); provider.Items.AddRange(db.Provider.Select(x => x.name).ToArray()); goodsCat.Items.AddRange(db.GoodsCat.Select(x => x.name).ToArray()); unit.Items.AddRange(db.Unit.Select(x => x.name).ToArray()); var employees = db.Employee.Where(x => !db.Job.FirstOrDefault(y => y.id == x.jobId).name.Contains("技师")); checker.Items.AddRange(employees.Select(x => x.name).ToArray()); transactor.Items.AddRange(employees.Select(x => x.name).ToArray()); var stocktext = db.Stock.FirstOrDefault(x => x.id == stockin.stockId); stock.Text = stocktext !=null?stocktext.name:""; string nametext = stockin.name; name.Text = nametext != "" ? nametext : ""; var goodCatext = db.GoodsCat.FirstOrDefault(y => y.id == db.StorageList.FirstOrDefault(x => x.name == stockin.name).goodsCatId); //MessageBox.Show("该商品没分类"); goodsCat.Text = goodCatext != null ? goodCatext.name : ""; string amouttext = stockin.amount.ToString(); amount.Text = amouttext != "" ? amouttext : ""; var providertext = db.Provider.FirstOrDefault(x => x.id == stockin.providerId); provider.Text = providertext != null ? providertext.name : ""; string costtext = stockin.cost.ToString(); cost.Text = costtext != "" ? costtext : ""; string moneytext = stockin.money.ToString(); money.Text = moneytext != "" ? moneytext : ""; dtPickerIntoStock.Value = stockin.date != null ? stockin.date : DateTime.Now; string checkertext = stockin.checker; checker.Text = checkertext != "" ? checkertext : ""; string transactortext=stockin.transactor; transactor.Text = transactortext != "" ? transactortext : ""; string notetext = stockin.note; note.Text = notetext != "" ? notetext : ""; }
//构造函数 public CheckForm(Employee user) { m_User = user; db = new BathDBDataContext(MainForm.connectionString); InitializeComponent(); btnPwd.Text = "修改\n密码"; }
//显示详细订单信息 private void dgvDetails_show() { var idobj = dgv.CurrentRow.Cells[5].Value; if (idobj == null) return; Int64 act_id; if (!Int64.TryParse(idobj.ToString(), out act_id)) return; var dc = new BathDBDataContext(LogIn.connectionString); var act = dc.Account.FirstOrDefault(x => x.id == act_id); if (act == null) return; var orders = dc.HisOrders.Where(x => x.accountId == act_id); orders = orders.OrderBy(x => x.inputTime); foreach (var o in orders) { string[] row = new string[7]; row[0] = o.text; row[1] = o.menu; row[2] = o.technician; row[4] = o.number.ToString(); row[6] = o.inputEmployee; var m = dc.Menu.FirstOrDefault(x => x.name == o.menu); bool redRow = false; if (m == null) { row[3] = ""; row[5] = o.money.ToString(); redRow = true; } else { if (o.priceType == "每小时") { row[3] = o.money.ToString() + "/时"; row[5] = (Math.Ceiling((act.payTime - o.inputTime).TotalHours) * o.money).ToString(); } else { row[3] = m.price.ToString(); row[5] = o.money.ToString(); } } this.Invoke(new delegate_add_row(add_row_details), (Object)row); //dgvExpense.Rows.Add(row); if (redRow) { this.Invoke(new delegate_no_para(change_dgv_color), null); //dgvExpense.Rows[dgvExpense.Rows.Count - 1].DefaultCellStyle.BackColor = Color.Red; } } //BathClass.set_dgv_fit(dgvExpense); }
public OpenSeatForm(HotelRoom seat, bool open) { m_open = open; db = new BathDBDataContext(LogIn.connectionString); m_Seats.Add(seat); chainId = BathClass.chainId(db, LogIn.connectionString); InitializeComponent(); }
//构造函数 public DepositForm(CSeat seat) { db = new BathDBDataContext(LogIn.connectionString); m_Seat = seat; dao = new DAO(LogIn.connectionString); //m_Seat = db.Seat.FirstOrDefault(x => x.systemId == seat.systemId); InitializeComponent(); }
//构造函数 public NewPostForm(BathDBDataContext dc) { db = dc; InitializeComponent(); ComboDeparts.Items.AddRange(dc.Department.Select(x => x.name).ToArray()); //PanelPicture.Visible = false; //this.Height = PanelMsg.Height + PanelControl.Height + 20; }
//构造函数 public ComboManagementForm() { db = new BathDBDataContext(LogIn.connectionString); InitializeComponent(); dgvCombo_show(); dgvItems_show(0); }
//构造函数 public MemberPromotionForm(Seat seat) { //m_systemId = systemid; db = new BathDBDataContext(LogIn.connectionString); m_Seat = db.Seat.FirstOrDefault(x => x.text == seat.text); //m_Seats.AddRange(db.Seat.Where(x => seat.Contains(x))); InitializeComponent(); }
//点击台位按钮 private void btn_Click(object sender, EventArgs e) { Button btn = sender as Button; btn.Enabled = false; btn.Enabled = true; BathDBDataContext db_new = new BathDBDataContext(LogIn.connectionString); m_HotelRoom = db_new.HotelRoom.FirstOrDefault(x => x.text == btn.Text); int status = m_HotelRoom.status; switch (status) { case 1://可用 case 3://已经结账 BathClass.printErrorMsg("手牌未开牌"); break; case 2://正在使用 case 7://押金离场 if (!BathClass.getAuthority(db_new, LogIn.m_User, "完整点单") && !BathClass.getAuthority(db_new, LogIn.m_User, "可见本人点单")) { BathClass.printErrorMsg("权限不够!"); break; } if (m_HotelRoom.paying.HasValue && m_HotelRoom.paying.Value) { BathClass.printErrorMsg("正在结账!"); break; } m_HotelRoom.ordering = true; db_new.SubmitChanges(); var orderForm = new HotelRoomOrderForm(m_HotelRoom); orderForm.ShowDialog(); m_HotelRoom.ordering = false; db_new.SubmitChanges(); break; case 4://锁定 BathClass.printErrorMsg("手牌已经锁定!"); break; case 5://停用 BathClass.printErrorMsg("台位已经停用!"); break; case 6://警告 var orderCheckForm = new HotelRoomOrderCheckForm(m_HotelRoom); orderCheckForm.ShowDialog(); break; case 8: BathClass.printErrorMsg("补救台位不能录单"); break; default: break; } }
//构造函数 public PanForm(BathDBDataContext dc, string _name, string _stock, double _amount) { db = dc; amount_p = _amount; InitializeComponent(); name.Text = _name; stock.Text = _stock; amount.Text = _amount.ToString(); }
//构造函数 public CardPopForm(BathDBDataContext dc, CardPopSale cardPopSale) { db = dc; if (cardPopSale != null) { newCardPopSale = false; m_CardPopSale = cardPopSale; } InitializeComponent(); }
//构造函数 public ProviderForm(BathDBDataContext dc, Provider provider) { db = dc; if (provider != null) { newProvider = false; m_provider = provider; } InitializeComponent(); }
//构造函数 public CustomerForm(BathDBDataContext dc, Customer customer) { db = dc; if (customer != null) { newCustomer = false; m_Customer = customer; } InitializeComponent(); }
//盘点调整 private void btnAdjustStock_Click(object sender, EventArgs e) { var db = new BathDBDataContext(LogIn.connectionString); string pro = ((Button)sender).Text; if (!BathClass.getAuthority(db, LogIn.m_User, pro)) { GeneralClass.printErrorMsg("权限不够,不能访问!"); return; } }
//构造函数 public PayForm(List<HotelRoom> seats, List<bool> keeps, CardInfo member, double discount_money) { db = new BathDBDataContext(LogIn.connectionString); m_wipe_limit = BathClass.ToInt(db.Options.FirstOrDefault().抹零限制); m_Seats.AddRange(db.HotelRoom.Where(x => seats.Contains(x))); m_keeps = new List<bool>(keeps); m_promotion_Member = member; m_discount_money = discount_money; InitializeComponent(); }
//构造函数 public SeatTypeForm(BathDBDataContext dc, SeatType seatType) { db = dc; if (seatType != null) { newSeatType = false; m_SeatType = seatType; } InitializeComponent(); }
//构造函数 public MemberTypeForm(MemberType element) { db = new BathDBDataContext(LogIn.connectionString); if (element != null) { newElement = false; m_Element = db.MemberType.FirstOrDefault(x => x.id == element.id); } InitializeComponent(); }
//构造函数 public StockOutForm(BathDBDataContext dc, StockOut _stockout) { db = dc; if (_stockout != null) { newStockout = false; stockout = _stockout; } InitializeComponent(); }
//构造函数 public StockForm(BathDBDataContext dc, Stock stock) { db = dc; if (stock != null) { m_Stock = stock; newStock = false; } InitializeComponent(); }