コード例 #1
0
ファイル: AssetDAL.cs プロジェクト: weiliji/NFMT
        public override IModel CreateModel(SqlDataReader dr)
        {
            Asset asset = new Asset();

            int indexAssetId = dr.GetOrdinal("AssetId");
            asset.AssetId = Convert.ToInt32(dr[indexAssetId]);

            int indexAssetName = dr.GetOrdinal("AssetName");
            asset.AssetName = Convert.ToString(dr[indexAssetName]);

            int indexMUId = dr.GetOrdinal("MUId");
            asset.MUId = Convert.ToInt32(dr[indexMUId]);

            int indexMisTake = dr.GetOrdinal("MisTake");
            if (dr["MisTake"] != DBNull.Value)
            {
                asset.MisTake = Convert.ToDecimal(dr[indexMisTake]);
            }

            int indexAmountPerHand = dr.GetOrdinal("AmountPerHand");
            if (dr["AmountPerHand"] != DBNull.Value)
            {
                asset.AmountPerHand = Convert.ToInt32(dr[indexAmountPerHand]);
            }

            int indexAssetStatus = dr.GetOrdinal("AssetStatus");
            asset.AssetStatus = (Common.StatusEnum)Convert.ToInt32(dr[indexAssetStatus]);

            int indexCreatorId = dr.GetOrdinal("CreatorId");
            asset.CreatorId = Convert.ToInt32(dr[indexCreatorId]);

            int indexCreateTime = dr.GetOrdinal("CreateTime");
            asset.CreateTime = Convert.ToDateTime(dr[indexCreateTime]);

            int indexLastModifyId = dr.GetOrdinal("LastModifyId");
            if (dr["LastModifyId"] != DBNull.Value)
            {
                asset.LastModifyId = Convert.ToInt32(dr[indexLastModifyId]);
            }

            int indexLastModifyTime = dr.GetOrdinal("LastModifyTime");
            if (dr["LastModifyTime"] != DBNull.Value)
            {
                asset.LastModifyTime = Convert.ToDateTime(dr[indexLastModifyTime]);
            }

            return asset;
        }
コード例 #2
0
ファイル: AssetDAL.cs プロジェクト: weiliji/NFMT
        public override IModel CreateModel(DataRow dr)
        {
            Asset asset = new Asset();

            asset.AssetId = Convert.ToInt32(dr["AssetId"]);

            asset.AssetName = Convert.ToString(dr["AssetName"]);

            asset.MUId = Convert.ToInt32(dr["MUId"]);

            if (dr["MisTake"] != DBNull.Value)
            {
                asset.MisTake = Convert.ToDecimal(dr["MisTake"]);
            }

            if (dr["AmountPerHand"] != DBNull.Value)
            {
                asset.AmountPerHand = Convert.ToInt32(dr["AmountPerHand"]);
            }

            asset.AssetStatus = (Common.StatusEnum)Convert.ToInt32(dr["AssetStatus"]);

            asset.CreatorId = Convert.ToInt32(dr["CreatorId"]);

            asset.CreateTime = Convert.ToDateTime(dr["CreateTime"]);

            if (dr["LastModifyId"] != DBNull.Value)
            {
                asset.LastModifyId = Convert.ToInt32(dr["LastModifyId"]);
            }

            if (dr["LastModifyTime"] != DBNull.Value)
            {
                asset.LastModifyTime = Convert.ToDateTime(dr["LastModifyTime"]);
            }

            return asset;
        }