Ejemplo n.º 1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Class_SQL.Model.Sys_DailyHealthStatus model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update Sys_DailyHealthStatus set ");
            if (model.UserID != null)
            {
                strSql.Append("UserID='" + model.UserID + "',");
            }
            if (model.UserName != null)
            {
                strSql.Append("UserName='******',");
            }
            if (model.RecordTime != null)
            {
                strSql.Append("RecordTime='" + model.RecordTime + "',");
            }
            if (model.UserTemperature != null)
            {
                strSql.Append("UserTemperature='" + model.UserTemperature + "',");
            }
            if (model.UserHeartRate != null)
            {
                strSql.Append("UserHeartRate='" + model.UserHeartRate + "',");
            }
            if (model.BloodPressure != null)
            {
                strSql.Append("BloodPressure='" + model.BloodPressure + "',");
            }
            if (model.UserHealthState != null)
            {
                strSql.Append("UserHealthState='" + model.UserHealthState + "',");
            }
            int n = strSql.ToString().LastIndexOf(",");

            strSql.Remove(n, 1);
            strSql.Append(" where DailyStatusID='" + model.DailyStatusID + "' ");
            int rowsAffected = DbHelperSQL.ExecuteSql(strSql.ToString());

            if (rowsAffected > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Class_SQL.Model.Sys_DailyHealthStatus GetModel(string DailyStatusID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1  ");
            strSql.Append(" DailyStatusID,UserID,UserName,RecordTime,UserTemperature,UserHeartRate,BloodPressure,UserHealthState ");
            strSql.Append(" from Sys_DailyHealthStatus ");
            strSql.Append(" where DailyStatusID='" + DailyStatusID + "' ");
            Class_SQL.Model.Sys_DailyHealthStatus model = new Class_SQL.Model.Sys_DailyHealthStatus();
            DataSet ds = DbHelperSQL.Query(strSql.ToString());

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Class_SQL.Model.Sys_DailyHealthStatus DataRowToModel(DataRow row)
 {
     Class_SQL.Model.Sys_DailyHealthStatus model = new Class_SQL.Model.Sys_DailyHealthStatus();
     if (row != null)
     {
         if (row["DailyStatusID"] != null)
         {
             model.DailyStatusID = row["DailyStatusID"].ToString();
         }
         if (row["UserID"] != null)
         {
             model.UserID = row["UserID"].ToString();
         }
         if (row["UserName"] != null)
         {
             model.UserName = row["UserName"].ToString();
         }
         if (row["RecordTime"] != null && row["RecordTime"].ToString() != "")
         {
             model.RecordTime = DateTime.Parse(row["RecordTime"].ToString());
         }
         if (row["UserTemperature"] != null)
         {
             model.UserTemperature = row["UserTemperature"].ToString();
         }
         if (row["UserHeartRate"] != null)
         {
             model.UserHeartRate = row["UserHeartRate"].ToString();
         }
         if (row["BloodPressure"] != null)
         {
             model.BloodPressure = row["BloodPressure"].ToString();
         }
         if (row["UserHealthState"] != null)
         {
             model.UserHealthState = row["UserHealthState"].ToString();
         }
     }
     return(model);
 }
Ejemplo n.º 4
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(Class_SQL.Model.Sys_DailyHealthStatus model)
        {
            StringBuilder strSql  = new StringBuilder();
            StringBuilder strSql1 = new StringBuilder();
            StringBuilder strSql2 = new StringBuilder();

            if (model.DailyStatusID != null)
            {
                strSql1.Append("DailyStatusID,");
                strSql2.Append("'" + model.DailyStatusID + "',");
            }
            if (model.UserID != null)
            {
                strSql1.Append("UserID,");
                strSql2.Append("'" + model.UserID + "',");
            }
            if (model.UserName != null)
            {
                strSql1.Append("UserName,");
                strSql2.Append("'" + model.UserName + "',");
            }
            if (model.RecordTime != null)
            {
                strSql1.Append("RecordTime,");
                strSql2.Append("'" + model.RecordTime + "',");
            }
            if (model.UserTemperature != null)
            {
                strSql1.Append("UserTemperature,");
                strSql2.Append("'" + model.UserTemperature + "',");
            }
            if (model.UserHeartRate != null)
            {
                strSql1.Append("UserHeartRate,");
                strSql2.Append("'" + model.UserHeartRate + "',");
            }
            if (model.BloodPressure != null)
            {
                strSql1.Append("BloodPressure,");
                strSql2.Append("'" + model.BloodPressure + "',");
            }
            if (model.UserHealthState != null)
            {
                strSql1.Append("UserHealthState,");
                strSql2.Append("'" + model.UserHealthState + "',");
            }
            strSql.Append("insert into Sys_DailyHealthStatus(");
            strSql.Append(strSql1.ToString().Remove(strSql1.Length - 1));
            strSql.Append(")");
            strSql.Append(" values (");
            strSql.Append(strSql2.ToString().Remove(strSql2.Length - 1));
            strSql.Append(")");
            int rows = DbHelperSQL.ExecuteSql(strSql.ToString());

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }