예제 #1
0
        //catch (Exception ex) {
        //    return false;
        //    }
        //    return false;
        //}

        public bool checkCellPhone(CustomerInfo customerInfo)
        {
            StockEntities db = new StockEntities();

            if (Regex.Match(customerInfo.CustCellPhone, @"^\d{ 10,}$").Success)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #2
0
        public int Custchecklogin(CustLogin custlogin, string x, string y)
        {
            StockEntities db = new StockEntities();
            int           z;
            var           query = from o in db.CustLogins
                                  where o.CustLoginName == custlogin.CustLoginName
                                  select o;

            try {
                List <CustLogin> lgin = query.ToList();
                if (lgin.Count() > 0)
                {
                    if (custlogin.CustPassword == lgin[0].CustPassword)
                    {
                        return(z = 1);
                    }
                }
            } catch { return(z = 0); }
            return(z = -1);
        }
예제 #3
0
        public bool AddProduct(int ProdId)
        {
            var findItem = this.cartItems.Where(s => s.ProdId == ProdId)
                           .Select(s => s)
                           .FirstOrDefault();

            if (findItem == default(CartItem))
            {
                using (StockEntities db = new StockEntities()) {
                    var product = (from s in db.ProdInfoes
                                   where s.ProdId == ProdId
                                   select s).FirstOrDefault();
                    if (product != default(ProdInfo))
                    {
                        this.AddProduct(product);
                    }
                }
            }
            else
            {
                findItem.ProdQuantity += 1;
            }
            return(true);
        }