protected override bool CheckCodeIsExists() { if (objBLDetail.CheckCodeIsExists(BookingID, txtBookingNo.Text.Trim())) { MessageBoxCommon.ShowMessageError("Mã đặt bàn <" + txtBookingNo.Text.Trim() + "> đã tồn tại"); txtBookingNo.Focus(); return(false); } return(base.CheckCodeIsExists()); }
private void cboArea_ItemNotInList(object sender, Infragistics.Win.UltraWinEditors.ValidationErrorEventArgs e) { try { e.RetainFocus = true; if (sender.GetType() == typeof(Infragistics.Win.UltraWinGrid.UltraCombo)) { UltraCombo control = (UltraCombo)sender; MessageBoxCommon.ShowMessageError(string.Format("Dữ liệu <{0}> không có trong danh mục", control.Tag)); control.SelectAll(); if (!control.IsDroppedDown) { control.ToggleDropdown(); } } } catch (Exception ex) { MessageBoxCommon.ShowException(ex); } }
protected override void Delete() { base.Delete(); if (grdList.Selected.Rows.Count == 0) { return; } if (MessageBoxCommon.ShowYesNoQuestion(Properties.Resources.Message_Question_Delete) == DialogResult.Yes) { var rowsDeleted = new List <Guid>(); var positionGrid = grdList.Selected.Rows[0].Index; foreach (var row in grdList.Selected.Rows) { positionGrid = positionGrid > row.Index ? row.Index : positionGrid; Guid id = Guid.Empty; if (Guid.TryParse(row.Cells[ColumnName.InventoryItemID].Value.ToString(), out id)) { if (id == Guid.Empty) { continue; } int result = oBL.Delete(id); if (result == (int)EnumResultDelete.Success) { rowsDeleted.Add(id); } else if (result == (int)EnumResultDelete.ItemWasUsed) { MessageBoxCommon.ShowMessageError(String.Format(Properties.Resources.Message_DeleteData_HadReference, row.Cells[ColumnName.InventoryItemName].Text)); break; } else { MessageBoxCommon.ShowMessageError(String.Format(Properties.Resources.Message_DeleteData_Error, row.Cells[ColumnName.InventoryItemName].Text)); break; } } } foreach (var item in rowsDeleted) { bsList.RemoveAt(bsList.Find(ColumnName.InventoryItemID, item)); } if (rowsDeleted.Count > 0) { if (bsList.Count == 0) { ShowHideFunctionByData(); return; } else if (positionGrid == 0 && bsList.Count > 0) { bsList.MoveFirst(); } else { positionGrid -= 1; } grdList.Rows[positionGrid].Activated = true; grdList.Rows[positionGrid].Selected = true; } } }