public static IList <NfceSuprimentoDTO> ConsultaNfceSuprimentoLista(NfceSuprimentoDTO pNfceSuprimento) { try { IList <NfceSuprimentoDTO> Resultado = null; using (ISession Session = NHibernateHelper.GetSessionFactory().OpenSession()) { NHibernateDAL <NfceSuprimentoDTO> DAL = new NHibernateDAL <NfceSuprimentoDTO>(Session); Resultado = DAL.Select(pNfceSuprimento); } return(Resultado); } catch (Exception ex) { throw new Exception(ex.Message + (ex.InnerException != null ? " " + ex.InnerException.Message : "")); } }
public static NfceSuprimentoDTO GravaNfceSuprimento(NfceSuprimentoDTO pNfceSuprimento) { try { using (ISession Session = NHibernateHelper.GetSessionFactory().OpenSession()) { NHibernateDAL <NfceSuprimentoDTO> DAL = new NHibernateDAL <NfceSuprimentoDTO>(Session); DAL.SaveOrUpdate(pNfceSuprimento); Session.Flush(); } return(pNfceSuprimento); } catch (Exception ex) { throw new Exception(ex.Message + (ex.InnerException != null ? " " + ex.InnerException.Message : "")); } }
public static NfceSuprimentoDTO ConsultaNfceSuprimento(string pFiltro) { try { NfceSuprimentoDTO Resultado = null; using (ISession Session = NHibernateHelper.GetSessionFactory().OpenSession()) { NHibernateDAL <NfceSuprimentoDTO> DAL = new NHibernateDAL <NfceSuprimentoDTO>(Session); String ConsultaSql = "from NfceSuprimentoDTO where " + pFiltro; Resultado = DAL.SelectObjetoSql <NfceSuprimentoDTO>(ConsultaSql); } return(Resultado); } catch (Exception ex) { throw new Exception(ex.Message + (ex.InnerException != null ? " " + ex.InnerException.Message : "")); } }
public static int ExcluiNfceSuprimento(NfceSuprimentoDTO pNfceSuprimento) { try { int Resultado = -1; using (ISession Session = NHibernateHelper.GetSessionFactory().OpenSession()) { NHibernateDAL <NfceSuprimentoDTO> DAL = new NHibernateDAL <NfceSuprimentoDTO>(Session); DAL.Delete(pNfceSuprimento); Session.Flush(); Resultado = 0; } return(Resultado); } catch (Exception ex) { throw new Exception(ex.Message + (ex.InnerException != null ? " " + ex.InnerException.Message : "")); } }
private void Confirma() { try { // verifica se senha e o nivel do operador estáo corretos NfceOperadorDTO Operador = NfceOperadorController.Usuario(editLoginOperador.Text, editSenhaOperador.Text); if (Operador != null) { // verifica se senha do gerente esta correta NfceOperadorDTO Gerente = NfceOperadorController.Usuario(editLoginGerente.Text, editSenhaGerente.Text); if (Gerente != null) { // verifica nivel de acesso do gerente/supervisor if ((Gerente.NivelAutorizacao == "G") || (Gerente.NivelAutorizacao == "S")) { DataRow Registro = DTTurno.Rows[GridTurno.CurrentRow.Index]; // insere movimento Sessao.Instance.Movimento = new NfceMovimentoDTO(); Sessao.Instance.Movimento.NfceTurno.Id = Convert.ToInt32(Registro["ID"]); Sessao.Instance.Movimento.Empresa.Id = Sessao.Instance.Configuracao.Empresa.Id; Sessao.Instance.Movimento.NfceOperador.Id = Operador.Id; Sessao.Instance.Movimento.NfceCaixa.Id = Sessao.Instance.Configuracao.NfceCaixa.Id; Sessao.Instance.Movimento.IdGerenteSupervisor = Gerente.Id; Sessao.Instance.Movimento.DataAbertura = DateTime.Now; Sessao.Instance.Movimento.HoraAbertura = DateTime.Now.ToString("hh:mm:ss"); if (editValorSuprimento.Text != "") { Sessao.Instance.Movimento.TotalSuprimento = Convert.ToDecimal(editValorSuprimento.Text); } Sessao.Instance.Movimento.StatusMovimento = "A"; Sessao.Instance.Movimento = NfceMovimentoController.GravaNfceMovimento(Sessao.Instance.Movimento); // insere suprimento if (editValorSuprimento.Text != "") { try { NfceSuprimentoDTO Suprimento = new NfceSuprimentoDTO(); Suprimento.IdNfceMovimento = Sessao.Instance.Movimento.Id; Suprimento.DataSuprimento = DateTime.Now; Suprimento.Valor = Convert.ToDecimal(editValorSuprimento.Text); NfceSuprimentoController.GravaNfceSuprimento(Suprimento); } catch (Exception eError) { Log.write(eError.ToString()); } } if (Sessao.Instance.Movimento != null) { MessageBox.Show("Movimento aberto com sucesso.", "Informação do Sistema", MessageBoxButtons.OK, MessageBoxIcon.Information); Sessao.Instance.StatusCaixa = Tipos.StatusCaixa.scAberto; ImprimeAbertura(); } Application.DoEvents(); this.Close(); } else { MessageBox.Show("Gerente ou Supervisor: nivel de acesso incorreto.", "Informação do Sistema", MessageBoxButtons.OK, MessageBoxIcon.Information); editLoginGerente.Focus(); } } else { MessageBox.Show("Gerente ou Supervisor: dados incorretos.", "Informação do Sistema", MessageBoxButtons.OK, MessageBoxIcon.Information); editLoginGerente.Focus(); } } else { MessageBox.Show("Operador: dados incorretos.", "Informação do Sistema", MessageBoxButtons.OK, MessageBoxIcon.Information); editSenhaOperador.Focus(); } } catch (Exception eError) { Log.write(eError.ToString()); } }