示例#1
0
 public static List <KartelaProduct> Edit(int Id)
 {
     using (var db = new MTSEntities())
     {
         var model = (from x in db.KartelaProduct where x.Id == Id select x).ToList();
         return(model);
     }
 }
示例#2
0
 public static List <Kartela> List()
 {
     using (var db = new MTSEntities())
     {
         var kartela = (from x in db.Kartela select x).ToList();
         return(kartela);
     }
 }
示例#3
0
 public static List <Kartela> Edit(int Id)
 {
     using (var db = new MTSEntities())
     {
         var kartela = (from x in db.Kartela where x.Id == Id select x).ToList();
         return(kartela);
     }
 }
示例#4
0
 public static List <KartelaProduct> KartelaForProduct(int KartelaId)
 {
     using (var db = new MTSEntities())
     {
         var kartelaForProduct = (from x in db.KartelaProduct where x.KartelaId == KartelaId select x).ToList();
         return(kartelaForProduct);
     }
 }
示例#5
0
 public static List <Product> List()
 {
     using (var db = new MTSEntities())
     {
         var Produtcs = (from x in db.Product select x).ToList();
         return(Produtcs);
     }
 }
示例#6
0
 public static List <Product> Edit(int Id)
 {
     using (var db = new MTSEntities())
     {
         var Products = (from x in db.Product where x.Id == Id select x).ToList();
         return(Products);
     }
 }
示例#7
0
 public static List <User> GetUser()
 {
     using (var db = new MTSEntities())
     {
         var users = (from x in db.User select x).ToList();
         return(users);
     }
 }
示例#8
0
 public static List <tblModel> Edit(int Id)
 {
     using (var db = new MTSEntities())
     {
         var model = (from x in db.tblModel where x.Id == Id select x).ToList();
         return(model);
     }
 }
示例#9
0
 public static List <tblModel> ProductForModel(int ProductId)
 {
     using (var db = new MTSEntities())
     {
         var productForModel = (from x in db.tblModel where x.ProductId == ProductId select x).ToList();
         return(productForModel);
     }
 }
示例#10
0
 public static List <User> Edit(int Id)
 {
     using (var db = new MTSEntities())
     {
         var users = (from x in db.User where x.Id == Id select x).ToList();
         return(users);
     }
 }
示例#11
0
 public static List <Customer> List()
 {
     using (var db = new MTSEntities())
     {
         var customers = (from x in db.Customer select x).ToList();
         return(customers);
     }
 }
示例#12
0
        public static int Add(Order order)
        {
            try
            {
                using (var db = new MTSEntities())
                {
                    var item = new Order
                    {
                        Cila        = order.Cila,
                        CustomerId  = order.CustomerId,
                        Description = order.Description,
                        FinishDate  = order.FinishDate,
                        KaporaPrice = order.KaporaPrice,

                        KartelaId      = order.KartelaId,
                        KartelaModelId = order.KartelaModelId,
                        ModelId        = order.ModelId,

                        ProductId  = order.ProductId,
                        StartDate  = order.StartDate,
                        TotalPrice = order.TotalPrice,

                        ProductId2      = order.ProductId2,
                        ModelId2        = order.ModelId2,
                        KartelaId2      = order.KartelaId2,
                        KartelaModelId2 = order.KartelaModelId2,
                        Cila2           = order.Cila2,
                        Description2    = order.Description2,

                        ProductId3      = order.ProductId3,
                        ModelId3        = order.ModelId3,
                        KartelaId3      = order.KartelaId3,
                        KartelaModelId3 = order.KartelaModelId3,
                        Cila3           = order.Cila3,
                        Description3    = order.Description3,

                        ProductId4      = order.ProductId4,
                        ModelId4        = order.ModelId4,
                        KartelaId4      = order.KartelaId4,
                        KartelaModelId4 = order.KartelaModelId4,
                        Cila4           = order.Cila4,
                        Description4    = order.Description4,

                        KaporaType  = order.KaporaType,
                        PaymentType = order.PaymentType,
                    };
                    db.Order.Add(item);
                    db.SaveChanges();
                    return(1);
                }
            }
            catch (Exception ex)
            {
                return(0);
            }
        }
示例#13
0
 public static List <User> GetUserLogin(User user)
 {
     using (var db = new MTSEntities())
     {
         var getuser = (from x in db.User
                        where x.Email == user.Email && x.Password == user.Password
                        select x).ToList();
         return(getuser);
     }
 }
