コード例 #1
0
ファイル: Coder.cs プロジェクト: wwkkww1983/LeProj
        public List <ValueType> DecodeListByDb(DataTable dt, itable tableClass)
        {
            List <ValueType> infoList = new List <ValueType>();

            foreach (DataRow dr in dt.Rows)
            {
                infoList.Add(tableClass.DecodeOneItemByDb(dr));
            }
            return(infoList);
        }
コード例 #2
0
        private itable GetTableHandlerByType(enumProductType itemType)
        {
            itable result = null;

            switch (itemType)
            {
            case enumProductType.Adapter:
            case enumProductType.Extend:
            case enumProductType.Focus: result = dbRingMedium; break;

            case enumProductType.Interface: result = dbConnector; break;

            case enumProductType.CamLens: result = dbCamlens; break;

            default: break;
            }

            return(result);
        }
コード例 #3
0
        private itable GetTableHandlerByType(Type itemType)
        {
            itable result = null;

            if (itemType == typeof(CameraLens))
            {
                result = dbCamlens;
            }
            else if (itemType == typeof(Connectors))
            {
                result = dbConnector;
            }
            else if (itemType == typeof(RingMedium))
            {
                result = dbRingMedium;
            }

            return(result);
        }
コード例 #4
0
        public bool InsertItem(ValueType info)
        {
            itable handler = this.GetTableHandlerByType(info.GetType());

            return(handler.InsertOneItem(info));
        }
コード例 #5
0
        private List <ValueType> GetDataList(string strSql, itable table)
        {
            DataSet dsConnector = SQLiteHelper.ExecuteDataSet(STR_CONNECTION, strSql, null);

            return(code.DecodeListByDb(dsConnector.Tables[0], table));
        }
コード例 #6
0
        public List <ValueType> GetAllDevices(enumProductType type)
        {
            itable handler = this.GetTableHandlerByType(type);

            return(handler.GetAllData());
        }