/// <summary>
        /// Handles the RowEditing event of the m_AvailableGridView control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="GridViewEditEventArgs" /> instance containing the event data.</param>
        protected void m_AvailableGridView_RowEditing(object sender, GridViewEditEventArgs e)
        {
            SPGridView _sender = sender as SPGridView;

            if (_sender == null)
            {
                return;
            }
            if (!_sender.FilterFieldValue.IsNullOrEmpty())
            {
                e.Cancel = true;
                string _msg = "SplittingEntryIsNotSupportedWhenFiltering".GetLocalizedString();
                m_AvailablePanel.Controls.Add(ControlExtensions.CreateMessage(_msg));
                return;
            }
            Label _idLabel = (Label)_sender.Rows[e.NewEditIndex].FindControlRecursive(m_IDItemLabel);

            if (Selection.SelectionTableRow.IsDisposal(_idLabel.Text))
            {
                e.Cancel = true;
                string _msg = "SplittingTheItemForTheSelectedGoodsGroupIsNotAllowed".GetLocalizedString();
                m_AvailablePanel.Controls.Add(ControlExtensions.CreateMessage(_msg));
                return;
            }
            _sender.EditIndex = e.NewEditIndex; //NewEditIndex is index of the selected item in filtering mode, but unfortunately entering editing mode the filter is not active.
            m_AvailableGridViewSkipBinding = true;
        }
        private GenericStateMachineEngine.ActionResult Export()
        {
            TraceEvent("Entering ExportWebPartUserControl.Export", 578, TraceSeverity.Monitorable);
            foreach (InvoiceContent item in m_ControlState.Invoice.InvoiceContent(m_DataContextManagement.DataContext))
            {
                //TODO ExportIsPossible - improve for many invoice content with the same FG batch groups by batch must be checked against possible export
                string _checkResult = item.ExportIsPossible(m_DataContextManagement.DataContext, item.Quantity);
                if (_checkResult.IsNullOrEmpty())
                {
                    TraceEvent(String.Format("Checked Item {0}", item.Title), 585, TraceSeverity.Verbose);
                    continue;
                }
                Controls.Add(ControlExtensions.CreateMessage(_checkResult));
                m_ControlState.InvoiceContent = item;
                string _ms = "CannotProceedWithExportBecauseTheInvoiceItemContainsErrors".GetLocalizedString();
                _ms = String.Format(_ms, item.Title);
                TraceEvent(_ms, 592, TraceSeverity.Verbose);
                return(GenericStateMachineEngine.ActionResult.NotValidated(_ms));
            }
            m_ControlState.Invoice.InvoiceLibraryStatus = true;
            Clearence _newClearance       = Clearence.CreateClearance(m_DataContextManagement.DataContext, "FinishedGoodsExport", ClearenceProcedure._3151, (x, y, z) => TraceEvent(x, y, z));
            string    _masterDocumentName = _newClearance.FinishedGoodsExportFormFileName(m_DataContextManagement.DataContext);

            TraceEvent(String.Format("ExportWebPartUserControl.Export - generated document name: {0}", _masterDocumentName), 578, TraceSeverity.Verbose);
            CigaretteExportFormCollection _cefc = FinishedGoodsFormFactory.GetFormContent
                                                      (m_DataContextManagement.DataContext, m_ControlState.Invoice, _newClearance, _masterDocumentName, _newClearance.SADDocumentNumber, (x, y, z) => TraceEvent(x, y, z));

            TraceEvent(String.Format("ExportWebPartUserControl.Export - at SPDocumentFactory.Prepare", _masterDocumentName), 578, TraceSeverity.Verbose);
            int            _sadConsignmentIdentifier = SPDocumentFactory.Prepare(SPContext.Current.Web, _cefc, _masterDocumentName, (x, y, z) => TraceEvent(x, y, z));
            SADConsignment _sadConsignment           = Element.GetAtIndex <SADConsignment>(m_DataContextManagement.DataContext.SADConsignment, _sadConsignmentIdentifier);

            _newClearance.SADConsignmentLibraryIndex = _sadConsignment;
            TraceEvent("ExportWebPartUserControl.Export at SubmitChanges", 605, TraceSeverity.Verbose);
            m_DataContextManagement.DataContext.SubmitChanges();
            TraceEvent("Finished ExportWebPartUserControl.Export", 607, TraceSeverity.Verbose);
            return(GenericStateMachineEngine.ActionResult.Success);
        }
 protected override void ShowActionResult(GenericStateMachineEngine.ActionResult _rslt)
 {
     Parent.Controls.Add(ControlExtensions.CreateMessage(_rslt.ActionException.Message));
     base.ShowActionResult(_rslt);
 }
 private void ShowActionResult(GenericStateMachineEngine.ActionResult _rslt)
 {
     Controls.Add(ControlExtensions.CreateMessage(_rslt.ActionException.Message));
 }