コード例 #1
0
 public override List <Product> SearchAll()
 {
     using (RequestItEntities db = new RequestItEntities())
     {
         return(db.Products.ToList());
     }
 }
コード例 #2
0
 public override List <RequestsItem> SearchAll()
 {
     using (RequestItEntities db = new RequestItEntities())
     {
         return(db.RequestsItems.ToList());
     }
 }
コード例 #3
0
 public RequestsItem SearchProductItemOfRequestItem(int productId)
 {
     using (RequestItEntities db = new RequestItEntities())
     {
         var request = (from ri in db.RequestsItems
                        where ri.productId == productId
                        select ri).FirstOrDefault();
         return(request);
     }
 }
コード例 #4
0
 public List <RequestsItem> SearchByRequestId(int requestId)
 {
     using (RequestItEntities db = new RequestItEntities())
     {
         var request = (from ri in db.RequestsItems
                        where ri.requestId == requestId
                        select ri).ToList();
         return(request);
     }
 }
コード例 #5
0
 public override RequestsItem Search(int id)
 {
     using (RequestItEntities db = new RequestItEntities())
     {
         var request = (from requests in db.RequestsItems
                        where requests.id == id
                        select requests).FirstOrDefault();
         return(request);
     }
 }
コード例 #6
0
 public CompoundProduct SearchProductItemOfCompoundProduct(int productId)
 {
     using (RequestItEntities db = new RequestItEntities())
     {
         var piocp = (from cp in db.CompoundProducts
                      where (cp.productId == productId)
                      select cp).FirstOrDefault();
         return(piocp);
     }
 }
コード例 #7
0
 public override Product Search(int id)
 {
     using (RequestItEntities db = new RequestItEntities())
     {
         var products = (from product in db.Products
                         where product.id == id
                         select product).Include(cp => cp.CompoundProducts).FirstOrDefault();
         return(products);
     }
 }
コード例 #8
0
 public CompoundProduct SearchCompound(int productId, int compoundProductId)
 {
     using (RequestItEntities db = new RequestItEntities())
     {
         var cpc = (from cp in db.CompoundProducts
                    where (cp.compoundProductId == compoundProductId) && (cp.productId == productId)
                    select cp).FirstOrDefault();
         return(cpc);
     }
 }
コード例 #9
0
 public override bool Delete(RequestsItem obj)
 {
     using (RequestItEntities db = new RequestItEntities())
     {
         RequestsItem requestItem = (from ri in db.RequestsItems
                                     where ri.id == obj.id
                                     select ri).FirstOrDefault();
         db.RequestsItems.Remove(requestItem);
         return(db.SaveChanges() > 0);
     }
 }
コード例 #10
0
 public override bool Delete(Product obj)
 {
     using (RequestItEntities db = new RequestItEntities())
     {
         Product product = (from p in db.Products
                            where p.id == obj.id
                            select p).FirstOrDefault();
         db.Products.Remove(product);
         return(db.SaveChanges() > 0);
     }
 }
コード例 #11
0
 public override bool Delete(CompoundProduct obj)
 {
     using (RequestItEntities db = new RequestItEntities())
     {
         CompoundProduct compoundProduct = (from cp in db.CompoundProducts
                                            where cp.id == obj.id
                                            select cp).FirstOrDefault();
         db.CompoundProducts.Remove(compoundProduct);
         return(db.SaveChanges() > 0);
     }
 }
コード例 #12
0
 public override CompoundProduct Search(int id)
 {
     using (RequestItEntities db = new RequestItEntities())
     {
         var cpc = (from cp in db.CompoundProducts
                    where cp.id == id
                    join p in db.Products
                    on cp.productId equals p.id
                    select cp).FirstOrDefault();
         return(cpc);
     }
 }
コード例 #13
0
 public bool DeleteByRequestId(int requestId)
 {
     using (RequestItEntities db = new RequestItEntities())
     {
         List <RequestsItem> requestItems = (from ri in db.RequestsItems
                                             where ri.requestId == requestId
                                             select ri).ToList();
         foreach (RequestsItem requestItem in requestItems)
         {
             db.RequestsItems.Remove(requestItem);
         }
         return(db.SaveChanges() > 0);
     }
 }
コード例 #14
0
 public override bool Save(bool Insert, RequestsItem obj)
 {
     using (RequestItEntities db = new RequestItEntities())
     {
         if (Insert)
         {
             db.RequestsItems.Add(obj);
         }
         else
         {
             db.RequestsItems.Attach(obj);
             db.Entry(obj).State = EntityState.Modified;
         }
         return(db.SaveChanges() > 0);
     }
 }
コード例 #15
0
 public override List <Product> Search(string description)
 {
     using (RequestItEntities db = new RequestItEntities())
     {
         if (description != "")
         {
             return((from p in db.Products
                     where p.name.ToUpper().Contains(description.ToUpper())
                     select p).ToList());
         }
         else
         {
             return(SearchAll());
         }
     }
 }
コード例 #16
0
 public override List <Request> Search(string employeeName)
 {
     using (RequestItEntities db = new RequestItEntities())
     {
         if (employeeName != "")
         {
             return((from r in db.Requests
                     where r.employeeName.ToUpper().Contains(employeeName.ToUpper())
                     select r).ToList());
         }
         else
         {
             return(SearchAll());
         }
     }
 }