public ResponseInfo<Model.Customer> Login(Customer customer)
        {
            ResponseInfo<Model.Customer> response = new ResponseInfo<Customer>();

            if (customer == null)
            {
                return response;
            }

            bool result = CustomerBLL.Login(customer);

            if (result)
            {
                Model.Customer customerDetail = CustomerBLL.GetCustomerDetail(customer);

                response.Code = 1;
                response.Value = customerDetail;
            }
            else
            {
                response.Code = -1;
                response.Message = "用户名或密码错误";
            }

            return response;
        }
        public ResponseInfo<Model.Customer> Register(Customer customer)
        {
            ResponseInfo<Model.Customer> response = new ResponseInfo<Customer>();

            if (customer == null)
            {
                return response;
            }

            bool result = CustomerBLL.Register(customer);

            if (result)
            {
                Model.Customer customerDetail = CustomerBLL.GetCustomerDetail(customer);

                response.Code = 1;
                response.Value = customerDetail;
            }
            else
            {
                response.Code = -1;
                response.Message = "注册用户已存在";
            }

            return response;
        }
Exemple #3
0
        private void BtnLogin_Click(object sender, EventArgs e)
        {
            string userName = TxtUserName.Text.Trim();
            string password = TxtPassword.Text.Trim();

            if (string.IsNullOrEmpty(userName) || string.IsNullOrEmpty(password))
            {
                MessageHelper.ShowMeesageBox("用户名或密码不能为空");
                return;
            }

            Customer customer = new Customer();
            customer.CustomerID = userName;
            customer.Password = xSimulate.Common.clsMD5.MD5(password);
            ResponseInfo<Customer> response = ServiceManager.CreateCustomerService().Login(customer);
            if (response.Code != 1)
            {
                MessageHelper.ShowMeesageBox(response.Message);
            }
            else
            {
                string boolPass = chkPass.Checked ? "1" : "0";
                string boolLogin = chkAuto.Checked ? "1" : "0";
                string[] member = { customer.CustomerID, password, boolPass, boolLogin };

                File.WriteAllLines("member", member, Encoding.GetEncoding("GB2312"));

                SessionContext.CustomerInfo = response.Value;
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
        }
Exemple #4
0
        private void BtnRegister_Click(object sender, EventArgs e)
        {
            string userName = TxtUserName.Text.Trim();
            string password = TxtPassword.Text.Trim();
            string qq = TxtQQ.Text.Trim();

            if (string.IsNullOrEmpty(userName))
            {
                MessageHelper.ShowMeesageBox("用户名不能为空");
                TxtUserName.Focus();
            }
            if (string.IsNullOrEmpty(password))
            {
                MessageHelper.ShowMeesageBox("请输入密码");
                TxtPassword.Focus();
            }

            Customer customer = new Customer();
            customer.CustomerID = userName;
            customer.Password = xSimulate.Common.clsMD5.MD5(password);
            customer.QQ = qq;

            ResponseInfo<Customer> response = ServiceManager.CreateCustomerService().Register(customer);
            if (response.Code != 1)
            {
                MessageHelper.ShowMeesageBox(response.Message);
            }
            else
            {
                this.DialogResult = DialogResult.OK;
                MessageBox.Show("恭喜,注册成功!");
                this.Close();
            }
        }
Exemple #5
0
 private void LoginFrm_Load(object sender, EventArgs e)
 {
     if (File.Exists("member"))
     {
         string[] member = File.ReadAllLines("member", Encoding.GetEncoding("GB2312"));
         if (member.Length == 4)
         {
             //记住密码
             if (member[2] == "1")
             {
                 this.TxtUserName.Text = member[0];
                 this.TxtPassword.Text = member[1];
                 this.chkPass.Checked = true;
                 if (member[3] == "1")
                 {
                     this.chkAuto.Checked = true;
                     Customer customer = new Customer();
                     customer.CustomerID = member[0];
                     customer.Password = xSimulate.Common.clsMD5.MD5(member[1]);
                     ResponseInfo<Customer> response = ServiceManager.CreateCustomerService().Login(customer);
                     if (response.Code != 1)
                     {
                         MessageHelper.ShowMeesageBox(response.Message);
                     }
                     else
                     {
                         SessionContext.CustomerInfo = response.Value;
                         this.DialogResult = DialogResult.OK;
                         this.Close();
                     }
                 }
             }
         }
     }
 }
 public ResponseInfo<Customer> Register(Customer customer)
 {
     object[] results = this.Invoke("Register", new object[] {
                 customer});
     return ((ResponseInfo<Customer>)(results[0]));
 }
 public ResponseInfo<Customer> Login(Customer customer)
 {
     object[] results = this.Invoke("Login", new object[] {
                 customer});
     return ((ResponseInfo<Customer>)(results[0]));
 }