public SolicitacaoDataHorario Find(SolicitacaoDataHorario obj) { List <SolicitacaoDataHorario> lstMenu = Search(new SolicitacaoDataHorario() { SolicitacaoDataHorarioId = obj.SolicitacaoDataHorarioId }).ToList(); return(lstMenu.FirstOrDefault()); }
public bool Delete(SolicitacaoDataHorario obj) { Boolean retId = false; using (SqlConnection oConnection = new SqlConnection(Conexao.DefaultConnection)) { oConnection.Open(); using (SqlCommand oCommand = oConnection.CreateCommand()) { oCommand.CommandText = Conexao.Owner + "usp_SolicitacaoDataHorario_Delete"; oCommand.CommandType = CommandType.StoredProcedure; #region --- Parâmetros --- oCommand.Parameters.Clear(); oCommand.Parameters.Add(new SqlParameter() { ParameterName = "@soh_Id", Direction = ParameterDirection.Input, Value = obj.SolicitacaoDataHorarioId }); oCommand.Parameters.Add(new SqlParameter() { ParameterName = "@return", Direction = ParameterDirection.ReturnValue }); #endregion try { oCommand.ExecuteNonQuery(); retId = Convert.ToBoolean(oCommand.Parameters["@return"].Value); } catch (SqlException ex) when(ex.Server == ".\\SQLEXPRESS") { Console.WriteLine("SQL Provider Error: " + ex.Message); } catch (Exception ex) when(ex.InnerException.ToString() == "Parameter Error") { Console.WriteLine("SQL Provider Error: " + ex.Message); } } oConnection.Close(); } return(retId); }
public List <SolicitacaoDataHorario> Search(SolicitacaoDataHorario obj) { List <SolicitacaoDataHorario> lstRet = new List <SolicitacaoDataHorario>(); using (SqlConnection oConnection = new SqlConnection(Conexao.DefaultConnection)) { oConnection.Open(); using (SqlCommand oCommand = oConnection.CreateCommand()) { oCommand.CommandText = Conexao.Owner + "usp_SolicitacaoDataHorario_Update"; oCommand.CommandType = CommandType.StoredProcedure; #region --- Parâmetros --- oCommand.Parameters.Clear(); oCommand.Parameters.Add(new SqlParameter() { ParameterName = "@soh_Id", Direction = ParameterDirection.Input, Value = obj.SolicitacaoDataHorarioId }); oCommand.Parameters.Add(new SqlParameter() { ParameterName = "@soh_Inicio", Direction = ParameterDirection.Input, Value = obj.Inicio }); oCommand.Parameters.Add(new SqlParameter() { ParameterName = "@soh_Termino", Direction = ParameterDirection.Input, Value = obj.Termino }); oCommand.Parameters.Add(new SqlParameter() { ParameterName = "@sod_Id", Direction = ParameterDirection.Input, Value = obj.SolicitacaoDataId }); #endregion try { SqlDataReader oDr = oCommand.ExecuteReader(); while (oDr.Read()) { SolicitacaoDataHorario item = new SolicitacaoDataHorario { SolicitacaoDataHorarioId = Convert.ToInt64(oDr["soh_Id"]), Inicio = oDr["soh_Inicio"].ToString(), Termino = oDr["soh_Termino"].ToString(), SolicitacaoDataId = Convert.ToInt64(oDr["sod_Id"]), }; lstRet.Add(item); } } catch (SqlException ex) when(ex.Server == ".\\SQLEXPRESS") { Console.WriteLine("SQL Provider Error: " + ex.Message); } catch (Exception ex) when(ex.InnerException.ToString() == "Parameter Error") { Console.WriteLine("SQL Provider Error: " + ex.Message); } } oConnection.Close(); } return(lstRet); }
public bool Update(SolicitacaoDataHorario obj) { return(_solicitacaoDataHorarioRepository.Update(obj)); }
public List <SolicitacaoDataHorario> Search(SolicitacaoDataHorario obj) { return(_solicitacaoDataHorarioRepository.Search(obj)); }
public long?Insert(SolicitacaoDataHorario obj) { return(_solicitacaoDataHorarioRepository.Insert(obj)); }
public SolicitacaoDataHorario Find(SolicitacaoDataHorario obj) { return(_solicitacaoDataHorarioRepository.Find(obj)); }
public bool Delete(SolicitacaoDataHorario obj) { return(_solicitacaoDataHorarioRepository.Delete(obj)); }