Ejemplo n.º 1
0
 //Debtor Payment Payment Click
 private void DebtorPaymentButtonPamentClick(object sender, System.Windows.RoutedEventArgs e)
 {
     this.DebtorsCredtorsPaymentButtonPayment.IsEnabled = false;
     Mouse.OverrideCursor = Cursors.Wait;
     DataSetPetunia commonDataUse = new DataSetPetunia();
     bool debtors = false;
     try
     {
         if (this.DebtorsCredtorsPaymentComboBoxName.Text != string.Empty && this.DebtorsCredtorsPaymentNumberBoxPaymentAmount.Text != string.Empty)
         {
                 if (operationType.Equals(Variables.OperationTrypes.Debtors))
                 {
                     debtors = true;
                 }
                 DataTable tempadataTable = new MySqlNaceassaryElement().DataReader(string.Format("SELECT {0} FROM {1} WHERE {2}='{3}' ORDER BY {4}", Variables.COLUMN_NAME[4], Variables.TABLE_NAME[3], Variables.COLUMN_NAME[3], this.DebtorsCredtorsPaymentComboBoxName.Text, Variables.COLUMN_NAME[0]));
                 if (tempadataTable.Rows.Count > 0)
                 {
                     DataRow tempDataRow = tempadataTable.Rows[0];
                     commonDataUse.PetuniaCommonUse.Rows.Add(this.DebtorsCredtorsPaymentComboBoxName.Text, tempDataRow[0], new PetuniaNecessaryFunction().DateFromRadDatePicker(this.DebtorsCredtorsPaymentDateAndTimePicker), new NecessaryFunction().ComaSpriter(this.DebtorsCredtorsPaymentNumberBoxPaymentAmount.Text));
                     if (debtors ? new AccountClass().CreditorsAndDebtorsPayment(commonDataUse.PetuniaCommonUse, TransactionType.debt, new DatabaseRead(new MySqlNaceassaryElement().DataReader), new DBQueres(new MySqlNaceassaryElement().DatabaseOperation)) : new AccountClass().CreditorsAndDebtorsPayment(commonDataUse.PetuniaCommonUse, TransactionType.Credit, new DatabaseRead(new MySqlNaceassaryElement().DataReader), new DBQueres(new MySqlNaceassaryElement().DatabaseOperation)))
                     {
                         throw new SuccessfullException(Variables.ERROR_MESSAGES[0, 11]);
                     }
                     else
                     {
                         throw new PetuniaException(Variables.ERROR_MESSAGES[0, 2]);
                     }
                 }
                 else
                 {
                     throw new PetuniaException(Variables.ERROR_MESSAGES[0, 2]);
                 }
         }
         else
         {
             throw new PetuniaException(Variables.ERROR_MESSAGES[0, 2]);
         }
     }
     catch (SuccessfullException success)
     {
         Mouse.OverrideCursor = null;
         Microsoft.Windows.Controls.MessageBox.Show(success.Message, Variables.ERROR_MESSAGES[0, 0], MessageBoxButton.OK, MessageBoxImage.Information);
     }
     catch (Exception error)
     {
         Mouse.OverrideCursor = null;
         Microsoft.Windows.Controls.MessageBox.Show(error.Message, Variables.ERROR_MESSAGES[0, 0], MessageBoxButton.OK, MessageBoxImage.Stop);
     }
     finally
     {
         commonDataUse.Dispose();
         this.DebtorsCredtorsPaymentButtonPayment.IsEnabled = true;
         Mouse.OverrideCursor = null;
     }
 }