示例#14
0
        public static int Update(Order order)
        {
            try
            {
                using (var db = new MTSEntities())
                {
                    Order temp = db.Order.SingleOrDefault(x => x.Id == order.Id);
                    temp.FinishDate = order.FinishDate;
                    temp.StartDate  = order.StartDate;

                    temp.ProductId  = order.ProductId;
                    temp.ProductId2 = order.ProductId2;
                    temp.ProductId3 = order.ProductId3;
                    temp.ProductId4 = order.ProductId4;

                    temp.ModelId  = order.ModelId;
                    temp.ModelId2 = order.ModelId2;
                    temp.ModelId3 = order.ModelId3;
                    temp.ModelId4 = order.ModelId4;

                    temp.KartelaModelId  = order.KartelaModelId;
                    temp.KartelaModelId2 = order.KartelaModelId2;
                    temp.KartelaModelId3 = order.KartelaModelId3;
                    temp.KartelaModelId4 = order.KartelaModelId4;

                    temp.KartelaId  = order.KartelaId;
                    temp.KartelaId2 = order.KartelaId2;
                    temp.KartelaId3 = order.KartelaId3;
                    temp.KartelaId4 = order.KartelaId4;

                    temp.Description  = order.Description;
                    temp.Description2 = order.Description2;
                    temp.Description3 = order.Description3;
                    temp.Description4 = order.Description4;

                    temp.CustomerId = order.CustomerId;

                    temp.Cila  = order.Cila;
                    temp.Cila2 = order.Cila2;
                    temp.Cila3 = order.Cila3;
                    temp.Cila4 = order.Cila4;

                    temp.TotalPrice = order.TotalPrice;
                    db.SaveChanges();
                    return(1);
                }
            }
            catch (Exception ex)
            {
                return(0);
            }
        }
示例#15
0
        public static List <OrderCustomerProduct> Edit(int Id)
        {
            using (var db = new MTSEntities())
            {
                var getOrder = (from order in db.Order
                                join customer in db.Customer on order.CustomerId equals customer.Id
                                where order.Id == Id
                                select new OrderCustomerProduct
                {
                    Id = order.Id,
                    CustomerId = customer.Id,
                    StartDate = order.StartDate.ToString(),
                    FinishDate = order.FinishDate.ToString(),

                    ProductId = order.ProductId,
                    ModelId = order.ModelId,
                    KartelaId = order.KartelaId,
                    KartelaModelId = order.KartelaModelId,
                    Cila = order.Cila,
                    Description = order.Description,


                    ProductId2 = order.ProductId2,
                    ModelId2 = order.ModelId2,
                    KartelaId2 = order.KartelaId2,
                    KartelaModelId2 = order.KartelaModelId2,
                    Cila2 = order.Cila2,
                    Description2 = order.Description2,

                    ProductId3 = order.ProductId3,
                    ModelId3 = order.ModelId3,
                    KartelaId3 = order.KartelaId3,
                    KartelaModelId3 = order.KartelaModelId3,
                    Cila3 = order.Cila3,
                    Description3 = order.Description3,

                    ProductId4 = order.ProductId4,
                    ModelId4 = order.ModelId4,
                    KartelaId4 = order.KartelaId4,
                    KartelaModelId4 = order.KartelaModelId4,
                    Cila4 = order.Cila4,
                    Description4 = order.Description4,

                    KaporaType = order.KaporaType,
                    PaymentType = order.PaymentType,
                    TotalPrice = order.TotalPrice
                }
                                ).ToList();
                return(getOrder);
            }
        }
示例#16
0
 public static int Update(Product product)
 {
     try
     {
         using (var db = new MTSEntities())
         {
             Product temp = db.Product.SingleOrDefault(x => x.Id == product.Id);
             temp.ProductName = product.ProductName;
             db.SaveChanges();
             return(1);
         }
     }
     catch (Exception ex)
     {
         return(0);
     }
 }
示例#17
0
 public static List <ModelProduct> List()
 {
     using (var db = new MTSEntities())
     {
         var models = (from x in db.tblModel
                       join p in db.Product on x.ProductId equals p.Id
                       select new ModelProduct
         {
             ProductName = p.ProductName,
             Id = x.Id,
             ProductId = p.Id,
             ModelName = x.ModelName
         }
                       ).ToList();
         return(models);
     }
 }
示例#18
0
 public static int Update(Kartela kartela)
 {
     try
     {
         using (var db = new MTSEntities())
         {
             var item = db.Kartela.SingleOrDefault(x => x.Id == kartela.Id);
             item.KartelaName = kartela.KartelaName;
             db.SaveChanges();
             return(1);
         }
     }
     catch (Exception ex)
     {
         return(0);
     }
 }
示例#19
0
 public static List <CatalogProduct> List()
 {
     using (var db = new MTSEntities())
     {
         var kp = (from x in db.KartelaProduct
                   join k in db.Kartela on x.KartelaId equals k.Id
                   select new CatalogProduct
         {
             ProductName = x.ProductName,
             Id = x.Id,
             KartelaId = k.Id,
             KartelaName = k.KartelaName,
             ProductCode = x.ProductName
         }).ToList();
         return(kp);
     }
 }
