Esempio n. 1
0
 public PRODUCTS_TBL compaireProductPrice(PRODUCTS_TBL product)
 {
     using (HMO_PROGECTEntities ctx = new HMO_PROGECTEntities())
     {
         return(null);
     }
 }
Esempio n. 2
0
 public static INSURANCE_TBL the_worth_hmo(int age, string categoryName)
 {
     categ     = db.CATEGORIES_TBL.Where(g => g.categoryName == categoryName).FirstOrDefault();
     prod      = db.PRODUCTS_TBL.Where(g => g.categoryId == categ.categoriesId).FirstOrDefault();
     price1    = db.PRICEs.Where(g => g.productId == prod.productId).FirstOrDefault();
     insurance = db.INSURANCE_TBL.Where(g => g.insuranceId == price1.insuranceId).FirstOrDefault();
     //age = db.AGE_TBL.Where(g => g.begins >= age && s=>s.ends <= age).FirstOrDefault();
     return(insurance);
 }
Esempio n. 3
0
 //public static int addClerk(string userName, string tz, string telephone, string mail, string adress,bool isAdmin)
 //{
 //    use = db.USERS_TBL.Where(g => g.tz == tz).FirstOrDefault();
 //    if (use == null)
 //    {
 //        Random rand = new Random();
 //        db.USERS_TBL.Add(new USERS_TBL() { userName = userName, adress = adress, isAdmin=isAdmin, mail = mail, telephone = telephone, tz = tz });
 //        db.SaveChanges();
 //        return 0;
 //    }
 //    return 1;
 //}
 public static void deleteProduct(int productid)
 {
     prod = db.PRODUCTS_TBL.Where(g => g.productId == productid).FirstOrDefault();
     if (prod != null)
     {
         db.PRODUCTS_TBL.Remove(db.PRODUCTS_TBL.Find(prod));
         db.SaveChanges();
     }
 }
Esempio n. 4
0
 public static PRODUCTS_DTO CastToDTO(PRODUCTS_TBL a)
 {
     return(new PRODUCTS_DTO
     {
         productId = a.productId,
         description = a.description,
         categoryId = a.categoryId,
         imag = a.imag,
         name = a.name
     });
 }
Esempio n. 5
0
 public static HMO_TBL GetHmoByProduct(PRODUCTS_TBL product)
 {
     using (HMO_PROGECTEntities ctx = new HMO_PROGECTEntities())
     {
         INSURANCE_TBL insurance = InsuranceModule.GetProductInsurance(product);
         if (insurance != null)
         {
             HMO_TBL hmo = ctx.HMO_TBL.Where(u => u.hmoId == insurance.hmoId).FirstOrDefault();
         }
         return(null);
     }
 }
Esempio n. 6
0
 public IHttpActionResult GetProductInsurance(PRODUCTS_TBL product)
 {
     try
     {
         InsuranceModule.GetProductInsurance(product);
         return(Ok());
     }
     catch (Exception)
     {
         return(InternalServerError());
     }
 }
Esempio n. 7
0
 public IHttpActionResult GetHmoByProduct(PRODUCTS_TBL product)
 {
     try
     {
         HmoModule.GetHmoByProduct(product);
         return(Ok());
     }
     catch (Exception)
     {
         return(InternalServerError());
     }
 }
Esempio n. 8
0
 public static PRICE GetProductPrice(PRODUCTS_TBL product)
 {
     using (HMO_PROGECTEntities ctx = new HMO_PROGECTEntities())
     {
         var productdetail = ProductsCRUD.ReadById(ctx, product.productId);
         if (productdetail != null)
         {
             PRICE price = ctx.PRICEs.Where(u => u.productId == product.productId).FirstOrDefault();
             return(price);
         }
         return(null);
     }
 }
Esempio n. 9
0
 //create
 public static int Create(PRODUCTS_DTO product)
 {
     using (HMO_PROGECTEntities ctx = new HMO_PROGECTEntities())
     {
         // ctx.PRODUCTS_TBL.Add(new PRODUCTS_TBL { name = product.name, description = product.description, categoryId = product.categoryId });
         PRODUCTS_TBL newProduct = new PRODUCTS_TBL()
         {
             name        = product.name,
             description = product.description,
             categoryId  = product.categoryId,
             imag        = product.imag
         };
         ctx.PRODUCTS_TBL.Add(newProduct);
         ctx.SaveChanges();
         var lastProduct = ctx.PRODUCTS_TBL.LastOrDefault();
         return(lastProduct.productId);
     }
 }