本文整理汇总了C#中Segator.Loms.Modules.Common.Entities.LomsContext类的典型用法代码示例。如果您正苦于以下问题:C# LomsContext类的具体用法?C# LomsContext怎么用?C# LomsContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LomsContext类属于Segator.Loms.Modules.Common.Entities命名空间,在下文中一共展示了LomsContext类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: GetCitySuppliers
public IEnumerable<CitySupplierInfo> GetCitySuppliers(int cityId)
{
using (var db = new LomsContext())
{
var suppliers = from a in db.DispatchSuppliers.IncludeAll("Country", "State", "State.Country", "Suburb", "Suburb.Country", "Suburb.State", "Suburb.State.Country")
join ac in db.DispatchSupplierCities on a.Id equals ac.SupplierId
where ac.CityId == cityId
orderby a.Name
select a;
var citySupplierInfos = new List<CitySupplierInfo>();
foreach (var supplier in suppliers.ToList())
{
if (supplier.CountryId != null && supplier.Country == null)
supplier.Country = db.Countries.SingleOrDefault(c => c.Id == supplier.CountryId);
else if (supplier.StateId != null && supplier.State == null)
supplier.State = db.States.Include("Country").SingleOrDefault(s => s.Id == supplier.StateId);
else if (supplier.SuburbId != null && supplier.Suburb == null)
supplier.Suburb = db.Suburbs.IncludeAll("State", "State.Country", "Country").SingleOrDefault(s => s.Id == supplier.SuburbId);
var info = new CitySupplierInfo() { Supplier = supplier };
info.Manager = db.DispatchSupplierUsers.FirstOrDefault(u => u.SupplierId == supplier.Id && u.RoleId == (int)SupplierUserRole.Manager);
var supplierCity = db.DispatchSupplierCities.IncludeAll("VehicleTypes", "VehicleTypes.VehicleType").SingleOrDefault(c => c.SupplierId == supplier.Id && c.CityId == cityId);
info.CityVehicleTypes = supplierCity.VehicleTypes;
citySupplierInfos.Add(info);
}
return citySupplierInfos;
}
}
开发者ID:felixthehat,项目名称:Limo,代码行数:34,代码来源:CommonBookingService.cs
示例2: GetWorldwide
public DispatchWorldwide GetWorldwide()
{
using (var db = new LomsContext())
{
return db.DispatchWorldwides.IncludeAll("Suburb", "Suburb.Country", "Suburb.State", "Suburb.State.Country").FirstOrDefault();
}
}
开发者ID:felixthehat,项目名称:Limo,代码行数:7,代码来源:DispatcherService.cs
示例3: GetAssociation
public Association GetAssociation()
{
using (var db = new LomsContext())
{
return db.Associations.SingleOrDefault(a => a.Id == CurrentAssociationId);
}
}
开发者ID:felixthehat,项目名称:Limo,代码行数:7,代码来源:AssociationRegistrationService.cs
示例4: GetCreditCards
public IEnumerable<AssociationUserCreditCard> GetCreditCards(int profileId, SearchRequest searchRequest)
{
using (var db = new LomsContext())
{
var query = db.AssociationUserCreditCards.IncludeAll("Info")
.Where(a => a.AssociationUserId == profileId);
if (!string.IsNullOrWhiteSpace(searchRequest.SearchFilterValue))
{
if (searchRequest.SearchFilter == "Nickname")
query = from card in query
where card.Nickname.Contains(searchRequest.SearchFilterValue)
select card;
}
var cards = query.OrderBy(a => a.Nickname).ToList();
cards.ForEach(card =>
{
card.Number = ObfuscateCreditCardNumber(card.Info.Number);
card.Info = null;
card.AcceptChanges();
});
return cards;
}
}
开发者ID:felixthehat,项目名称:Limo,代码行数:26,代码来源:AssociationStaffService.Clientele.cs
示例5: GetRate
public static double GetRate(LomsContext db, Booking booking, DebugWriter debugInfoWriter)
{
double extras;
bool autoPending = false;
double price = 0.0;
try
{
price = GetBaseRateWithAdminFees(db, booking, debugInfoWriter, out autoPending, out extras);
if (price == 0.0 || autoPending)
return 0.0;
}
catch (Exception ex)
{
debugInfoWriter.WriteLine("Exception during GetBaseRateWithAdminFees!");
debugInfoWriter.WriteLine(ex.ToString());
return 0.0;
}
RateHelper.ApplyVehicleMargin(db, booking, debugInfoWriter, ref price);
price += extras;
RateHelper.ApplyHourZone(db, booking, debugInfoWriter, ref price);
//RateHelper.ApplyEventMargin(db, booking, debugInfoWriter, ref price, ref autoPending, ref eventName);
//if (autoPending)
// return 0.0;
return price;
}
开发者ID:felixthehat,项目名称:Limo,代码行数:32,代码来源:RateHelper.cs
示例6: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
string guidStr = Page.RouteData.Values["guid"] as string;
Guid guid;
if (guidStr == null || !Guid.TryParseExact(guidStr, "D", out guid))
{
multiView1.SetActiveView(viewError);
lblError.Text = "Wrong reset guid!";
return;
}
else
{
using (var db = new LomsContext())
{
var pwdReset = db.AssociationUserPasswordResets.FirstOrDefault(a => a.Guid == guid);
if (pwdReset == null)
{
multiView1.SetActiveView(viewError);
lblError.Text = "Wrong reset guid!";
return;
}
var user = db.AssociationUsers.First(u => u.Id == pwdReset.AssociationUserId);
lblUserWelcome.Text = string.Format("Welcome, {0}.", user.FullName.ToUpper());
multiView1.SetActiveView(viewPwd);
}
}
}
}
开发者ID:felixthehat,项目名称:Limo,代码行数:32,代码来源:PasswordReset.aspx.cs
示例7: GetCreditCards
public IEnumerable<AssociationUserCreditCard> GetCreditCards(int profileId, SearchRequest searchRequest)
{
using (var db = new LomsContext())
{
return GetCreditCards(db, profileId, searchRequest);
}
}
开发者ID:felixthehat,项目名称:Limo,代码行数:7,代码来源:BookingsService.Payments.cs
示例8: AllocateVehicle
public static bool AllocateVehicle(LomsContext db, Booking booking, bool isPhantom, StringBuilder debug)
{
int vehicleTypeId = booking.VehicleTypeId.Value;
var pickUpTime = booking.PickUpTime.Value;
int jorneyLength = 30; //min
DateTime fromDate = pickUpTime.Date;
DateTime toDate = pickUpTime.AddMinutes(jorneyLength).Date;
int fromTime = (((int)pickUpTime.TimeOfDay.TotalMinutes) / 30) * 30;
int toTime = (((int)pickUpTime.AddMinutes(jorneyLength).TimeOfDay.TotalMinutes) / 30) * 30;
if (!CheckAvailability(db, booking.Id, booking.CityId, vehicleTypeId, fromDate, toDate, fromTime, toTime, isPhantom, debug))
return false;
if (booking.AllocatedVehicle == null)
booking.AllocatedVehicle = new BookingAllocatedVehicle() { BookingId = booking.Id };
booking.AllocatedVehicle.CityId = booking.CityId;
booking.AllocatedVehicle.VehicleTypeId = vehicleTypeId;
booking.AllocatedVehicle.From = fromDate.AddMinutes(fromTime);
booking.AllocatedVehicle.To = toDate.AddMinutes(toTime);
booking.AllocatedVehicle.IsPhantom = isPhantom;
return true;
}
开发者ID:felixthehat,项目名称:Limo,代码行数:26,代码来源:VehicleAvailabilityHelper.cs
示例9: GetBooking
public Booking GetBooking(int id)
{
using (var db = new LomsContext())
{
return GetBooking(db, id);
}
}
开发者ID:felixthehat,项目名称:Limo,代码行数:7,代码来源:BookingsService.cs
示例10: SaveAddress
public AssociationUserAddress SaveAddress(AssociationUserAddress address)
{
try
{
using (var db = new LomsContext())
{
if (address.SuburbId != null)
{
address.Country = null;
address.State = null;
}
else if (address.StateId != null)
address.Country = null;
db.AssociationUserAddresses.ApplyChanges(address);
db.SaveChanges();
return db.AssociationUserAddresses.IncludeAll("Country", "State", "State.Country", "Suburb", "Suburb.Country", "Suburb.State", "Suburb.State.Country")
.FirstOrDefault(a => a.Id == address.Id);
}
}
catch (Exception ex)
{
address.AddError("Error", ex.Message);
return address;
}
}
开发者ID:felixthehat,项目名称:Limo,代码行数:27,代码来源:AssociationStaffService.Clientele.cs
示例11: SaveWorldwideUser
public DispatchUser SaveWorldwideUser(DispatchUser user, byte[] imageBytes, bool deleteImage)
{
int managerId = int.Parse(((FormsIdentity)(HttpContext.Current.User.Identity)).Ticket.UserData);
using (var scope = new TransactionScope())
using (var db = new LomsContext())
{
if (user.Id == 0)
{
user.Login = user.FirstName[0] + user.LastName;
var staffManager = (from m in db.DispatchUsers
where m.Id == managerId
select m).Single();
user.CreatedBy = staffManager.FirstName + " " + staffManager.LastName;
user.CreatedDate = DateTime.UtcNow;
}
if (user.Id == 0)
{
if (user.Id == 0 && string.IsNullOrEmpty(user.Pwd))
user.Pwd = "123456!";
MembershipCreateStatus ret;
MembershipUser membershipUser = Membership.CreateUser(user.Login, user.Pwd, user.Email, "Who am I?", "I", true, null, out ret);
if (ret != MembershipCreateStatus.Success)
throw new ApplicationException(ret.ToString());
user.AspNetUserId = (Guid)membershipUser.ProviderUserKey;
}
else if (!string.IsNullOrEmpty(user.Pwd))
{
MembershipUser membershipUser = Membership.GetUser(user.Login);
string tempPwd = membershipUser.ResetPassword();
membershipUser.ChangePassword(tempPwd, user.Pwd);
}
if (!Roles.IsUserInRole(user.Login, RoleName.DispatchUser))
Roles.AddUserToRole(user.Login, RoleName.DispatchUser);
if (user.Role == DispatchUserRole.Manager && !Roles.IsUserInRole(user.Login, RoleName.DispatchManager))
Roles.AddUserToRole(user.Login, RoleName.DispatchManager);
else if (user.Role != DispatchUserRole.Manager && Roles.IsUserInRole(user.Login, RoleName.DispatchManager))
Roles.RemoveUserFromRole(user.Login, RoleName.DispatchManager);
db.DispatchUsers.ApplyChanges(user);
db.SaveChanges();
user = db.DispatchUsers.IncludeAll("Suburb", "Suburb.Country", "Suburb.State", "Suburb.State.Country")
.FirstOrDefault(a => a.Id == user.Id);
scope.Complete();
return user;
}
}
开发者ID:felixthehat,项目名称:Limo,代码行数:58,代码来源:DispatcherService.cs
示例12: GetAssociationName
public string GetAssociationName()
{
using (var db = new LomsContext())
{
return (from a in db.Associations
where a.Id == CurrentAssociationId
select a.Name).FirstOrDefault();
}
}
开发者ID:felixthehat,项目名称:Limo,代码行数:9,代码来源:AssociationStaffService.cs
示例13: GetCurrentAssociation
public Association GetCurrentAssociation()
{
var associationId = (int)HttpContext.Current.Items["AssociationId"];
using (var db = new LomsContext())
{
var association = db.Associations.Include("Country").FirstOrDefault(a => a.Id == associationId);
return association;
}
}
开发者ID:felixthehat,项目名称:Limo,代码行数:9,代码来源:AuthenticationService.cs
示例14: GetWorldwideUsers
public IEnumerable<DispatchUser> GetWorldwideUsers()
{
using (var db = new LomsContext())
{
return db.DispatchUsers.IncludeAll("Country", "Suburb", "Suburb.Country", "Suburb.State", "Suburb.State.Country")
.Where(u => u.RegionId == null && u.DistrictId == null)
.ToList();
}
}
开发者ID:felixthehat,项目名称:Limo,代码行数:9,代码来源:DispatcherService.cs
示例15: GetUser
public AssociationUser GetUser()
{
using (var db = new LomsContext())
{
int currentUserId = CurrentUserId();
var user = db.AssociationUsers.IncludeAll("Country").FirstOrDefault(u => u.Id == currentUserId);
return user;
}
}
开发者ID:felixthehat,项目名称:Limo,代码行数:9,代码来源:BookingsService.Users.cs
示例16: ChangePassword
public bool ChangePassword(int managerId, string pwd, string newPwd)
{
using (var db = new LomsContext())
{
var manager = db.AssociationUsers.FirstOrDefault(m => m.Id == managerId);
MembershipUser user = Membership.GetUser(manager.Email);
return user.ChangePassword(pwd, newPwd);
}
}
开发者ID:felixthehat,项目名称:Limo,代码行数:9,代码来源:AssociationsService.cs
示例17: GetAssociations
public IEnumerable<Association> GetAssociations()
{
using (var db = new LomsContext())
{
var query = from a in db.Associations
orderby a.Name
select a;
return query.ToList();
}
}
开发者ID:felixthehat,项目名称:Limo,代码行数:11,代码来源:DispatcherService.Bookings.cs
示例18: GetCurrentAssociationCountry
public Segator.Loms.Modules.Common.Entities.Country GetCurrentAssociationCountry()
{
var associationId = (int)HttpContext.Current.Items["AssociationId"];
using (var db = new LomsContext())
{
var query = from a in db.Associations.Include("Country")
where a.Id == associationId
select a.Country;
return query.SingleOrDefault();
}
}
开发者ID:felixthehat,项目名称:Limo,代码行数:11,代码来源:AuthenticationService.cs
示例19: GetAssociationCountries
public IEnumerable<Country> GetAssociationCountries()
{
using (var db = new LomsContext())
{
var query = from ac in db.AssociationCountries.Include("Country")
where ac.AssociationId == CurrentAssociationId && ac.Country.StatusId == (byte)EntityStatus.Active
orderby ac.Country.Name
select ac.Country;
return query.Distinct().OrderBy(c => c.Name).ToList();
}
}
开发者ID:felixthehat,项目名称:Limo,代码行数:12,代码来源:BookingsService.Secondary.cs
示例20: GetBillings
public GetBillingsResponse GetBillings(int profileId)
{
using (var db = new LomsContext())
{
return new GetBillingsResponse
{
CreditCards = GetCreditCards(db, profileId, null),
BillingAccounts = GetBillingAccounts(db, profileId),
SavedBillingAccounts = GetUserBillingAccounts(db, profileId, null)
};
}
}
开发者ID:felixthehat,项目名称:Limo,代码行数:12,代码来源:BookingsService.Payments.cs
注:本文中的Segator.Loms.Modules.Common.Entities.LomsContext类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论