Exemple #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);
            }
        }
Exemple #2
0
        public MatrixPackageDetails DetailsByMatrixID(Int64 MatrixID)
        {
            try
            {
                string SQL = SQLSelect() + "WHERE 1=1 AND a.MatrixID = @MatrixID LIMIT 1;";



                MySqlCommand cmd = new MySqlCommand();


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

                MySqlParameter prmMatrixID = new MySqlParameter("@MatrixID", MySqlDbType.Int64);
                prmMatrixID.Value = MatrixID;
                cmd.Parameters.Add(prmMatrixID);

                MySqlDataReader myReader = base.ExecuteReader(cmd, System.Data.CommandBehavior.SingleResult);

                MatrixPackageDetails clsDetails = new MatrixPackageDetails();;

                while (myReader.Read())
                {
                    clsDetails.PackageID     = myReader.GetInt64("PackageID");
                    clsDetails.MatrixID      = myReader.GetInt64("MatrixID");
                    clsDetails.UnitID        = myReader.GetInt32("UnitID");
                    clsDetails.UnitCode      = "" + myReader["UnitCode"].ToString();
                    clsDetails.UnitName      = "" + myReader["UnitName"].ToString();
                    clsDetails.Price         = myReader.GetDecimal("Price");
                    clsDetails.WSPrice       = myReader.GetDecimal("WSPrice");
                    clsDetails.PurchasePrice = myReader.GetDecimal("PurchasePrice");
                    clsDetails.Quantity      = myReader.GetDecimal("Quantity");
                    clsDetails.VAT           = myReader.GetDecimal("VAT");
                    clsDetails.EVAT          = myReader.GetDecimal("EVAT");
                    clsDetails.LocalTax      = myReader.GetDecimal("LocalTax");
                }

                myReader.Close();

                return(clsDetails);
            }

            catch (Exception ex)
            {
                {
                }

                throw base.ThrowException(ex);
            }
        }
Exemple #3
0
        public void UpdateByMatrixIDUnitIDAndQuantity(MatrixPackageDetails Details, long pvtUID, DateTime pvtChangeDate, string pvtHistoryRemarks)
        {
            try
            {
                string SQL = "SELECT PackageID FROM tblMatrixPackage WHERE MatrixID = @MatrixID " +
                             "AND UnitID		=	@UnitID "+
                             "AND Quantity	=	@Quantity;";



                MySqlCommand cmd = new MySqlCommand();


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

                cmd.Parameters.AddWithValue("@MatrixID", Details.MatrixID);
                cmd.Parameters.AddWithValue("@UnitID", Details.MatrixID);
                cmd.Parameters.AddWithValue("@Quantity", Details.Quantity);

                MySqlDataReader myReader = base.ExecuteReader(cmd, System.Data.CommandBehavior.SingleResult);

                while (myReader.Read())
                {
                    Details.PackageID = myReader.GetInt64("PackageID");
                }

                myReader.Close();

                Update(Details, pvtUID, pvtChangeDate, pvtHistoryRemarks);
            }

            catch (Exception ex)
            {
                {
                }

                throw base.ThrowException(ex);
            }
        }
Exemple #4
0
        public MatrixPackageDetails DetailsByMatrixID(Int64 MatrixID)
        {
            try
            {
                string SQL = SQLSelect() + "WHERE 1=1 AND a.MatrixID = @MatrixID LIMIT 1;";



                MySqlCommand cmd = new MySqlCommand();


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

                MySqlParameter prmMatrixID = new MySqlParameter("@MatrixID", MySqlDbType.Int64);
                prmMatrixID.Value = MatrixID;
                cmd.Parameters.Add(prmMatrixID);

                MySqlDataReader myReader = base.ExecuteReader(cmd, System.Data.CommandBehavior.SingleResult);

                MatrixPackageDetails clsDetails = new MatrixPackageDetails(); ;

                while (myReader.Read())
                {
                    clsDetails.PackageID = myReader.GetInt64("PackageID");
                    clsDetails.MatrixID = myReader.GetInt64("MatrixID");
                    clsDetails.UnitID = myReader.GetInt32("UnitID");
                    clsDetails.UnitCode = "" + myReader["UnitCode"].ToString();
                    clsDetails.UnitName = "" + myReader["UnitName"].ToString();
                    clsDetails.Price = myReader.GetDecimal("Price");
                    clsDetails.WSPrice = myReader.GetDecimal("WSPrice");
                    clsDetails.PurchasePrice = myReader.GetDecimal("PurchasePrice");
                    clsDetails.Quantity = myReader.GetDecimal("Quantity");
                    clsDetails.VAT = myReader.GetDecimal("VAT");
                    clsDetails.EVAT = myReader.GetDecimal("EVAT");
                    clsDetails.LocalTax = myReader.GetDecimal("LocalTax");
                }

                myReader.Close();

                return clsDetails;
            }

            catch (Exception ex)
            {


                {




                }

                throw base.ThrowException(ex);
            }
        }
