Beispiel #1
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            string DescripPrice = txtDescripPrice.Text;
            int    Row          = dgvPriceTag.CurrentRow.Index;
            int    IdPriceTag   = Convert.ToInt32(dgvPriceTag[0, Row].Value);

            if (dgvPriceTag[1, Row].Value == null || string.IsNullOrEmpty(DescripPrice.Trim()))
            {
                MetroMessageBox.Show(this, "Debe Seleccionar Al menos Algún Valor para Inactivar. \n Favor Intentelo Nuevamente", "Error en Validación", MessageBoxButtons.OK, MessageBoxIcon.Error);
                dgvPriceTag.Focus();
                return;
            }
            else
            {
                if (MetroFramework.MetroMessageBox.Show(this, "¿Desea Eliminar el Precio : " + DescripPrice + "?", "Confirmación de Acción", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
                {
                    try
                    {
                        ObjPrice.ID_Product = IdPriceTag;
                        ObjPrice.IdSession  = pIdSession;
                        ApiAccess.DeleteProduct(ObjPrice);
                    }
                    catch (Exception)
                    {
                        throw;
                    }
                    CleanFields();
                    LoadDataGrid();
                }
            }
        }
        public ReturnMessage DeleteProduct(Product product)
        {
            ReturnMessage message     = new ReturnMessage();
            string        productName = product.ProductName;
            bool          isDeleted   = productManagement.DeleteProduct(product);

            if (isDeleted)
            {
                message.Value        = $"{productName} is successfully deleted.";
                message.isSuccessful = true;
                return(message);
            }
            else
            {
                message.Value        = DatabaseErrorMessage();
                message.isSuccessful = false;
                return(message);
            }
        }
Beispiel #3
0
        public bool DeleteProduct(Product product)
        {
            bool isDeleted = productManagement.DeleteProduct(product);

            return(isDeleted);
        }