示例#1
0
        private bool SaveRecord()
        {
            ProductPackageDetails clsDetails = new ProductPackageDetails();

            clsDetails.ProductID     = Convert.ToInt64(lblProductID.Text);
            clsDetails.UnitID        = Convert.ToInt32(cboUnit.SelectedItem.Value);
            clsDetails.Price         = Convert.ToDecimal(txtProductPrice.Text);
            clsDetails.Price1        = Convert.ToDecimal(txtPrice1.Text);
            clsDetails.Price2        = Convert.ToDecimal(txtPrice2.Text);
            clsDetails.Price3        = Convert.ToDecimal(txtPrice3.Text);
            clsDetails.Price4        = Convert.ToDecimal(txtPrice4.Text);
            clsDetails.Price5        = Convert.ToDecimal(txtPrice5.Text);
            clsDetails.WSPrice       = Convert.ToDecimal(txtWSPrice.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);
            clsDetails.BarCode1      = txtBarCode1.Text;
            clsDetails.BarCode2      = txtBarCode2.Text;
            clsDetails.BarCode3      = txtBarCode3.Text;

            ProductPackage clsProductPackage = new ProductPackage();

            clsProductPackage.Insert(clsDetails);
            clsProductPackage.CommitAndDispose();

            return(true);
        }
示例#2
0
        private Int32 SaveRecord()
        {
            ProductUnitsMatrix        clsUnitMatrix = new ProductUnitsMatrix();
            ProductUnitsMatrixDetails clsDetails    = new ProductUnitsMatrixDetails();

            clsDetails.ProductID       = Convert.ToInt64(lblProductID.Text);
            clsDetails.BaseUnitID      = Convert.ToInt32(lblBaseUnitID.Text);
            clsDetails.BaseUnitValue   = Convert.ToDecimal(txtBaseUnitValue.Text);
            clsDetails.BottomUnitID    = Convert.ToInt32(cboBottomUnit.SelectedItem.Value);
            clsDetails.BottomUnitValue = Convert.ToDecimal(txtBottomUnitValue.Text);
            int id = clsUnitMatrix.Insert(clsDetails);

            ProductPackageDetails clsProductPackageDetails = new ProductPackageDetails();
            ProductPackage        clsProductPackage        = new ProductPackage(clsUnitMatrix.Connection, clsUnitMatrix.Transaction);

            clsProductPackageDetails = clsProductPackage.DetailsByProductIDAndUnitID(Convert.ToInt64(lblProductID.Text), Convert.ToInt32(cboBottomUnit.SelectedItem.Value));
            if (clsProductPackageDetails.PackageID == 0)
            {
                Products       clsProduct        = new Products(clsUnitMatrix.Connection, clsUnitMatrix.Transaction);
                ProductDetails clsProductDetails = clsProduct.Details(Convert.ToInt64(lblProductID.Text));

                Terminal        clsTerminal        = new Terminal(clsUnitMatrix.Connection, clsUnitMatrix.Transaction);
                TerminalDetails clsTerminalDetails = clsTerminal.Details(Int32.Parse(Session["BranchID"].ToString()), Session["TerminalNo"].ToString());

                clsProductPackageDetails.ProductID     = Convert.ToInt64(lblProductID.Text);
                clsProductPackageDetails.UnitID        = Convert.ToInt32(cboBottomUnit.SelectedItem.Value);
                clsProductPackageDetails.Price         = clsProductDetails.Price * Convert.ToDecimal(txtBaseUnitValue.Text);
                clsProductPackageDetails.WSPrice       = clsProductDetails.WSPrice * Convert.ToDecimal(txtBaseUnitValue.Text);
                clsProductPackageDetails.PurchasePrice = clsProductDetails.PurchasePrice * Convert.ToDecimal(txtBaseUnitValue.Text);
                clsProductPackageDetails.Quantity      = 1;
                clsProductPackageDetails.VAT           = clsTerminalDetails.VAT;
                clsProductPackageDetails.EVAT          = clsTerminalDetails.EVAT;
                clsProductPackageDetails.LocalTax      = clsTerminalDetails.LocalTax;
                if (!string.IsNullOrEmpty(clsProductDetails.BarCode1))
                {
                    clsProductPackageDetails.BarCode1 = clsProductDetails.BarCode1 + clsProductPackageDetails.UnitID.ToString() + clsProductPackageDetails.Quantity.ToString();
                }
                if (!string.IsNullOrEmpty(clsProductDetails.BarCode2))
                {
                    clsProductPackageDetails.BarCode2 = clsProductDetails.BarCode2 + clsProductPackageDetails.UnitID.ToString() + clsProductPackageDetails.Quantity.ToString();
                }
                if (!string.IsNullOrEmpty(clsProductDetails.BarCode3))
                {
                    clsProductPackageDetails.BarCode3 = clsProductDetails.BarCode3 + clsProductPackageDetails.UnitID.ToString() + clsProductPackageDetails.Quantity.ToString();
                }
                clsProductPackage.Insert(clsProductPackageDetails);
            }
            clsUnitMatrix.CommitAndDispose();

            return(id);
        }