コード例 #1
0
        /// <summary>
        /// Gets all orders.
        /// </summary>
        /// <returns>System.Collections.Generic.IList&lt;YCRCPracticeWebApp.Service.DataTransferObject.OrderDto&gt;.</returns>
        public IList <OrderDto> GetAllOrders()
        {
            var source = _orderRepo.GetAll()
                         .ToList();
            var dtos = Mapper.Map <IList <Orders>, IList <OrderDto> >(source);

            return(dtos);
        }
コード例 #2
0
 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
         });
     }
 }
コード例 #3
0
        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);
        }
コード例 #4
0
 public ColumnsChartProductListForm(ViewType v)
 {
     InitializeComponent();
     _repProduct = new GeneralRepository <Product>();
     chartControl.Series.Clear();
     CreateNewSerriesName("Quantity Serries", v, chartControl, _repProduct.GetAll().ToList());
 }
コード例 #5
0
ファイル: RSSService.cs プロジェクト: Ian26875/Practice
        /// <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);
        }
コード例 #6
0
        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
            });
        }
コード例 #7
0
        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;
        }
コード例 #8
0
        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;
        }
コード例 #9
0
 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;
 }
コード例 #10
0
        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();
        }
コード例 #11
0
 private void btnAll_ItemClick(object sender, ItemClickEventArgs e)
 {
     productbindingSource.DataSource = _repository.GetAll().ToList();
 }
コード例 #12
0
 private void btnAll_ItemClick(object sender, ItemClickEventArgs e)
 {
     stockReceivedsBindingSource.DataSource = _stockRepository.GetAll().ToList();
     listChanged.Clear();
 }
コード例 #13
0
 public IEnumerable <UserDto> Get() => _mapper.Map <IEnumerable <UserDto> >(_userRepo.GetAll());
コード例 #14
0
        public IEnumerable <UserRoleDto> GetUserRoles(string userName)
        {
            var user = _userRepo.GetAll($"UserName='******'");

            return(_mapper.Map <IEnumerable <UserRoleDto> >(_userRoleRepo.GetAll($"UserId={user.FirstOrDefault().UserId}")));
        }
コード例 #15
0
ファイル: GeneralBusiness.cs プロジェクト: hyazici/framework
 public IList <TModel> GetAll <TModel>(bool withDeleted = false, IDbTransaction trans = null) where TModel : BaseViewModel
 {
     return(_repository.GetAll <TModel>(withDeleted, trans));
 }
コード例 #16
0
 private void btnRefreshPro_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     gridProducts.DataSource = _repProducts.GetAll().ToList();
 }
コード例 #17
0
 private void refreshToolStripMenuItem_Click(object sender, EventArgs e)
 {
     wageCoefficientsBindingSource.DataSource = _repository.GetAll().ToList();//for new row (_repository.GetAll() => IQueryable<T> not accept new row)
 }
コード例 #18
0
 public List <T> GetAll()
 {
     return(_generalRepository.GetAll());
 }
コード例 #19
0
 private void expandablePanel_Click(object sender, EventArgs e)
 {
     productsBindingSource.DataSource = _proRepository.GetAll().ToList();
 }