public void grdBase_KitchenCommand(object sender, EventArgs e) { try { //get the selected rows List <DataGridViewRow> selectedRows = grdBase.GridSelectedRows; if (selectedRows.Count <= 0) { UtilityMessage.Warning(GeneralMessage.NoSelectedDataUpdate, GeneralMessage.MessageBoxTitle); } //else if (!UtilityMessage.Confirm(GeneralMessage.ConfirmDelete, GeneralMessage.MessageBoxTitle)) //{ // return; //} else { //Button currenButton = List <string> OrderDetailKeyList = selectedRows.Select(x => x.Cells["ID"].Value.ToString()).ToList(); string StatusToUpdate = string.Empty; //sould have gone with hieritiing EventArgs , but ain't nobody got time for that shit Button currentCommand = sender as Button; if (currentCommand != null) { StatusToUpdate = DetermineStatusFromButton(currentCommand); } ServiceProvider.KCSaleOrderDetailService.UpdateOrderDetailStatus(OrderDetailKeyList, StatusToUpdate); grdBase.LoadData(true); UtilityMessage.Alert(GeneralMessage.UpdateStatusCompleted, GeneralMessage.MessageBoxTitle); /*string answer = string.Empty; * foreach (string key in OrderDetailKeyList) answer += key; * MessageBox.Show(answer);*/ } } catch (ValidationException ex) { base.formBase.ShowErrorMessage(ex); } }
private void UpdateDataRow(DataGridViewRow rowSelected) { RowEventArgs RowArg = new RowEventArgs(); //Grid.Rows[rowIndex] if (rowSelected.IsNewRow) { UtilityMessage.Warning(GeneralMessage.NoSelectedDataUpdate, GeneralMessage.MessageBoxTitle); } else { //if (onSelectedDataRow != null && UtilityMessage.Confirm(GeneralMessage.ConfirmUpdate, GeneralMessage.MessageBoxTitle)) if (onSelectedDataRow != null) { RowArg.RowSelected = rowSelected; onSelectedDataRow(GetUpdateDataKey(rowSelected), RowArg); LoadData(); Grid.ClearSelection(); //Grid.Rows //Grid.Rows[rowIndex].Selected = true; } } }
private void DeleteData(List <DataGridViewRow> selectedRows) { if (selectedRows.Count > 0) { if (UtilityMessage.Confirm(GeneralMessage.ConfirmDelete, GeneralMessage.MessageBoxTitle)) { RowsEventArgs RowArg = new RowsEventArgs() { RowsSelected = selectedRows }; if (onDeleteDataRows != null) { onDeleteDataRows(GetDeleteDataKey(selectedRows), RowArg); LoadData(); Grid.ClearSelection(); UtilityMessage.Alert(GeneralMessage.DeleteComplete, GeneralMessage.MessageBoxTitle); } } } else { UtilityMessage.Warning(GeneralMessage.NoSelectedData, GeneralMessage.MessageBoxTitle); } }