/// <summary>
        /// GetList
        /// Calls [usp_selectAll_IndustryType]
        /// </summary>
        public override List <IndustryTypeDetails> GetList()
        {
            SqlConnection cn  = null;
            SqlCommand    cmd = null;

            try {
                cn                 = new SqlConnection(this.ConnectionString);
                cmd                = new SqlCommand("usp_selectAll_IndustryType", cn);
                cmd.CommandType    = CommandType.StoredProcedure;
                cmd.CommandTimeout = 30;
                cn.Open();
                DbDataReader reader            = ExecuteReader(cmd);
                List <IndustryTypeDetails> lst = new List <IndustryTypeDetails>();
                while (reader.Read())
                {
                    IndustryTypeDetails obj = new IndustryTypeDetails();
                    obj.IndustryTypeId = GetReaderValue_Int32(reader, "IndustryTypeId", 0);
                    obj.Name           = GetReaderValue_String(reader, "Name", "");
                    obj.Inactive       = GetReaderValue_Boolean(reader, "Inactive", false);
                    obj.UpdatedBy      = GetReaderValue_NullableInt32(reader, "UpdatedBy", null);
                    obj.DLUP           = GetReaderValue_NullableDateTime(reader, "DLUP", null);
                    lst.Add(obj);
                    obj = null;
                }
                return(lst);
            } catch (SqlException sqlex) {
                //LogException(sqlex);
                throw new Exception("Failed to get IndustryTypes", sqlex);
            } finally {
                cmd.Dispose();
                cn.Close();
                cn.Dispose();
            }
        }
        /// <summary>
        /// DropDown
        /// Calls [usp_dropdown_IndustryType]
        /// </summary>
        public override List <IndustryTypeDetails> DropDown()
        {
            SqlConnection cn  = null;
            SqlCommand    cmd = null;

            try {
                cn                 = new SqlConnection(this.ConnectionString);
                cmd                = new SqlCommand("usp_dropdown_IndustryType", cn);
                cmd.CommandType    = CommandType.StoredProcedure;
                cmd.CommandTimeout = 30;
                cn.Open();
                DbDataReader reader            = ExecuteReader(cmd);
                List <IndustryTypeDetails> lst = new List <IndustryTypeDetails>();
                while (reader.Read())
                {
                    IndustryTypeDetails obj = new IndustryTypeDetails();
                    obj.IndustryTypeId = GetReaderValue_Int32(reader, "IndustryTypeId", 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 IndustryTypes", sqlex);
            } finally {
                cmd.Dispose();
                cn.Close();
                cn.Dispose();
            }
        }
Exemple #3
0
        private static IndustryType PopulateFromDBDetailsObject(IndustryTypeDetails obj)
        {
            IndustryType objNew = new IndustryType();

            objNew.IndustryTypeId = obj.IndustryTypeId;
            objNew.Name           = obj.Name;
            objNew.Inactive       = obj.Inactive;
            objNew.UpdatedBy      = obj.UpdatedBy;
            objNew.DLUP           = obj.DLUP;
            return(objNew);
        }
        /// <summary>
        /// Get
        /// Calls [usp_select_IndustryType]
        /// </summary>
        public override IndustryTypeDetails Get(System.Int32?industryTypeId)
        {
            SqlConnection cn  = null;
            SqlCommand    cmd = null;

            try {
                cn                 = new SqlConnection(this.ConnectionString);
                cmd                = new SqlCommand("usp_select_IndustryType", cn);
                cmd.CommandType    = CommandType.StoredProcedure;
                cmd.CommandTimeout = 30;
                cmd.Parameters.Add("@IndustryTypeId", SqlDbType.Int).Value = industryTypeId;
                cn.Open();
                DbDataReader reader = ExecuteReader(cmd, CommandBehavior.SingleRow);
                if (reader.Read())
                {
                    //return GetIndustryTypeFromReader(reader);
                    IndustryTypeDetails obj = new IndustryTypeDetails();
                    obj.IndustryTypeId = GetReaderValue_Int32(reader, "IndustryTypeId", 0);
                    obj.Name           = GetReaderValue_String(reader, "Name", "");
                    obj.Inactive       = GetReaderValue_Boolean(reader, "Inactive", false);
                    obj.UpdatedBy      = GetReaderValue_NullableInt32(reader, "UpdatedBy", null);
                    obj.DLUP           = GetReaderValue_NullableDateTime(reader, "DLUP", null);
                    return(obj);
                }
                else
                {
                    return(null);
                }
            } catch (SqlException sqlex) {
                //LogException(sqlex);
                throw new Exception("Failed to get IndustryType", sqlex);
            } finally {
                cmd.Dispose();
                cn.Close();
                cn.Dispose();
            }
        }