public void UpdateStatus(TableFood tableFood) { TableFood table = db.TableFoods.FirstOrDefault(q => q.id == tableFood.id); tableFood.name = table.name; db.Entry(table).CurrentValues.SetValues(tableFood); db.SaveChanges(); }
void AddProduct() { TableFood table = lsvBill.Tag as TableFood; if (table == null) { MessageBox.Show("Xin chọn bàn!!"); return; } int idBill = _serviceBill.GetUncheckBillByIdTable_S(table.id); int idProduct = (cmbProduct.SelectedItem as Product).id; int count = (int)nmdCount.Value; if (count > _serviceProduct.GetProductById_S(idProduct).inventory) { MessageBox.Show("Số lượng sản phẩm hiện tại không đủ. Xin nhập thêm !"); return; } if (count == 0) { return; } if (idBill == -1) // Bill not exist { if (_serviceBill.AddBill_S(new Bill() { idTable = table.id, dateCheckIn = DateTime.Now, discount = 0, status = 0, totalPrice = 0 })) { if (_serviceBillInfo.AddBillInfo_S(new BillInfo() { idBill = _serviceBill.GetMaxIdBill_S().GetValueOrDefault(), idProduct = idProduct, count = count })) { //Cập nhật status _serviceTable.UpdateStatus_S(new TableFood() { id = table.id, status = "Có khách" }); } } } else // Bill đã tồn tại { if (_serviceBillInfo.AddBillInfo_S(new BillInfo() { idBill = idBill, idProduct = idProduct, count = count })) { //Do something if you want } } ShowBill(table.id); LoadTable(); nmdCount.Value = 1; }
public bool GetStatusbyIdTable(int id) { string query = string.Format("select * from TableFood where ID = {0}", id); DataTable dt = DataProvider.Instance.ExecuteQuery(query); DataRow dr = dt.Rows[0]; TableFood item = new TableFood(dr); return(item.Status); }
public List <TableFood> LoadTable() { List <TableFood> listTable = new List <TableFood>(); DataTable data = DataProvider.Instance.ExecuteQuery("EXEC GetTableList"); foreach (DataRow item in data.Rows) { TableFood table = new TableFood(item); listTable.Add(table); } return(listTable); }
public List <TableFood> GetListTableFood() { List <TableFood> list = new List <TableFood>(); DataTable data = DataProvider.Instance.ExcuteQuery("select * from TableFood"); foreach (DataRow item in data.Rows) { TableFood table = new TableFood(item); list.Add(table); } return(list); }
public List <TableFood> LoadTableList() { List <TableFood> listTableFood = new List <TableFood>(); string query = "USP_LoadTableList"; DataTable data = DataProvider.ExecuteQuery(query); foreach (DataRow row in data.Rows) { TableFood tableFood = new TableFood(row); listTableFood.Add(tableFood); } return(listTableFood); }
private void btnMoreHandling_Click(object sender, EventArgs e) { TableFood table = lsvBill.Tag as TableFood; if (table == null) { return; } int idBill = _serviceBill.GetUncheckBillByIdTable_S(table.id); IEnumerable listBillInfo = _serviceBillInfo.GetListBillInfoByIdBill_S(idBill); HandlingMoreForm h = new HandlingMoreForm(table.id, listBillInfo); h.ShowDialog(); LoadTable(); }
public List <TableFood> LoadTable() { List <TableFood> tables = new List <TableFood>(); DataTable data = DataProvider.Instance.ExecuteQuery("select * from TableFood"); foreach (DataRow dataRow in data.Rows) { TableFood table = new TableFood(dataRow); tables.Add(table); } return(tables); }
public bool AddTable(string nameTable) { var result = db.TableFoods.SingleOrDefault(m => m.nameTable == nameTable); if (result != null) { return(false); } TableFood T = new TableFood(); T.nameTable = nameTable; T.statusTable = "Trống"; db.TableFoods.Add(T); db.SaveChanges(); return(true); }
private void btn_Delete_Click(object sender, EventArgs e) { try { TableFood table = lv_Bill.Tag as TableFood; int id = Convert.ToInt32(txt_Product.Text); int idTable = Convert.ToInt32(lb_TenBan.Text); int idBill = BillDAO.Instance.GetUnCheckBillbyIdTable(idTable); DeleteProduct(idBill, id); ShowBill(table.ID); } catch { return; } }
private void btnCheckOut_Click(object sender, EventArgs e) { TableFood table = dgvTableDetails.Tag as TableFood; int billID = BillDAO.Instance.GetIDBillbyIDTable(table.id); int Discount = (int)nmDiscount.Value; if (billID != -1) { if (MessageBox.Show("Sử dụng mã giảm giá " + Discount + "%" + " cho bàn " + table.id + "\n Xác nhận Thanh Toán ?", "Xác Nhận", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { BillDAO.Instance.CheckOut(billID, Discount); TableDAO.Instance.CheckoutTable(table.id); bindDgvBill(table.id); } } InitTable(); }
private void LoadTableFood() { List <TableFood> lstTable = new List <TableFood>(); DataTable dataTable = new DataTable(); dataTable = TableDAO.Instance.GetDataTable(); foreach (DataRow item in dataTable.Rows) { TableFood tableFood = new TableFood(item); lstTable.Add(tableFood); string status = (tableFood.Status == 1) ? "Occupied" : "Unoccupied"; Button btn = new Button() { Width = 100, Height = 100, Content = tableFood.Name + "\n" + status }; pnlTable.Children.Add(btn); } }
public void AddTable(int ID, string name, bool status, string nameGroup) { TableFood table = new TableFood(ID, name, status, nameGroup); TableItem item; if (table.Status == true) { item = new TableItem(table.ID, table.Name, table.Status, table.NameGroup, Color.FromArgb(250, 204, 206)); } else { item = new TableItem(table.ID, table.Name, table.Status, table.NameGroup, Color.FromArgb(255, 255, 255)); } item.Tag = table; item.onChoose += TableItem_onChoose; this.flowLayoutPanelTable.Controls.Add(item); }
private void btnAddFood_Click(object sender, EventArgs e) { TableFood table = dgvTableDetails.Tag as TableFood; int idBill = BillDAO.Instance.GetIDBillbyIDTable(table.id); int FoodID = (cmbFood.SelectedItem as Food).id; int count = (int)nmFoodCount.Value; if (idBill == -1) //Bill chưa tồn tại { BillDAO.Instance.InsertBill(table.id); BillInfoDAO.Instance.InsertBillInfo(BillDAO.Instance.GetMaxIDBill(), FoodID, count); } else { BillInfoDAO.Instance.InsertBillInfo(idBill, FoodID, count); } bindDgvBill(table.id); InitTable(); }
void CheckOut() { TableFood table = lsvBill.Tag as TableFood; if (table == null) { return; } int idBill = _serviceBill.GetUncheckBillByIdTable_S(table.id); int discount = Convert.ToInt32(cmbDiscount.SelectedItem); double totalPrice = double.Parse(txtTotalPrice.Text.Split(',')[0]); double finalTotalPrice = totalPrice * (100 - discount) / 100; if (idBill != -1) { if (MessageBox.Show(String.Format("Bạn có chắc chắn muốn thanh toán bàn : {0}\nTổng tiền là : {1}\nGiảm giá : {2}\nTổng tiền phải trả là : {3}" , table.name, totalPrice, totalPrice - finalTotalPrice, finalTotalPrice) , "Thông báo", MessageBoxButtons.OKCancel) == DialogResult.OK) { if (_serviceBill.CheckOut_S(new Bill() { id = idBill, discount = discount, dateCheckIn = DateTime.Now, idTable = table.id, totalPrice = finalTotalPrice, status = 1 })) { MessageBox.Show("Thanh toán thành công!"); _serviceTable.UpdateStatus_S(new TableFood() { id = table.id, name = table.name, status = "Trống" }); } ShowBill(table.id); LoadTable(); } } cmbDiscount.SelectedIndex = 15; }
public void UpdateStatus_S(TableFood tableFood) { _repository.UpdateStatus(tableFood); }
void LoadTableStatus(int idTable) { TableFood table = DAL_TableFood.Instance.LoadTableStatusByID(idTable); UpdateTableStatus(btnTable[idTable], table.Name, table.Status); }
void SwitchTable() { TableFood table = lsvBill.Tag as TableFood; if (table == null) { return; } int idBillBeSwitch = _serviceBill.GetUncheckBillByIdTable_S(table.id); int idTableSwitchTo = (cmbTableFood.SelectedItem as TableFood).id; if (idTableSwitchTo == table.id) { return; } int idBillSwitchTo = _serviceBill.GetUncheckBillByIdTable_S(idTableSwitchTo); IEnumerable listBillInfo_TableBeSwitch = _serviceBillInfo.GetListBillInfoByIdBill_S(idBillBeSwitch); bool check = false; if (idBillSwitchTo == -1) { if (MessageBox.Show(String.Format("Bạn có chắc chắn muốn chuyển {0} sang {1} không?" , table.name, (cmbTableFood.SelectedItem as TableFood).name), "Thông báo", MessageBoxButtons.OKCancel) == DialogResult.OK) { if (_serviceBill.AddBill_S(new Bill() { idTable = idTableSwitchTo, dateCheckIn = DateTime.Now, discount = 0, status = 0, totalPrice = 0 })) {//Tạo bill mới cho bàn đc chuyển tới int idBillCurrent = _serviceBill.GetMaxIdBill_S().GetValueOrDefault(); foreach (BillInfo item in listBillInfo_TableBeSwitch) {//Chuyển tất cả billinfo của bàn được chuyển qua bàn mới if (_serviceBillInfo.UpdateBillInfo_S(new BillInfo() { id = item.id, idBill = idBillCurrent, idProduct = item.idProduct, count = item.count })) { // idBill ở đây là của bill mới tạo nên lấy giá trị max của bill check = true; } } } } } else { //Trường hợp này là 2 bàn cùng có bill nên k cần tạo bill mới cho bàn chuyển tới if (MessageBox.Show(String.Format("Bạn có chắc chắn muốn gọp {0} và {1} không?" , table.name, (cmbTableFood.SelectedItem as TableFood).name), "Thông báo", MessageBoxButtons.OKCancel) == DialogResult.OK) { foreach (BillInfo item in listBillInfo_TableBeSwitch) {//Chuyển tất các các billinfo cho bàn đc chuyển tới if (_serviceBillInfo.UpdateBillInfo_S(new BillInfo() { id = item.id, idBill = idBillSwitchTo, idProduct = item.idProduct, count = item.count })) { check = true; } } } } _serviceBill.DeleteBillById_S(idBillBeSwitch); if (check) { _serviceTable.UpdateStatus_S(new TableFood() { id = table.id, status = "Trống" }); if (idBillSwitchTo == -1) { MessageBox.Show("Chuyển bàn thành công!"); _serviceTable.UpdateStatus_S(new TableFood() { id = idTableSwitchTo, status = "Có Khách" }); } else { MessageBox.Show("Gọp bàn thành công!"); } } //ShowBill(idTableSwitchTo); LoadTable(); }
public bool Invocate(ManageDungeon dun) { if (IsInvocation == false) { return(false); } IsActive = true; IsInvocation = false; int bresult; //オプションによるトラップ回避 float t = 0; foreach (BaseOption o in Target.Options) { t += o.DexTrap(); } if (CommonFunction.IsRandom(t) == true) { DisplayInformation.Info.AddMessage(CommonConst.Message.DexTrap); Target = null; return(false); } //スコア値の更新 DungeonHistoryInformation.Info.iTrapInvokeCount++; //サウンドを鳴らす if (Target.Type == ObjectType.Player) { VoiceInformation.Voice.Play(PlayerInformation.Info.PType, VoiceInformation.Voice.PlayRandomDefence()); } bool result = false; //効果発動 switch (TType) { case TrapType.Bomb: //サウンドを鳴らす SoundInformation.Sound.Play(SoundInformation.SoundType.Bomb); //エフェクトの発動 EffectBigBang.CreateObject(this).Play(); //ダメージ処理 int damage = Mathf.CeilToInt(Target.CurrentHp / PerPlayerDamage); AttackState atState = Target.AddDamage(damage); //プレイヤーが死亡したら if (atState == AttackState.Death) { DisplayInformation.Info.AddMessage( Target.GetMessageDeath(Target.HaveExperience)); ScoreInformation.Info.CauseDeath = string.Format(CommonConst.DeathMessage.Trap, DisplayNameNormal); ScoreInformation.Info.CauseDeathType = DeathCouseType.Trap; Target.Death(); Target.DeathAction(dun); } //ダメージエフェクト EffectDamage d = EffectDamage.CreateObject(Target); d.SetText(damage.ToString(), AttackState.Hit); d.Play(); //ヒットメッセージ DisplayInformation.Info.AddMessage( Target.GetMessageAttackHit(damage)); //周辺キャラのダメージ処理 dun.SetUpCharacterMap(); List <BaseCharacter> list = dun.GetNearCharacters(this.CurrentPoint, 1); foreach (BaseCharacter c in list) { atState = c.AddDamage(CommonNumber); EffectDamage d2 = EffectDamage.CreateObject(c); d2.SetText(CommonNumber.ToString(), AttackState.Hit); d2.Play(); //対象が死亡したら if (atState == AttackState.Death) { DisplayInformation.Info.AddMessage( string.Format(CommonConst.Message.DeathCommon, c.DisplayNameInMessage)); c.Death(); c.DeathAction(dun); } } result = true; break; case TrapType.ColorMonitor: //サウンドを鳴らす SoundInformation.Sound.Play(SoundInformation.SoundType.Smoke); //エフェクトの発動 EffectColorMonitor.CreateObject(this).Play(); //効果 bresult = Target.AddStateAbnormal((int)StateAbnormal.StiffShoulder); //対象が異常になったらメッセージを表示 if (bresult != 0) { DisplayInformation.Info.AddMessage( CommonFunction.GetAbnormalMessage(StateAbnormal.StiffShoulder, Target)); } result = true; break; case TrapType.Cyclone: //サウンドを鳴らす SoundInformation.Sound.Play(SoundInformation.SoundType.Cyclone); //エフェクトの発動 EffectCyclone.CreateObject(Target).Play(); //メッセージの出力 DisplayInformation.Info.AddMessage( string.Format(CommonConst.Message.TrapCyclone2, Target.DisplayNameInMessage)); //効果 result = true; break; case TrapType.Electric: //サウンドを鳴らす SoundInformation.Sound.Play(SoundInformation.SoundType.ElectricTrap); //エフェクトの発動 EffectThunder.CreateObject(Target).Play(); BaseItem[] equips = PlayerCharacter.ItemList.FindAll(i => i.IsEquip == true).ToArray(); if (equips.Length > 0) { foreach (BaseItem i in equips) { i.ForceRemoveEquip(Target); } DisplayInformation.Info.AddMessage( string.Format(CommonConst.Message.TrapEquipRemove, Target.DisplayNameInMessage)); } result = true; break; case TrapType.Mud: //サウンドを鳴らす SoundInformation.Sound.Play(SoundInformation.SoundType.Smoke); //エフェクトの発動 EffectBadSmoke.CreateObject(Target).Play(); //効果 bresult = Target.AddStateAbnormal((int)StateAbnormal.Slow); //対象が異常になったらメッセージを表示 if (bresult != 0) { DisplayInformation.Info.AddMessage( CommonFunction.GetAbnormalMessage(StateAbnormal.Slow, Target)); } result = true; break; case TrapType.Palalysis: //サウンドを鳴らす SoundInformation.Sound.Play(SoundInformation.SoundType.Smoke); //エフェクトの発動 EffectBadSmoke.CreateObject(Target).Play(); //効果 bresult = Target.AddStateAbnormal((int)StateAbnormal.Palalysis); //対象が異常になったらメッセージを表示 if (bresult != 0) { DisplayInformation.Info.AddMessage( CommonFunction.GetAbnormalMessage(StateAbnormal.Palalysis, Target)); } result = true; break; case TrapType.Photo: if (Target.Type == ObjectType.Player) { //サウンドを鳴らす SoundInformation.Sound.Play(SoundInformation.SoundType.Smoke); //エフェクトの発動 EffectBadSmoke.CreateObject(Target).Play(); //メッセージの出力 DisplayInformation.Info.AddMessage( string.Format(CommonConst.Message.TrapCroquette2, Target.DisplayNameInMessage)); ((PlayerCharacter)Target).ReduceSatiety(CommonNumber); result = true; } break; case TrapType.Poison: //サウンドを鳴らす SoundInformation.Sound.Play(SoundInformation.SoundType.Smoke); //エフェクトの発動 EffectBadSmoke.CreateObject(Target).Play(); //効果 bresult = Target.AddStateAbnormal((int)StateAbnormal.Poison); //対象が異常になったらメッセージを表示 if (bresult != 0) { DisplayInformation.Info.AddMessage( CommonFunction.GetAbnormalMessage(StateAbnormal.Poison, Target)); } result = true; break; case TrapType.DeadlyPoison: //サウンドを鳴らす SoundInformation.Sound.Play(SoundInformation.SoundType.Smoke); //エフェクトの発動 EffectBadSmoke.CreateObject(Target).Play(); //効果 bresult = Target.AddStateAbnormal((int)StateAbnormal.DeadlyPoison); //対象が異常になったらメッセージを表示 if (bresult != 0) { DisplayInformation.Info.AddMessage( CommonFunction.GetAbnormalMessage(StateAbnormal.DeadlyPoison, Target)); } result = true; break; case TrapType.Rotation: //サウンドを鳴らす SoundInformation.Sound.Play(SoundInformation.SoundType.Rotation); //エフェクトの発動 EffectRotation.CreateObject(Target).Play(); //効果 bresult = Target.AddStateAbnormal((int)StateAbnormal.Confusion); //対象が異常になったらメッセージを表示 if (bresult != 0) { EffectSmoke.CreateObject(Target); DisplayInformation.Info.AddMessage( CommonFunction.GetAbnormalMessage(StateAbnormal.Confusion, Target)); } result = true; break; case TrapType.SandStorm: //サウンドを鳴らす SoundInformation.Sound.Play(SoundInformation.SoundType.Cyclone); //エフェクトの発動 EffectSandStorm.CreateObject(Target).Play(); //効果 bresult = Target.AddStateAbnormal((int)StateAbnormal.Dark); //対象が異常になったらメッセージを表示 if (bresult != 0) { DisplayInformation.Info.AddMessage( CommonFunction.GetAbnormalMessage(StateAbnormal.Dark, Target)); } result = true; break; case TrapType.Song: //サウンドを鳴らす SoundInformation.Sound.Play(SoundInformation.SoundType.Smoke); //エフェクトの発動 EffectBadSmoke.CreateObject(Target).Play(); //効果 bresult = Target.AddStateAbnormal((int)StateAbnormal.Sleep); //対象が異常になったらメッセージを表示 if (bresult != 0) { DisplayInformation.Info.AddMessage( CommonFunction.GetAbnormalMessage(StateAbnormal.Sleep, Target)); } result = true; break; case TrapType.Summon: //サウンドを鳴らす SoundInformation.Sound.Play(SoundInformation.SoundType.Summon); //エフェクトの発動 EffectSummon.CreateObject(Target).Play(); int cnt = CommonFunction.ConvergenceRandom(CountStart, ProbStart, ProbReduce); for (int i = 0; i < cnt; i++) { dun.SetUpCharacterMap(); //敵の出現地点を取得 MapPoint mp = dun.GetCharacterEmptyTarget(Target.CurrentPoint); if (CommonFunction.IsNull(mp) == true) { break; } int enemytype = TableEnemyMap.GetValue(dun.DungeonObjNo, DisplayInformation.Info.Floor); uint rand = CommonFunction.GetRandomUInt32(); BaseEnemyCharacter enemy = TableEnemyIncidence.GetEnemy(enemytype, rand, DisplayInformation.Info.Floor); enemy.SetCharacterDisplayObject(mp.X, mp.Y); dun.AddNewCharacter(enemy); } DisplayInformation.Info.AddMessage( CommonConst.Message.TrapSummon); result = true; break; case TrapType.TheFly: if (Target.Type == ObjectType.Player) { //サウンドを鳴らす SoundInformation.Sound.Play(SoundInformation.SoundType.Smoke); //エフェクトの発動 EffectBadSmoke.CreateObject(Target).Play(); BaseItem[] foods = PlayerCharacter.ItemList.FindAll(i => i.IType == ItemType.Food).ToArray(); if (foods.Length > 0) { foreach (BaseItem i in foods) { PlayerCharacter.RemoveItem(i); ((PlayerCharacter)Target).AddItem(TableFood.GetItem(CommonConst.ObjNo.FlyCroquette), i.SortNo); } //メッセージの出力 DisplayInformation.Info.AddMessage( string.Format(CommonConst.Message.TrapFly2)); } result = true; } break; case TrapType.WaterBucket: //サウンドを鳴らす SoundInformation.Sound.Play(SoundInformation.SoundType.BucketFall); //エフェクトの発動 EffectWaterBucket.CreateObject(Target).Play(); //効果 bresult = Target.AddStateAbnormal((int)StateAbnormal.Reticent); //対象が異常になったらメッセージを表示 if (bresult != 0) { DisplayInformation.Info.AddMessage( CommonFunction.GetAbnormalMessage(StateAbnormal.Reticent, Target)); } result = true; break; //花粉 case TrapType.Pollen: //サウンドを鳴らす SoundInformation.Sound.Play(SoundInformation.SoundType.Smoke); //エフェクトの発動 EffectSmoke d3 = EffectSmoke.CreateObject(Target); d3.SetColor(Color.yellow); d3.Play(); //力減少 Target.ReducePower((ushort)CommonNumber); //メッセージの出力 DisplayInformation.Info.AddMessage( string.Format(CommonConst.Message.TrapPllen2, Target.DisplayNameInMessage)); result = true; break; case TrapType.Ember: //ダメージ処理 int damage2 = CommonNumber; //通常ダメージの場合 if (CommonFunction.HasOptionType(this.Options, OptionType.ReverceDamage) == false) { AttackState atState2 = Target.AddDamage(damage2); //ダメージエフェクト EffectDamage d4 = EffectDamage.CreateObject(Target); d4.SetText(damage2.ToString(), AttackState.Hit); d4.Play(); DisplayInformation.Info.AddMessage( string.Format(CommonConst.Message.TrapDamage, Target.DisplayNameInMessage, this.DisplayNameInMessage, damage2)); //対象が死亡したら if (atState2 == AttackState.Death) { DisplayInformation.Info.AddMessage( Target.GetMessageDeath(Target.HaveExperience)); if (Target.Type == ObjectType.Player) { ScoreInformation.Info.CauseDeath = string.Format(CommonConst.DeathMessage.Trap, DisplayNameNormal); ScoreInformation.Info.CauseDeathType = DeathCouseType.Trap; } Target.Death(); Target.DeathAction(dun); } } //反転回復の場合 else { Target.RecoverHp(damage2); //ダメージエフェクト EffectDamage d4 = EffectDamage.CreateObject(Target); d4.SetText(damage2.ToString(), AttackState.Heal); d4.Play(); DisplayInformation.Info.AddMessage( string.Format(CommonConst.Message.TrapRecover, Target.DisplayNameInMessage, this.DisplayNameInMessage, damage2)); } break; } Target = null; return(result); }