Ejemplo n.º 1
0
 public static bool AddRecommendation(RECOMMENDATION reco)
 {
     using (CloudEDUEntities ctx = new CloudEDUEntities())
     {
         try
         {
             ctx.Set<RECOMMENDATION>().Add(reco);
             ctx.SaveChanges();
         }
         catch (Exception e)
         {
             System.Diagnostics.Debug.WriteLine(e.ToString());
             return false;
         }
     }
     return true;
 }
Ejemplo n.º 2
0
 public static bool AddCategory(CATEGORY category)
 {
     using (CloudEDUEntities ctx = new CloudEDUEntities())
     {
         try
         {
             ctx.Set<CATEGORY>().Add(category);
             ctx.SaveChanges();
         }
         catch (Exception e)
         {
             System.Diagnostics.Debug.WriteLine(e.ToString());
             return false;
         }
     }
     return true;
 }
Ejemplo n.º 3
0
 public static bool RemovePermission(int permission_id)
 {
     using (CloudEDUEntities ctx = new CloudEDUEntities())
     {
         try
         {
             var permission = ctx.PERMISSIONs.Where(m => m.ID == permission_id).FirstOrDefault<PERMISSION>();
             ctx.Set<PERMISSION>().Remove(permission);
             ctx.SaveChanges();
         }
         catch (Exception e)
         {
             System.Diagnostics.Debug.WriteLine(e.ToString());
             return false;
         }
     }
     return true;
 }
Ejemplo n.º 4
0
 /// <summary>
 /// 移除TYPE。如果有Manager与该TYPE相关联,则该Manager的MNGR_TYPE将会为NULL
 /// </summary>
 /// <param name="type_id">被删除的TYPE的id</param>
 /// <returns>true表示成功创建,false表示失败</returns>
 public static bool RemoveManagerType(int type_id)
 {
     using (CloudEDUEntities ctx = new CloudEDUEntities())
     {
         try
         {
             var type = ctx.TYPEs.Where(m => m.ID == type_id).FirstOrDefault<TYPE>();
             ctx.Set<TYPE>().Remove(type);
             ctx.SaveChanges();
         }
         catch (Exception e)
         {
             System.Diagnostics.Debug.WriteLine(e.ToString());
             return false;
         }
     }
     return true;
     //throw new Exception("Not Support Yet");
 }
Ejemplo n.º 5
0
 public static bool RemoveManager(int manager_id)
 {
     using (CloudEDUEntities ctx = new CloudEDUEntities())
     {
         try
         {
             var manager = ctx.MANAGERs.Where(m => m.ID == manager_id).FirstOrDefault<MANAGER>();
             ctx.Set<MANAGER>().Remove(manager);
             ctx.SaveChanges();
         }
         catch (Exception e)
         {
             System.Diagnostics.Debug.WriteLine(e.ToString());
             return false;
         }
     }
     return true;
 }
Ejemplo n.º 6
0
 public static bool ToggleNoteSharability(NOTE note)
 {
     note.SHARE = !note.SHARE;
     using (CloudEDUEntities ctx = new CloudEDUEntities())
     {
         try
         {
             ctx.Set<NOTE>().Attach(note);
             ctx.Entry(note).State = System.Data.EntityState.Modified;
             ctx.SaveChanges();
         }
         catch (Exception e)
         {
             System.Diagnostics.Debug.WriteLine(e.ToString());
             return false;
         }
     }
     return true;
 }
Ejemplo n.º 7
0
 public static bool RemoveResource(RESOURCE resource)
 {
     using (CloudEDUEntities ctx = new CloudEDUEntities())
     {
         try
         {
             ctx.Set<RESOURCE>().Attach(resource);
             ctx.Set<RESOURCE>().Remove(resource);
             ctx.SaveChanges();
         }
         catch (Exception e)
         {
             System.Diagnostics.Debug.WriteLine(e.ToString());
             return false;
         }
     }
     return true;
 }
Ejemplo n.º 8
0
 public static bool RemoveLesson(LESSON lesson)
 {
     using (CloudEDUEntities ctx = new CloudEDUEntities())
     {
         try
         {
             ctx.Set<LESSON>().Attach(lesson);
             ctx.Set<LESSON>().Remove(lesson);
             ctx.SaveChanges();
         }
         catch (Exception e)
         {
             System.Diagnostics.Debug.WriteLine(e.ToString());
             return false;
         }
     }
     return true;
 }
Ejemplo n.º 9
0
 public static bool RemoveDocument(DOCUMENT document)
 {
     using (CloudEDUEntities ctx = new CloudEDUEntities())
     {
         try
         {
             ctx.Set<DOCUMENT>().Attach(document);
             ctx.Set<DOCUMENT>().Remove(document);
             ctx.SaveChanges();
         }
         catch (Exception e)
         {
             System.Diagnostics.Debug.WriteLine(e.ToString());
             return false;
         }
     }
     return true;
 }