/// <summary> /// Get /// Calls [usp_select_CommunicationLogType] /// </summary> public override CommunicationLogTypeDetails Get(System.Int32?communicationLogTypeId) { SqlConnection cn = null; SqlCommand cmd = null; try { cn = new SqlConnection(this.ConnectionString); cmd = new SqlCommand("usp_select_CommunicationLogType", cn); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandTimeout = 30; cmd.Parameters.Add("@CommunicationLogTypeId", SqlDbType.Int).Value = communicationLogTypeId; cn.Open(); DbDataReader reader = ExecuteReader(cmd, CommandBehavior.SingleRow); if (reader.Read()) { //return GetCommunicationLogTypeFromReader(reader); CommunicationLogTypeDetails obj = new CommunicationLogTypeDetails(); obj.CommunicationLogTypeId = GetReaderValue_Int32(reader, "CommunicationLogTypeId", 0); obj.Name = GetReaderValue_String(reader, "Name", ""); return(obj); } else { return(null); } } catch (SqlException sqlex) { //LogException(sqlex); throw new Exception("Failed to get CommunicationLogType", sqlex); } finally { cmd.Dispose(); cn.Close(); cn.Dispose(); } }
/// <summary> /// DropDown /// Calls [usp_dropdown_CommunicationLogType] /// </summary> public override List <CommunicationLogTypeDetails> DropDown() { SqlConnection cn = null; SqlCommand cmd = null; try { cn = new SqlConnection(this.ConnectionString); cmd = new SqlCommand("usp_dropdown_CommunicationLogType", cn); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandTimeout = 30; cn.Open(); DbDataReader reader = ExecuteReader(cmd); List <CommunicationLogTypeDetails> lst = new List <CommunicationLogTypeDetails>(); while (reader.Read()) { CommunicationLogTypeDetails obj = new CommunicationLogTypeDetails(); obj.CommunicationLogTypeId = GetReaderValue_Int32(reader, "CommunicationLogTypeId", 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 CommunicationLogTypes", sqlex); } finally { cmd.Dispose(); cn.Close(); cn.Dispose(); } }
private static CommunicationLogType PopulateFromDBDetailsObject(CommunicationLogTypeDetails obj) { CommunicationLogType objNew = new CommunicationLogType(); objNew.CommunicationLogTypeId = obj.CommunicationLogTypeId; objNew.Name = obj.Name; return(objNew); }