Ejemplo n.º 2
0
 //Salary Update Click
 private void SalaryButtonUpdateClick(object sender, System.Windows.RoutedEventArgs e)
 {
     this.SalaryButtonUpdate.IsEnabled = false;
     Mouse.OverrideCursor = Cursors.Wait;
     DataSetPetunia temDataSet = new DataSetPetunia();
     try
     {
         if (this.SalaryComboBoxName.Text != string.Empty && this.SalaryDateAndTime.DisplayDate.ToString() != string.Empty && this.SalaryNumberBoxAmount.Text != string.Empty && this.SalaryTextBoxDescription.Text != string.Empty)
         {
             temDataSet.PetuniaCommonUse.Rows.Add(this.SalaryComboBoxName.Text, new PetuniaNecessaryFunction().DateFromRadDatePicker(this.SalaryDateAndTime), new NecessaryFunction().ComaSpriter(this.SalaryNumberBoxAmount.Text), this.SalaryTextBoxDescription.Text);
             if (new AccountClass().Salary(temDataSet.PetuniaCommonUse, new DBQueres(new MySqlNaceassaryElement().DatabaseOperation), new DatabaseRead(new MySqlNaceassaryElement().DataReader)))
             {
                 this.SalaryNumberBoxAmount.Text = string.Empty;
                 throw new SuccessfullException(Variables.ERROR_MESSAGES[0, 11]);
             }
             else
             {
                 this.SalaryNumberBoxAmount.Text = string.Empty;
                 throw new PetuniaException(Variables.ERROR_MESSAGES[0, 3]);
             }
         }
         else
         {
             throw new PetuniaException(Variables.ERROR_MESSAGES[0, 5]);
         }
     }
     catch (SuccessfullException success)
     {
         Mouse.OverrideCursor = null;
         Microsoft.Windows.Controls.MessageBox.Show(success.Message, Variables.ERROR_MESSAGES[0, 0], MessageBoxButton.OK, MessageBoxImage.Information);
     }
     catch (Exception error)
     {
         Mouse.OverrideCursor = null;
         Microsoft.Windows.Controls.MessageBox.Show(error.Message, Variables.ERROR_MESSAGES[0, 0], MessageBoxButton.OK, MessageBoxImage.Error);
     }
     finally
     {
         temDataSet.Dispose();
         Mouse.OverrideCursor = null;
         this.SalaryButtonUpdate.IsEnabled = true;
     }
 }
