Exemplo n.º 1
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public TDTK.PlatForm.MVC4.Model.TT_TaxItem DataRowToModel(DataRow row)
 {
     TDTK.PlatForm.MVC4.Model.TT_TaxItem model = new TDTK.PlatForm.MVC4.Model.TT_TaxItem();
     if (row != null)
     {
         if (row["TaxItemCode"] != null)
         {
             model.TaxItemCode = row["TaxItemCode"].ToString();
         }
         if (row["ItemName"] != null)
         {
             model.ItemName = row["ItemName"].ToString();
         }
         if (row["ItemType"] != null)
         {
             model.ItemType = row["ItemType"].ToString();
         }
         if (row["IsCount"] != null)
         {
             model.IsCount = row["IsCount"].ToString();
         }
         if (row["IsForbid"] != null)
         {
             model.IsForbid = row["IsForbid"].ToString();
         }
         if (row["Remark"] != null)
         {
             model.Remark = row["Remark"].ToString();
         }
     }
     return model;
 }
Exemplo n.º 2
0
        public Model.TT_TaxItem GetModel(Model.TT_TaxItem t)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  top 1 TaxItemCode,ItemName,ItemType,IsCount,IsForbid,Remark from TT_TaxItem ");
            strSql.Append(" where TaxItemCode=@TaxItemCode ");
            SqlParameter[] parameters = {
					new SqlParameter("@TaxItemCode", SqlDbType.VarChar,10)			};
            parameters[0].Value = t.TaxItemCode;

            TDTK.PlatForm.MVC4.Model.TT_TaxItem model = new TDTK.PlatForm.MVC4.Model.TT_TaxItem();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                return DataRowToModel(ds.Tables[0].Rows[0]);
            }
            else
            {
                return null;
            }
        }