Esempio n. 1
0
        /// <summary>
        /// Source
        /// Calls [usp_select_Analysis8DSubCategory]
        /// </summary>
        public override EightDCodeDetails GetSubCat(System.Int32?Id)
        {
            SqlConnection cn  = null;
            SqlCommand    cmd = null;

            try
            {
                cn = new SqlConnection(this.ConnectionString);
                //cmd = new SqlCommand("USP_Select8DCategory", cn);
                cmd = new SqlCommand("usp_select_Analysis8DSubCategory", cn);
                cmd.Parameters.Add("@Analysis8DSubCategoryId", SqlDbType.Int).Value = Id;
                cmd.CommandType    = CommandType.StoredProcedure;
                cmd.CommandTimeout = 30;
                cn.Open();
                //DbDataReader reader = ExecuteReader(cmd);
                DbDataReader reader = ExecuteReader(cmd, CommandBehavior.SingleRow);
                if (reader.Read())
                {
                    EightDCodeDetails obj = new EightDCodeDetails();
                    obj.Analysis8DSubCategoryID = GetReaderValue_Int32(reader, "Analysis8DSubCategoryID", 0);
                    obj.Code                 = GetReaderValue_String(reader, "Code", "");
                    obj.CodeDescription      = GetReaderValue_String(reader, "CodeDescription", "");
                    obj.Analysis8DCategoryID = GetReaderValue_Int32(reader, "PrefixNo", 0);
                    obj.SortOrder            = GetReaderValue_Int32(reader, "SortedOrder", 0);
                    obj.Inactive             = GetReaderValue_Boolean(reader, "Inactive", false);

                    return(obj);
                }
                else
                {
                    return(null);
                }
            }
            catch (SqlException sqlex)
            {
                //LogException(sqlex);
                throw new Exception("Failed to get 8D Sub-Category", sqlex);
            }
            finally
            {
                cmd.Dispose();
                cn.Close();
                cn.Dispose();
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Source
        /// Calls [USP_Select8DSubCategory]
        /// </summary>
        public override List <EightDCodeDetails> GetListSubCategory(System.Int32?Id)
        {
            SqlConnection cn  = null;
            SqlCommand    cmd = null;

            try
            {
                cn = new SqlConnection(this.ConnectionString);
                //cmd = new SqlCommand("USP_Select8DCategory", cn);
                cmd = new SqlCommand("USP_Select8DSubCategory", cn);
                cmd.Parameters.Add("@prifix", SqlDbType.Int).Value = Id;
                cmd.CommandType    = CommandType.StoredProcedure;
                cmd.CommandTimeout = 30;
                cn.Open();
                DbDataReader             reader = ExecuteReader(cmd);
                List <EightDCodeDetails> lst    = new List <EightDCodeDetails>();
                while (reader.Read())
                {
                    EightDCodeDetails obj = new EightDCodeDetails();

                    obj.Code                    = GetReaderValue_String(reader, "Code", "");
                    obj.CodeDescription         = GetReaderValue_String(reader, "CodeDescription", "");
                    obj.Analysis8DSubCategoryID = GetReaderValue_Int32(reader, "Analysis8DSubCategoryID", 0);
                    obj.Inactive                = GetReaderValue_Boolean(reader, "Inactive", false);
                    obj.SortOrder               = GetReaderValue_NullableInt32(reader, "SortOrder", 0);
                    lst.Add(obj);
                    obj = null;
                }
                return(lst);
            }
            catch (SqlException sqlex)
            {
                //LogException(sqlex);
                throw new Exception("Failed to get 8DCode Category", sqlex);
            }
            finally
            {
                cmd.Dispose();
                cn.Close();
                cn.Dispose();
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Source
        /// Calls [usp_source_Stock]
        /// </summary>
        public override List <EightDCodeDetails> GetListOfCategory()
        {
            SqlConnection cn  = null;
            SqlCommand    cmd = null;

            try
            {
                cn = new SqlConnection(this.ConnectionString);
                //cmd = new SqlCommand("USP_Select8DCategory", cn);
                cmd                = new SqlCommand("USP_Select8DSubCat", cn);
                cmd.CommandType    = CommandType.StoredProcedure;
                cmd.CommandTimeout = 30;
                cn.Open();
                DbDataReader             reader = ExecuteReader(cmd);
                List <EightDCodeDetails> lst    = new List <EightDCodeDetails>();
                while (reader.Read())
                {
                    EightDCodeDetails obj = new EightDCodeDetails();
                    obj.Prefix            = GetReaderValue_String(reader, "Prefix", "");
                    obj.PrefixDescription = GetReaderValue_String(reader, "CategoryName", "");
                    obj.CodeDescription   = GetReaderValue_String(reader, "SubCategoryName", "");
                    obj.Code = GetReaderValue_String(reader, "code", "");
                    obj.Analysis8DSubCategoryID = GetReaderValue_Int32(reader, "SubCategoryID", 0);
                    lst.Add(obj);
                    obj = null;
                }
                return(lst);
            }
            catch (SqlException sqlex)
            {
                //LogException(sqlex);
                throw new Exception("Failed to get 8DCode Category", sqlex);
            }
            finally
            {
                cmd.Dispose();
                cn.Close();
                cn.Dispose();
            }
        }