protected void btnDelete_Click(object sender, ImageClickEventArgs e)
        {
            bool returnStatus = false;

            BusinessObjects.NonWorkingDay nonWorkingDay = new BusinessObjects.NonWorkingDay();

            foreach (GridViewRow CurrRow in grdNonWorkingDays.Rows)
            {
                if (GetControl <CheckBox>("chkDelete", CurrRow).Checked)
                {
                    try
                    {
                        nonWorkingDay.Id = (int)grdNonWorkingDays.DataKeys[CurrRow.RowIndex].Value;
                        returnStatus     = NonWorkingDayController.DeleteNonWorkingDay(nonWorkingDay);
                    }
                    catch (Exception ex)
                    {
                        if (ExceptionPolicy.HandleException(ex, "User Interface"))
                        {
                            DisplayMessage("Failed to delete.");
                        }
                    }
                    if (!returnStatus)
                    {
                        DisplayMessage("Failure to delete");
                    }
                }
            }
            PageGridView.DataBind();
        }
示例#2
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(txtWarehouseId.Text))
            {
                MessageBox.Show("Use Get Details Button to retrieve the non-working date");
                bool setcursorto = txtWarehouseCode.Focus();
                return;
            }
            // Return the id from the NonWorkingDayController.SaveNonWorkingDay method,
            // passing in the object nonWorkingDay and storing the returned id in the nonWorkingDay.Id
            // field.
            bool returnValue = NonWorkingDayController.DeleteNonWorkingDay(nonWorkingDay);

            if (!returnValue)
            {
                MessageBox.Show("Error to delete the non-working date");
                return;
            }
            else
            {
                MessageBox.Show("The non-working date is removed");
                return;
            }
        }
示例#3
0
 /// <summary>
 /// Deletes the item.
 /// </summary>
 /// <param name="nonWorkingDay">The non working day.</param>
 /// <returns></returns>
 internal bool DeleteItem(NonWorkingDay nonWorkingDay)
 {
     return(NonWorkingDayController.DeleteNonWorkingDay(nonWorkingDay));
 }