Exemplo n.º 1
0
            public static List<QualityControlLevelType> DatasetQCLevels(ValuesDataSet ds, string valuesWhereClause)
            {
                /* generate a list
                 * create a distinct DataSet
                 * - new data view
                 * - set filter (no nulls)
                 * - use toTable with unique to get unique list
                 * foreach to generate qualifiers
                 * */
                string COLUMN = "QualityControlLevelID";
                string TABLENAME = "QualityControlLevels";
                List<QualityControlLevelType> list = new List<QualityControlLevelType>();
                try
                {
                    DataView view = new DataView(ds.DataValues);
                    view.RowFilter = valuesWhereClause;

                    DataTable ids = view.ToTable(TABLENAME, true, new string[] {COLUMN});

                    foreach (DataRow r in ids.Rows)
                    {
                        try
                        {
                           // Object aId = r[COLUMN];

                            if (r[COLUMN] == DBNull.Value)
                            {
                                continue;
                            }
                            int? aId = Convert.ToInt32(r[COLUMN]);
                            // edit here
                            ValuesDataSet.QualityControlLevelsRow qcLevels =
                                ds.QualityControlLevels.FindByQualityControlLevelID((int) aId.Value);
                            if (qcLevels != null)
                            {
                                QualityControlLevelType t = new QualityControlLevelType();
                                t.qualityControlLevelID = qcLevels.QualityControlLevelID;
                                t.qualityControlLevelIDSpecified = true;
                                t.qualityControlLevelCode = qcLevels.QualityControlLevelCode;
                                t.definition = qcLevels.Definition;
                                t.explanation = qcLevels.Explanation;

                                list.Add(t);
                            }
                        }
                        catch (Exception e)
                        {
                            log.Error("Error generating a QualityControlLevels " + r.ToString() + e.Message);
                        }
                    }
                    return list;
                }

                catch (Exception e)
                {
                    log.Error("Error generating a QualityControlLevels " + e.Message);
                    // non fatal exceptions
                    return null;
                }
            }
Exemplo n.º 2
0
            public static List <QualityControlLevelType> DatasetQCLevels(ValuesDataSet ds, string valuesWhereClause)
            {
                /* generate a list
                 * create a distinct DataSet
                 * - new data view
                 * - set filter (no nulls)
                 * - use toTable with unique to get unique list
                 * foreach to generate qualifiers
                 * */
                string COLUMN    = "QualityControlLevelID";
                string TABLENAME = "QualityControlLevels";
                List <QualityControlLevelType> list = new List <QualityControlLevelType>();

                try
                {
                    DataView view = new DataView(ds.DataValues);
                    view.RowFilter = valuesWhereClause;

                    DataTable ids = view.ToTable(TABLENAME, true, new string[] { COLUMN });

                    foreach (DataRow r in ids.Rows)
                    {
                        try
                        {
                            // Object aId = r[COLUMN];

                            if (r[COLUMN] == DBNull.Value)
                            {
                                continue;
                            }
                            int?aId = Convert.ToInt32(r[COLUMN]);
                            // edit here
                            ValuesDataSet.QualityControlLevelsRow qcLevels =
                                ds.QualityControlLevels.FindByQualityControlLevelID((int)aId.Value);
                            if (qcLevels != null)
                            {
                                QualityControlLevelType t = new QualityControlLevelType();
                                t.qualityControlLevelID          = qcLevels.QualityControlLevelID;
                                t.qualityControlLevelIDSpecified = true;
                                t.qualityControlLevelCode        = qcLevels.QualityControlLevelCode;
                                t.definition  = qcLevels.Definition;
                                t.explanation = qcLevels.Explanation;


                                list.Add(t);
                            }
                        }
                        catch (Exception e)
                        {
                            log.Error("Error generating a QualityControlLevels " + r.ToString() + e.Message);
                        }
                    }
                    return(list);
                }

                catch (Exception e)
                {
                    log.Error("Error generating a QualityControlLevels " + e.Message);
                    // non fatal exceptions
                    return(null);
                }
            }