/// <summary> /// DropDown /// Calls [usp_dropdown_GlobalCurrencyList] /// </summary> public override List <GlobalCurrencyListDetails> DropDown(System.Boolean?includeSelected, System.Int32?clientNo) { SqlConnection cn = null; SqlCommand cmd = null; try { cn = new SqlConnection(this.ConnectionString); cmd = new SqlCommand("usp_dropdown_GlobalCurrencyList", cn); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandTimeout = 30; cmd.Parameters.Add("@IncludeSelected", SqlDbType.Bit).Value = includeSelected; cmd.Parameters.Add("@ClientNo", SqlDbType.Int).Value = clientNo; cn.Open(); DbDataReader reader = ExecuteReader(cmd); List <GlobalCurrencyListDetails> lst = new List <GlobalCurrencyListDetails>(); while (reader.Read()) { GlobalCurrencyListDetails obj = new GlobalCurrencyListDetails(); obj.GlobalCurrencyId = GetReaderValue_Int32(reader, "GlobalCurrencyId", 0); obj.GlobalCurrencyName = GetReaderValue_String(reader, "GlobalCurrencyName", ""); obj.GlobalCurrencyDescription = GetReaderValue_String(reader, "GlobalCurrencyDescription", ""); lst.Add(obj); obj = null; } return(lst); } catch (SqlException sqlex) { //LogException(sqlex); throw new Exception("Failed to get GlobalCurrencyLists", sqlex); } finally { cmd.Dispose(); cn.Close(); cn.Dispose(); } }
private static GlobalCurrencyList PopulateFromDBDetailsObject(GlobalCurrencyListDetails obj) { GlobalCurrencyList objNew = new GlobalCurrencyList(); objNew.GlobalCurrencyId = obj.GlobalCurrencyId; objNew.GlobalCurrencyName = obj.GlobalCurrencyName; objNew.GlobalCurrencyDescription = obj.GlobalCurrencyDescription; objNew.UpdatedBy = obj.UpdatedBy; objNew.DLUP = obj.DLUP; objNew.Priority = obj.Priority; objNew.Symbol = obj.Symbol; return(objNew); }
/// <summary> /// Get /// Calls [usp_select_GlobalCurrencyList] /// </summary> public override GlobalCurrencyListDetails Get(System.Int32?currencyId) { SqlConnection cn = null; SqlCommand cmd = null; try { cn = new SqlConnection(this.ConnectionString); cmd = new SqlCommand("usp_select_GlobalCurrencyList", cn); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandTimeout = 30; cmd.Parameters.Add("@CurrencyId", SqlDbType.Int).Value = currencyId; cn.Open(); DbDataReader reader = ExecuteReader(cmd, CommandBehavior.SingleRow); if (reader.Read()) { //return GetGlobalCurrencyListFromReader(reader); GlobalCurrencyListDetails obj = new GlobalCurrencyListDetails(); obj.GlobalCurrencyId = GetReaderValue_Int32(reader, "GlobalCurrencyId", 0); obj.GlobalCurrencyName = GetReaderValue_String(reader, "GlobalCurrencyName", ""); obj.GlobalCurrencyDescription = GetReaderValue_String(reader, "GlobalCurrencyDescription", ""); obj.UpdatedBy = GetReaderValue_NullableInt32(reader, "UpdatedBy", null); obj.DLUP = GetReaderValue_DateTime(reader, "DLUP", DateTime.MinValue); obj.Priority = GetReaderValue_Boolean(reader, "Priority", false); obj.Symbol = GetReaderValue_String(reader, "Symbol", ""); return(obj); } else { return(null); } } catch (SqlException sqlex) { //LogException(sqlex); throw new Exception("Failed to get GlobalCurrencyList", sqlex); } finally { cmd.Dispose(); cn.Close(); cn.Dispose(); } }
/// <summary> /// GetList /// Calls [usp_selectAll_GlobalCurrencyList] /// </summary> public override List <GlobalCurrencyListDetails> GetList() { SqlConnection cn = null; SqlCommand cmd = null; try { cn = new SqlConnection(this.ConnectionString); cmd = new SqlCommand("usp_selectAll_GlobalCurrencyList", cn); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandTimeout = 30; cn.Open(); DbDataReader reader = ExecuteReader(cmd); List <GlobalCurrencyListDetails> lst = new List <GlobalCurrencyListDetails>(); while (reader.Read()) { GlobalCurrencyListDetails obj = new GlobalCurrencyListDetails(); obj.GlobalCurrencyId = GetReaderValue_Int32(reader, "GlobalCurrencyId", 0); obj.GlobalCurrencyName = GetReaderValue_String(reader, "GlobalCurrencyName", ""); obj.GlobalCurrencyDescription = GetReaderValue_String(reader, "GlobalCurrencyDescription", ""); obj.UpdatedBy = GetReaderValue_NullableInt32(reader, "UpdatedBy", null); obj.DLUP = GetReaderValue_DateTime(reader, "DLUP", DateTime.MinValue); obj.Priority = GetReaderValue_Boolean(reader, "Priority", false); obj.Symbol = GetReaderValue_String(reader, "Symbol", ""); lst.Add(obj); obj = null; } return(lst); } catch (SqlException sqlex) { //LogException(sqlex); throw new Exception("Failed to get GlobalCurrencyLists", sqlex); } finally { cmd.Dispose(); cn.Close(); cn.Dispose(); } }