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