Ejemplo n.º 3
0
 //Return Product Sales Save Button Click
 private void ReturnProductSalesButtonSaveClick(object sender, System.Windows.RoutedEventArgs e)
 {
     this.ReturnProductSalesButtonSave.IsEnabled = false;
     Mouse.OverrideCursor = Cursors.Wait;
     DataSetPetunia tempDataSet = new DataSetPetunia();
     try
     {
         if (GridViewInvoice.Count > 0)
         {
             double paymentAmountIs = new NecessaryFunction().ComaSpriter(this.ReturnProductSalesNumberBoxPaymentAmountCreditOrDebit.Text);
             string creditAmountIs = this.ReturnProductSalesLabelCreditAmount.Text;
             foreach (InvoiceItems returnproductItems in GridViewInvoice)
             {
                 tempDataSet.PetuniaCommonUse.Rows.Add(returnproductItems.ProductID, new PetuniaNecessaryFunction().DateFromRadDatePicker(this.ReturnProductSalesDateAndTime), returnproductItems.Quantity, returnproductItems.Rate, returnproductItems.Amount, this.ReturnProductSalesComboBoxName.Text, this.ReturnProductSalesLabelInvoiceNumber.Text, creditAmountIs, paymentAmountIs);
                 paymentAmountIs = 0;
                 creditAmountIs = "0";
                 if (this.ReturnProductSalesRadioButtonCash.IsChecked.Equals(true))
                 {
                     if (operationType.Equals(Variables.OperationTrypes.PurchaseReturn) ? new AccountClass().PurchaseReturn(tempDataSet.PetuniaCommonUse, TransactionType.Cash, new DBQueres(new MySqlNaceassaryElement().DatabaseOperation), new DatabaseRead(new MySqlNaceassaryElement().DataReader)) : new AccountClass().SalesReturn(tempDataSet.PetuniaCommonUse, TransactionType.Cash, new DBQueres(new MySqlNaceassaryElement().DatabaseOperation), new DatabaseRead(new MySqlNaceassaryElement().DataReader)))
                     {
                         throw new SuccessfullException(Variables.ERROR_MESSAGES[0, 11]);
                     }
                     else
                     {
                         throw new PetuniaException(Variables.ERROR_MESSAGES[0, 3]);
                     }
                 }
                 else if (this.ReturnProductSalesRadioButtonCreditOrDebit.IsChecked.Equals(true))
                 {
                     if (this.ReturnProductSalesComboBoxName.Text != string.Empty && this.ReturnProductSalesNumberBoxPaymentAmountCreditOrDebit.Text != string.Empty)
                     {
                         if (operationType.Equals(Variables.OperationTrypes.PurchaseReturn) ? new AccountClass().PurchaseReturn(tempDataSet.PetuniaCommonUse, TransactionType.Credit, new DBQueres(new MySqlNaceassaryElement().DatabaseOperation), new DatabaseRead(new MySqlNaceassaryElement().DataReader)) : new AccountClass().SalesReturn(tempDataSet.PetuniaCommonUse, TransactionType.debt, new DBQueres(new MySqlNaceassaryElement().DatabaseOperation), new DatabaseRead(new MySqlNaceassaryElement().DataReader)))
                         {
                             throw new SuccessfullException(Variables.ERROR_MESSAGES[0, 11]);
                         }
                         else
                         {
                             throw new PetuniaException(Variables.ERROR_MESSAGES[0, 3]);
                         }
                     }
                     else
                     {
                         throw new PetuniaException(Variables.ERROR_MESSAGES[0, 5]);
                     }
                 }
             }
         }
         else
         {
             throw new PetuniaException(Variables.ERROR_MESSAGES[0, 14]);
         }
     }
     catch (SuccessfullException success)
     {
         Mouse.OverrideCursor = null;
         Microsoft.Windows.Controls.MessageBox.Show(success.Message, Variables.ERROR_MESSAGES[0, 0], MessageBoxButton.OK, MessageBoxImage.Information);
     }
     catch (Exception error)
     {
         Mouse.OverrideCursor = null;
         Microsoft.Windows.Controls.MessageBox.Show(error.Message, Variables.ERROR_MESSAGES[0, 0], MessageBoxButton.OK, MessageBoxImage.Stop);
     }
     finally
     {
         tempDataSet.Dispose();
         Mouse.OverrideCursor = null;
         this.ReturnProductSalesButtonSave.IsEnabled = true;
     }
 }
