Пример #1
0
        public override IModel CreateModel(SqlDataReader dr)
        {
            EmpMenu empmenu = new EmpMenu();

            int indexRefId = dr.GetOrdinal("RefId");
            empmenu.RefId = Convert.ToInt32(dr[indexRefId]);

            int indexEmpId = dr.GetOrdinal("EmpId");
            if (dr["EmpId"] != DBNull.Value)
            {
                empmenu.EmpId = Convert.ToInt32(dr[indexEmpId]);
            }

            int indexMenuId = dr.GetOrdinal("MenuId");
            if (dr["MenuId"] != DBNull.Value)
            {
                empmenu.MenuId = Convert.ToInt32(dr[indexMenuId]);
            }

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

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

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

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

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

            return empmenu;
        }
Пример #2
0
        public override IModel CreateModel(DataRow dr)
        {
            EmpMenu empmenu = new EmpMenu();

            empmenu.RefId = Convert.ToInt32(dr["RefId"]);

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

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

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

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

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

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

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

            return empmenu;
        }