public bool NickNameExists(string nickName) { using (Data.Entities entities = GetEntities()) { Data.User userEntity = entities.Users.Where(u => u.NickName == nickName).SingleOrDefault <LegendsOfKesmaiSurvival.Data.User>(); return(userEntity != null); } }
public Business.UserAccount GetUserAccount(string userName) { using (Data.Entities entities = GetEntities()) { Data.User userEntity = entities.Users.Where(u => u.UserName == userName).SingleOrDefault <LegendsOfKesmaiSurvival.Data.User>(); if (userEntity == null) { return(null); } return(new Business.UserAccount(userEntity.Id, userEntity.UserName, userEntity.NickName)); } }
public void CreateUserAccount(string userName, string nickName, string password) { using (Data.Entities entities = GetEntities()) { Data.User userEntity = new Data.User() { UserName = userName, NickName = nickName, Password = password, }; entities.Users.AddObject(userEntity); entities.SaveChanges(); } }
private static void AddPaymentDetails(Document document, InvoiceEntity invoiceEntity) { var table = new PdfPTable(3) { WidthPercentage = 45 }; var colWidthPercentages = new[] { 4f, 1f, 5f }; table.SetWidths(colWidthPercentages); table.AddCell(ElementFactory.CreateCell("Name of Account", Element.ALIGN_LEFT, -1, BaseColor.WHITE, 1, ElementFactory.Fonts.Footer)); table.AddCell(ElementFactory.CreateCell(":", Element.ALIGN_CENTER, -1, BaseColor.WHITE, 1, ElementFactory.Fonts.Footer)); table.AddCell(ElementFactory.CreateCell(invoiceEntity.AccountDetails.Name, Element.ALIGN_LEFT, -1, BaseColor.WHITE, 1, ElementFactory.Fonts.Footer)); table.AddCell(ElementFactory.CreateCell("Account Number:", Element.ALIGN_LEFT, -1, BaseColor.WHITE, 1, ElementFactory.Fonts.Footer)); table.AddCell(ElementFactory.CreateCell(":", Element.ALIGN_CENTER, -1, BaseColor.WHITE, 1, ElementFactory.Fonts.Footer)); table.AddCell(ElementFactory.CreateCell(invoiceEntity.AccountDetails.Number, Element.ALIGN_LEFT, -1, BaseColor.WHITE, 1, ElementFactory.Fonts.Footer)); table.AddCell(ElementFactory.CreateCell("Sort Code", Element.ALIGN_LEFT, -1, BaseColor.WHITE, 1, ElementFactory.Fonts.Footer)); table.AddCell(ElementFactory.CreateCell(":", Element.ALIGN_CENTER, -1, BaseColor.WHITE, 1, ElementFactory.Fonts.Footer)); table.AddCell(ElementFactory.CreateCell(invoiceEntity.AccountDetails.SortCode, Element.ALIGN_LEFT, -1, BaseColor.WHITE, 1, ElementFactory.Fonts.Footer)); document.Add(table); }
public bool ValidateUserCredentials(string username, string password, out Business.UserAccount userAccount) { //TODO:Encrypt/Decrypt password using (Data.Entities entities = GetEntities()) { bool authenticated; authenticated = entities.Users.Where(u => u.UserName == username && u.Password == password).SingleOrDefault <LegendsOfKesmaiSurvival.Data.User>() != null; if (!authenticated) { userAccount = null; return(false); } else { userAccount = GetUserAccount(username); return(true); } } }
protected override void Initialize(RequestContext requestContext) { dbContext = new Data.Entities(); base.Initialize(requestContext); }