本文整理汇总了C#中ApplicationUserManager.FindByEmail方法的典型用法代码示例。如果您正苦于以下问题:C# ApplicationUserManager.FindByEmail方法的具体用法?C# ApplicationUserManager.FindByEmail怎么用?C# ApplicationUserManager.FindByEmail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ApplicationUserManager
的用法示例。
在下文中一共展示了ApplicationUserManager.FindByEmail方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Home
public ActionResult Home()
{
#region Prep Utilities
myHandler = new BusinessLogicHandler();
Supplier supplier = new Supplier();
RangeViewModel model = new RangeViewModel();
#endregion
#region Get User(Supplier)
string userName = User.Identity.GetUserName();
ApplicationDbContext dataSocket = new ApplicationDbContext();
UserStore<ApplicationUser> myStore = new UserStore<ApplicationUser>(dataSocket);
_userManager = new ApplicationUserManager(myStore);
var user = _userManager.FindByEmail(userName);
#endregion
#region Get Supplier Details
supplier = myHandler.GetSupplier(user.Id);
#endregion
#region Get Orders For Supplier
model.Orders = myHandler.GetSupplierOrders(supplier.SupplierID);
if(model.Orders != null)
{ model.Orders.OrderBy(m => m.DateCreated); }
#endregion
return View(model);
}
示例2: RangeSearch
public ActionResult RangeSearch(RangeViewModel model)
{
if(ModelState.IsValid)
{
#region Prep Utilities
myHandler = new BusinessLogicHandler();
Supplier supplier = new Supplier();
#endregion
#region Get User(Supplier)
string userName = User.Identity.GetUserName();
ApplicationDbContext dataSocket = new ApplicationDbContext();
UserStore<ApplicationUser> myStore = new UserStore<ApplicationUser>(dataSocket);
_userManager = new ApplicationUserManager(myStore);
var user = _userManager.FindByEmail(userName);
#endregion
#region Get Supplier Details
supplier = myHandler.GetSupplier(user.Id);
#endregion
#region Get the Data
string dateFrom = model.myRange.From.ToString("yyyMMdd");
string dateTo = model.myRange.To.ToString("yyyMMdd");
model.Orders = myHandler.GetOrderByRange(dateFrom, dateTo, supplier.SupplierID);
#endregion
return View(model);
}
return View();
}
示例3: Receipt
public async Task<ActionResult> Receipt(int? IID)
{
List<CartItem> myItems = new List<CartItem>();
myItems = (List<CartItem>)Session["myItems"];
ProductViewModel model = new ProductViewModel();
myHandler = new BusinessLogicHandler();
model = (ProductViewModel)Session["deliverData"];
#region Get Cart Items
List<Book> ifBooks = new List<Book>();
List<Technology> ifGadget = new List<Technology>();
foreach (var item in myItems)
{
if (myHandler.CheckProductType(item.ProductID))
{
Book book = new Book();
book = myHandler.GetBook(item.ProductID);
ifBooks.Add(book);
}
else
{
Technology gadget = new Technology();
gadget = myHandler.GetTechnologyDetails(item.ProductID);
ifGadget.Add(gadget);
}
//try
//{
// Book book = new Book();
// book = myHandler.GetBook(item.ProductID);
// ifBooks.Add(book);
//}
//catch
//{
// Technology gadget = new Technology();
// gadget = myHandler.GetTechnologyDetails(item.ProductID);
// ifGadget.Add(gadget);
//}
}
model.allTechnology = ifGadget;
model.allBook = ifBooks;
model.allCartItem = myItems;
#endregion
#region Push User Details
string userName = User.Identity.GetUserName();
ApplicationDbContext dataSocket = new ApplicationDbContext();
UserStore<ApplicationUser> myStore = new UserStore<ApplicationUser>(dataSocket);
userMgr = new ApplicationUserManager(myStore);
var user = userMgr.FindByEmail(userName);
model.UserDetails = new ProvideUser();
model.UserDetails.Address = user.Address;
model.UserDetails.email = user.Email;
model.UserDetails.PhoneNumber = user.PhoneNumber;
CustomerContext customer = new CustomerContext();
Customer thisCust = new Customer();
thisCust = customer.Customers.FirstOrDefault(cust => cust.User_Id == user.Id);
model.UserDetails.LName = thisCust.LastName;
model.UserDetails.Name = thisCust.FirstName;
#endregion
#region Push Invoice nfo
model.recieptData = new Invoice();
model.recieptData = myHandler.GetInvoice(IID.GetValueOrDefault());
#endregion
#region Push Company nfo
myHandler = new BusinessLogicHandler();
model.company = new Company();
model.company = myHandler.GetCompanyDetail();
#endregion
#region Push Delivery nfo
Delivery shipping = new Delivery();
myHandler = new BusinessLogicHandler();
shipping = myHandler.GetDeliveryDetails(model.recieptData.DeliveryServiceID);
model.deliveryHelper.DeliveryServiceName = shipping.ServiceName;
model.deliveryHelper.DeliveryServicePrice = shipping.Price;
model.deliveryHelper.DeliveryServiceType = shipping.ServiceType;
#endregion
#region Calculate
List<ProductViewModel.CartHelper> itemList = new List<ProductViewModel.CartHelper>();
ProductViewModel.CartHelper cartHelp;
if (myItems != null)
{
if (ifBooks != null)
{
//.........这里部分代码省略.........
示例4: Checkout
public ActionResult Checkout(FormCollection collection, ProductViewModel model)
{
Delivery shipping = new Delivery();
IEnumerable<Book> ifBooks = (IEnumerable<Book>)Session["myBooks"];
IEnumerable<Technology> ifGadget = (IEnumerable<Technology>)Session["myGadget"];
List<CartItem> myItems = (List<CartItem>)Session["myItems"];
myHandler = new BusinessLogicHandler();
#region Get Shipping Data
try
{
shipping = myHandler.GetDeliveryDetails(Convert.ToInt32(collection[1].ToString()));
if (ModelState.ContainsKey("I_DeliveryList"))
ModelState["I_DeliveryList"].Errors.Clear();
}
catch
{ ModelState.AddModelError("deliveryHelper.DeliveryServicePrice", "Please select a delivery service from dropdown !"); }
#endregion
#region Cathing model errors
var error = ModelState.Values.SelectMany(e => e.Errors);
var errors = ModelState
.Where(x => x.Value.Errors.Count > 0)
.Select(x => new { x.Key, x.Value.Errors })
.ToArray();
#endregion
int? IID = 0;
if (ModelState.IsValid)
{
#region Get User
string userName = User.Identity.GetUserName();
ApplicationDbContext dataSocket = new ApplicationDbContext();
UserStore<ApplicationUser> myStore = new UserStore<ApplicationUser>(dataSocket);
userMgr = new ApplicationUserManager(myStore);
var user = userMgr.FindByEmail(userName);
#endregion
try
{
#region Creating the reciept/invoice
Invoice reciept = new Invoice { User_Id = user.Id, DateCreated = DateTime.Now, DeliveryAddress = model.deliveryHelper.DeliveryAddress, DeliveryServiceID = Convert.ToInt32(collection[1].ToString()), Status = false };
try
{
InvoiceItem invoiceLine = new InvoiceItem();
invoiceLine = myHandler.GetInvoiceLastNumber(reciept);
foreach (var item in myItems)
{
invoiceLine.CartItemID = item.CartItemID;
invoiceLine.ProductID = item.ProductID;
invoiceLine.Quantity = item.Quantity;
#region Get Product Price
bool chk = false;
chk = myHandler.CheckProductType(item.ProductID);
if (chk)
{
Book book = new Book();
book = myHandler.GetBook(item.ProductID);
invoiceLine.Price = book.SellingPrice;
myHandler.AddinvoiceItem(invoiceLine);
}
else
{
Technology device = new Technology();
device = myHandler.GetTechnologyDetails(item.ProductID);
invoiceLine.Price = device.SellingPrice;
myHandler.AddinvoiceItem(invoiceLine);
}
#endregion
}
IID = invoiceLine.InvoiceID;
}
catch { }
#endregion
#region Placing the order
try
{
#region Prep Utilities
Order ord;
Book book = new Book();
Technology gadget = new Technology();
int supplierId = 0;
OrderItem orderLine = new OrderItem();
myHandler = new BusinessLogicHandler();
List<int> orders = new List<int>();
List<int> suppliers = new List<int>();
#endregion
foreach (var item in myItems)
{
//.........这里部分代码省略.........
示例5: Search
public ActionResult Search(FormCollection collector)
{
#region Prep Utilities
string Query = collector.GetValue("query").AttemptedValue;
myHandler = new BusinessLogicHandler();
Supplier supplier = new Supplier();
InvoiceModel model = new InvoiceModel();
#endregion
#region Get User(Supplier)
string userName = User.Identity.GetUserName();
ApplicationDbContext dataSocket = new ApplicationDbContext();
UserStore<ApplicationUser> myStore = new UserStore<ApplicationUser>(dataSocket);
_userManager = new ApplicationUserManager(myStore);
var user = _userManager.FindByEmail(userName);
#endregion
#region Get Supplier Details
supplier = myHandler.GetSupplier(user.Id);
#endregion
#region Get the data
model.Order = new Order();
model.Invoice = new Invoice();
try
{
model.Order = myHandler.GetOrder(Convert.ToInt32(Query));
}
catch
{ model.Order = null; }
try
{
model.Invoice = myHandler.GetInvoice(Convert.ToInt32(Query));
}
catch
{ model.Invoice = null; }
///get product
#endregion
return View(model);
}