本文整理汇总了C#中BootstrapVillas.Models.PortugalVillasContext类的典型用法代码示例。如果您正苦于以下问题:C# PortugalVillasContext类的具体用法?C# PortugalVillasContext怎么用?C# PortugalVillasContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PortugalVillasContext类属于BootstrapVillas.Models命名空间,在下文中一共展示了PortugalVillasContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Property
public Property()
{
this.Bookings = new List<Booking>();
this.Comments = new List<Comment>();
this.Packages = new List<Package>();
this.PropertyEntities = new List<PropertyEntity>();
this.PropertyPricingSeasonalInstances = new List<PropertyPricingSeasonalInstance>();
this.PropertySecurityItems = new List<PropertySecurityItem>();
this.PropertyStaffTaskAssignments = new List<PropertyStaffTaskAssignment>();
//set up datasets
using (var _db = new PortugalVillasContext())
{
var pricesForThisProp = _db.PropertyPricingSeasonalInstances.Where(x => x.PropertyID == this.PropertyID).ToList();
if (pricesForThisProp.Count() > 0)
{ this.PropertyPricingSeasonalInstances = _db.PropertyPricingSeasonalInstances.Where(x => x.PropertyID == this.PropertyID).ToList(); }
}
switch (this.Active)
{
case true:
CreatePriceRange();
break;
}
}
示例2: ReturnAllBookingsAndTransactions
private static List<BookingAndRelatedTransactions> ReturnAllBookingsAndTransactions(long AccountID, PortugalVillasContext db)
{
var owner = db.PropertyOwnerAccounts.Where(x => x.AccountID == AccountID).First();
var props = db.Properties.Where(x => x.PropertyOwnerID == owner.PropertyOwnerID).ToList();
var bookings = new List<Booking>();
foreach (var property in props)
{
bookings.AddRange(db.Bookings.Where(booking => booking.PropertyID == property.PropertyID).Include(x=>x.Property).ToList());
}
var transactions = db.AccountTransactions.Where(x => x.AccountID == AccountID).Where(x=>x.Voided != true);
List<BookingAndRelatedTransactions> bookingAndTrans = new List<BookingAndRelatedTransactions>();
foreach (var booking in bookings)
{
bookingAndTrans.Add(new BookingAndRelatedTransactions
{
booking = booking,
transactions = transactions.Where(x=>x.BookingID == booking.BookingID).ToList()
});
}
return bookingAndTrans;
}
示例3: CreateAccountsForOwnersWithoutAccount
public static int CreateAccountsForOwnersWithoutAccount(PortugalVillasContext db)
{
//get all ownersIDs
var owners = db.PropertyOwners.ToList();
//checks they all have an account is accounts
var accounts = db.PropertyOwnerAccounts.ToList();
List<PropertyOwnerAccount> accountsToCreate = new List<PropertyOwnerAccount>();
foreach (var propertyOwner in owners)
{
var account = accounts.Where(x => x.PropertyOwnerID == propertyOwner.PropertyOwnerID).FirstOrDefault();
if (account == null)
{
db.PropertyOwnerAccounts.Add(new PropertyOwnerAccount
{
AccountBalance = 0.00M,
PropertyOwnerID = propertyOwner.PropertyOwnerID
});
}
}
return db.SaveChanges();
}
示例4: GetRandomTopRatedComments
public static List<Comment> GetRandomTopRatedComments()
{
try
{
PortugalVillasContext _db = new PortugalVillasContext();
List<Comment> theCommentsList = new List<Comment>();
return theCommentsList = _db.Comments.Where(x => x.StarRating > 2)
.Where(x => x.Approved == true).Take(10)
.ToList();
}
catch (Exception ex)
{
throw ex;
}
throw new Exception();
}
示例5: GetBookingExtraAttributesByBookingExtraID
public static List<BookingExtraAttribute> GetBookingExtraAttributesByBookingExtraID(long? bookingExtraID)
{
List<BookingExtraAttribute> theListOfAttributes = new List<BookingExtraAttribute>();
PortugalVillasContext _db = new PortugalVillasContext();
return theListOfAttributes = _db.BookingExtraAttributes.Where(x => x.BookingExtraID == bookingExtraID).ToList();
}
示例6: GetCustomerBankDetailFromCustomer
/// <summary>
/// Gets
/// </summary>
public static CustomerBankDetail GetCustomerBankDetailFromCustomer(Customer aCustomer)
{
PortugalVillasContext db = new PortugalVillasContext();
CustomerBankDetail theBankDetailsToReturn = db.CustomerBankDetails.Where(x => x.CustomerID == aCustomer.CustomerID).FirstOrDefault();
return theBankDetailsToReturn;
}
示例7: CreateDocumentAndSaveToLocation
//
// GET: /DocumentMangementService/
public ActionResult CreateDocumentAndSaveToLocation()
{
var db = new PortugalVillasContext();
var parentContainer = new BookingParentContainer();
//dependenceies
var dc = new DocumentGenerationController();
var customer = db.Customers.Find(1);
var booking = db.Bookings.Find(4);
var type = PRCDocument.PRCDocumentType.UK_WineTasting;
//create a document with all parsed variables
var document = dc.CreateDocumentToFileSystem(customer, type, booking);
/* db.Documents.Add(new Document
{
CustomerID = customer.CustomerID,
DocumentBLOB = document,
EventID = 2
});
db.SaveChanges();*/
//save it to the DB or the FileSystem
return RedirectToAction("Dashboard", "Admin");
}
开发者ID:Weissenberger13,项目名称:web.portugalrentalcottages,代码行数:32,代码来源:DocumentMangementServiceController.cs
示例8: GetBookingExtraTypes
//get all the booking extra types
public static List<BookingExtraType> GetBookingExtraTypes()
{
List<BookingExtraType> theList = new List<BookingExtraType>();
PortugalVillasContext _db = new PortugalVillasContext();
return theList = _db.BookingExtraTypes.ToList();
}
示例9: GetBookingByID
//get individual booking by ID -- NEED TO TEST FOR EMPTY RESULT
public static Booking GetBookingByID(int bookingID)
{
PortugalVillasContext _db = new PortugalVillasContext();
var aBooking = _db.Bookings.Include(x => x.Property).FirstOrDefault(x => x.BookingID == bookingID);
return aBooking;
}
示例10: GetAllProperties
/////////////////////////////
//// STATIC METHODS
/////////////////////////////
//INT or STRING methods to get a list of properties- all return List<Property>
//////////////////////////////////////////////////////////
////These methods pull back Properties based on given criteria
//////////////////////////////////////////////////////////
public static List<Property> GetAllProperties()
{
PortugalVillasContext _db = new PortugalVillasContext();
var allProperties = _db.Properties.ToList();
return allProperties;
}
示例11: GetAllCommentSectionsForComment
public static List<CommentSection> GetAllCommentSectionsForComment(Comment aComment)
{
PortugalVillasContext _db = new PortugalVillasContext();
List<CommentSection> theCommentSections = new List<CommentSection>();
theCommentSections = _db.CommentSections.Where(x => x.CommentID == aComment.CommentID).ToList();
return theCommentSections;
}
示例12: GetBookingExtras
//get all the booking extras - return list
public static List<BookingExtra> GetBookingExtras()
{
List<BookingExtra> theList = new List<BookingExtra>();
PortugalVillasContext _db = new PortugalVillasContext();
return theList = _db.BookingExtras
.Where(x => x.TopLevelItem == true)
.ToList();
}
示例13: GetMaxBooking
protected DateTime? GetMaxBooking()
{
PortugalVillasContext _db = new PortugalVillasContext();
DateTime? maxBooking = _db.Bookings
.Max(x => x.StartDate);
return maxBooking;
}
示例14: GetTitles
//////////TITLES//////////////////
//////////////////////////////////
//GET the title
public static List<Title> GetTitles()
{
using(PortugalVillasContext _db = new PortugalVillasContext()){
List<Title> TitleList = _db.Titles.ToList();
return TitleList;
}
}
示例15: GetSingleCustomer
public static Customer GetSingleCustomer(long? CustomerID)
{
PortugalVillasContext _db = new PortugalVillasContext();
var aCustomer = (_db.Customers
.Where(x => x.CustomerID == CustomerID).First());
return (Customer) aCustomer;
}