Esempio n. 1
0
 public CDMarzoAutoShopMethods()
 {
     customerinfobll = new CustomerInfoDAL();
     itembll         = new ItemDAL();
     orderinfobll    = new OrderInfoDAL();
     salesbll        = new SalesDAL();
 }
Esempio n. 2
0
        public void TestMethod1()
        {
            var bll = new CustomerInfoBLL();
            var rs  = bll.GetModel(1);

            Assert.IsNotNull(rs, "失败");
        }
Esempio n. 3
0
        public object Delete([FromBody] CustomerInfo model)
        {
            int result = CustomerInfoBLL.Delete(model);

            if (result > 0)
            {
                return(new { result = 0 });
            }
            return(new { result = 1 });
        }
Esempio n. 4
0
        public object Put([FromBody] CustomerInfo model)
        {
            if (string.IsNullOrWhiteSpace(model.CustomerAccount) || string.IsNullOrWhiteSpace(model.CustomerName) || string.IsNullOrWhiteSpace(model.CustomerPwd))
            {
                return(new { result = Result.ValueCanNotBeNull });
            }

            if (!Regex.IsMatch(model.CustomerAccount, @"^[a-zA-Z_]\w{3,16}"))
            {
                return(new { result = Result.AccountOnlyConsistOfLettersAndNumbers });
            }
            if (!Regex.IsMatch(model.CustomerName, @"^[\u0391-\uFFE5a-zA-Z_]\w{3,16}"))
            {
                return(new { result = Result.AccountOnlyConsistOfLettersAndNumbers });
            }


            CustomerInfo mi = CustomerInfoBLL.GetModel(model);

            if (mi != null)
            {
                return(new { result = Result.AccountHasBeenRegistered });
            }


            model.CustomerState = 0;
            model.CustomerPwd   = Utils.MD5(model.CustomerPwd);
            model.CreateDate    = DateTime.Now;



            int result = CustomerInfoBLL.Add(model);

            if (result > 0)
            {
                return(new { result = 0 });
            }

            return(new { result = 4 });
        }
Esempio n. 5
0
        public object Options([FromBody] CustomerInfo model)
        {
            if (string.IsNullOrWhiteSpace(model.CustomerName))
            {
                return(new { result = Result.ValueCanNotBeNull });
            }


            if (!Regex.IsMatch(model.CustomerName, @"^[\u0391-\uFFE5a-zA-Z_]\w{3,16}"))
            {
                return(new { result = Result.AccountOnlyConsistOfLettersAndNumbers });
            }


            CustomerInfo mi = CustomerInfoBLL.GetModelByID(model);

            if (!string.IsNullOrWhiteSpace(model.CustomerPwd) && mi.CustomerPwd != Utils.MD5(model.CustomerPwd))
            {
                mi.CustomerPwd = Utils.MD5(model.CustomerPwd);
            }



            mi.CustomerName = model.CustomerName;



            int result = CustomerInfoBLL.Update(mi);

            if (result > 0)
            {
                return(new { result = 0 });
            }

            return(new { result = 4 });
        }