예제 #1
0
파일: CtSql.cs 프로젝트: rlittletht/CtLists
        static string s_sSqlBinnedWinesWhere = " WHERE Bin<>''"; // And DatePart(year, IsNull(Consumed, '1900-01-01 00:00:00.000')) = 1900";

        void SetValueFromSqlString(Bottle bottle, SqlReader sqlr, int i, string sKey)
        {
            if (!sqlr.Reader.IsDBNull(i))
            {
                bottle.SetValue(sKey, sqlr.Reader.GetString(i));
            }
        }
예제 #2
0
파일: CtSql.cs 프로젝트: rlittletht/CtLists
        Bottle BottleFromReader(SqlReader sqlr)
        {
            Bottle bottle = new Bottle();

            int i = 0;

            SetValueFromSqlString(bottle, sqlr, i++, "Barcode");
            SetValueFromSqlString(bottle, sqlr, i++, "Wine");
            SetValueFromSqlString(bottle, sqlr, i++, "Vintage");
            SetValueFromSqlString(bottle, sqlr, i++, "Locale");
            SetValueFromSqlString(bottle, sqlr, i++, "Country");
            SetValueFromSqlString(bottle, sqlr, i++, "Region");
            SetValueFromSqlString(bottle, sqlr, i++, "SubRegion");
            SetValueFromSqlString(bottle, sqlr, i++, "Appellation");
            SetValueFromSqlString(bottle, sqlr, i++, "Producer");
            SetValueFromSqlString(bottle, sqlr, i++, "Type");
            SetValueFromSqlString(bottle, sqlr, i++, "Color");
            SetValueFromSqlString(bottle, sqlr, i++, "Category");
            SetValueFromSqlString(bottle, sqlr, i++, "Varietal");
            SetValueFromSqlString(bottle, sqlr, i++, "Designation");
            SetValueFromSqlString(bottle, sqlr, i++, "Vineyard");
            SetValueFromSqlString(bottle, sqlr, i++, "Score");
            SetValueFromSqlString(bottle, sqlr, i++, "Begin");
            SetValueFromSqlString(bottle, sqlr, i++, "End");
            SetValueFromSqlString(bottle, sqlr, i++, "iWine");
            SetValueFromSqlString(bottle, sqlr, i++, "Notes");
            SetValueFromSqlString(bottle, sqlr, i++, "Bin");
            SetValueFromSqlString(bottle, sqlr, i++, "Location");
            bottle.SetValue("UpdatedCT", sqlr.Reader.GetBoolean(i++).ToString());
            // consumed is a date...
            if (!sqlr.Reader.IsDBNull(i))
            {
                bottle.SetValue("Consumed", sqlr.Reader.GetDateTime(i).ToString("MM/dd/yyyy"));
            }
            i++;


            return(bottle);
        }