Пример #1
0
 private void ScanBarcode()
 {
     if (txtbarcode.Text != string.Empty)
     {
         int             orderid = Convert.ToInt16(txtorderid.Text);
         ProductReleases pr      = new ProductReleases();
         pr = _release.ProductReleaseFind(orderid, txtbarcode.Text);
         if (pr != null)
         {
             lblPcode.Text = pr.productcode;
             lblPid.Text   = pr.product_id.ToString();
             lblPname.Text = pr.ProductName;
             txtqty.Text   = pr.QTY.ToString();
             if (_release.isItemExists(orderid, pr.sales_detail_id) == false)
             {
                 ReleaseItem(pr);
             }
             else
             {
                 MessageBox.Show("Item already released");
             }
         }
         else
         {
             MessageBox.Show("Item not found");
         }
     }
     txtbarcode.Text = string.Empty;
     txtqty.Text     = string.Empty;
     LoadProducts();
 }
Пример #2
0
        private void ReleaseItem(ProductReleases pr)
        {
            bool result = _release.ProductRelease(pr.sales_detail_id, pr.product_id.Value, pr.QTY.Value, true);

            if (result == true)
            {
                int qtys = Convert.ToInt16(txtqty.Text);
                _release.ReleaseItemInsert(pr.sales_detail_id, pr.sales_id.Value, qtys);
                loadReleasedLists();
            }
        }
Пример #3
0
        public ProductReleases ProductReleaseFind(int salesid, string barcode)
        {
            trn_transactionsales_product_details_Result trx = pEntity.trn_transactionsales_product_details(salesid, barcode).FirstOrDefault();
            ProductReleases result = new ProductReleases();

            if (trx != null)
            {
                result.Barcode         = trx.Barcode;
                result.productcode     = trx.productcode;
                result.ProductName     = trx.ProductName;
                result.product_id      = trx.product_id;
                result.QTY             = trx.QTY;
                result.TotalAmount     = trx.TotalAmount;
                result.sales_detail_id = trx.sales_detail_id;
                result.sales_id        = trx.sales_id;
            }
            else
            {
                result = null;
            }
            return(result);
        }
Пример #4
0
        public List <ProductReleases> ProductReleaseSelect(int salesid)
        {
            var                    trxn    = pEntity.trn_transactionsales_product_details_select(salesid);
            ProductReleases        result  = new ProductReleases();
            List <ProductReleases> result2 = new List <ProductReleases>();

            foreach (trn_transactionsales_product_details_select_Result trx in trxn)
            {
                result.Barcode         = trx.Barcode;
                result.productcode     = trx.productcode;
                result.ProductName     = trx.ProductName;
                result.product_id      = trx.product_id;
                result.QTY             = trx.QTY;
                result.RetailPrice     = trx.RetailPrice;
                result.TotalAmount     = trx.TotalAmount;
                result.isCheckedout    = trx.isCheckedout;
                result.sales_detail_id = trx.sales_detail_id;
                result.sales_id        = trx.sales_id;
                result2.Add(result);
            }
            return(result2);
        }
        /// <summary>
        /// Update the target database to the latest version of the product.
        /// </summary>
        /// <returns>True if the Update was from a "clean" install.</returns>
        private bool Update()
        {
            // Get the currently installed version of the product.
            var currentVersion = GetCurrentlyInstalledVersion(Context.TargetDatabaseConnectionString);

            // Log some Information
            _log.Info("Current Version: " + currentVersion);
            _log.Info("Target Version: " + ProductVersion);

            // Figure out what is going on.
            var isNewInstall     = currentVersion == new Version(0, 0, 0, 0);
            var isCurrentVersion = ProductVersion == currentVersion;
            var isNewerVersion   = currentVersion > ProductVersion;

            // Just in Case
            if (isNewerVersion)
            {
                throw new Exception("The version of the system (" + currentVersion + ") is newer than this installation (" + ProductVersion +
                                    ").  Please contact your system administrator.");
            }

            // Gather any Releases that have not been applied yet.
            var pendingUpdates = ProductReleases
                                 .Where(x => x.Version > currentVersion)
                                 .ToList();

            #region Inform the User

            // Log some Information
            if (isNewInstall)
            {
                _log.Info("Beginning new product installation.");
            }
            else
            {
                // We ain't illiterate...
                switch (pendingUpdates.Count)
                {
                case 0:
                    // We are running against a server that is already on the latest product version.
                    _log.Info("Current version is already installed.");
                    break;

                case 1:
                    _log.Info("There is one pending update to apply.");
                    break;

                default:
                    _log.Info("There are " + pendingUpdates.Count + " pending updates to apply.");
                    break;
                }
            }

            #endregion

            // Execute any PreUpdate Logic
            PreUpdate(pendingUpdates);

            // If We are Installing the Same Version over an existing Installation
            // allow any pending migrations within that version to be applied.
            if (isCurrentVersion && !pendingUpdates.Any())
            {
                // Let the user know we will attempt to apply any outstanding schema migrations
                // within the current product version.
                _log.Info("Checking for pending version migrations...");

                // Add the latest release to the empty list of pending updates.
                pendingUpdates.Add(ProductReleases.First(x => x.Version == ProductVersion));
            }

            // Apply the pending releases in version order.
            foreach (var update in pendingUpdates.OrderBy(x => x.Version))
            {
                update.Apply();
            }

            // Execute any PostUpdate Logic
            PostUpdate(isNewInstall);

            // Return true if the original version was 0.
            return(isNewInstall);
        }