Exemplo n.º 1
0
 /*
 /// <summary>
 /// ��ҳ��ȡ�����б�
 /// </summary>
 public DataSet GetList(int PageSize,int PageIndex,string strWhere)
 {
     MySqlParameter[] parameters = {
             new MySqlParameter("@tblName", MySqlDbType.VarChar, 255),
             new MySqlParameter("@fldName", MySqlDbType.VarChar, 255),
             new MySqlParameter("@PageSize", MySqlDbType.Int32),
             new MySqlParameter("@PageIndex", MySqlDbType.Int32),
             new MySqlParameter("@IsReCount", MySqlDbType.Bit),
             new MySqlParameter("@OrderType", MySqlDbType.Bit),
             new MySqlParameter("@strWhere", MySqlDbType.VarChar,1000),
             };
     parameters[0].Value = "package_type";
     parameters[1].Value = "ID";
     parameters[2].Value = PageSize;
     parameters[3].Value = PageIndex;
     parameters[4].Value = 0;
     parameters[5].Value = 0;
     parameters[6].Value = strWhere;
     return DBHelper.RunProcedure("UP_GetRecordByPage",parameters,"ds");
 }*/
 public IList<AutoBwsModel.Credit.package_type> GetPackageTypeList()
 {
     IList<AutoBwsModel.Credit.package_type> list = new List<AutoBwsModel.Credit.package_type>();
     DataSet ds = this.GetList("");
     foreach (DataRow r in ds.Tables[0].Rows)
     {
         AutoBwsModel.Credit.package_type model = new AutoBwsModel.Credit.package_type();
         SetModel(r, ref model);
         list.Add(model);
     }
     return list;
 }
Exemplo n.º 2
0
        /// <summary>
        /// �õ�һ������ʵ��
        /// </summary>
        public AutoBwsModel.Credit.package_type GetModel(int id)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select * from package_type ");
            strSql.Append(" where id=@id ");
            MySqlParameter[] parameters = {
                                          	new MySqlParameter("@id", MySqlDbType.Int32)
                                          };
            parameters[0].Value = id;

            AutoBwsModel.Credit.package_type model = new AutoBwsModel.Credit.package_type();
            DataSet ds = DBHelper.ExecuteDataset(con, CommandType.Text, strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["id"].ToString() != "")
                {
                    model.id = int.Parse(ds.Tables[0].Rows[0]["id"].ToString());
                }
                model.remark = ds.Tables[0].Rows[0]["remark"].ToString();
                model.name = ds.Tables[0].Rows[0]["name"].ToString();
                //  model.credit_count = ds.Tables[0].Rows[0]["name"].ToString();
                model.credit_count = Convert.ToInt32(ds.Tables[0].Rows[0]["credit_count"].ToString());
                model.level = Convert.ToInt32(ds.Tables[0].Rows[0]["level"].ToString());
                return model;
            }
            else
            {
                return null;
            }
        }