Ejemplo n.º 1
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public RuRo.Model.TB_Family DataRowToModel(DataRow row)
 {
     RuRo.Model.TB_Family model = new RuRo.Model.TB_Family();
     if (row != null)
     {
         if (row["ID"] != null && row["ID"].ToString() != "")
         {
             model.ID = int.Parse(row["ID"].ToString());
         }
         if (row["PatientID"] != null && row["PatientID"].ToString() != "")
         {
             model.PatientID = int.Parse(row["PatientID"].ToString());
         }
         if (row["PatientName"] != null)
         {
             model.PatientName = row["PatientName"].ToString();
         }
         if (row["SexFlag"] != null)
         {
             model.SexFlag = row["SexFlag"].ToString();
         }
         if (row["Birthday"] != null && row["Birthday"].ToString() != "")
         {
             model.Birthday = DateTime.Parse(row["Birthday"].ToString());
         }
         if (row["PFamilyID"] != null && row["PFamilyID"].ToString() != "")
         {
             model.PFamilyID = int.Parse(row["PFamilyID"].ToString());
         }
         if (row["PFamilyName"] != null)
         {
             model.PFamilyName = row["PFamilyName"].ToString();
         }
         if (row["FamilyNeuxs"] != null)
         {
             model.FamilyNeuxs = row["FamilyNeuxs"].ToString();
         }
     }
     return model;
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public RuRo.Model.TB_Family GetModel(int ID)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  top 1 ID,PatientID,PatientName,SexFlag,Birthday,PFamilyID,PFamilyName,FamilyNeuxs from TB_Family ");
            strSql.Append(" where ID=@ID");
            SqlParameter[] parameters = {
                    new SqlParameter("@ID", SqlDbType.Int,4)
            };
            parameters[0].Value = ID;

            RuRo.Model.TB_Family model = new RuRo.Model.TB_Family();
            DataSet ds = DbHelperSQL_SY.QuerySY(strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                return DataRowToModel(ds.Tables[0].Rows[0]);
            }
            else
            {
                return null;
            }
        }