Exemplo n.º 1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(LingLong.Admin.Model.t_checkcode model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into t_checkcode(");
            strSql.Append("PhoneNumber,Code,Type,CreateTime)");
            strSql.Append(" values (");
            strSql.Append("@PhoneNumber,@Code,@Type,@CreateTime)");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@PhoneNumber", MySqlDbType.VarChar, 20),
                new MySqlParameter("@Code",        MySqlDbType.VarChar, 10),
                new MySqlParameter("@Type",        MySqlDbType.Int16,    4),
                new MySqlParameter("@CreateTime",  MySqlDbType.DateTime)
            };
            parameters[0].Value = model.PhoneNumber;
            parameters[1].Value = model.Code;
            parameters[2].Value = model.Type;
            parameters[3].Value = model.CreateTime;

            int rows = DbHelperMySql.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public LingLong.Admin.Model.t_checkcode DataRowToModel(DataRow row)
 {
     LingLong.Admin.Model.t_checkcode model = new LingLong.Admin.Model.t_checkcode();
     if (row != null)
     {
         if (row["ID"] != null && row["ID"].ToString() != "")
         {
             model.ID = int.Parse(row["ID"].ToString());
         }
         if (row["PhoneNumber"] != null)
         {
             model.PhoneNumber = row["PhoneNumber"].ToString();
         }
         if (row["Code"] != null)
         {
             model.Code = row["Code"].ToString();
         }
         if (row["Type"] != null && row["Type"].ToString() != "")
         {
             model.Type = int.Parse(row["Type"].ToString());
         }
         if (row["CreateTime"] != null && row["CreateTime"].ToString() != "")
         {
             model.CreateTime = DateTime.Parse(row["CreateTime"].ToString());
         }
     }
     return(model);
 }
Exemplo n.º 3
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(LingLong.Admin.Model.t_checkcode model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update t_checkcode set ");
            strSql.Append("PhoneNumber=@PhoneNumber,");
            strSql.Append("Code=@Code,");
            strSql.Append("Type=@Type,");
            strSql.Append("CreateTime=@CreateTime");
            strSql.Append(" where ID=@ID");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@PhoneNumber", MySqlDbType.VarChar,   20),
                new MySqlParameter("@Code",        MySqlDbType.VarChar,   10),
                new MySqlParameter("@Type",        MySqlDbType.Int16,      4),
                new MySqlParameter("@CreateTime",  MySqlDbType.DateTime),
                new MySqlParameter("@ID",          MySqlDbType.Int32, 11)
            };
            parameters[0].Value = model.PhoneNumber;
            parameters[1].Value = model.Code;
            parameters[2].Value = model.Type;
            parameters[3].Value = model.CreateTime;
            parameters[4].Value = model.ID;

            int rows = DbHelperMySql.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public LingLong.Admin.Model.t_checkcode GetModel(int ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select ID,PhoneNumber,Code,Type,CreateTime from t_checkcode ");
            strSql.Append(" where ID=@ID");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@ID", MySqlDbType.Int32)
            };
            parameters[0].Value = ID;

            LingLong.Admin.Model.t_checkcode model = new LingLong.Admin.Model.t_checkcode();
            DataSet ds = DbHelperMySql.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 5
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(LingLong.Admin.Model.t_checkcode model)
 {
     return(dal.Update(model));
 }
Exemplo n.º 6
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(LingLong.Admin.Model.t_checkcode model)
 {
     return(dal.Add(model));
 }