コード例 #1
0
        //delete
        public static void Delete(USERS_DTO user)
        {
            var userToRemove = ctx.USERS_TBL.FirstOrDefault(u => u.userId == user.userId);

            userToRemove.isActive = false;
            ctx.SaveChanges();
        }
コード例 #2
0
 //create
 public static void Create(REQUEST_DTO request)
 {
     ctx.REQUEST_TBL.Add(new REQUEST_TBL {
         categoryName = request.categoryName, parentCategory = request.parentCategory, requestKind = request.requestKind, requestStatus = request.requestStatus
     });
     ctx.SaveChanges();
 }
コード例 #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();
     }
 }
コード例 #4
0
ファイル: CategoryCRUD.cs プロジェクト: nechamigit/hmoProject
 //static PRICE price = new PRICE();
 //Create
 public static void Create(CATEGORIES_DTO category)
 {
     ctx.CATEGORIES_TBL.Add(new CATEGORIES_TBL {
         categoryName = category.categoryName, parentCategory = category.parentCategory
     });
     //product=db.PRODUCTS_TBL.Add(new PRODUCTS_TBL { categoryId = add_categories.categoriesId, description = description });
     //db.PRICE.Add(new PRICE { discount = discount, productId = product.productId, priceText = price });
     ctx.SaveChanges();
 }
コード例 #5
0
ファイル: priceCRUD.cs プロジェクト: nechamigit/hmoProject
 //create
 public static void create(PRICE_DTO price)
 {
     ctx.PRICEs.Add(new PRICE {
         priceText = price.priceText, discount = price.discount
     });
     ctx.SaveChanges();
 }
コード例 #6
0
        public HttpResponseMessage UploadFile(string id)
        {
            var pathToSql = " http://localhost:58516/UploadFiles/ ";
            var allPath   = " ";
            HttpResponseMessage response = new HttpResponseMessage();
            var abc         = Request.Properties.Values;
            var httpRequest = HttpContext.Current.Request;

            foreach (string file in httpRequest.Files)
            {
                pathToSql = " http://localhost:58516/UploadFiles/";
                var postedFile    = httpRequest.Files[file];
                var directoryPath = HttpContext.Current.Server.MapPath(" ~/ UploadFiles / ");
                Directory.CreateDirectory(directoryPath + id);
                allPath = directoryPath + id + "/" + postedFile.FileName;
                postedFile.SaveAs(allPath);
                pathToSql += id + "/ " + postedFile.FileName;
                using (HMO_PROGECTEntities db = new HMO_PROGECTEntities())
                {
                    var product = db.PRODUCTS_TBL.FirstOrDefault(u => u.productId.ToString() == id);
                    product.imag = pathToSql;
                    db.SaveChanges();
                }
            }
            return(response);
        }
コード例 #7
0
 public static void Create(USERS_DTO user)
 {
     using (HMO_PROGECTEntities ctx = new HMO_PROGECTEntities())
     {
         USERS_TBL newUser = ctx.USERS_TBL.Where(u => u.userId == user.userId || u.userName == user.userName).FirstOrDefault();
         if (newUser == null)
         {
             ctx.USERS_TBL.Add(new USERS_TBL()
             {
                 firstName   = user.firstName,
                 lastName    = user.lastName,
                 userName    = user.userName,
                 password    = user.password,
                 hmoId       = user.hmoId,
                 mail        = user.mail,
                 telephone   = user.telephone,
                 adress      = user.adress,
                 tz          = user.tz,
                 requestForm = user.requestForm,
                 isActive    = true,
                 isConfirm   = false
             });
             ctx.SaveChanges();
         }
         else
         {
             throw new Exception("is exsist");
         }
     }
 }
コード例 #8
0
 //create
 public static void Create(INSURANCE_DTO insurence)
 {
     using (HMO_PROGECTEntities ctx = new HMO_PROGECTEntities())
     {
         ctx.INSURANCE_TBL.Add(new INSURANCE_TBL());
         ctx.SaveChanges();
     }
 }
