Esempio n. 1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(Maticsoft.Model.BST.staff_card model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into staff_card(");
            strSql.Append("id_card,name,auth_type,is_register,date_begin,date_end)");
            strSql.Append(" values (");
            strSql.Append("@id_card,@name,@auth_type,@is_register,@date_begin,@date_end)");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@id_card",     MySqlDbType.VarChar, 60),
                new MySqlParameter("@name",        MySqlDbType.VarChar, 20),
                new MySqlParameter("@auth_type",   MySqlDbType.VarChar,  1),
                new MySqlParameter("@is_register", MySqlDbType.VarChar,  1),
                new MySqlParameter("@date_begin",  MySqlDbType.VarChar, 45),
                new MySqlParameter("@date_end",    MySqlDbType.VarChar, 45)
            };
            parameters[0].Value = model.id_card;
            parameters[1].Value = model.name;
            parameters[2].Value = model.auth_type;
            parameters[3].Value = model.is_register;
            parameters[4].Value = model.date_begin;
            parameters[5].Value = model.date_end;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(Maticsoft.Model.BST.staff_update model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into staff_update(");
            strSql.Append("id,name,info,image,authority,date_begin,date_end,data_keepon1,data_keepon2,data_keepon3,data_keepon4,data_keepon5)");
            strSql.Append(" values (");
            strSql.Append("@id,@name,@info,@image,@authority,@date_begin,@date_end,@data_keepon1,@data_keepon2,@data_keepon3,@data_keepon4,@data_keepon5)");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@id",           MySqlDbType.VarChar,     60),
                new MySqlParameter("@name",         MySqlDbType.VarChar,     45),
                new MySqlParameter("@info",         MySqlDbType.VarBinary),
                new MySqlParameter("@image",        MySqlDbType.MediumBlob),
                new MySqlParameter("@authority",    MySqlDbType.VarChar,      1),
                new MySqlParameter("@date_begin",   MySqlDbType.VarChar,     45),
                new MySqlParameter("@date_end",     MySqlDbType.VarChar,     45),
                new MySqlParameter("@data_keepon1", MySqlDbType.VarChar,     45),
                new MySqlParameter("@data_keepon2", MySqlDbType.VarChar,     45),
                new MySqlParameter("@data_keepon3", MySqlDbType.VarChar,     45),
                new MySqlParameter("@data_keepon4", MySqlDbType.VarChar,     45),
                new MySqlParameter("@data_keepon5", MySqlDbType.VarChar, 45)
            };
            parameters[0].Value  = model.id;
            parameters[1].Value  = model.name;
            parameters[2].Value  = model.info;
            parameters[3].Value  = model.image;
            parameters[4].Value  = model.authority;
            parameters[5].Value  = model.date_begin;
            parameters[6].Value  = model.date_end;
            parameters[7].Value  = model.data_keepon1;
            parameters[8].Value  = model.data_keepon2;
            parameters[9].Value  = model.data_keepon3;
            parameters[10].Value = model.data_keepon4;
            parameters[11].Value = model.data_keepon5;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }