Exemple #1
0
        public void ShowTransactionByShortcut(string _traShortcut)
        {
            ITSTransaction tra;

            Trace("Creating transaction by shortcut " + _traShortcut);
            try
            {
                using (var ctx = new GenericContextIts <TransactionInfo>(AppConfigManager.Configuration.ConnectionString))
                {
                    TransactionInfo traInfo = ctx.Dao.Where(t => t.TransactionShortcut == _traShortcut).FirstOrDefault();
                    if (traInfo != null)
                    {
                        tra = ((ITSTransaction)Activator.CreateInstance(Type.GetType(traInfo.TransactionType)));
                        tra._transactionInfo = traInfo;

                        InternalShowTransaction(tra, traInfo);
                    }
                }
            }
            catch (Exception ex)
            {
                Trace(string.Format("ITSApplication.ShowTransactionByShortcut: '{0}' StackTrace: '{1}'", ex.Message, ex.StackTrace));
                LoggerUtilIts.WriteOnEventViewer(ex.Message, ex.StackTrace);
                XMessageIts.Mensagem(string.Format("Não foi encontrada uma transação com o atalho '{0}'", _traShortcut));
            }
        }
Exemple #2
0
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            var grupoSelect = cbGrupoEvento.SelectedItem as GrupoEvento;

            if (grupoSelect != null)
            {
                var dtPeriodo = (cbPeriodo.SelectedItem as CalendarMonth).DateTime;
                dtPeriodo = DataUtil.GetDataFinalDoMes(dtPeriodo);

                Task <bool> myTask = new Task <bool>(
                    () => new FolhaDaoManager()
                    .ExecutaCalculoFolha(dtPeriodo, userLogado, IndexTipoFechamento(),
                                         grupoSelect, chkConsGrpFunc.Checked, new System.Threading.CancellationTokenSource()));


                var tempo = TaskWatch.StartTaskWatch(myTask);

                var message = "Geração da folha de pagamento. -> " + DateTime.Now +
                              "\n Tempo gasto: 0" + tempo.Hours + ":0" + tempo.Minutes + ":" + tempo.Seconds + ":" + tempo.Milliseconds;

                LoggerUtilIts.WriteOnEventViewer(message);

                if (myTask.Result)
                {
                    XMessageIts.Mensagem("Competencia criada com sucesso");
                    this.Dispose();
                }
            }
            else
            {
                XMessageIts.Advertencia("Selecione um grupo de eventos para efetuar o cálculo da folha.");
            }
        }
Exemple #3
0
        private void InternalShowTransaction(IITSTransaction _itsTransaction, TransactionInfo transactionInfo = null)
        {
            try
            {
                Trace("Creating transaction " + _itsTransaction.GetTransactionText());
                _itsTransaction.ITSTools = this.ITSTools;
                if (_ancestorDesktop.IsMdiContainer)
                {
                    _itsTransaction.MdiParent = (Form)_ancestorDesktop;
                    if (transactionInfo != null)
                    {
                        _itsTransaction.TransactionInfo = transactionInfo;
                    }

                    Trace("Create succesful!");
                    _itsTransaction.Show();
                }
                else
                {
                    _itsTransaction.ShowDialog();
                }
            }
            catch (Exception ex)
            {
                Trace(string.Format("ITSApplication.ShowTransaction: '{0}' StackTrace: '{1}'", ex.Message, ex.StackTrace));
                LoggerUtilIts.WriteOnEventViewer(ex.Message, ex.StackTrace);
                XMessageIts.Mensagem(string.Format("Transação não encontrada!"));
            }
        }