Exemple #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                return;
            }
            //Tool.Admin.admin();
            try
            {
                i = int.Parse(Request["id"]);
                admin a = new admin()
                {
                    id = i
                };
                Hq = BLL.Product.GetAdmin(a);
            }
            catch (Exception exception)
            {
                i = 11;
                admin a = new admin()
                {
                    id = i
                };
                Hq = BLL.Product.GetAdmin(a);
            }

            Name.Text       = Hq.name;
            Image1.ImageUrl = "../img/admin/" + Hq.imurl;
        }
Exemple #2
0
        public MySqlDataReader checkAdmin(admin admim)
        {
            StringBuilder sql = new StringBuilder();
            sql.Append("select * from admin where _name=@name");

            MySqlParameter[] par = {
                              new MySqlParameter("@name",MySqlDbType.VarChar,50)

                             };
            par[0].Value = admim.name;

            return DBHelperMySQL.ExecuteReader(sql.ToString(), par);
        }
Exemple #3
0
        public int deleteAdmin(admin admin)
        {
            StringBuilder sql = new StringBuilder();
            sql.Append("delete from admin where _id=@id");

            MySqlParameter[] par = {
                                 new MySqlParameter("@id",MySqlDbType.Int32)

                                 };

            par[0].Value = admin.id;

            return DBHelperMySQL.ExecuteSql(sql.ToString(), par);
        }
Exemple #4
0
        public int insertAdmin(admin admin)
        {
            StringBuilder sql = new StringBuilder();
            sql.Append("insert into admin values(@name,@pwd,@role)");

            MySqlParameter[] par ={
                               new MySqlParameter("@name",MySqlDbType.VarChar,50),
                               new MySqlParameter ("@pwd",MySqlDbType.VarChar,50),
                               new MySqlParameter ("@role",MySqlDbType.Int32)
                               };
            par[0].Value = admin.name;
            par[1].Value = admin.pwd;
            par[2].Value = admin.role;

            return DBHelperMySQL.ExecuteSql(sql.ToString(), par);
        }
Exemple #5
0
        public MySqlDataReader readAdmin(admin admin)
        {
            StringBuilder sql = new StringBuilder();
            sql.Append("select * from admin ");
            sql.Append("where _id=@id");

            MySqlParameter[] par = {
                                 new MySqlParameter("@id",MySqlDbType.Int32)

                                 };

            par[0].Value = admin.id;

            return DBHelperMySQL.ExecuteReader(sql.ToString(), par);
        }
Exemple #6
0
        public MySqlDataReader _login(admin admin)
        {
            StringBuilder sql = new StringBuilder();
            sql.Append("select * from admin where _name=@name and _pwd=@pwd and _role=@role");

            MySqlParameter[] pra = {
                                 new MySqlParameter("@name",MySqlDbType.VarChar,50),
                                 new MySqlParameter("@pwd",MySqlDbType.VarChar,50),
                                 new MySqlParameter("@role",MySqlDbType.Int32)
                                 };
            pra[0].Value = admin.name;
            pra[1].Value = Common.DESEncrypt.Encrypt(admin.pwd);
            pra[2].Value = admin.role;

            return DBHelperMySQL.ExecuteReader(sql.ToString(), pra);
        }
Exemple #7
0
        public int updateAdmin(admin admin)
        {
            StringBuilder sql = new StringBuilder();
            sql.Append("update admin set _name=@name,_pwd=@pwd where _id=@id");

            MySqlParameter[] par = {
                                 new MySqlParameter("@name",MySqlDbType.VarChar,50),
                                 new MySqlParameter("@pwd",MySqlDbType.VarChar,50),
                                 new MySqlParameter("@id",MySqlDbType.Int32)
                                 };
            par[0].Value = admin.name;
            par[1].Value = admin.pwd;
            par[2].Value = admin.id;
            return DBHelperMySQL.ExecuteSql(sql.ToString(), par);
        }