Ejemplo n.º 4
0
 private void RechargeAmountButonUpdateClick(object sender, System.Windows.RoutedEventArgs e)
 {
     this.RechargeAmountButonUpdate.IsEnabled = false;
     Mouse.OverrideCursor = Cursors.Wait;
     DataSetPetunia commonDataUse = new DataSetPetunia();
     try
     {
         OperationType tempOperationType;
         if (this.RechargeAmountRedioButtonPurchase.IsChecked.Equals(true))
         {
             tempOperationType = OperationType.Purchase;
         }
         else if (this.RechargeAmountRedioButtonSales.IsChecked.Equals(true))
         {
             tempOperationType = OperationType.Sales;
         }
         else
         {
             throw new PetuniaException(Variables.ERROR_MESSAGES[1, 4]);
         }
         if (this.RechargeAmountNumicBoxAmount.Text != string.Empty)
         {
             commonDataUse.PetuniaCommonUse.Rows.Add(new PetuniaNecessaryFunction().DateFromRadDatePicker(this.RechargeAmountDate), this.RechargeAmountComBoxBoxCompayName.Text, new NecessaryFunction().ComaSpriter(this.RechargeAmountNumicBoxAmount.Text));
             if (new AccountClass().Rechares(commonDataUse.PetuniaCommonUse, tempOperationType, new MySqlNaceassaryElement().DatabaseOperation, new MySqlNaceassaryElement().DataReader))
             {
                 throw new SuccessfullException(Variables.ERROR_MESSAGES[0, 11]);
             }
             else
             {
                 throw new PetuniaException(Variables.ERROR_MESSAGES[0, 3]);
             }
         }
         else
         {
             Mouse.OverrideCursor = null;
             Microsoft.Windows.Controls.MessageBox.Show(Variables.ERROR_MESSAGES[0, 5], Variables.ERROR_MESSAGES[0, 0], MessageBoxButton.OK, MessageBoxImage.Stop);
         }
     }
     catch (SuccessfullException success)
     {
         Mouse.OverrideCursor = null;
         Microsoft.Windows.Controls.MessageBox.Show(success.Message, Variables.ERROR_MESSAGES[0, 0], MessageBoxButton.OK, MessageBoxImage.Information);
     }
     catch (Exception error)
     {
         Mouse.OverrideCursor = null;
         Microsoft.Windows.Controls.MessageBox.Show(error.Message, Variables.ERROR_MESSAGES[0, 0], MessageBoxButton.OK, MessageBoxImage.Error);
     }
     finally
     {
         Mouse.OverrideCursor = null;
         this.RechargeAmountButonUpdate.IsEnabled = true;
         commonDataUse.Dispose();
     }
 }
Ejemplo n.º 5
0
 // Add stock Update Button
 private void AddStockUpdateClick(object sender, System.Windows.RoutedEventArgs e)
 {
     this.AddStockButtonAdd.IsEnabled = false;
     Mouse.OverrideCursor = Cursors.Wait;
     MySqlNaceassaryElement mysqlNecessaryFunction = new MySqlNaceassaryElement();
     DataSetPetunia commonUseDataSet = new DataSetPetunia();
     try
     {
         if (this.StockAddProductInfo.CompanyNameIs != string.Empty && this.StockAddProductInfo.ProductNameIs != string.Empty && this.StockAddProductInfo.ModelNumberIs != string.Empty && AddStockLabelProductIDInfo.Text != string.Empty && AddStockNumericUpDown.Value > 0 && AddStockTextBoxRate.Text != string.Empty && AddStockTextBoxInvoiceNUmber.Text != string.Empty && Convert.ToDouble(this.AddStockTextBoxRate.Text) > 0)
         {
             commonUseDataSet.PetuniaCommonUse.Rows.Add(this.AddStockLabelProductIDInfo.Text, new PetuniaNecessaryFunction().DateFromRadDatePicker(this.AddStockDatePicker), this.AddStockNumericUpDown.Value.ToString(), this.AddStockLabelRateInfo.Text, new NecessaryFunction().ComaSpriter(this.AddStockTextBoxRate.Text), this.AddStockLabelAmountNewInfo.Text, this.AddStockTextBoxInvoiceNote.Text, this.AddStockComboBoxCreditorsName.Text, this.AddStockTextBoxIssueName.Text, this.AddStockTextBoxInvoiceNUmber.Text, this.AddStockLabelCreditAmount.Text, new NecessaryFunction().ComaSpriter(this.AddStockTextBoxPaymentAmount.Text));
             if (this.AddStockRadioButtonCash.IsChecked.Equals(true))
             {
                 if (new AccountClass().Purchase(commonUseDataSet.PetuniaCommonUse, TransactionType.Cash, new DBQueres(mysqlNecessaryFunction.DatabaseOperation), new DatabaseRead(mysqlNecessaryFunction.DataReader)))
                 {
                     this.AddStockTextBoxInvoiceNUmber.Text = string.Empty;
                     throw new SuccessfullException(Variables.ERROR_MESSAGES[0, 11]);
                 }
                 else
                 {
                     throw new PetuniaException(Variables.ERROR_MESSAGES[0, 2]);
                 }
             }
             else if (this.AddStockRadioButtonCheeck.IsChecked.Equals(true))
             {
                 if (new AccountClass().Purchase(commonUseDataSet.PetuniaCommonUse, TransactionType.check, new DBQueres(mysqlNecessaryFunction.DatabaseOperation), new DatabaseRead(mysqlNecessaryFunction.DataReader)))
                 {
                     this.AddStockTextBoxInvoiceNUmber.Text = string.Empty;
                     throw new SuccessfullException(Variables.ERROR_MESSAGES[0, 11]);
                 }
                 else
                 {
                     throw new PetuniaException(Variables.ERROR_MESSAGES[0, 2]);
                 }
             }
             else if (this.AddStockReadioButtonCredit.IsChecked.Equals(true))
             {
                 if (this.AddStockComboBoxCreditorsName.Text != string.Empty && this.AddStockTextBoxPaymentAmount.Text != string.Empty && this.AddStockLabelCreditAmount.Text != string.Empty && Convert.ToDouble(this.AddStockLabelCreditAmount.Text) >= 0)
                 {
                     if (new AccountClass().Purchase(commonUseDataSet.PetuniaCommonUse, TransactionType.Credit, new DBQueres(mysqlNecessaryFunction.DatabaseOperation), new DatabaseRead(mysqlNecessaryFunction.DataReader)))
                     {
                         this.AddStockTextBoxInvoiceNUmber.Text = string.Empty;
                         throw new SuccessfullException(Variables.ERROR_MESSAGES[0, 11]);
                     }
                     else
                     {
                         throw new PetuniaException(Variables.ERROR_MESSAGES[0, 2]);
                     }
                 }
                 else
                 {
                     throw new PetuniaException(Variables.ERROR_MESSAGES[0, 5]);
                 }
             }
             else
             {
                 throw new PetuniaException(Variables.ERROR_MESSAGES[1, 4]);
             }
         }
         else
         {
             throw new PetuniaException(Variables.ERROR_MESSAGES[0, 5]);
         }
     }
     catch (SuccessfullException success)
     {
         Mouse.OverrideCursor = null;
         Microsoft.Windows.Controls.MessageBox.Show(success.Message, Variables.ERROR_MESSAGES[0, 0], MessageBoxButton.OK, MessageBoxImage.Information);
     }
     catch (Exception error)
     {
         Mouse.OverrideCursor = null;
         Microsoft.Windows.Controls.MessageBox.Show(error.Message, Variables.ERROR_MESSAGES[0, 0], MessageBoxButton.OK, MessageBoxImage.Stop);
     }
     finally
     {
         Mouse.OverrideCursor = null;
         this.AddStockButtonAdd.IsEnabled = true;
         mysqlNecessaryFunction.Dispose();
         commonUseDataSet.Dispose();
     }
 }
