Пример #1
0
        public void Update(MatrixPackageDetails Details, long pvtUID, DateTime pvtChangeDate, string pvtHistoryRemarks)
        {
            try
            {
                // Update MatrixPackagePriceHistory first to get the history
                MatrixPackagePriceHistoryDetails clsMatrixPackagePriceHistoryDetails = new MatrixPackagePriceHistoryDetails();
                clsMatrixPackagePriceHistoryDetails.UID           = pvtUID;
                clsMatrixPackagePriceHistoryDetails.PackageID     = Details.PackageID;
                clsMatrixPackagePriceHistoryDetails.ChangeDate    = pvtChangeDate;
                clsMatrixPackagePriceHistoryDetails.PurchasePrice = Details.PurchasePrice;
                clsMatrixPackagePriceHistoryDetails.Price         = Details.Price;
                clsMatrixPackagePriceHistoryDetails.VAT           = Details.VAT;
                clsMatrixPackagePriceHistoryDetails.EVAT          = Details.EVAT;
                clsMatrixPackagePriceHistoryDetails.LocalTax      = Details.LocalTax;
                clsMatrixPackagePriceHistoryDetails.Remarks       = pvtHistoryRemarks;

                MatrixPackagePriceHistory clsMatrixPackagePriceHistory = new MatrixPackagePriceHistory(base.Connection, base.Transaction);
                clsMatrixPackagePriceHistory.Insert(clsMatrixPackagePriceHistoryDetails);

                string SQL = "CALL procMatrixPackageUpdate(@PackageID, @MatrixID, @UnitID, @Price, @WSPrice, @PurchasePrice, @Quantity, @VAT, @EVAT, @LocalTax);";

                MySqlCommand cmd = new MySqlCommand();


                cmd.CommandType = System.Data.CommandType.Text;
                cmd.CommandText = SQL;

                cmd.Parameters.AddWithValue("@PackageID", Details.PackageID);
                cmd.Parameters.AddWithValue("@MatrixID", Details.MatrixID);
                cmd.Parameters.AddWithValue("@UnitID", Details.UnitID);
                cmd.Parameters.AddWithValue("@Price", Details.Price);
                cmd.Parameters.AddWithValue("@WSPrice", Details.WSPrice);
                cmd.Parameters.AddWithValue("@PurchasePrice", Details.PurchasePrice);
                cmd.Parameters.AddWithValue("@Quantity", Details.Quantity);
                cmd.Parameters.AddWithValue("@VAT", Details.VAT);
                cmd.Parameters.AddWithValue("@EVAT", Details.EVAT);
                cmd.Parameters.AddWithValue("@LocalTax", Details.LocalTax);

                base.ExecuteNonQuery(cmd);

                if (Details.Quantity == 1)
                {
                    ProductVariationsMatrix clsProductVariationsMatrix = new ProductVariationsMatrix(base.Connection, base.Transaction);
                    //clsProductVariationsMatrix.UpdateByPackage(Details.MatrixID, Details.UnitID, Details.Price, Details.WSPrice, Details.PurchasePrice, Details.VAT, Details.EVAT, Details.LocalTax);
                }
            }

            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
Пример #2
0
        public void Update(MatrixPackageDetails Details, long pvtUID, DateTime pvtChangeDate, string pvtHistoryRemarks)
        {
            try
            {


                // Update MatrixPackagePriceHistory first to get the history
                MatrixPackagePriceHistoryDetails clsMatrixPackagePriceHistoryDetails = new MatrixPackagePriceHistoryDetails();
                clsMatrixPackagePriceHistoryDetails.UID = pvtUID;
                clsMatrixPackagePriceHistoryDetails.PackageID = Details.PackageID;
                clsMatrixPackagePriceHistoryDetails.ChangeDate = pvtChangeDate;
                clsMatrixPackagePriceHistoryDetails.PurchasePrice = Details.PurchasePrice;
                clsMatrixPackagePriceHistoryDetails.Price = Details.Price;
                clsMatrixPackagePriceHistoryDetails.VAT = Details.VAT;
                clsMatrixPackagePriceHistoryDetails.EVAT = Details.EVAT;
                clsMatrixPackagePriceHistoryDetails.LocalTax = Details.LocalTax;
                clsMatrixPackagePriceHistoryDetails.Remarks = pvtHistoryRemarks;

                MatrixPackagePriceHistory clsMatrixPackagePriceHistory = new MatrixPackagePriceHistory(base.Connection, base.Transaction);
                clsMatrixPackagePriceHistory.Insert(clsMatrixPackagePriceHistoryDetails);

                string SQL = "CALL procMatrixPackageUpdate(@PackageID, @MatrixID, @UnitID, @Price, @WSPrice, @PurchasePrice, @Quantity, @VAT, @EVAT, @LocalTax);";

                MySqlCommand cmd = new MySqlCommand();


                cmd.CommandType = System.Data.CommandType.Text;
                cmd.CommandText = SQL;

                cmd.Parameters.AddWithValue("@PackageID", Details.PackageID);
                cmd.Parameters.AddWithValue("@MatrixID", Details.MatrixID);
                cmd.Parameters.AddWithValue("@UnitID", Details.UnitID);
                cmd.Parameters.AddWithValue("@Price", Details.Price);
                cmd.Parameters.AddWithValue("@WSPrice", Details.WSPrice);
                cmd.Parameters.AddWithValue("@PurchasePrice", Details.PurchasePrice);
                cmd.Parameters.AddWithValue("@Quantity", Details.Quantity);
                cmd.Parameters.AddWithValue("@VAT", Details.VAT);
                cmd.Parameters.AddWithValue("@EVAT", Details.EVAT);
                cmd.Parameters.AddWithValue("@LocalTax", Details.LocalTax);

                base.ExecuteNonQuery(cmd);

                if (Details.Quantity == 1)
                {
                    ProductVariationsMatrix clsProductVariationsMatrix = new ProductVariationsMatrix(base.Connection, base.Transaction);
                    //clsProductVariationsMatrix.UpdateByPackage(Details.MatrixID, Details.UnitID, Details.Price, Details.WSPrice, Details.PurchasePrice, Details.VAT, Details.EVAT, Details.LocalTax);
                }
            }

            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }