Beispiel #1
0
 /// <summary>
 /// 往实体集合中添加记录
 /// </summary>
 /// <param name="list">实体列表</param>
 /// <param name="dt">表</param>
 private void LoadListData(ref IList<Model.Applyforresale > list, DataTable dt)
 {
     if (dt.Rows.Count > 0)
     {
         Model.Applyforresale  model;
         foreach (DataRow dr in dt.Rows)
         {
             model = new Model.Applyforresale ();
             LoadEntityData(ref model, dr);
             list.Add(model);
         }
     }
 }
Beispiel #2
0
 /// <summary>
 /// 获得单个实体对象
 /// </summary>
 /// <param name="id">关键字</param>
 /// <returns>实体对象</returns>
 public Model.Applyforresale SelectModel(int id)
 {
     StringBuilder strSql = new StringBuilder();
     strSql.Append(@"select [Id],[JK_Applyforresale],[JK_Applyforresale_DateTime],[JK_Applyforresale_Member_Id],[JK_Applforresale_Member_name] from [Applyforresale] ");
     strSql.Append(@" where [Id]=@id ");
     SqlParameter[] parameters = {
             new SqlParameter("@id", SqlDbType.Int,4)};
     parameters[0].Value = id;
     Model.Applyforresale model = new Model.Applyforresale();
     DataTable dt = DAL.SqlDataHelper.GetDataTable(strSql.ToString(), parameters);
     if (dt.Rows.Count > 0)
     {
         LoadEntityData(ref model, dt.Rows[0]);
         return model;
     }
     else
     {
         return null;
     }
 }
Beispiel #3
0
 /// <summary>
 /// 获得单个实体对象
 /// </summary>
 /// <param name="whereStr">关键字</param>
 /// <returns>实体对象</returns>
 public Model.Applyforresale SelectModel(string whereStr)
 {
     StringBuilder strSql = new StringBuilder();
     strSql.Append(@"select [Id],[JK_Applyforresale],[JK_Applyforresale_DateTime],[JK_Applyforresale_Member_Id],[JK_Applforresale_Member_name] from [Applyforresale] ");
     if (whereStr.Trim() != "")
     {
         strSql.Append(@" where " + whereStr);
     }
     Model.Applyforresale model = new Model.Applyforresale();
     DataTable dt = DAL.SqlDataHelper.GetDataTable(strSql.ToString());
     if (dt.Rows.Count > 0)
     {
         LoadEntityData(ref model, dt.Rows[0]);
         return model;
     }
     else
     {
         return null;
     }
 }
Beispiel #4
0
        /// <summary>
        /// 根据条件查询实体记录
        /// </summary>
        /// <param name="whereStr">查询条件</param>
        /// <returns>实体记录</returns>
        public IList<Model.Applyforresale> SelectList(int top,string whereStr)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append(@"select ");
            if(top>0)
            {
               strSql.Append(" top "+top);
            }
            strSql.Append(" [Id],[JK_Applyforresale],[JK_Applyforresale_DateTime],[JK_Applyforresale_Member_Id],[JK_Applforresale_Member_name] from [Applyforresale] ");
            if (whereStr.Trim() != "")
            {
                strSql.Append(@" where " + whereStr);
            }
            DataTable dt = DAL.SqlDataHelper.GetDataTable(strSql.ToString());
            List<Model.Applyforresale > list = null;
            if (dt.Rows.Count > 0)
            {
                list = new List<Model.Applyforresale >();
                Model.Applyforresale  model = null;

                foreach (DataRow dr in dt.Rows)
                {
                    model = new Model.Applyforresale ();
                    LoadEntityData(ref model, dr);
                    list.Add(model);
                }
            }
            return list;
        }