//public static InsightSupplierCustomDetail GetInsightSupplierCustomDetailByInsightSupplierId(int insightSupplierId)
        //{
        //    Database db = DatabaseFactory.CreateDatabase("SPARInsightManagement");
        //    string sqlCommand = "GetInsightSupplierCustomDetailByInsightSupplierId";
        //    DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand);
        //    db.AddInParameter(dbCommand, "@InsightSupplierId", DbType.Int32, insightSupplierId);
        //    db.AddOutParameter(dbCommand, "@InsightSupplierCustomDetailId", DbType.Int32, 4);
        //    db.AddOutParameter(dbCommand, "@CustomType", DbType.String, 50);
        //    db.AddOutParameter(dbCommand, "@CustomFrequency", DbType.String, 50);
        //    db.AddOutParameter(dbCommand, "@CustomResponsibility", DbType.String, 50);
        //    db.AddOutParameter(dbCommand, "@Detail", DbType.String, 50);
        //    db.AddOutParameter(dbCommand, "@SourceFile", DbType.String, 50);
        //    db.AddOutParameter(dbCommand, "@Status", DbType.String, 50);
        //    db.ExecuteNonQuery(dbCommand);
        //    InsightSupplierCustomDetail insightSupplierCustomDetail = new InsightSupplierCustomDetail();
        //    insightSupplierCustomDetail.InsightSupplierId = insightSupplierId;
        //    insightSupplierCustomDetail.InsightSupplierCustomDetailId = Convert.ToInt32(db.GetParameterValue(dbCommand, "InsightSupplierCustomDetailId"));
        //    insightSupplierCustomDetail.CustomType = db.GetParameterValue(dbCommand, "CustomType").ToString();
        //    insightSupplierCustomDetail.CustomFrequency = db.GetParameterValue(dbCommand, "CustomFrequency").ToString();
        //    insightSupplierCustomDetail.CustomResponsibility = db.GetParameterValue(dbCommand, "CustomResponsibility").ToString();
        //    insightSupplierCustomDetail.Detail = db.GetParameterValue(dbCommand, "Detail").ToString();
        //    insightSupplierCustomDetail.SourceFile = db.GetParameterValue(dbCommand, "SourceFile").ToString();
        //    insightSupplierCustomDetail.Status = db.GetParameterValue(dbCommand, "Status").ToString();
        //    return insightSupplierCustomDetail;
        //}

        public static InsightSupplierCustomDetail GetInsightSupplierCustomDetailByInsightSupplierCustomDetailId(int insightSupplierCustomDetailId)
        {
            Database  db         = DatabaseFactory.CreateDatabase("SPARInsightManagement");
            string    sqlCommand = "GetInsightSupplierCustomDetailByInsightSupplierCustomDetailId";
            DbCommand dbCommand  = db.GetStoredProcCommand(sqlCommand);

            db.AddInParameter(dbCommand, "@InsightSupplierCustomDetailId", DbType.Int32, insightSupplierCustomDetailId);
            db.AddOutParameter(dbCommand, "@InsightSupplierId", DbType.Int32, 4);
            db.AddOutParameter(dbCommand, "@CustomTypeId", DbType.Int32, 4);
            db.AddOutParameter(dbCommand, "@CustomFrequencyId", DbType.Int32, 4);
            db.AddOutParameter(dbCommand, "@CustomResponsibilityId", DbType.Int32, 4);
            db.AddOutParameter(dbCommand, "@Detail", DbType.String, 8000);
            db.AddOutParameter(dbCommand, "@SourceFile", DbType.String, 8000);
            db.AddOutParameter(dbCommand, "@StatusId", DbType.Int32, 4);
            db.ExecuteNonQuery(dbCommand);
            InsightSupplierCustomDetail insightSupplierCustomDetail = new InsightSupplierCustomDetail();

            insightSupplierCustomDetail.InsightSupplierCustomDetailId = insightSupplierCustomDetailId;
            insightSupplierCustomDetail.InsightSupplierId             = Convert.ToInt32(db.GetParameterValue(dbCommand, "InsightSupplierId"));
            insightSupplierCustomDetail.CustomTypeId           = Convert.ToInt32(db.GetParameterValue(dbCommand, "CustomTypeId"));
            insightSupplierCustomDetail.CustomFrequencyId      = Convert.ToInt32(db.GetParameterValue(dbCommand, "CustomFrequencyId"));
            insightSupplierCustomDetail.CustomResponsibilityId = Convert.ToInt32(db.GetParameterValue(dbCommand, "CustomResponsibilityId"));
            insightSupplierCustomDetail.Detail     = db.GetParameterValue(dbCommand, "Detail").ToString();
            insightSupplierCustomDetail.SourceFile = db.GetParameterValue(dbCommand, "SourceFile").ToString();
            insightSupplierCustomDetail.StatusId   = Convert.ToInt32(db.GetParameterValue(dbCommand, "StatusId"));
            return(insightSupplierCustomDetail);
        }
        public static List <InsightSupplierCustomDetail> GetInsightSupplierCustomDetailByInsightSupplierId(int insightSupplierId)
        {
            List <InsightSupplierCustomDetail> list = new List <InsightSupplierCustomDetail>();

            Database  db         = DatabaseFactory.CreateDatabase("SPARInsightManagement");
            string    sqlCommand = "GetInsightSupplierCustomDetailByInsightSupplierId";
            DbCommand dbCommand  = db.GetStoredProcCommand(sqlCommand);

            db.AddInParameter(dbCommand, "@InsightSupplierId", DbType.Int32, insightSupplierId);

            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                while (dataReader.Read())
                {
                    InsightSupplierCustomDetail insightSupplierCustomDetail = new InsightSupplierCustomDetail();
                    insightSupplierCustomDetail.InsightSupplierId             = insightSupplierId;
                    insightSupplierCustomDetail.InsightSupplierCustomDetailId = Convert.ToInt32(dataReader["InsightSupplierCustomDetailId"]);
                    insightSupplierCustomDetail.CustomType           = dataReader["CustomType"].ToString();
                    insightSupplierCustomDetail.CustomFrequency      = dataReader["CustomFrequency"].ToString();
                    insightSupplierCustomDetail.CustomResponsibility = dataReader["CustomResponsibility"].ToString();
                    insightSupplierCustomDetail.Detail     = dataReader["Detail"].ToString();
                    insightSupplierCustomDetail.SourceFile = dataReader["SourceFile"].ToString();
                    insightSupplierCustomDetail.Status     = dataReader["Status"].ToString();
                    list.Add(insightSupplierCustomDetail);
                }
            }
            return(list);
        }