本文整理汇总了C#中YouSoftBathGeneralClass.BathDBDataContext.SubmitChanges方法的典型用法代码示例。如果您正苦于以下问题:C# BathDBDataContext.SubmitChanges方法的具体用法?C# BathDBDataContext.SubmitChanges怎么用?C# BathDBDataContext.SubmitChanges使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类YouSoftBathGeneralClass.BathDBDataContext
的用法示例。
在下文中一共展示了BathDBDataContext.SubmitChanges方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BTRegister_Click
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);
}
}
示例2: BonusTableForm_Load
//对话框载入
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;
}
}
示例3: SeatExpenseForm
//构造函数
public SeatExpenseForm(HotelRoom seat)
{
var db = new BathDBDataContext(LogIn.connectionString);
if (MainWindow.seatLock)
{
m_Seats.Add(db.HotelRoom.FirstOrDefault(x => x.text == seat.text));
}
else
{
var seats = db.HotelRoom.Where(x => (seat.chainId == null && x.text == seat.text) || (seat.chainId != null && x.chainId == seat.chainId));
seats = seats.Where(x => x.status == 2 || x.status == 6 || x.status == 7 || x.status == 8);
m_Seats.AddRange(seats);
}
foreach (var s in m_Seats)
{
s.paying = true;
}
db.SubmitChanges();
//m_Seats.AddRange(db.HotelRoom.Where(x => x.chainId == seat.chainId && (x.status == 2 || x.status == 6 || x.status == 7)));
InitializeComponent();
}
示例4: toolReArrange_Click
//全部重排
private void toolReArrange_Click(object sender, EventArgs e)
{
var dc = new BathDBDataContext(m_con_str);
dc.ExecuteCommand("truncate table techindex");
dc.SubmitChanges();
var job_ids = dc.Job.Where(x => x.name.Contains("技师")).Select(x => x.id);
foreach (var job_id in job_ids)
{
var techs = dc.Employee.Where(x => x.jobId == job_id);
techs = techs.Where(x => x.techStatus == null || x.techStatus == "空闲" || x.techStatus == "待钟");
var techs_male = techs.Where(x=>x.gender=="男");
var techIndex = new TechIndex();
techIndex.dutyid = job_id;
techIndex.gender = "男";
techIndex.ids = string.Join("%", techs_male.OrderBy(x => x.id).Select(x => x.id + "=T").ToArray());
dc.TechIndex.InsertOnSubmit(techIndex);
var techs_female = techs.Where(x => x.gender == "女");
techIndex = new TechIndex();
techIndex.dutyid = job_id;
techIndex.gender = "女";
techIndex.ids = string.Join("%", techs_female.OrderBy(x => x.id).Select(x => x.id + "=T").ToArray());
dc.TechIndex.InsertOnSubmit(techIndex);
}
dc.SubmitChanges();
dgv_show(dc);
}
示例5: toolReturn_Click
//留牌操作 F9
//private void toolKeep_Click(object sender, EventArgs e)
//{
// List<int> sLst = new List<int>();
// sLst.Add(2);
// sLst.Add(6);
// sLst.Add(7);
// InputSeatForm inputseatForm = new InputSeatForm(sLst);
// if (inputseatForm.ShowDialog() != DialogResult.OK)
// return;
// var seat = inputseatForm.m_Seat;
// if (m_Seats.FirstOrDefault(x=>x.text==seat.text) == null)
// {
// m_Seats.Add(seat);
// var dc_new = new BathDBDataContext(LogIn.connectionString);
// dc_new.HotelRoom.FirstOrDefault(x => x.text == inputseatForm.m_Seat.text).paying = false;
// dc_new.SubmitChanges();
// }
// dgvChain_show();
// dgvChain.CurrentCell = null;
// //chain = true;
// //dgvExpense_show();
// //setStatus();
//}
//联牌账务
//private void btnChain_Click(object sender, EventArgs e)
//{
// //chain = true;
// dgvChain.CurrentCell = null;
// dgvExpense_show();
// setStatus();
//}
//退单 F10
private void toolReturn_Click(object sender, EventArgs e)
{
BathDBDataContext dc = new BathDBDataContext(LogIn.connectionString);
if (dgvExpense.CurrentCell == null)
{
BathClass.printErrorMsg("需要输入订单!");
return;
}
int orderId = Convert.ToInt32(dgvExpense.CurrentRow.Cells[0].Value);
var order = dc.Orders.FirstOrDefault(x => x.id == orderId);
if (order == null || order.menu.Contains("套餐"))
{
BathClass.printErrorMsg("不能删除套餐优惠!");
return;
}
InputEmployeeByPwd inputServerForm = new InputEmployeeByPwd();
Employee del_employee;
if (BathClass.getAuthority(dc, LogIn.m_User, "退单"))
del_employee = LogIn.m_User;
else if (inputServerForm.ShowDialog() != DialogResult.OK)
return;
else if (!BathClass.getAuthority(dc, inputServerForm.employee, "退单"))
{
BathClass.printErrorMsg("没有退单权限");
return;
}
else
del_employee = inputServerForm.employee;
order.deleteEmployee = del_employee.id.ToString();
Employee employee = dc.Employee.FirstOrDefault(x => x.id.ToString() == order.technician);
if (employee != null)
employee.status = "空闲";
dc.SubmitChanges();
find_combo(dc, order);
dgvExpense_show(dc);
setStatus(dc);
}
示例6: SeatExpenseForm_FormClosing
private void SeatExpenseForm_FormClosing(object sender, FormClosingEventArgs e)
{
var dc = new BathDBDataContext(LogIn.connectionString);
var lockSeat = BathClass.ToBool(dc.Options.FirstOrDefault().结账未打单锁定手牌);
for (int i = 0; i < m_Seats.Count; i++ )
{
var s_new = dc.HotelRoom.FirstOrDefault(x => x.text == m_Seats[i].text);
s_new.paying = false;
if (lockSeat && s_new.status != 3 && s_new.status != 8 && dgvChain.Rows[i].Cells[1].EditedFormattedValue.ToString() == "False")
{
s_new.status = 4;
}
}
dc.SubmitChanges();
}
示例7: order_guoye
//加收过夜费
private void order_guoye(HotelRoom seat, BathDBDataContext dc)
{
if (!BathClass.ToBool(m_Options.自动加收过夜费))
return;
if (dc.Orders.FirstOrDefault(x=>x.systemId==seat.systemId && x.menu=="过夜费") != null ||
dc.HisOrders.FirstOrDefault(x => x.systemId == seat.systemId && x.menu == "过夜费") != null)
return;
var m_OverMenu = dc.Menu.FirstOrDefault(x => x.name == "过夜费");
if (m_OverMenu == null)
return;
DateTime now = DateTime.Now;
string year = now.Year.ToString();
string month = now.Month.ToString();
string day = now.Day.ToString();
string date = year+"-"+month+"-"+day+" ";
string time = ":00:00";
DateTime st = DateTime.Parse(date + m_Options.过夜费起点 + time);
DateTime et = DateTime.Parse(date + m_Options.过夜费终点 + time);
DateTime open_time = seat.openTime.Value;
if ((now >= et && open_time >= et) || (open_time <= st && now <= st))
return;
Orders order = new Orders();
order.menu = m_OverMenu.name;
order.text = seat.text;
order.systemId = seat.systemId;
order.number = 1;
order.money = m_OverMenu.price;
order.inputTime = now;
order.inputEmployee = "过夜费";
order.departmentId = 1;
order.paid = false;
dc.Orders.InsertOnSubmit(order);
dc.SubmitChanges();
find_combo(dc, order);
}
示例8: find_combo
private void find_combo(BathDBDataContext dc, Orders theOrder)
{
dc.Orders.DeleteAllOnSubmit(dc.Orders.Where(x => x.systemId == theOrder.systemId && x.menu.Contains("套餐")));
var orders = dc.Orders.Where(x => x.systemId == theOrder.systemId && x.deleteEmployee == null);
orders = orders.Where(x => !x.inputEmployee.Contains("电脑"));
foreach (Orders tmp_order in orders)
{
tmp_order.comboId = null;
}
dc.SubmitChanges();
var order_menus = orders.Where(x => x.comboId == null).Select(x => x.menu);
var menus = dc.Menu;
var comboList = dc.Combo.OrderByDescending(x => x.originPrice - x.price);
foreach (Combo combo in comboList)
{
List<int> menuIds = BathClass.disAssemble(combo.menuIds);
var combo_menus = menus.Where(x => menuIds.Contains(x.id)).Select(x => x.name);
if (combo_menus.All(x => order_menus.Any(y => y == x)))
{
foreach (var combo_menu in combo_menus)
{
var tmp_order = orders.FirstOrDefault(x => x.menu == combo_menu);
tmp_order.comboId = combo.id;
if (combo.priceType == "免项目")
{
var freeIds = BathClass.disAssemble(combo.freeMenuIds);
var freeMenus = dc.Menu.Where(x => freeIds.Contains(x.id)).Select(x => x.name);
if (freeMenus.Contains(tmp_order.menu))
tmp_order.money = 0;
}
}
if (combo.priceType == "减金额")
{
Orders comboOrder = new Orders();
comboOrder.menu = "套餐" + combo.id.ToString() + "优惠";
comboOrder.text = theOrder.text;
comboOrder.systemId = theOrder.systemId;
comboOrder.number = 1;
comboOrder.inputTime = GeneralClass.Now;
comboOrder.inputEmployee = "套餐";
comboOrder.paid = false;
comboOrder.comboId = combo.id;
comboOrder.departmentId = 1;
comboOrder.money = Convert.ToDouble(combo.price) - combo.originPrice;
dc.Orders.InsertOnSubmit(comboOrder);
}
dc.SubmitChanges();
}
}
}
示例9: unWarnTool_Click
private void unWarnTool_Click(object sender, EventArgs e)
{
BathDBDataContext db_new = new BathDBDataContext(LogIn.connectionString);
Seat seat = getContextSenderSeat(db_new, sender);
if (seat.status != 6)
return;
Employee op_user;
if (BathClass.getAuthority(db_new, LogIn.m_User, "解除警告"))
op_user = LogIn.m_User;
else
{
InputEmployeeByPwd inputEmployee = new InputEmployeeByPwd();
if (inputEmployee.ShowDialog() != DialogResult.OK)
return;
if (BathClass.getAuthority(db_new, inputEmployee.employee, "解除警告"))
op_user = inputEmployee.employee;
else
{
BathClass.printErrorMsg("不具有权限!");
return;
}
}
seat.status = 2;
seat.unwarn = op_user.id;
db_new.SubmitChanges();
}
示例10: CtxAddNote_Click
//添加备注
private void CtxAddNote_Click(object sender, EventArgs e)
{
BathDBDataContext db_new = new BathDBDataContext(LogIn.connectionString);
Seat seat = getContextSenderSeat(db_new, sender);
if (seat.status != 2 && seat.status != 6)
{
GeneralClass.printErrorMsg("手牌未使用,不能添加备注");
return;
}
NoteForm noteForm = new NoteForm();
if (noteForm.ShowDialog() != DialogResult.OK)
return;
seat.note = noteForm.note;
db_new.SubmitChanges();
}
示例11: orderTool_Click
//消费录入
private void orderTool_Click(object sender, EventArgs e)
{
BathDBDataContext db_new = new BathDBDataContext(LogIn.connectionString);
if (!BathClass.getAuthority(db_new, LogIn.m_User, "完整点单") &&
!BathClass.getAuthority(db_new, LogIn.m_User, "可见本人点单"))
{
BathClass.printErrorMsg("权限不够!");
return;
}
List<int> sLst = new List<int>();
sLst.Add(2);
sLst.Add(6);
var inputSeatForm = new InputRoomForm(sLst);
if (inputSeatForm.ShowDialog() != DialogResult.OK)
return;
var seat = db_new.HotelRoom.FirstOrDefault(x => x.text == inputSeatForm.m_Seat.text);
seat.ordering = true;
db_new.SubmitChanges();
var orderForm = new HotelRoomOrderForm(inputSeatForm.m_Seat);
orderForm.ShowDialog();
seat.ordering = false;
db_new.SubmitChanges();
}
示例12: lock_unlock
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();
}
示例13: btnDeposit_Click
//押金离场
private void btnDeposit_Click(object sender, EventArgs e)
{
List<int> s = new List<int>();
s.Add(2);
s.Add(7);
var inputSeatForm = new InputRoomForm(s);
if (inputSeatForm.ShowDialog() != DialogResult.OK)
return;
var seat = inputSeatForm.m_Seat;
if (seat.status == 2)
{
DepositForm depositForm = new DepositForm(inputSeatForm.m_Seat);
depositForm.ShowDialog();
}
else if (seat.status == 7 && BathClass.printAskMsg("是否取消押金离场状态")==DialogResult.Yes)
{
var db_new = new BathDBDataContext(LogIn.connectionString);
var seat_new = db_new.HotelRoom.FirstOrDefault(x => x.text == seat.text);
seat_new.status = 2;
seat_new.note = null;
db_new.SubmitChanges();
}
}
示例14: CtxSop_Click
//停用启用
private void CtxSop_Click(object sender, EventArgs e)
{
BathDBDataContext db_new = new BathDBDataContext(LogIn.connectionString);
var seat = getContextSenderSeat(db_new, sender);
InputEmployeeByPwd inputEmployee = new InputEmployeeByPwd();
if (inputEmployee.ShowDialog() != DialogResult.OK)
return;
if (!BathClass.getAuthority(db_new, inputEmployee.employee, "停用启用"))
{
BathClass.printErrorMsg("权限不够!");
return;
}
if (seat.status == 2 || seat.status == 6 || seat.status == 7 || seat.status == 8)
{
BathClass.printErrorMsg("手牌正在使用不能停用");
return;
}
else if (seat.status == 4)
{
BathClass.printErrorMsg("手牌已经锁定,不能停用");
return;
}
else if (seat.status == 1 || seat.status == 3)
{
seat.status = 5;
}
else if (seat.status == 5)
{
seat.status = 1;
}
db_new.SubmitChanges();
}
示例15: CtxChangeSeat_Click
//更换手牌
private void CtxChangeSeat_Click(object sender, EventArgs e)
{
BathDBDataContext db_new = new BathDBDataContext(LogIn.connectionString);
var seat = getContextSenderSeat(db_new, sender);
InputEmployeeByPwd inputEmployee = new InputEmployeeByPwd();
if (inputEmployee.ShowDialog() != DialogResult.OK)
return;
if (!BathClass.getAuthority(db_new, inputEmployee.employee, "更换手牌"))
{
BathClass.printErrorMsg(inputEmployee.employee.id + "不具有更换手牌操作权限!");
return;
}
if (seat.status != 2)
{
BathClass.printErrorMsg("该手牌目前不在使用中,不能换台!");
return;
}
List<int> sLst = new List<int>();
sLst.Add(1);
sLst.Add(3);
var inputSeatForm = new InputRoomForm(sLst);
if (inputSeatForm.ShowDialog() != DialogResult.OK)
return;
HotelRoom newSeat = db_new.HotelRoom.FirstOrDefault(x => x == inputSeatForm.m_Seat);
var orders = db_new.Orders.Where(x => x.systemId == seat.systemId);
foreach (Orders order in orders)
order.text = newSeat.text;
newSeat.systemId = seat.systemId;
newSeat.name = seat.name;
newSeat.population = seat.population;
newSeat.openTime = GeneralClass.Now;
newSeat.openEmployee = LogIn.m_User.name;
newSeat.phone = seat.phone;
newSeat.chainId = seat.chainId;
newSeat.status = seat.status;
newSeat.note = seat.note;
newSeat.ordering = seat.ordering;
BathClass.reset_seat(seat);
db_new.SubmitChanges();
}