/// <summary> /// Get /// Calls [usp_select_QuoteStatus] /// </summary> public override QuoteStatusDetails Get(System.Int32?quoteStatusId) { SqlConnection cn = null; SqlCommand cmd = null; try { cn = new SqlConnection(this.ConnectionString); cmd = new SqlCommand("usp_select_QuoteStatus", cn); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandTimeout = 30; cmd.Parameters.Add("@QuoteStatusId", SqlDbType.Int).Value = quoteStatusId; cn.Open(); DbDataReader reader = ExecuteReader(cmd, CommandBehavior.SingleRow); if (reader.Read()) { //return GetQuoteStatusFromReader(reader); QuoteStatusDetails obj = new QuoteStatusDetails(); obj.QuoteStatusId = GetReaderValue_Int32(reader, "QuoteStatusId", 0); obj.Name = GetReaderValue_String(reader, "Name", ""); return(obj); } else { return(null); } } catch (SqlException sqlex) { //LogException(sqlex); throw new Exception("Failed to get QuoteStatus", sqlex); } finally { cmd.Dispose(); cn.Close(); cn.Dispose(); } }
/// <summary> /// DropDown /// Calls [usp_dropdown_QuoteStatus] /// </summary> public override List <QuoteStatusDetails> DropDown() { SqlConnection cn = null; SqlCommand cmd = null; try { cn = new SqlConnection(this.ConnectionString); cmd = new SqlCommand("usp_dropdown_QuoteStatus", cn); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandTimeout = 30; cn.Open(); DbDataReader reader = ExecuteReader(cmd); List <QuoteStatusDetails> lst = new List <QuoteStatusDetails>(); while (reader.Read()) { QuoteStatusDetails obj = new QuoteStatusDetails(); obj.QuoteStatusId = GetReaderValue_Int32(reader, "QuoteStatusId", 0); obj.Name = GetReaderValue_String(reader, "Name", ""); lst.Add(obj); obj = null; } return(lst); } catch (SqlException sqlex) { //LogException(sqlex); throw new Exception("Failed to get QuoteStatuss", sqlex); } finally { cmd.Dispose(); cn.Close(); cn.Dispose(); } }
private static QuoteStatus PopulateFromDBDetailsObject(QuoteStatusDetails obj) { QuoteStatus objNew = new QuoteStatus(); objNew.QuoteStatusId = obj.QuoteStatusId; objNew.Name = obj.Name; return objNew; }