//套餐管理 private void btnCombo_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; } ComboManagementForm comboForm = new ComboManagementForm(); comboForm.ShowDialog(); }
//确定 private void okBtn_Click(object sender, EventArgs e) { if (priceType.SelectedIndex == 1 && price.Text == "") { GeneralClass.printErrorMsg("需要输入价格"); return; } if (priceType.SelectedIndex == 0 && dgvFreeItems.Rows.Count == 0) { GeneralClass.printErrorMsg("需要输入减免项目"); return; } if (priceType.SelectedIndex == 2 && upTo.Text == "") { GeneralClass.printErrorMsg("需要输入价格"); return; } if (priceType.SelectedIndex == 2 && dgvFreeItems3.Rows.Count == 0) { GeneralClass.printErrorMsg("需要输入减免项目"); return; } if (priceType.SelectedIndex == 0 || priceType.SelectedIndex == 1) { m_Combo.menuIds = ComboManagementForm.assembleCombo(menuIdList); m_Combo.originPrice = ComboManagementForm.getComboOriginPrice(db, menuIdList); } if (priceType.SelectedIndex == 0) { m_Combo.priceType = "免项目"; m_Combo.freeMenuIds = ComboManagementForm.assembleCombo(freeIdList); m_Combo.price = m_Combo.originPrice - BathClass.get_combo_price(db, m_Combo); } else if (priceType.SelectedIndex == 1) { m_Combo.priceType = "减金额"; m_Combo.freeMenuIds = null; m_Combo.price = Convert.ToDouble(price.Text); } else if (priceType.SelectedIndex == 2) { m_Combo.priceType = "消费满免项目"; m_Combo.menuIds = ComboManagementForm.assembleCombo(menuIdList); m_Combo.freeMenuIds = ComboManagementForm.assembleCombo(freeIdList); m_Combo.expenseUpTo = Convert.ToDouble(upTo.Text); } m_Combo.freePrice = BathClass.get_combo_price(db, m_Combo); if (newCombo) { db.Combo.InsertOnSubmit(m_Combo); } db.SubmitChanges(); this.DialogResult = DialogResult.OK; this.Close(); }