Exemple #5
0
        public void UpdateByMatrixIDUnitIDAndQuantity(MatrixPackageDetails Details, long pvtUID, DateTime pvtChangeDate, string pvtHistoryRemarks)
        {
            try
            {
                string SQL = "SELECT PackageID FROM tblMatrixPackage WHERE MatrixID = @MatrixID " +
                                "AND UnitID		=	@UnitID " +
                                "AND Quantity	=	@Quantity;";



                MySqlCommand cmd = new MySqlCommand();


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

                cmd.Parameters.AddWithValue("@MatrixID", Details.MatrixID);
                cmd.Parameters.AddWithValue("@UnitID", Details.MatrixID);
                cmd.Parameters.AddWithValue("@Quantity", Details.Quantity);

                MySqlDataReader myReader = base.ExecuteReader(cmd, System.Data.CommandBehavior.SingleResult);

                while (myReader.Read())
                { Details.PackageID = myReader.GetInt64("PackageID"); }

                myReader.Close();

                Update(Details, pvtUID, pvtChangeDate, pvtHistoryRemarks);
            }

            catch (Exception ex)
            {


                {




                }

                throw base.ThrowException(ex);
            }
        }
Exemple #6
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);
            }
        }
Exemple #7
0
        public void Insert(MatrixPackageDetails Details)
        {
            try
            {
                string SQL = "INSERT INTO tblMatrixPackage (" +
                                "MatrixID, " +
                                "UnitID, " +
                                "Price, " +
                                "WSPrice, " +
                                "PurchasePrice, " +
                                "Quantity, " +
                                "VAT, " +
                                "EVAT, " +
                                "LocalTax" +
                            ") VALUES (" +
                                "@MatrixID, " +
                                "@UnitID, " +
                                "@Price, " +
                                "@WSPrice, " +
                                "@PurchasePrice, " +
                                "@Quantity, " +
                                "@VAT, " +
                                "@EVAT, " +
                                "@LocalTax" +
                            ");";



                MySqlCommand cmd = new MySqlCommand();


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

                MySqlParameter prmMatrixID = new MySqlParameter("@MatrixID", MySqlDbType.Int64);
                prmMatrixID.Value = Details.MatrixID;
                cmd.Parameters.Add(prmMatrixID);

                MySqlParameter prmUnitID = new MySqlParameter("@UnitID", MySqlDbType.Int32);
                prmUnitID.Value = Details.UnitID;
                cmd.Parameters.Add(prmUnitID);

                cmd.Parameters.AddWithValue("@Price", Details.Price);
                cmd.Parameters.AddWithValue("@WSPrice", Details.WSPrice);
                cmd.Parameters.AddWithValue("@PurchasePrice", Details.PurchasePrice);

                MySqlParameter prmQuantity = new MySqlParameter("@Quantity", MySqlDbType.Decimal);
                prmQuantity.Value = Details.Quantity;
                cmd.Parameters.Add(prmQuantity);

                MySqlParameter prmVAT = new MySqlParameter("@VAT", MySqlDbType.Decimal);
                prmVAT.Value = Details.VAT;
                cmd.Parameters.Add(prmVAT);

                MySqlParameter prmEVAT = new MySqlParameter("@EVAT", MySqlDbType.Decimal);
                prmEVAT.Value = Details.EVAT;
                cmd.Parameters.Add(prmEVAT);

                MySqlParameter prmLocalTax = new MySqlParameter("@LocalTax", MySqlDbType.Decimal);
                prmLocalTax.Value = Details.LocalTax;
                cmd.Parameters.Add(prmLocalTax);

                base.ExecuteNonQuery(cmd);
            }

            catch (Exception ex)
            {


                {




                }

                throw base.ThrowException(ex);
            }
        }
