Example #1
0
 //注册为顾客,已测
 //注册失败返回0,成功返回1
 public int registerAsCustonmer(string userName, string password, string name,
     string phone, string email, string address)
 {
     int result;
     customerAccess ca = new customerAccess();
     result = ca.insertCustomer(userName, password, name,
      phone, email, address);
     return result;
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["role"] == null)
                Response.Redirect(Server.MapPath("Login.aspx"));
            //判断是否为管理员
            int role = Convert.ToInt32(Session["role"]);
            System.Diagnostics.Debug.WriteLine("我是角色" + role);
            if (role!=3)
            {
                Response.Redirect(Server.MapPath("Error.aspx"));
            }
            customerAccess ca  = new customerAccess();

            GridView1.DataSource = ca.SelectCustomerAll();
            GridView1.DataBind();
        }
Example #3
0
        //验证账号密码,已测
        //result[0]返回数字UserID(大于1整数):登 陆成功 -1:密码错误 -2:账号不存在
        //result[1]登陆成功返回用户角色
        public int[] login(string name ,string psw)
        {
            int[] result = { 0, 0 };
            customerAccess ca = new customerAccess();
            userAccess ua = new userAccess();
            User u = ua.SelectUserByName(name);
            //System.Diagnostics.Debug.WriteLine("我是输入密码" + psw);
            //System.Diagnostics.Debug.WriteLine("我是密码"+u.password);
            //移除空字符;
            string password= u.password.Trim();
            if (u == null)
            { result[0] = -2; return result; }
            if (!psw.Equals(password))
            { result[0] = -1; return result; }
            result[0] = u.userID;
            result[1] = u.role;



            return result;
            
        }
Example #4
0
 //修改顾客信息,已测
 //修改成功返回1,失败返回0
 public int updateCustomer(int customerID, string name, string phone,
                                                       string address, string email)
 {
     customerAccess ca = new customerAccess();
     int result;
     result = ca.updateCustomer(customerID, name, phone,
                                                     address, email);
     return result;
 }