Exemple #1
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public RuRo.Model.TB_SETTING_VALUE DataRowToModel(DataRow row)
 {
     RuRo.Model.TB_SETTING_VALUE model = new RuRo.Model.TB_SETTING_VALUE();
     if (row != null)
     {
         if (row["SETTING_ID"] != null && row["SETTING_ID"].ToString() != "")
         {
             model.SETTING_ID = int.Parse(row["SETTING_ID"].ToString());
         }
         if (row["SETTING_TYPE"] != null)
         {
             model.SETTING_TYPE = row["SETTING_TYPE"].ToString();
         }
         if (row["SETTING_VALUE"] != null)
         {
             model.SETTING_VALUE = row["SETTING_VALUE"].ToString();
         }
         if (row["DEPARTMENTS"] != null)
         {
             model.DEPARTMENTS = row["DEPARTMENTS"].ToString();
         }
         if (row["ADD_TIME"] != null && row["ADD_TIME"].ToString() != "")
         {
             model.ADD_TIME = DateTime.Parse(row["ADD_TIME"].ToString());
         }
     }
     return model;
 }
Exemple #2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public RuRo.Model.TB_SETTING_VALUE GetModel(int SETTING_ID)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  top 1 SETTING_ID,SETTING_TYPE,SETTING_VALUE,DEPARTMENTS,ADD_TIME from TB_SETTING_VALUE ");
            strSql.Append(" where SETTING_ID=@SETTING_ID");
            SqlParameter[] parameters = {
                    new SqlParameter("@SETTING_ID", SqlDbType.Int,4)
            };
            parameters[0].Value = SETTING_ID;

            RuRo.Model.TB_SETTING_VALUE model = new RuRo.Model.TB_SETTING_VALUE();
            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;
            }
        }