Exemplo n.º 1
0
        private void inicio(bool flag)
        {
            try
            {
                tspMenuSuperior.Enabled = true;
                cLog cl = new cLog();
                ds = cl.retorna_log(flag);

                if (ds.Tables["Log"].Rows.Count == 0)
                {
                    limpa();
                    return;
                }

                #region DATASET
                txtID.DataBindings.Clear();
                txtForm.DataBindings.Clear();
                txtEvento.DataBindings.Clear();
                txtData.DataBindings.Clear();
                txtUsuarioSistema.DataBindings.Clear();
                txtUsuarioRede.DataBindings.Clear();
                txtTerminal.DataBindings.Clear();
                txtLog.DataBindings.Clear();

                txtID.DataBindings.Add("Text", ds, "Log.ID_LOG");
                txtForm.DataBindings.Add("Text", ds, "Log.FORM");
                txtEvento.DataBindings.Add("Text", ds, "Log.METODO");
                txtData.DataBindings.Add("Text", ds, "Log.DT");
                txtUsuarioSistema.DataBindings.Add("Text", ds, "Log.USER_SISTEMA");
                txtUsuarioRede.DataBindings.Add("Text", ds, "Log.USER_REDE");
                txtTerminal.DataBindings.Add("Text", ds, "Log.TERMINAL");
                txtLog.DataBindings.Add("Text", ds, "Log.LOG");

                //tslblStatus.Text = string.Concat(BindingContext[ds, "Log"].Position + 1, "/", BindingContext[ds, "Log"].Count);
                BindingContext[ds, "Log"].Position = BindingContext[ds, "Log"].Count - 1;
                tslblStatus.Text = string.Concat(BindingContext[ds, "Log"].Count, "/", BindingContext[ds, "Log"].Count);
                #endregion
            }
            catch (Exception ex)
            {
                #region LOG ERRO
                cLog lg = new cLog();
                lg.log         = ex.Message.Replace("'", "");
                lg.form        = this.Text;
                lg.metodo      = "inicio";
                lg.dt          = DateTime.Now;
                lg.usersistema = cGlobal.userlogado;
                lg.userRede    = Environment.UserName;
                lg.terminal    = Environment.MachineName;
                lg.tp_flag     = false;
                lg.grava_log(lg);
                #endregion
            }
        }