Exemple #8
0
		private bool SaveRecord()
		{
			MatrixPackageDetails clsDetails = new MatrixPackageDetails();
			
			clsDetails.MatrixID = Convert.ToInt64(lblMatrixID.Text);
			clsDetails.UnitID = Convert.ToInt32(cboUnit.SelectedItem.Value);
			clsDetails.Price = Convert.ToDecimal(txtProductPrice.Text);
			clsDetails.PurchasePrice = Convert.ToDecimal(txtPurchasePrice.Text);
			clsDetails.Quantity = Convert.ToDecimal(txtQuantity.Text);
			clsDetails.VAT = Convert.ToDecimal(txtVAT.Text);
			clsDetails.EVAT = Convert.ToDecimal(txtEVAT.Text);
			clsDetails.LocalTax = Convert.ToDecimal(txtLocalTax.Text);
			
			MatrixPackage clsMatrixPackage = new MatrixPackage();
			clsMatrixPackage.Insert(clsDetails);

			clsMatrixPackage.CommitAndDispose();

			return true;
		}
Exemple #9
0
        public void Insert(MatrixPackageDetails Details)
        {
            try
            {
                string SQL = "INSERT INTO tblMatrixPackage (" +
                             "MatrixID, " +
                             "UnitID, " +
                             "Price, " +
                             "WSPrice, " +
                             "PurchasePrice, " +
                             "Quantity, " +
                             "VAT, " +
                             "EVAT, " +
                             "LocalTax" +
                             ") VALUES (" +
                             "@MatrixID, " +
                             "@UnitID, " +
                             "@Price, " +
                             "@WSPrice, " +
                             "@PurchasePrice, " +
                             "@Quantity, " +
                             "@VAT, " +
                             "@EVAT, " +
                             "@LocalTax" +
                             ");";



                MySqlCommand cmd = new MySqlCommand();


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

                MySqlParameter prmMatrixID = new MySqlParameter("@MatrixID", MySqlDbType.Int64);
                prmMatrixID.Value = Details.MatrixID;
                cmd.Parameters.Add(prmMatrixID);

                MySqlParameter prmUnitID = new MySqlParameter("@UnitID", MySqlDbType.Int32);
                prmUnitID.Value = Details.UnitID;
                cmd.Parameters.Add(prmUnitID);

                cmd.Parameters.AddWithValue("@Price", Details.Price);
                cmd.Parameters.AddWithValue("@WSPrice", Details.WSPrice);
                cmd.Parameters.AddWithValue("@PurchasePrice", Details.PurchasePrice);

                MySqlParameter prmQuantity = new MySqlParameter("@Quantity", MySqlDbType.Decimal);
                prmQuantity.Value = Details.Quantity;
                cmd.Parameters.Add(prmQuantity);

                MySqlParameter prmVAT = new MySqlParameter("@VAT", MySqlDbType.Decimal);
                prmVAT.Value = Details.VAT;
                cmd.Parameters.Add(prmVAT);

                MySqlParameter prmEVAT = new MySqlParameter("@EVAT", MySqlDbType.Decimal);
                prmEVAT.Value = Details.EVAT;
                cmd.Parameters.Add(prmEVAT);

                MySqlParameter prmLocalTax = new MySqlParameter("@LocalTax", MySqlDbType.Decimal);
                prmLocalTax.Value = Details.LocalTax;
                cmd.Parameters.Add(prmLocalTax);

                base.ExecuteNonQuery(cmd);
            }

            catch (Exception ex)
            {
                {
                }

                throw base.ThrowException(ex);
            }
        }
Exemple #10
0
		private bool SaveRecord()
		{
            long lngUID = long.Parse(Session["UID"].ToString());
            DateTime dteChangeDate = DateTime.Now;

			MatrixPackage clsMatrixPackage = new MatrixPackage();
			MatrixPackageDetails clsDetails = new MatrixPackageDetails();
			
			clsDetails.PackageID = Convert.ToInt64(lblPackageID.Text);
			clsDetails.MatrixID = Convert.ToInt64(lblMatrixID.Text);
			clsDetails.UnitID = Convert.ToInt32(cboUnit.SelectedItem.Value);
			clsDetails.Price = Convert.ToDecimal(txtProductPrice.Text);
			clsDetails.PurchasePrice = Convert.ToDecimal(txtPurchasePrice.Text);
			clsDetails.Quantity = Convert.ToDecimal(txtQuantity.Text);
			clsDetails.VAT = Convert.ToDecimal(txtVAT.Text);
			clsDetails.EVAT = Convert.ToDecimal(txtEVAT.Text);
			clsDetails.LocalTax = Convert.ToDecimal(txtLocalTax.Text);

			clsMatrixPackage.Update(clsDetails, lngUID, dteChangeDate, "Matrix Package update.");
			clsMatrixPackage.CommitAndDispose();

			return true;
		}