コード例 #1
0
 public int Update(int RouteId, int PortalId, int ContentItemId, string CultureCode, string RouteName, string RouteUrl, string PhysicalFile,
 bool CheckPhysicalUrlAccess, string RouteValueDictionary, string Description, bool Discontinued)
 {
     int i = 0;
     using (CommonEntities dbContext = new CommonEntities())
     {
         using (System.Transactions.TransactionScope transcope = new System.Transactions.TransactionScope())
         {
             dbContext.Connection.Open();
             aspnet_Routes entity = dbContext.aspnet_Routes.Single(x => x.RouteId == RouteId);
             entity.PortalId = PortalId;
             entity.ContentItemId = ContentItemId;
             entity.CultureCode = CultureCode;
             entity.RouteName = RouteName;
             entity.RouteUrl = RouteUrl;
             entity.PhysicalFile = PhysicalFile;
             entity.CheckPhysicalUrlAccess = CheckPhysicalUrlAccess;
             entity.RouteValueDictionary = RouteValueDictionary;
             entity.Description = Description;
             entity.Discontinued = Discontinued;
             i = dbContext.SaveChanges();
             dbContext.Connection.Close();
             transcope.Complete();
         }
     }
     return i;
 }
コード例 #2
0
 ////INSERT- UPDATE - DELETE 
 public int Insert(int PortalId, int ContentItemId, string CultureCode, string RouteName, string RouteUrl, string PhysicalFile,
 bool CheckPhysicalUrlAccess, string RouteValueDictionary, string Description, bool Discontinued)
 {
     int returnValue = 0;
     using (CommonEntities dbContext = new CommonEntities())
     {
         using (System.Transactions.TransactionScope transcope = new System.Transactions.TransactionScope())
         {
             int ListOrder = (from u in dbContext.aspnet_Routes select u.ListOrder).DefaultIfEmpty(0).Max() + 1;
             aspnet_Routes entity = new aspnet_Routes();
             entity.PortalId = PortalId;
             entity.ContentItemId = ContentItemId;
             entity.CultureCode = CultureCode;
             entity.RouteName = RouteName;
             entity.RouteUrl = RouteUrl;
             entity.PhysicalFile = PhysicalFile;
             entity.CheckPhysicalUrlAccess = CheckPhysicalUrlAccess;
             entity.RouteValueDictionary = RouteValueDictionary;
             entity.Description = Description;
             entity.ListOrder = ListOrder;
             entity.Discontinued = Discontinued;
             dbContext.AddToaspnet_Routes(entity);
             returnValue = dbContext.SaveChanges();
             dbContext.Connection.Close();
             transcope.Complete();
         }
     }
     return returnValue;
 }
コード例 #3
0
 public aspnet_Routes GetDetails(int RouteId)
 {
     using (CommonEntities dbContext = new CommonEntities())
     {
         dbContext.CommandTimeout = Settings.CommandTimeout;
         aspnet_Routes entity = dbContext.aspnet_Routes.Where(x => x.RouteId == RouteId).FirstOrDefault();
         return entity;
     }
 }
コード例 #4
0
 public static List<aspnet_Routes> GetListByPortalIdCultureCodeStatus(int PortalId, int ContentItemId, string CultureCode, bool Discontinued)
 {
     using (CommonEntities dbContext = new CommonEntities())
     {
         dbContext.CommandTimeout = Settings.CommandTimeout;
         var query = from x in dbContext.aspnet_Routes
                     where x.PortalId == PortalId
                         && x.CultureCode == CultureCode
                         && x.Discontinued == Discontinued
                     select x;
         if (!string.IsNullOrEmpty(ContentItemId.ToString()) && ContentItemId > 0)
             query = query.Where(x => x.ContentItemId == ContentItemId);
         return query.ToList();
     }
 }
コード例 #5
0
 public static void Delete(int RouteId)
 {
     using (CommonEntities dbContext = new CommonEntities())
     {
         using (System.Transactions.TransactionScope transcope = new System.Transactions.TransactionScope())
         {
             dbContext.Connection.Open();
             aspnet_Routes entity = dbContext.aspnet_Routes.Single(x => x.RouteId == RouteId);
             dbContext.aspnet_Routes.DeleteObject(entity);
             dbContext.SaveChanges();
             dbContext.Connection.Close();
             transcope.Complete();
         }
     }
 }
コード例 #6
0
 public int UpdateSortKey(int RouteId, int ListOrder)
 {
     using (CommonEntities dbContext = new CommonEntities())
     {
         dbContext.CommandTimeout = Settings.CommandTimeout;
         aspnet_Routes album_obj = dbContext.aspnet_Routes.Single(x => x.RouteId == RouteId);
         album_obj.ListOrder = ListOrder;
         int i = dbContext.SaveChanges();
         return i;
     }
 }
コード例 #7
0
 public int UpdateStatus(int RouteId, bool Discontinued)
 {
     using (CommonEntities dbContext = new CommonEntities())
     {
         dbContext.CommandTimeout = Settings.CommandTimeout;
         aspnet_Routes entity = dbContext.aspnet_Routes.Single(x => x.RouteId == RouteId);
         entity.Discontinued = Discontinued;
         int i = dbContext.SaveChanges();
         return i;
     }
 }