Exemple #1
0
        public static bool ChangeStore(ClientRegistry cr, StoreSiteInfo si, Store store, AppVersion appVersion)
        {
            bool success = false;

            OracleTransaction pawnSecTransaction = null;
            OracleTransaction cdOwnerTransaction = null;

            try
            {
                int result = UpdatePawnSec(cr, si, out pawnSecTransaction);

                if (result == 0)
                {
                    pawnSecTransaction.Rollback();
                    return(false);
                }

                if (appVersion.UsesCashDrawer)
                {
                    result = UpdateCdOwner(cr, store, out cdOwnerTransaction);

                    if (result == 0)
                    {
                        cdOwnerTransaction.Rollback();
                        return(false);
                    }
                }

                pawnSecTransaction.Commit();

                if (appVersion.UsesCashDrawer)
                {
                    cdOwnerTransaction.Commit();
                }

                success = true;
            }
            catch (Exception)
            {
                if (pawnSecTransaction != null)
                {
                    pawnSecTransaction.Rollback();
                }
                if (cdOwnerTransaction != null)
                {
                    cdOwnerTransaction.Rollback();
                }
                success = false;
            }

            return(success);
        }