示例#20
0
 public static int Update(tblModel model)
 {
     try
     {
         using (var db = new MTSEntities())
         {
             tblModel temp = db.tblModel.SingleOrDefault(x => x.Id == model.Id);
             temp.ModelName = model.ModelName;
             temp.ProductId = model.ProductId;
             db.SaveChanges();
             return(1);
         }
     }
     catch (Exception ex)
     {
         return(0);
     }
 }
示例#21
0
 public static int Update(KartelaProduct kp)
 {
     try
     {
         using (var db = new MTSEntities())
         {
             KartelaProduct temp = db.KartelaProduct.SingleOrDefault(x => x.Id == kp.Id);
             temp.KartelaId   = kp.KartelaId;
             temp.ProductName = kp.ProductName;
             temp.ProductCode = kp.ProductCode;
             db.SaveChanges();
             return(1);
         }
     }
     catch (Exception ex)
     {
         return(0);
     }
 }
示例#22
0
 public static int Update(User user)
 {
     try
     {
         using (var db = new MTSEntities())
         {
             User temp = db.User.SingleOrDefault(x => x.Id == user.Id);
             temp.NameSurname = user.NameSurname;
             temp.Password    = user.Password;
             temp.Email       = user.Email;
             db.SaveChanges();
             return(1);
         }
     }
     catch (Exception ex)
     {
         return(0);
     }
 }
示例#23
0
 public static int Add(Kartela kartela)
 {
     try
     {
         using (var db = new MTSEntities())
         {
             var item = new Kartela
             {
                 KartelaName = kartela.KartelaName
             };
             db.Kartela.Add(item);
             db.SaveChanges();
             return(1);
         }
     }
     catch (Exception ex)
     {
         return(0);
     }
 }
示例#24
0
 public static int Add(Product product)
 {
     try
     {
         using (var db = new MTSEntities())
         {
             var temp = new Product
             {
                 ProductName = product.ProductName
             };
             db.Product.Add(temp);
             db.SaveChanges();
             return(1);
         }
     }
     catch (Exception ex)
     {
         return(0);
     }
 }
示例#25
0
 public static int Add(tblModel model)
 {
     try
     {
         using (var db = new MTSEntities())
         {
             var temp = new tblModel
             {
                 ProductId = model.ProductId,
                 ModelName = model.ModelName
             };
             db.tblModel.Add(temp);
             db.SaveChanges();
             return(1);
         }
     }
     catch (Exception ex)
     {
         return(0);
     }
 }
示例#26
0
        public static List <OrderCustomerProduct> FirstLoginPageOrderList()
        {
            using (var db = new MTSEntities())
            {
                var orderList = (from order in db.Order
                                 join customer in db.Customer on order.CustomerId equals customer.Id

                                 select new OrderCustomerProduct
                {
                    Id = order.Id,
                    CustomerId = customer.Id,
                    NameSurname = customer.NameSurname,
                    Phone1 = customer.Phone1,
                    TotalPrice = order.TotalPrice,
                    FinishDate = order.FinishDate.ToString(),
                    StartDate = order.StartDate.ToString(),
                    KaporaPrice = order.KaporaPrice
                }
                                 ).ToList();
                return(orderList);
            }
        }
示例#27
0
 public static int Add(User user)
 {
     try
     {
         using (var db = new MTSEntities())
         {
             var temp = new User
             {
                 Email       = user.Email,
                 NameSurname = user.NameSurname,
                 Password    = user.Password
             };
             db.User.Add(temp);
             db.SaveChanges();
             return(1);
         }
     }
     catch (Exception ex)
     {
         return(0);
     }
 }
示例#28
0
 public static int Add(KartelaProduct kp)
 {
     try
     {
         using (var db = new MTSEntities())
         {
             var item = new KartelaProduct
             {
                 KartelaId   = kp.KartelaId,
                 ProductName = kp.ProductName,
                 ProductCode = kp.ProductCode
             };
             db.KartelaProduct.Add(item);
             db.SaveChanges();
             return(1);
         }
     }
     catch (Exception ex)
     {
         return(0);
     }
 }
示例#29
0
 public static int Delete(int Id)
 {
     try
     {
         using (var db = new MTSEntities())
         {
             var item = db.Kartela.SingleOrDefault(x => x.Id == Id);
             if (item != null)
             {
                 db.Kartela.Remove(item);
                 db.SaveChanges();
                 return(1);
             }
             else
             {
                 return(0);
             }
         }
     }
     catch (Exception ex)
     {
         return(0);
     }
 }
示例#30
0
 public static int Delete(int Id)
 {
     try
     {
         using (var db = new MTSEntities())
         {
             var tempRemove = db.tblModel.SingleOrDefault(x => x.Id == Id);
             if (tempRemove != null)
             {
                 db.tblModel.Remove(tempRemove);
                 db.SaveChanges();
                 return(1);
             }
             else
             {
                 return(0);
             }
         }
     }
     catch (Exception ex)
     {
         return(0);
     }
 }