Exemplo n.º 1
0
 /// <summary>
 /// 创建新的ManagerType,注意ManagerType和Type在当前语义下表示意义相同,均表示Manager的类型
 /// </summary>
 /// <param name="type">需要创建的Type,需要在函数外部创建实例,并且为DESCRIPTION属性赋值</param>
 /// <returns>true表示成功创建,false表示失败</returns>
 public static bool AddManagerType(TYPE type)
 {
     int count = 0;
     using (CloudEDUEntities ctx = new CloudEDUEntities())
     {
         try
         {
             ctx.TYPEs.Add(type);
             count = ctx.SaveChanges();
         }
         catch (Exception e)
         {
             System.Diagnostics.Debug.WriteLine(e.ToString());
             return false;
         }
     }
     return count == 1;
 }
Exemplo n.º 2
0
 /// <summary>
 /// 用于更改TYPE的一般信息,包括DESCRIPTION
 /// </summary>
 /// <param name="type">更改后的TYPE的实例</param>
 /// <returns>true表示成功创建,false表示失败</returns>
 public static bool UpdateManagerType(TYPE type)
 {
     using (CloudEDUEntities ctx = new CloudEDUEntities())
     {
         try
         {
             ctx.Entry(type).State = System.Data.EntityState.Modified;
             ctx.SaveChanges();
         }
         catch (Exception e)
         {
             System.Diagnostics.Debug.WriteLine(e.ToString());
             return false;
         }
     }
     return true;
 }