/// <summary> /// Gets all orders. /// </summary> /// <returns>System.Collections.Generic.IList<YCRCPracticeWebApp.Service.DataTransferObject.OrderDto>.</returns> public IList <OrderDto> GetAllOrders() { var source = _orderRepo.GetAll() .ToList(); var dtos = Mapper.Map <IList <Orders>, IList <OrderDto> >(source); return(dtos); }
public void AddUserRole(long userId, long roleId) { if (_userRoleRepo.GetAll($"UserId={userId} AND RoleId={roleId}").FirstOrDefault() == null) { _userRoleRepo.Create(new UserRole { UserId = userId, RoleId = roleId }); } }
public bool Login(string userName, string password) { string savedPasswordHash = _userRepo.GetAll($"UserName='******'").FirstOrDefault()?.Password; if (savedPasswordHash == null) { return(false); } byte[] hashBytes = Convert.FromBase64String(savedPasswordHash); byte[] salt = new byte[16]; Array.Copy(hashBytes, 0, salt, 0, 16); var pbkdf2 = new Rfc2898DeriveBytes(password, salt, 10000); byte[] hash = pbkdf2.GetBytes(20); for (int i = 0; i < 20; i++) { if (hashBytes[i + 16] != hash[i]) { return(false); } } return(true); }
public ColumnsChartProductListForm(ViewType v) { InitializeComponent(); _repProduct = new GeneralRepository <Product>(); chartControl.Series.Clear(); CreateNewSerriesName("Quantity Serries", v, chartControl, _repProduct.GetAll().ToList()); }
/// <summary> /// Gets the feed data. /// </summary> /// <returns></returns> public SyndicationFeed GetFeedData() { var scheme = HttpContext.Current.Request.Url.Scheme; var host = HttpContext.Current.Request.Headers["host"]; var feedAlternateLink = $"{scheme}://{host}"; var feed = new SyndicationFeed( "Account Book", "帳單 RSS!", new Uri(feedAlternateLink)); var items = new List <SyndicationItem>(); var models = _accountBookRepository .GetAll() .OrderByDescending(x => x.Dateee); foreach (AccountBook model in models) { var item = new SyndicationItem( model.Remarkkk, model.Amounttt.ToString(), new Uri($"{feedAlternateLink}/Home/Details?id={model.Id}"), "ID", DateTime.Now); items.Add(item); } feed.Items = items; return(feed); }
public void Register(UserDto user) { User domainUser = _mapper.Map <User>(user); domainUser.Password = GetHash(domainUser.Password); domainUser.AccountRegistered = DateTime.Now; _userRepository.Create(domainUser); var domainUserId = _userRepository.GetAll($"UserName='******'").FirstOrDefault().UserId; _userRoleRepo.Create(new UserRole { UserId = domainUserId, RoleId = 4 }); }
private void btnAll_ItemClick(object sender, ItemClickEventArgs e) { var li = _repBills.GetAll().ToList(); li.ForEach(i => { i.CusInfo = _repMembers.Find(m => m.UseName == i.CusID).First(); i.CusName = i.CusInfo.FullName; }); li.ForEach(i => { i.SelerInfo = _repMembers.Find(m => m.UseName == i.SelID).First(); i.SalerName = i.SelerInfo.FullName; }); bindingSource.DataSource = li; }
private void btnRefresh_Click(object sender, EventArgs e) { var li = _repository.GetAll().ToList(); li.ForEach(i => { i.WageCoefficientInfo = _repCoefficient.Find(c => c.ID == i.CoefficientsID).FirstOrDefault(); i.Point = i.WageCoefficientInfo.Point; }); li.ForEach(i => { i.AdminInfo = _repMember.Find(m => m.UseName == i.AdminID).FirstOrDefault(); }); li.ForEach(i => { i.EmployeeInfo = _repMember.Find(m => m.UseName == i.EmployeeID).FirstOrDefault(); }); wagesBindingSource.DataSource = li; }
public XtraReportProducts(IGeneralRepository <Product> _repository) { InitializeComponent(); DataSource = _repository.GetAll().Select(p => new XProduct() { Name = p.Name, Type = p.Type?"Phone":"Other", UnitPrice = p.UnitPrice, Description = p.Description, Image = System.Drawing.Image.FromFile(@"images/" + p.Image), Price = p.Price.ToString() //Quantity = p.Quantity.ToString(), }).ToList(); DataAdapter = DataSource; }
private void StockReceivedListForm_Load(object sender, EventArgs e) { _proRepository = new GeneralRepository <Product>(); _stockRepository = new GeneralRepository <StockReceived>(); _stockDetails = new GeneralRepository <StockReceivedDetail>(); _memberRepository = new MemberRepository(); _manager = new StockReceivedManager(_stockRepository); _managerStockedDetails = new StockReceivedDetailManager(_stockDetails); _managerProducts = new ProductManager(_proRepository); repAdmins.DataSource = _memberRepository.GetAll().Where(mb => mb.CategoryInfo.Location == "Admin").ToList(); repProducts.DataSource = _proRepository.GetAll().ToList(); listChanged = new List <int>(); expandablePanel.PerformClick(); btnAll.PerformClick(); }
private void btnAll_ItemClick(object sender, ItemClickEventArgs e) { productbindingSource.DataSource = _repository.GetAll().ToList(); }
private void btnAll_ItemClick(object sender, ItemClickEventArgs e) { stockReceivedsBindingSource.DataSource = _stockRepository.GetAll().ToList(); listChanged.Clear(); }
public IEnumerable <UserDto> Get() => _mapper.Map <IEnumerable <UserDto> >(_userRepo.GetAll());
public IEnumerable <UserRoleDto> GetUserRoles(string userName) { var user = _userRepo.GetAll($"UserName='******'"); return(_mapper.Map <IEnumerable <UserRoleDto> >(_userRoleRepo.GetAll($"UserId={user.FirstOrDefault().UserId}"))); }
public IList <TModel> GetAll <TModel>(bool withDeleted = false, IDbTransaction trans = null) where TModel : BaseViewModel { return(_repository.GetAll <TModel>(withDeleted, trans)); }
private void btnRefreshPro_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { gridProducts.DataSource = _repProducts.GetAll().ToList(); }
private void refreshToolStripMenuItem_Click(object sender, EventArgs e) { wageCoefficientsBindingSource.DataSource = _repository.GetAll().ToList();//for new row (_repository.GetAll() => IQueryable<T> not accept new row) }
public List <T> GetAll() { return(_generalRepository.GetAll()); }
private void expandablePanel_Click(object sender, EventArgs e) { productsBindingSource.DataSource = _proRepository.GetAll().ToList(); }