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

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