コード例 #9
0
ファイル: priceCRUD.cs プロジェクト: nechamigit/hmoProject
 //delete
 public static void delete(PRICE_DTO price)
 {
     using (HMO_PROGECTEntities ctx = new HMO_PROGECTEntities())
     {
         ctx.PRICEs.Remove(ctx.PRICEs.FirstOrDefault(u => u.priceId == price.priceId));
         ctx.SaveChanges();
     }
 }
コード例 #10
0
ファイル: HmoCRUD.cs プロジェクト: nechamigit/hmoProject
 //create
 public static void Create(HMO_PROGECTEntities ctx, HMO_TBL hmo)
 {
     ctx.HMO_TBL.Add(new HMO_TBL()
     {
         hmoName = hmo.hmoName,
         hmoMail = hmo.hmoMail
     });
     ctx.SaveChanges();
 }
コード例 #11
0
 public static void changeConfirm(int requestid)
 {
     using (HMO_PROGECTEntities ctx = new HMO_PROGECTEntities())
     {
         var x = ctx.REQUEST_TBL.FirstOrDefault(u => u.requestId == requestid);
         x.requestStatus = 2;
         ctx.SaveChanges();
     }
 }
コード例 #12
0
ファイル: priceCRUD.cs プロジェクト: nechamigit/hmoProject
 public static void Update(PRICE_DTO price)
 {
     using (HMO_PROGECTEntities ctx = new HMO_PROGECTEntities())
     {
         var x = ctx.PRICEs.FirstOrDefault(u => u.priceId == price.priceId);
         x.insuranceId = price.insuranceId;
         x.INSURANCE_TBL.insuranceName = price.insuranceName;
         x.priceText = price.priceText;
         x.discount  = price.discount;
         //x.AGE_TBL.begins = price.ageRange;
         ctx.SaveChanges();
     }
 }
コード例 #13
0
ファイル: Class1.cs プロジェクト: nechamigit/hmoProject
 public int addClerk(string userName, string tz, string telephone, string mail, string adress)
 {
     use = db.USERS_TBL.Where(g => g.tz == tz).FirstOrDefault();
     if (use == null)
     {
         db.USERS_TBL.Add(new USERS_TBL()
         {
             userName = userName, adress = adress, kind = 2, mail = mail, telephone = telephone, tz = tz
         });
         db.SaveChanges();
         return(0);
     }
     return(1);
 }
コード例 #14
0
ファイル: ProductsCRUD.cs プロジェクト: nechamigit/hmoProject
 //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);
     }
 }
コード例 #15
0
 public static void Update(USERS_DTO user)
 {
     using (HMO_PROGECTEntities ctx = new HMO_PROGECTEntities())
     {
         var x = ctx.USERS_TBL.FirstOrDefault(u => u.userId == user.userId);
         x.userName  = user.userName;
         x.tz        = user.tz;
         x.lastName  = user.lastName;
         x.firstName = user.firstName;
         x.adress    = user.adress;
         x.isAdmin   = user.isAdmin;
         x.telephone = user.telephone;
         x.password  = user.password;
         x.mail      = user.mail;
         x.isConfirm = user.isConfirm;
         x.isActive  = user.isActive;
         x.hmoId     = user.hmoId;
         ctx.SaveChanges();
     }
 }
コード例 #16
0
ファイル: HmoCRUD.cs プロジェクト: nechamigit/hmoProject
 //delete
 public static void delete(HMO_PROGECTEntities ctx, HMO_TBL hmo)
 {
     ctx.HMO_TBL.Remove(ctx.HMO_TBL.FirstOrDefault(u => u.hmoId == hmo.hmoId));
     ctx.SaveChanges();
 }
コード例 #17
0
 //delete
 public static void Delete(HMO_PROGECTEntities ctx, INSURANCE_DTO insurance)
 {
     ctx.INSURANCE_TBL.Remove(ctx.INSURANCE_TBL.Find(insurance));
     ctx.SaveChanges();
 }
コード例 #18
0
ファイル: ProductsCRUD.cs プロジェクト: nechamigit/hmoProject
 //delete
 public static void Delete(PRODUCTS_DTO product)
 {
     ctx.PRODUCTS_TBL.Remove(ctx.PRODUCTS_TBL.FirstOrDefault(u => u.productId == product.productId));
     ctx.SaveChanges();
 }