コード例 #1
0
 public List <ProductCategory> aa(int?ID)
 {
     try
     {
         using (ProductEva_Entities1 product = new ProductEva_Entities1())
         {
             var ID2 = product.Products.Where(x => x.ProductID == ID);
             var qu  = ID2.Select(x => x.ProductCategoryID);
             List <ProductCategory> productCategories = new List <ProductCategory>();
             foreach (var item in qu)
             {
                 int counter  = 0;
                 var category = product.ProductCategory.Where(x => x.ProductCategoryID == item);
                 foreach (var item2 in category)
                 {
                     var lastItem = category.Where(x => x.ProductCategoryName == x.ProductCategoryName).OrderBy(x => x.ProductCategoryName).Skip(counter).FirstOrDefault();
                     productCategories.Add(lastItem);
                 }
             }
             return(productCategories.ToList());
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #2
0
 public BitmapImage feedBakcImage(int feedBackDetailID)
 {
     try
     {
         using (ProductEva_Entities1 product = new ProductEva_Entities1())
         {
             var         row         = product.FeedBackDetail.Where(x => x.FeedBackDetail_ID == feedBackDetailID).FirstOrDefault();
             BitmapImage bitmapImage = new BitmapImage();
             string      imgFilePath = row.IMG;
             if (row.IMG != null)
             {
                 bitmapImage.BeginInit();
                 bitmapImage.UriSource = new Uri(imgFilePath);
                 bitmapImage.EndInit();
                 return(bitmapImage);
             }
             else
             {
                 bitmapImage.BeginInit();
                 bitmapImage.UriSource = new Uri("C:\\b\\resimyok.png");
                 bitmapImage.EndInit();
                 return(bitmapImage);
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #3
0
        public List <Sells> GetSells(int companyID)
        {
            try
            {
                using (ProductEva_Entities1 product = new ProductEva_Entities1())
                {
                    int          counter      = 0;
                    var          CompanySells = product.Products.Where(x => x.CompanyID == companyID);
                    var          productID    = CompanySells.Select(x => x.ProductID);
                    List <Sells> selList      = new List <Sells>();
                    foreach (var ID in productID)
                    {
                        counter = 0;
                        var sells = product.Sells.Where(x => x.ProductID == ID);
                        foreach (var ID2 in sells)
                        {
                            var sells2 = sells.Where(x => x.Sell_Id == x.Sell_Id).OrderBy(x => x.Sell_Id).Skip(counter).FirstOrDefault();
                            selList.Add(sells2);
                            counter++;
                        }
                    }

                    return(selList.ToList());
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #4
0
        public string UserTicketProduct(int ProductID, bool re)
        {
            try
            {
                using (ProductEva_Entities1 product = new ProductEva_Entities1())
                {
                    var productName = product.Products.Where(x => x.ProductID == ProductID).FirstOrDefault();
                    int?companyID   = productName.CompanyID;
                    var companyName = product.Company.Where(x => x.CompanyID == companyID).FirstOrDefault();

                    if (re == true)
                    {
                        return(companyName.CompanyName);
                    }

                    else
                    {
                        return(productName.PName);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #5
0
        public BitmapImage Image(int ID)
        {
            try
            {
                using (ProductEva_Entities1 product = new ProductEva_Entities1())
                {
                    var imgFilePath = product.Products.Where(x => x.ProductID == ID).Select(x => x.IMG).FirstOrDefault();

                    BitmapImage bitmapImage = new BitmapImage();
                    if (imgFilePath != null)
                    {
                        bitmapImage.BeginInit();
                        bitmapImage.UriSource = new Uri(imgFilePath);
                        bitmapImage.EndInit();

                        return(bitmapImage);
                    }

                    else
                    {
                        bitmapImage.BeginInit();
                        bitmapImage.UriSource = new Uri("C:\\b\\resimyok.png");
                        bitmapImage.EndInit();

                        return(bitmapImage);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #6
0
        public double?AVgPointForProduct(int ID)
        {
            try
            {
                using (ProductEva_Entities1 product = new ProductEva_Entities1())
                {
                    var feedback = product.FeedBack.Where(x => x.ProductID == ID).Select(x => x.ReturnID);
                    IQueryable <int?> feedBack_Detail;
                    double?           feedBackDetail = 0;
                    foreach (var item in feedback)
                    {
                        feedBack_Detail = product.FeedBack_FeedBackDetail.Where(x => x.FeedBack_ID == item).Select(x => x.FeedBakcDetailID);
                        foreach (var item2 in feedBack_Detail)
                        {
                            feedBackDetail = product.FeedBackDetail.Where(x => x.FeedBackDetail_ID == item2).Average(x => x.Dayanıklılık + x.DısGörünüs + x.FiyatPerf + x.Kalite + x.KullanımKolaylıgı);
                        }
                    }

                    if (feedBackDetail != 0)
                    {
                        return(feedBackDetail / 5);
                    }
                    else
                    {
                        return(0);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #7
0
        public List <V_FeedBakDetail> UserTicket(int UserID)
        {
            try
            {
                using (ProductEva_Entities1 product = new ProductEva_Entities1())
                {
                    var userTicket = product.V_FeedBakDetail.Where(x => x.UserID == UserID);

                    return(userTicket.ToList());

                    //var userFeedBack = product.FeedBack.Where(x=> x.UserID==UserID).Select(x=> x.ReturnID);

                    //if (userFeedBack!=null)
                    //{
                    //    var userTicket = product.FeedBack_FeedBackDetail.Where(x=> x.FeedBack_ID==int.Parse(userFeedBack.ToString())).Select(x=> x.FeedBakcDetailID);
                    //    if (userTicket!=null)
                    //    {
                    //        product.Fee
                    //    }
                    //}
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #8
0
        public bool NewFeedBackStatus(int?userID, int?productID)
        {
            try
            {
                using (ProductEva_Entities1 product = new ProductEva_Entities1())
                {
                    var  control  = product.FeedBack.Where(x => x.UserID == userID);
                    bool control2 = false;
                    foreach (var item in control)
                    {
                        if (item.ProductID == productID)
                        {
                            control2 = true;
                        }
                    }

                    if (control2 == false)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #9
0
        //public void UpdatePro(Products product) {

        //    using (ProductEva_Entities1 productEva = new ProductEva_Entities1())
        //    {
        //        var row = productEva.Products.Where(x=> x.ProductID==product.ProductID).FirstOrDefault();
        //        row.PName = product.PName;
        //        row.Color = product.Color;
        //        row.Price = product.Price;
        //        row.SellStartDate = product.SellStartDate;
        //        row.ProductCategoryID = product.ProductCategoryID;
        //        row.IMG = product.IMG;

        //        productEva.SaveChanges();
        //    }

        //}
        public List <string> vs()
        {
            try
            {
                using (ProductEva_Entities1 product = new ProductEva_Entities1())
                {
                    var           cID = product.Category.Select(x => x.CategoryID);
                    int           counter;
                    List <string> name = new List <string>();

                    foreach (var items in cID)
                    {
                        counter = 0;
                        var Pcategory = product.ProductCategory.Where(x => x.CategoryID == items);
                        foreach (var item in Pcategory)
                        {
                            var id = Pcategory.Where(x => x.ProductCategoryID == item.ProductCategoryID).Select(x => x.ProductCategoryName).Skip(counter).FirstOrDefault();
                            counter++;
                            name.Add(id);
                        }
                    }
                    return(name.ToList());
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #10
0
        public List <V_FeedBakDetail> GetViewFeedBak(int ID)
        {
            try
            {
                using (ProductEva_Entities1 product = new ProductEva_Entities1())
                {
                    int skip      = 0;
                    var productID = product.Products.Where(x => x.CompanyID == ID);

                    var products = productID.Select(x => x.ProductID).ToList();
                    List <V_FeedBakDetail> ff = new List <V_FeedBakDetail>();
                    foreach (var item in products)
                    {
                        skip = 0;
                        var v_FeedBak = product.V_FeedBakDetail.Where(x => x.ProductID == item);
                        foreach (var item2 in v_FeedBak)
                        {
                            var v_back = v_FeedBak.Where(x => x.UserReview == x.UserReview).OrderBy(x => x.CompanyReview).Skip(skip).FirstOrDefault();
                            if (v_FeedBak != null)
                            {
                                ff.Add(v_back);
                            }
                            skip++;
                        }
                    }
                    return(ff.ToList());
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #11
0
 public string GetUserName(int?id)
 {
     using (ProductEva_Entities1 product = new ProductEva_Entities1())
     {
         var name = product.Users.Where(x => x.UserID == id).Select(x => x.UserName).FirstOrDefault();
         return(name);
     }
 }
コード例 #12
0
 public string GetProductName(int?id)
 {
     using (ProductEva_Entities1 product = new ProductEva_Entities1())
     {
         var productName = product.Products.Where(x => x.ProductID == id).Select(x => x.PName).FirstOrDefault();
         return(productName);
     }
 }
コード例 #13
0
 public void NewADmin(Company admins)
 {
     using (ProductEva_Entities1 product = new ProductEva_Entities1())
     {
         product.Company.Add(admins);
         product.SaveChanges();
     }
 }
コード例 #14
0
 public void UserBuy(Sells sells)
 {
     using (ProductEva_Entities1 product = new ProductEva_Entities1())
     {
         product.Sells.Add(sells);
         product.SaveChanges();
     }
 }
コード例 #15
0
 public void NewProduct(Products products)
 {
     using (ProductEva_Entities1 entiti = new ProductEva_Entities1())
     {
         entiti.Products.Add(products);
         entiti.SaveChanges();
     }
 }
コード例 #16
0
 public Users getUserInfo(int ID)
 {
     try
     {
         using (ProductEva_Entities1 product = new ProductEva_Entities1())
         {
             return(product.Users.Where(x => x.UserID == ID).FirstOrDefault());
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #17
0
 public List <string> returnProductCategory()
 {
     try
     {
         using (ProductEva_Entities1 product = new ProductEva_Entities1())
         {
             return(product.ProductCategory.Select(x => x.ProductCategoryName).ToList());
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #18
0
 public List <V_Categories> GetCategories()
 {
     try
     {
         using (ProductEva_Entities1 product = new ProductEva_Entities1())
         {
             var a = product.V_Categories.ToList();
             return(a);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #19
0
 public List <Sells> getUserProducts(int ID)
 {
     try
     {
         using (ProductEva_Entities1 product = new ProductEva_Entities1())
         {
             var userProducts = product.Sells.Where(x => x.UserID == ID);
             return(userProducts.ToList());
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #20
0
 public List <string> CompanyNamesforUI()
 {
     try
     {
         using (ProductEva_Entities1 product = new ProductEva_Entities1())
         {
             var companyName = product.Company.Select(x => x.CompanyName);
             return(companyName.ToList());
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #21
0
 public List <V_Product_V> ListProductCategory(string CategoryName)
 {
     try
     {
         using (ProductEva_Entities1 product = new ProductEva_Entities1())
         {
             var source = product.V_Product_V.Where(x => x.CategoryName == CategoryName);
             return(source.ToList());
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #22
0
 public bool flagControl(int ID)
 {
     using (ProductEva_Entities1 product = new ProductEva_Entities1())
     {
         var flagCont = product.FeedBackDetail.Where(x => x.FeedBackDetail_ID == ID).FirstOrDefault();
         if (flagCont.Flag == 1)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
 }
コード例 #23
0
 public void NewUser(Users users)
 {
     try
     {
         using (ProductEva_Entities1 product = new ProductEva_Entities1())
         {
             product.Users.Add(users);
             product.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #24
0
        public List <string> UserPoint(int?ProductID, int?UserID)
        {
            try
            {
                using (ProductEva_Entities1 product = new ProductEva_Entities1())
                {
                    var           userFeedBack       = product.FeedBack.Where(x => x.ProductID == ProductID).Where(x => x.UserID == UserID).FirstOrDefault();
                    List <string> userFeedBackPoints = new List <string>();
                    if (userFeedBack != null)
                    {
                        var FeedBack_feedBackdetail = product.FeedBack_FeedBackDetail.Where(x => x.FeedBack_ID == userFeedBack.ReturnID).FirstOrDefault();

                        var feedBackDetail = product.FeedBackDetail.Where(x => x.FeedBackDetail_ID == FeedBack_feedBackdetail.FeedBakcDetailID).FirstOrDefault();

                        if (feedBackDetail.DısGörünüs != null && feedBackDetail.FiyatPerf != null && feedBackDetail.KullanımKolaylıgı != null && feedBackDetail.Kalite != null && feedBackDetail.Dayanıklılık != null)
                        {
                            userFeedBackPoints.Add(feedBackDetail.DısGörünüs.ToString());

                            userFeedBackPoints.Add(feedBackDetail.FiyatPerf.ToString());

                            userFeedBackPoints.Add(feedBackDetail.KullanımKolaylıgı.ToString());

                            userFeedBackPoints.Add(feedBackDetail.Kalite.ToString());

                            userFeedBackPoints.Add(feedBackDetail.Dayanıklılık.ToString());

                            userFeedBackPoints.Add(feedBackDetail.UserReview);

                            return(userFeedBackPoints.ToList());
                        }
                        else
                        {
                            userFeedBackPoints = null;
                            return(userFeedBackPoints);
                        }
                    }
                    else
                    {
                        userFeedBackPoints = null;
                        return(userFeedBackPoints);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #25
0
        public Company Company(int ID)
        {
            try
            {
                using (ProductEva_Entities1 product = new ProductEva_Entities1())
                {
                    var row = product.Company.Where(x => x.CompanyID == ID).FirstOrDefault();

                    return(row);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #26
0
        public List <V_Product_V> ProductList(string name)
        {
            try
            {
                using (ProductEva_Entities1 product = new ProductEva_Entities1())
                {
                    var source = product.V_Product_V.Where(x => x.CompanyName == name);

                    return(source.ToList());
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #27
0
 public void flag(Sells sells)
 {
     try
     {
         using (ProductEva_Entities1 product = new ProductEva_Entities1())
         {
             var sel = product.Sells.Where(x => x.Sell_Id == sells.Sell_Id).FirstOrDefault();
             sel.DeliveryFlag = sells.DeliveryFlag;
             product.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #28
0
 public int GetCompanyID(string companyName)
 {
     try
     {
         using (ProductEva_Entities1 product = new ProductEva_Entities1())
         {
             var name = product.Company.Where(x => x.CompanyName == companyName).FirstOrDefault();
             int id   = name.CompanyID;
             return(id);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #29
0
 public List <V_Product_V> getView(int ID)
 {
     try
     {
         using (ProductEva_Entities1 product = new ProductEva_Entities1())
         {
             var cName    = product.Company.Where(x => x.CompanyID == ID).FirstOrDefault();
             var products = product.V_Product_V.Where(x => x.CompanyName == cName.CompanyName);
             return(products.ToList());
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #30
0
 public void NewPerCategory(ProductCategory productCategory, string categoryName)
 {
     try
     {
         using (ProductEva_Entities1 product = new ProductEva_Entities1())
         {
             var category = product.Category.Where(x => x.CategoryName == categoryName).FirstOrDefault();
             int id       = category.CategoryID;
             productCategory.CategoryID = id;
             product.ProductCategory.Add(productCategory);
             product.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }