Ejemplo n.º 1
0
        /// <summary>
        /// DropDown
        /// Calls [usp_dropdown_OfferStatus]
        /// </summary>
        public override List <OfferStatusDetails> DropDown()
        {
            SqlConnection cn  = null;
            SqlCommand    cmd = null;

            try {
                cn                 = new SqlConnection(this.ConnectionString);
                cmd                = new SqlCommand("usp_dropdown_OfferStatus", cn);
                cmd.CommandType    = CommandType.StoredProcedure;
                cmd.CommandTimeout = 30;
                cn.Open();
                DbDataReader reader           = ExecuteReader(cmd);
                List <OfferStatusDetails> lst = new List <OfferStatusDetails>();
                while (reader.Read())
                {
                    OfferStatusDetails obj = new OfferStatusDetails();
                    obj.OfferStatusId = GetReaderValue_Int32(reader, "OfferStatusId", 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 OfferStatuss", sqlex);
            } finally {
                cmd.Dispose();
                cn.Close();
                cn.Dispose();
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Get
        /// Calls [usp_select_OfferStatus]
        /// </summary>
        public override OfferStatusDetails Get(System.Int32?offerStatusId)
        {
            SqlConnection cn  = null;
            SqlCommand    cmd = null;

            try {
                cn                 = new SqlConnection(this.ConnectionString);
                cmd                = new SqlCommand("usp_select_OfferStatus", cn);
                cmd.CommandType    = CommandType.StoredProcedure;
                cmd.CommandTimeout = 30;
                cmd.Parameters.Add("@OfferStatusId", SqlDbType.Int).Value = offerStatusId;
                cn.Open();
                DbDataReader reader = ExecuteReader(cmd, CommandBehavior.SingleRow);
                if (reader.Read())
                {
                    //return GetOfferStatusFromReader(reader);
                    OfferStatusDetails obj = new OfferStatusDetails();
                    obj.OfferStatusId = GetReaderValue_Int32(reader, "OfferStatusId", 0);
                    obj.Name          = GetReaderValue_String(reader, "Name", "");
                    return(obj);
                }
                else
                {
                    return(null);
                }
            } catch (SqlException sqlex) {
                //LogException(sqlex);
                throw new Exception("Failed to get OfferStatus", sqlex);
            } finally {
                cmd.Dispose();
                cn.Close();
                cn.Dispose();
            }
        }
Ejemplo n.º 3
0
        private static OfferStatus PopulateFromDBDetailsObject(OfferStatusDetails obj)
        {
            OfferStatus objNew = new OfferStatus();

            objNew.OfferStatusId = obj.OfferStatusId;
            objNew.Name          = obj.Name;
            return(objNew);
        }