예제 #1
0
 public static int GetProductID(string proName, double salePrice, string explanation)
 {
     using (AccDeficitEntities s = new AccDeficitEntities()) {
         return(s.Products.Where(x => x.proName == proName && x.salePrice == salePrice &&
                                 x.Cate.explanation == explanation).FirstOrDefault().productID);
     }
 }
예제 #2
0
        public static ResultSet CRUD(Cate cate, EntityState state)
        {
            using (AccDeficitEntities s = new AccDeficitEntities()) {
                s.Entry(cate).State = state;

                if (s.SaveChanges() > 0)
                {
                    r.isSuccess = true;
                    if (state == EntityState.Added)
                    {
                        r.Message = "Kategori sisteme başarıyla eklendi!";
                    }
                    else if (state == EntityState.Modified)
                    {
                        r.Message = null;
                    }
                    else if (state == EntityState.Deleted)
                    {
                        r.Message = "Kategori silindi!";
                    }
                    r.Cate     = cate;
                    r.iconType = IconType.ok;
                }
                else
                {
                    r.isSuccess = false;
                    r.Message   = "Hata!!";
                    r.Cate      = cate;
                    r.iconType  = IconType.warning;
                }
                return(r);
            }
        }
 public static int GetCustomerID(string name, string sname, string phone, string addressLine)
 {
     using (AccDeficitEntities s = new AccDeficitEntities()) {
         return(s.Customers.Where(x => x.cFirstName == name && x.cLastName == sname &&
                                  x.phone == phone && x.addressLine == addressLine).FirstOrDefault().customerID);
     }
 }
예제 #4
0
        public static OrderModel GetOrderModel(int orderID)
        {
            using (AccDeficitEntities s = new AccDeficitEntities()) {
                var dbOrd = s.Orders.Where(x => x.orderID == orderID).FirstOrDefault();

                return(ConvertToModel(dbOrd));
            }
        }
        public static string GetCustomerFullName(int customerID)
        {
            using (AccDeficitEntities s = new AccDeficitEntities()) {
                var cus = s.Customers.Where(x => x.customerID == customerID).FirstOrDefault();

                return(cus.cFirstName + " " + cus.cLastName);
            }
        }
예제 #6
0
        public static List <ProductModel> GetProductModelList()
        {
            using (AccDeficitEntities s = new AccDeficitEntities()) {
                var dbList = s.Products.ToList();

                return(ConvertToModelList(dbList));
            }
        }
예제 #7
0
        public static List <OrderModel> GetOrderModelList(int cusID)
        {
            using (AccDeficitEntities s = new AccDeficitEntities()) {
                var dbList = s.Orders.Where(x => x.Customers.customerID == cusID).ToList();

                return(ConvertToModelList(dbList));
            }
        }
예제 #8
0
        public static List <OrderModel> GetOrderModelProList(string query)
        {
            using (AccDeficitEntities s = new AccDeficitEntities()) {
                var dbList = s.Orders.Where(x => x.Products.proName.Contains(query)).ToList();

                return(ConvertToModelList(dbList));
            }
        }
예제 #9
0
        public static List <OrderModel> GetOrderModelCusList(string query)
        {
            using (AccDeficitEntities s = new AccDeficitEntities()) {
                var dbList = s.Orders.Where(x => (x.Customers.cFirstName + " " + x.Customers.cLastName).Contains(query)).ToList();

                return(ConvertToModelList(dbList));
            }
        }
예제 #10
0
        public static List <OrderModel> GetOrderModelList()
        {
            using (AccDeficitEntities s = new AccDeficitEntities()) {
                var dbList = s.Orders.ToList();

                return(ConvertToModelList(dbList));
            }
        }
예제 #11
0
        public static ProductModel GetProductModel(int productID)
        {
            using (AccDeficitEntities s = new AccDeficitEntities()) {
                var dbPro = s.Products.Where(x => x.productID == productID).FirstOrDefault();

                return(ConvertToModel(dbPro));
            }
        }
        public static List <string> GetPhoneNumbers()
        {
            List <string> numbers = new List <string>();

            using (AccDeficitEntities s = new AccDeficitEntities()) {
                foreach (var item in GetCustomerList())
                {
                    numbers.Add(item.phone);
                }
                return(numbers);
            }
        }
