예제 #1
0
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static int insert(loginModel model)
        {
            //定义添加sql
            string sql = "insert cc values(@name,@pwd,default)";

            //集合存储值
            SqlParameter[] sqlpar = new SqlParameter[]
            {
                new SqlParameter("@name", model.name),
                new SqlParameter("@pwd", model.pwd),
            };
            //定义查询sql
            string sql2 = "select * from cc where name=@name";

            //查询所需的参数
            SqlParameter[] sqlpar2 = new SqlParameter[]
            {
                new SqlParameter("@name", model.name),
            };

            int num = 0;
            //执行查询判断是否存在相同值
            object cx = DBhelp.select(sql2, sqlpar2);

            if (cx != null)
            {
                //返回一个数字(任意数字即可,前台判断所用)
                return(num = 66);
            }
            //执行添加语句
            num = DBhelp.Notquery(sql, sqlpar);
            return(num);
        }
예제 #2
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static int delete(ModelComment model)
        {
            string sql = "delete from Comment where commentid =@commentid ";

            SqlParameter[] sqlpar = new SqlParameter[]
            {
                new SqlParameter("@commentid ", model.commentid)
            };
            return(DBhelp.Notquery(sql, sqlpar));
        }
예제 #3
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static int delete(ModelProviderProduct model)
        {
            string sql = "delete from ProviderProduct where Productid=@Productid";

            SqlParameter[] sqlpar = new SqlParameter[]
            {
                new SqlParameter("@Productid", model.Productid)
            };
            return(DBhelp.Notquery(sql, sqlpar));
        }
예제 #4
0
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static int insert(ModelComment model)
        {
            string sql = "insert into Comment values(@commentcontent ,@commenttime ,@Sproductid )";

            SqlParameter[] sqlpar = new SqlParameter[]
            {
                new SqlParameter("@commentcontent", model.commentcontent),
                new SqlParameter("@commenttime", model.commenttime),
                new SqlParameter("@Sproductid", model.Sproductid)
            };
            return(DBhelp.Notquery(sql, sqlpar));
        }
예제 #5
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static int update(ModelComment model)
        {
            string sql = "update Comment set commentcontent =@commentcontent ,commenttime =@commenttime ,Sproductid =@Sproductid  where commentid =@commentid ";

            SqlParameter[] sqlpar = new SqlParameter[]
            {
                new SqlParameter("@commentcontent", model.commentcontent),
                new SqlParameter("@commenttime", model.commenttime),
                new SqlParameter("@Sproductid", model.Sproductid),
                new SqlParameter("@commentid", model.commentid)
            };
            return(DBhelp.Notquery(sql, sqlpar));
        }
예제 #6
0
        /// <summary>
        /// 添加
        /// </summary>
        /// <returns></returns>
        public static int insert(ModelProviderProduct model)
        {
            string sql = "insert into ProviderProduct values(@Productname ,@Productcontent ,@Productprice ,@Productimg ,@Userid)";

            SqlParameter[] sqlpar = new SqlParameter[]
            {
                new SqlParameter("@Productname", model.Productname),
                new SqlParameter("@Productcontent", model.Productcontent),
                new SqlParameter("@Productprice", model.Productprice),
                new SqlParameter("@Productimg", model.Productimg),
                new SqlParameter("@Userid", model.Userid)
            };
            return(DBhelp.Notquery(sql, sqlpar));
        }
예제 #7
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static int delete(loginModel model)
        {
            //定义sql
            string sql = "update cc set zt=1 where id=@id";

            //修改所需的参数
            SqlParameter[] sqlpar = new SqlParameter[]
            {
                new SqlParameter("@id", model.id),
            };
            //执行
            int num = DBhelp.Notquery(sql, sqlpar);

            return(num);
        }
예제 #8
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static int update(ModelProviderProduct model)
        {
            string sql = "update ProviderProduct set Productname=@Productname,Productcontent=@Productcontent,Productprice=@Productprice,Productimg=@Productimg,Userid=@Userid where Productid=@Productid";

            SqlParameter[] sqlpar = new SqlParameter[]
            {
                new SqlParameter("@Productname", model.Productname),
                new SqlParameter("@Productcontent", model.Productcontent),
                new SqlParameter("@Productprice", model.Productprice),
                new SqlParameter("@Productimg", model.Productimg),
                new SqlParameter("@Userid", model.Userid),
                new SqlParameter("@Productid", model.Productid)
            };
            return(DBhelp.Notquery(sql, sqlpar));
        }
예제 #9
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static int Update(loginModel model)
        {
            //定义sql
            string sql = "update cc set name=@name,pow=@pwd where id=@id";

            //存储参数
            SqlParameter[] sqlpar = new SqlParameter[]
            {
                new SqlParameter("@id", model.id),
                new SqlParameter("@name", model.name),
                new SqlParameter("@pwd", model.pwd),
            };
            //执行
            int num = DBhelp.Notquery(sql, sqlpar);

            return(num);
        }