Ejemplo n.º 6
0
        //Should Be error
        //Invoice Save
        private void InvoiceSpritButtonSaveClick(object sender, System.Windows.RoutedEventArgs e)
        {
            this.InvoiceButtonSaveAndPrint.IsEnabled = false;
            DataSetPetunia commonDataUse = new DataSetPetunia();
            try
            {
                if (GridViewInvoice.Count > 0)
                {
                    double paymentAmount = new NecessaryFunction().ComaSpriter(this.InvoiceNumberBoxPaidAmount.Text);
                    string creditAmount = this.InvoieLabelCreditAmount.Text;
                    MessageBoxResult messageBoxResult = Microsoft.Windows.Controls.MessageBox.Show(Variables.ERROR_MESSAGES[1, 14], Variables.ERROR_MESSAGES[0, 0], MessageBoxButton.YesNo, MessageBoxImage.Question);
                    Mouse.OverrideCursor = Cursors.Wait;
                    if (messageBoxResult.Equals(MessageBoxResult.Yes))
                    {
                            foreach (InvoiceItems tempInvoiceItem in GridViewInvoice)
                            {
                                commonDataUse.PetuniaCommonUse.Rows.Add(tempInvoiceItem.ProductID, new PetuniaNecessaryFunction().DateFromRadDatePicker(this.InvoiceDateTimePicker), tempInvoiceItem.Quantity, tempInvoiceItem.Rate, tempInvoiceItem.Amount, "NONE", this.InvoiceTextBoxIssueName.Text, invoiceNumber, paymentAmount, this.InvoiceComboBoxDebtorName.Text, creditAmount);
                                paymentAmount = 0;
                                creditAmount = "0";
                                if (this.InvoiceRadioButtonCash.IsChecked.Equals(true))
                                {
                                    if (new AccountClass().Sales(commonDataUse.PetuniaCommonUse, TransactionType.Cash, new DBQueres(new MySqlNaceassaryElement().DatabaseOperation), new DatabaseRead(new MySqlNaceassaryElement().DataReader)))
                                    {
                                       throw new SuccessfullException(Variables.ERROR_MESSAGES[0, 11]);
                                    }
                                    else
                                    {
                                        throw new PetuniaException(Variables.ERROR_MESSAGES[0, 3]);
                                    }
                                }
                                else if (this.InvoiceRadioButtonDebtor.IsChecked.Equals(true))
                                {
                                    if (this.InvoiceComboBoxDebtorName.Text != string.Empty && this.InvoiceNumberBoxPaidAmount.Text != string.Empty && this.InvoieLabelCreditAmount.Text != string.Empty && Convert.ToDouble(this.InvoieLabelCreditAmount.Text) >= 0)
                                    {
                                        if (new AccountClass().Sales(commonDataUse.PetuniaCommonUse, TransactionType.Credit, new DBQueres(new MySqlNaceassaryElement().DatabaseOperation), new DatabaseRead(new MySqlNaceassaryElement().DataReader)))
                                        {
                                            throw new SuccessfullException(Variables.ERROR_MESSAGES[0, 11]);
                                        }
                                        else
                                        {
                                            throw new PetuniaException(Variables.ERROR_MESSAGES[0, 3]);
                                        }
                                    }
                                    else
                                    {
                                        throw new PetuniaException(Variables.ERROR_MESSAGES[0, 5]);
                                    }
                                }
                                else if (this.InvoiceRadioButtonCheck.IsChecked.Equals(true))
                                {
                                    if (new AccountClass().Sales(commonDataUse.PetuniaCommonUse, TransactionType.check, new DBQueres(new MySqlNaceassaryElement().DatabaseOperation), new DatabaseRead(new MySqlNaceassaryElement().DataReader)))
                                    {
                                        throw new SuccessfullException(Variables.ERROR_MESSAGES[0, 11]);
                                    }
                                    else
                                    {
                                        throw new PetuniaException(Variables.ERROR_MESSAGES[0, 3]);
                                    }
                                }
                                else
                                {
                                    throw new PetuniaException(Variables.ERROR_MESSAGES[0, 13]);
                                }
                            }
                    }
                }

                else
                {
                    throw new PetuniaException(Variables.ERROR_MESSAGES[0, 14]);
                }
            }
            catch (SuccessfullException success)
            {
                GridViewInvoice.Clear();
                Mouse.OverrideCursor = null;
                Microsoft.Windows.Controls.MessageBox.Show(success.Message, Variables.ERROR_MESSAGES[0, 0], MessageBoxButton.OK, MessageBoxImage.Information);
            }
            catch (Exception error)
            {
                Mouse.OverrideCursor = null;
                Microsoft.Windows.Controls.MessageBox.Show(error.Message, Variables.ERROR_MESSAGES[0, 0], MessageBoxButton.OK, MessageBoxImage.Stop);
            }
            finally
            {
                Mouse.OverrideCursor = null;
                this.InvoiceButtonSaveAndPrint.IsEnabled = true;
                commonDataUse.Dispose();
            }
        }