예제 #1
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public FishEntity.SequenceEntity DataRowToModel(DataRow row)
 {
     FishEntity.SequenceEntity model = new FishEntity.SequenceEntity();
     if (row != null)
     {
         if (row["id"] != null && row["id"].ToString() != "")
         {
             model.id = int.Parse(row["id"].ToString());
         }
         if (row["key"] != null)
         {
             model.key = row["key"].ToString();
         }
         if (row["prefix"] != null)
         {
             model.prefix = row["prefix"].ToString();
         }
         if (row["separator"] != null)
         {
             model.separator = row["separator"].ToString();
         }
         if (row["step"] != null && row["step"].ToString() != "")
         {
             model.step = int.Parse(row["step"].ToString());
         }
         if (row["maxseq"] != null && row["maxseq"].ToString() != "")
         {
             model.maxseq = int.Parse(row["maxseq"].ToString());
         }
         if (row["description"] != null)
         {
             model.description = row["description"].ToString();
         }
         if (row["createtime"] != null && row["createtime"].ToString() != "")
         {
             model.createtime = DateTime.Parse(row["createtime"].ToString());
         }
         if (row["createman"] != null)
         {
             model.createman = row["createman"].ToString();
         }
         if (row["modifytime"] != null && row["modifytime"].ToString() != "")
         {
             model.modifytime = DateTime.Parse(row["modifytime"].ToString());
         }
         if (row["modifyman"] != null)
         {
             model.modifyman = row["modifyman"].ToString();
         }
         if (row["isdelete"] != null && row["isdelete"].ToString() != "")
         {
             model.isdelete = int.Parse(row["isdelete"].ToString());
         }
     }
     return(model);
 }
예제 #2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(FishEntity.SequenceEntity model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update t_sequence set ");
            strSql.Append("key=@key,");
            strSql.Append("prefix=@prefix,");
            strSql.Append("separator=@separator,");
            strSql.Append("step=@step,");
            strSql.Append("maxseq=@maxseq,");
            strSql.Append("description=@description,");
            strSql.Append("createman=@createman,");
            strSql.Append("modifyman=@modifyman,");
            strSql.Append("isdelete=@isdelete");
            strSql.Append(" where id=@id");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@key",         MySqlDbType.VarChar,  45),
                new MySqlParameter("@prefix",      MySqlDbType.VarChar,  45),
                new MySqlParameter("@separator",   MySqlDbType.VarChar,  45),
                new MySqlParameter("@step",        MySqlDbType.Int32,    11),
                new MySqlParameter("@maxseq",      MySqlDbType.Int32,    11),
                new MySqlParameter("@description", MySqlDbType.VarChar, 100),
                new MySqlParameter("@createman",   MySqlDbType.VarChar,  45),
                new MySqlParameter("@modifyman",   MySqlDbType.VarChar,  45),
                new MySqlParameter("@isdelete",    MySqlDbType.Int16,     4),
                new MySqlParameter("@id",          MySqlDbType.Int32, 11)
            };
            parameters[0].Value = model.key;
            parameters[1].Value = model.prefix;
            parameters[2].Value = model.separator;
            parameters[3].Value = model.step;
            parameters[4].Value = model.maxseq;
            parameters[5].Value = model.description;
            parameters[6].Value = model.createman;
            parameters[7].Value = model.modifyman;
            parameters[8].Value = model.isdelete;
            parameters[9].Value = model.id;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(FishEntity.SequenceEntity model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into t_sequence(");
            strSql.Append("key,prefix,separator,step,maxseq,description,createtime,createman,modifytime,modifyman,isdelete)");
            strSql.Append(" values (");
            strSql.Append("@key,@prefix,@separator,@step,@maxseq,@description,@createtime,@createman,@modifytime,@modifyman,@isdelete)");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@key",         MySqlDbType.VarChar,     45),
                new MySqlParameter("@prefix",      MySqlDbType.VarChar,     45),
                new MySqlParameter("@separator",   MySqlDbType.VarChar,     45),
                new MySqlParameter("@step",        MySqlDbType.Int32,       11),
                new MySqlParameter("@maxseq",      MySqlDbType.Int32,       11),
                new MySqlParameter("@description", MySqlDbType.VarChar,    100),
                new MySqlParameter("@createtime",  MySqlDbType.Timestamp),
                new MySqlParameter("@createman",   MySqlDbType.VarChar,     45),
                new MySqlParameter("@modifytime",  MySqlDbType.Timestamp),
                new MySqlParameter("@modifyman",   MySqlDbType.VarChar,     45),
                new MySqlParameter("@isdelete",    MySqlDbType.Int16, 4)
            };
            parameters[0].Value  = model.key;
            parameters[1].Value  = model.prefix;
            parameters[2].Value  = model.separator;
            parameters[3].Value  = model.step;
            parameters[4].Value  = model.maxseq;
            parameters[5].Value  = model.description;
            parameters[6].Value  = model.createtime;
            parameters[7].Value  = model.createman;
            parameters[8].Value  = model.modifytime;
            parameters[9].Value  = model.modifyman;
            parameters[10].Value = model.isdelete;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public FishEntity.SequenceEntity GetModel(int id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select id,key,prefix,separator,step,maxseq,description,createtime,createman,modifytime,modifyman,isdelete from t_sequence ");
            strSql.Append(" where id=@id");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@id", MySqlDbType.Int32)
            };
            parameters[0].Value = id;

            FishEntity.SequenceEntity model = new FishEntity.SequenceEntity();
            DataSet ds = MySqlHelper.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
예제 #5
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(FishEntity.SequenceEntity model)
 {
     return(dal.Update(model));
 }
예제 #6
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(FishEntity.SequenceEntity model)
 {
     return(dal.Add(model));
 }