示例#1
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public 珠宝入库系统.Model.Dictionary DataRowToModel(DataRow row)
 {
     珠宝入库系统.Model.Dictionary model = new 珠宝入库系统.Model.Dictionary();
     if (row != null)
     {
         if (row["id"] != null && row["id"].ToString() != "")
         {
             model.id = int.Parse(row["id"].ToString());
         }
         if (row["mclass"] != null)
         {
             model.mclass = row["mclass"].ToString();
         }
         if (row["sclass"] != null)
         {
             model.sclass = row["sclass"].ToString();
         }
         if (row["name"] != null)
         {
             model.name = row["name"].ToString();
         }
         if (row["type"] != null)
         {
             model.type = row["type"].ToString();
         }
         if (row["parentid"] != null && row["parentid"].ToString() != "")
         {
             model.parentid = int.Parse(row["parentid"].ToString());
         }
         if (row["sort"] != null && row["sort"].ToString() != "")
         {
             model.sort = int.Parse(row["sort"].ToString());
         }
         if (row["memo"] != null)
         {
             model.memo = row["memo"].ToString();
         }
         if (row["value"] != null)
         {
             model.value = row["value"].ToString();
         }
     }
     return model;
 }
示例#2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public 珠宝入库系统.Model.Dictionary GetModel(int id)
 {
     StringBuilder strSql = new StringBuilder();
     strSql.Append("select  top 1  ");
     strSql.Append(" id,mclass,sclass,name,type,parentid,sort,memo,value ");
     strSql.Append(" from dictionary ");
     strSql.Append(" where id=" + id + "");
     珠宝入库系统.Model.Dictionary model = new 珠宝入库系统.Model.Dictionary();
     DataSet ds = DbHelperSQL.Query(strSql.ToString());
     if (ds.Tables[0].Rows.Count > 0)
     {
         return DataRowToModel(ds.Tables[0].Rows[0]);
     }
     else
     {
         return null;
     }
 }