Пример #1
0
        /// <summary>
        /// Initialize Data
        /// </summary>
        /// <param name="transaction"></param>
        public void InitializeData(out TransactionalInformation transaction)
        {
            transaction = new TransactionalInformation();

            Customer customer = new Customer();

            try
            {
                _customerDataService.CreateSession();
                _customerDataService.BeginTransaction();
                _customerDataService.InitializeData();
                _customerDataService.CommitTransaction(true);
                _customerDataService.CloseSession();

                _customerDataService.CreateSession();
                _customerDataService.BeginTransaction();
                _customerDataService.LoadData();
                _customerDataService.CommitTransaction(true);
                _customerDataService.CloseSession();

                transaction.ReturnStatus = true;
            }
            catch (Exception ex)
            {
                string errorMessage = ex.Message;
                transaction.ReturnMessage.Add(errorMessage);
                transaction.ReturnStatus = false;
            }
            finally
            {
                _customerDataService.CloseSession();
            }
        }