예제 #13
0
        public static List <OrderModel> GetOrderModelCateList(string query)
        {
            using (AccDeficitEntities s = new AccDeficitEntities()) {
                var           cateList  = s.Cate.Where(x => x.cateName.Contains(query)).ToList();
                List <Orders> dbOrdList = new List <Orders>();

                foreach (var item in cateList)
                {
                    var ordList = s.Orders.Where(x => x.Products.cateID == item.cateID).ToList();
                    dbOrdList.AddRange(ordList);
                }
                return(ConvertToModelList(dbOrdList));
            }
        }
예제 #14
0
        public static ResultSet CRUD(Orders ord, EntityState state)
        {
            using (AccDeficitEntities s = new AccDeficitEntities()) {
                s.Entry(ord).State = state;

                if (s.SaveChanges() > 0)
                {
                    r.isSuccess = true;
                    r.Message   = "Satış kaydı eklendi!";
                    r.Order     = ord;
                    r.iconType  = IconType.ok;
                }
                else
                {
                    r.isSuccess = false;
                    r.Message   = "Hata!!";
                    r.Order     = ord;
                    r.iconType  = IconType.warning;
                }
                return(r);
            }
        }
예제 #15
0
        public static ResultSet CRUD(Signin sign, EntityState state)
        {
            using (AccDeficitEntities s = new AccDeficitEntities()) {
                s.Entry(sign).State = state;

                if (s.SaveChanges() > 0)
                {
                    r.isSuccess = true;
                    r.Message   = "Şifre başarıyla değiştirildi!";
                    r.Signin    = sign;
                    r.iconType  = IconType.ok;
                }
                else
                {
                    r.isSuccess = false;
                    r.Message   = "Hata!!";
                    r.Signin    = sign;
                    r.iconType  = IconType.warning;
                }
                return(r);
            }
        }
 public static List <Customers> GetCustomerList()
 {
     using (AccDeficitEntities s = new AccDeficitEntities()) {
         return(s.Customers.ToList());
     }
 }
예제 #17
0
 public static List <Cate> GetCateList()
 {
     using (AccDeficitEntities s = new AccDeficitEntities()) {
         return(s.Cate.ToList());
     }
 }
예제 #18
0
 public static int GetCateID(string cName, string exp)
 {
     using (AccDeficitEntities s = new AccDeficitEntities()) {
         return(s.Cate.Where(x => x.cateName == cName && x.explanation == exp).FirstOrDefault().cateID);
     }
 }
예제 #19
0
 public static int GetCateIDbyName(string cName)
 {
     using (AccDeficitEntities s = new AccDeficitEntities()) {
         return(s.Cate.Where(x => x.cateName == cName).FirstOrDefault().cateID);
     }
 }
예제 #20
0
 public static Cate GetCate(int cateID)
 {
     using (AccDeficitEntities s = new AccDeficitEntities()) {
         return(s.Cate.Where(x => x.cateID == cateID).FirstOrDefault());
     }
 }
 public static Customers GetCustomer(int customerID)
 {
     using (AccDeficitEntities s = new AccDeficitEntities()) {
         return(s.Customers.Where(x => x.customerID == customerID).FirstOrDefault());
     }
 }
 public static int GetCustomerID(string fullName)
 {
     using (AccDeficitEntities s = new AccDeficitEntities()) {
         return(s.Customers.Where(x => x.cFirstName + " " + x.cLastName == fullName).FirstOrDefault().customerID);
     }
 }
예제 #23
0
 public static Signin GetUser(int signinID)
 {
     using (AccDeficitEntities s = new AccDeficitEntities()) {
         return(s.Signin.Where(x => x.signinID == signinID).FirstOrDefault());
     }
 }
예제 #24
0
 public static Products GetProduct(int productID)
 {
     using (AccDeficitEntities s = new AccDeficitEntities()) {
         return(s.Products.Where(x => x.productID == productID).FirstOrDefault());
     }
 }
예제 #25
0
 public static List <Signin> GetUserList()
 {
     using (AccDeficitEntities s = new AccDeficitEntities()) {
         return(s.Signin.ToList());
     }
 }