Пример #1
0
        private void SaveRecord()
        {
            long lProductGroupID    = Convert.ToInt64(cboProductGroup.SelectedItem.Value);
            long lProductSubGroupID = Convert.ToInt64(cboProductSubGroup.SelectedItem.Value);
            long lProductID         = Convert.ToInt64(cboProduct.SelectedItem.Value);

            int iChartOfAccountIDPurchase    = Convert.ToInt32(cboChartOfAccountPurchase.SelectedItem.Value);
            int iChartOfAccountIDSold        = Convert.ToInt32(cboChartOfAccountSold.SelectedItem.Value);
            int iChartOfAccountIDInventory   = Convert.ToInt32(cboChartOfAccountInventory.SelectedItem.Value);
            int iChartOfAccountIDTaxPurchase = Convert.ToInt32(cboChartOfAccountIDTaxPurchase.SelectedItem.Value);
            int iChartOfAccountIDTaxSold     = Convert.ToInt32(cboChartOfAccountIDTaxSold.SelectedItem.Value);

            ProductGroup clsProductGroup = new ProductGroup();

            clsProductGroup.GetConnection();
            ProductSubGroup clsProductSubGroup = new ProductSubGroup(clsProductGroup.Connection, clsProductGroup.Transaction);
            Products        clsProduct         = new Products(clsProductGroup.Connection, clsProductGroup.Transaction);

            if (lProductGroupID == 0)
            {
                clsProductGroup.UpdateFinancialInformation(iChartOfAccountIDPurchase, iChartOfAccountIDSold, iChartOfAccountIDInventory, iChartOfAccountIDTaxPurchase, iChartOfAccountIDTaxSold);
                if (lProductSubGroupID == 0)
                {
                    clsProductSubGroup.UpdateFinancialInformation(iChartOfAccountIDPurchase, iChartOfAccountIDSold, iChartOfAccountIDInventory, iChartOfAccountIDTaxPurchase, iChartOfAccountIDTaxSold);
                    if (lProductID == 0)
                    {
                        clsProduct.UpdateFinancialInformation(iChartOfAccountIDPurchase, iChartOfAccountIDSold, iChartOfAccountIDInventory, iChartOfAccountIDTaxPurchase, iChartOfAccountIDTaxSold);
                    }
                    else
                    {
                        clsProduct.UpdateFinancialInformation(lProductID, iChartOfAccountIDPurchase, iChartOfAccountIDSold, iChartOfAccountIDInventory, iChartOfAccountIDTaxPurchase, iChartOfAccountIDTaxSold);
                    }
                }
                else if (lProductSubGroupID > 0)
                {
                    clsProductSubGroup.UpdateFinancialInformation(lProductSubGroupID, iChartOfAccountIDPurchase, iChartOfAccountIDSold, iChartOfAccountIDInventory, iChartOfAccountIDTaxPurchase, iChartOfAccountIDTaxSold);
                    if (lProductID == 0)
                    {
                        clsProduct.UpdateFinancialInformationBySubGroup(lProductSubGroupID, iChartOfAccountIDPurchase, iChartOfAccountIDSold, iChartOfAccountIDInventory, iChartOfAccountIDTaxPurchase, iChartOfAccountIDTaxSold);
                    }
                    else
                    {
                        clsProduct.UpdateFinancialInformation(lProductID, iChartOfAccountIDPurchase, iChartOfAccountIDSold, iChartOfAccountIDInventory, iChartOfAccountIDTaxPurchase, iChartOfAccountIDTaxSold);
                    }
                }
            }
            else
            {
                clsProductGroup.UpdateFinancialInformation(lProductGroupID, iChartOfAccountIDPurchase, iChartOfAccountIDSold, iChartOfAccountIDInventory, iChartOfAccountIDTaxPurchase, iChartOfAccountIDTaxSold);
                if (lProductSubGroupID == 0)
                {
                    clsProductSubGroup.UpdateFinancialInformationByGroup(lProductGroupID, iChartOfAccountIDPurchase, iChartOfAccountIDSold, iChartOfAccountIDInventory, iChartOfAccountIDTaxPurchase, iChartOfAccountIDTaxSold);
                    if (lProductID == 0)
                    {
                        clsProduct.UpdateFinancialInformationByGroup(lProductGroupID, iChartOfAccountIDPurchase, iChartOfAccountIDSold, iChartOfAccountIDInventory, iChartOfAccountIDTaxPurchase, iChartOfAccountIDTaxSold);
                    }
                    else
                    {
                        clsProduct.UpdateFinancialInformation(lProductID, iChartOfAccountIDPurchase, iChartOfAccountIDSold, iChartOfAccountIDInventory, iChartOfAccountIDTaxPurchase, iChartOfAccountIDTaxSold);
                    }
                }
                else if (lProductSubGroupID > 0)
                {
                    clsProductSubGroup.UpdateFinancialInformation(lProductSubGroupID, iChartOfAccountIDPurchase, iChartOfAccountIDSold, iChartOfAccountIDInventory, iChartOfAccountIDTaxPurchase, iChartOfAccountIDTaxSold);
                    if (lProductID == 0)
                    {
                        clsProduct.UpdateFinancialInformationBySubGroup(lProductSubGroupID, iChartOfAccountIDPurchase, iChartOfAccountIDSold, iChartOfAccountIDInventory, iChartOfAccountIDTaxPurchase, iChartOfAccountIDTaxSold);
                    }
                    else
                    {
                        clsProduct.UpdateFinancialInformation(lProductID, iChartOfAccountIDPurchase, iChartOfAccountIDSold, iChartOfAccountIDInventory, iChartOfAccountIDTaxPurchase, iChartOfAccountIDTaxSold);
                    }
                }
            }

            clsProductGroup.CommitAndDispose();
        }