Beispiel #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);
        }
Beispiel #2
0
        /// <summary>
        /// 根据级别进行查询营销额
        /// </summary>
        /// <param name="num"></param>
        /// <returns></returns>
        public static object selectListsale(string num)
        {
            SqlParameter[] sqlpar = new SqlParameter[]
            {
                new SqlParameter("@num", num)
            };
            object sdr = DBhelp.select("Listsale", sqlpar);

            return(sdr);
        }
Beispiel #3
0
        /// <summary>
        /// 根据用户级别进行查询总人数
        /// </summary>
        /// <param name="num"></param>
        /// <returns></returns>
        public static object selectUsergrade(string num)
        {
            SqlParameter[] sqlpar = new SqlParameter[]
            {
                new SqlParameter("@num", num)
            };
            object sdr = DBhelp.select("selectnumber", sqlpar);

            return(sdr);
        }
Beispiel #4
0
        /// <summary>
        /// 根据用户名密码查询
        /// </summary>
        /// <param name="Username"></param>
        /// <param name="Userpassword"></param>
        /// <returns></returns>
        public static object Userslogin(string Username, string Userpassword)
        {
            SqlParameter[] sqlpar = new SqlParameter[]
            {
                new SqlParameter("@Username", Username),
                new SqlParameter("@Userpassword", Userpassword),
            };
            object obj = DBhelp.select("Userslogin", sqlpar);

            return(obj);
        }
Beispiel #5
0
        /// <summary>
        /// 分页
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="docount"></param>
        /// <returns></returns>
        public static object Userspaging(int pageIndex, int pageSize, out int docount)
        {
            docount = 1;
            SqlParameter[] sqlpar = new SqlParameter[]
            {
                new SqlParameter("@pageindex", pageIndex),
                new SqlParameter("@pagesize", pageSize),
                new SqlParameter("@docount", docount),
            };
            //sqlpar[2].Direction = ParameterDirection.Output;
            object dt = DBhelp.select("Userspaging", sqlpar);

            //docount = Convert.ToInt32(sqlpar[2].Value);
            return(dt);
        }
Beispiel #6
0
        /// <summary>
        /// 根据账号密码进行查询
        /// </summary>
        /// <param name="name"></param>
        /// <param name="pwd"></param>
        /// <returns></returns>
        public static object selectone(string name, string pwd)
        {
            //创建连接字符串
            string sql = "select * from cc where name=@name and pow=@pwd";

            //创建sqlpar
            SqlParameter[] sqlpar = new SqlParameter[]
            {
                new SqlParameter("@name", name),
                new SqlParameter("@pwd", pwd)
            };
            //方法调用
            object num = DBhelp.select(sql, sqlpar);

            return(num);
        }