示例#1
0
        public override IModel CreateModel(DataRow dr)
        {
            RoleDept roledept = new RoleDept();

            roledept.RoleDeptId = Convert.ToInt32(dr["RoleDeptId"]);

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

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

            if (dr["RefStatus"] != DBNull.Value)
            {
                roledept.RefStatus = (Common.StatusEnum)Convert.ToInt32(dr["RefStatus"]);
            }

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

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

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

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

            return roledept;
        }
示例#2
0
        public override IModel CreateModel(SqlDataReader dr)
        {
            RoleDept roledept = new RoleDept();

            int indexRoleDeptId = dr.GetOrdinal("RoleDeptId");
            roledept.RoleDeptId = Convert.ToInt32(dr[indexRoleDeptId]);

            int indexRoleId = dr.GetOrdinal("RoleId");
            if (dr["RoleId"] != DBNull.Value)
            {
                roledept.RoleId = Convert.ToInt32(dr[indexRoleId]);
            }

            int indexDeptId = dr.GetOrdinal("DeptId");
            if (dr["DeptId"] != DBNull.Value)
            {
                roledept.DeptId = Convert.ToInt32(dr[indexDeptId]);
            }

            int indexRefStatus = dr.GetOrdinal("RefStatus");
            if (dr["RefStatus"] != DBNull.Value)
            {
                roledept.RefStatus = (Common.StatusEnum)Convert.ToInt32(dr[indexRefStatus]);
            }

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

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

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

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

            return roledept;
        }