/// <summary>
        /// Insere uma nova venda.
        /// </summary>
        /// <param name="sale">Venda realizada</param>
        /// <param name="lstProducts">Lista de produtos vendidos</param>
        public void InsertSale(Sale sale, List<Product> lstProducts)
        {
            try
            {
                using (this.saleDataAccess = new SaleDataAccess())
                {
                    this.saleDataAccess.InsertSale(sale.OperatorId, sale.DateTime, sale.Subtotal, sale.Discount, sale.Total);

                    sale.Id = this.saleDataAccess.GetId(sale.OperatorId, sale.DateTime);

                    if (sale.Id > 0)
                    {
                        foreach (Product product in lstProducts)
                        {
                            try
                            {
                                this.saleDataAccess.InsertSaleProducts(sale.Id, product.Id, product.Quantity, product.CostPrice, product.SalePrice);

                                using (this.productDataAccess = new ProductDataAccess())
                                {
                                    this.productDataAccess.UpdateProductStockQuantity(product.BarCode, product.StockQuantity - product.Quantity);
                                }
                            }
                            catch (Exception ex)
                            {
                                Logging.Error(BusinessConstants.ProjectName,
                                              MethodBase.GetCurrentMethod().DeclaringType.Name,
                                              MethodBase.GetCurrentMethod().Name,
                                              ex.Message);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Logging.Error(BusinessConstants.ProjectName,
                              MethodBase.GetCurrentMethod().DeclaringType.Name,
                              MethodBase.GetCurrentMethod().Name,
                              ex.Message);

                throw ex;
            }
        }
        /// <summary>
        /// Confirma a realização da venda.
        /// </summary>
        private void ConfirmSale()
        {
            try
            {
                CalculateTotal();

                Sale sale = new Sale();
                sale.OperatorId = SharedData.Instance.OperatorData.Id;
                sale.DateTime = DateTime.Now;
                sale.Subtotal = this.subtotal;
                sale.Discount = this.discount;
                sale.Total = this.total;

                this.saleBusiness.InsertSale(sale, lstProducts);

                MessageBox.Show(this, Resources.SaleSaveSuccess, Resources.Success, 
                                MessageBoxButtons.OK, MessageBoxIcon.Information);

                ThrowConfirmSale();

                this.Close();
            }
            catch (Exception ex)
            {
                Logging.Error(ViewConstants.ProjectName,
                              MethodBase.GetCurrentMethod().DeclaringType.Name,
                              MethodBase.GetCurrentMethod().Name,
                              ex.Message);
            }
        }