Пример #1
0
        public override IModel CreateModel(DataRow dr)
        {
            InvoiceApply invoiceapply = new InvoiceApply();

            invoiceapply.InvoiceApplyId = Convert.ToInt32(dr["InvoiceApplyId"]);

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

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

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

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

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

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

            return invoiceapply;
        }
Пример #2
0
        public override IModel CreateModel(SqlDataReader dr)
        {
            InvoiceApply invoiceapply = new InvoiceApply();

            int indexInvoiceApplyId = dr.GetOrdinal("InvoiceApplyId");
            invoiceapply.InvoiceApplyId = Convert.ToInt32(dr[indexInvoiceApplyId]);

            int indexApplyId = dr.GetOrdinal("ApplyId");
            if (dr["ApplyId"] != DBNull.Value)
            {
                invoiceapply.ApplyId = Convert.ToInt32(dr[indexApplyId]);
            }

            int indexTotalBala = dr.GetOrdinal("TotalBala");
            if (dr["TotalBala"] != DBNull.Value)
            {
                invoiceapply.TotalBala = Convert.ToDecimal(dr[indexTotalBala]);
            }

            int indexCreatorId = dr.GetOrdinal("CreatorId");
            if (dr["CreatorId"] != DBNull.Value)
            {
                invoiceapply.CreatorId = Convert.ToInt32(dr[indexCreatorId]);
            }

            int indexCreateTime = dr.GetOrdinal("CreateTime");
            if (dr["CreateTime"] != DBNull.Value)
            {
                invoiceapply.CreateTime = Convert.ToDateTime(dr[indexCreateTime]);
            }

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

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

            return invoiceapply;
        }