示例#1
0
        public void ChangeEmailTo(string newEmailValue)
        {
            if (Emails.Count > 1)
            {
                Emails.Find(e => e.IsActive).IsActive = false;
            }

            Emails.Find(e => e.Value == newEmailValue).IsActive = true;

            Credentials.Logins.Find(l => l.Type == LoginType.Email).Value = newEmailValue;
        }
        public OspDataDTO GetOspData(int userId, int ospId)
        {
            // Период получения документов в ОСА (30 дней).
            DateTime startPeriod = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day).AddDays(-30);
            DateTime endPeriod   = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
            // Получить общие списки.
            ICollection <AccessDTO>    allAccesses = Accesses.GetAll();
            ICollection <UserDTO>      allUsers    = Users.GetAll();
            ICollection <CartridgeDTO> allCarts    = Cartridges.GetAll();
            ICollection <PrinterDTO>   allPrints   = Printers.GetAll();
            ICollection <OspDTO>       allOsps     = Osps.GetAll();
            // Получить данные по ОСП.
            ICollection <BalanceDTO>  balances     = Balance.Find(x => x.Osp.Id == ospId);
            ICollection <EmailDTO>    emails       = Emails.Find(x => x.Osp.Id == ospId);
            ICollection <ProviderDTO> providers    = Providers.Find(x => x.Osp.Id == ospId);
            ICollection <ReceiptDTO>  receipts     = Receipts.Find(u => u.Osp.Id == ospId && u.Date >= startPeriod && u.Date <= endPeriod);
            ICollection <ExpenseDTO>  expenses     = Expenses.Find(u => u.Osp.Id == ospId && u.Date >= startPeriod && u.Date <= endPeriod);
            ICollection <ExpenseDTO>  userExpenses = Expenses.Find(u => u.User.Id == userId && u.Osp.Id == ospId && u.Date >= startPeriod && u.Date <= endPeriod);
            // Создать объект данных для пользователя.
            var userDataDTO = new OspDataDTO()
            {
                Accesses     = new ObservableCollection <AccessDTO>(allAccesses),
                Osps         = new ObservableCollection <OspDTO>(allOsps),
                Cartridges   = new ObservableCollection <CartridgeDTO>(allCarts),
                Printers     = new ObservableCollection <PrinterDTO>(allPrints),
                Balance      = new ObservableCollection <BalanceDTO>(balances),
                Expenses     = new ObservableCollection <ExpenseDTO>(expenses),
                UserExpenses = new ObservableCollection <ExpenseDTO>(userExpenses),
                Providers    = new ObservableCollection <ProviderDTO>(providers),
                Receipts     = new ObservableCollection <ReceiptDTO>(receipts),
                Emails       = new ObservableCollection <EmailDTO>(emails),
                Users        = new ObservableCollection <UserDTO>(allUsers)
            };

            return(userDataDTO);
        }
示例#3
0
 public Pair <Guid, Pair <string, string> > SearchEmailById(Guid id)
 {
     return(Emails.Find(email => new Guid(email.Key.ToString()) == id));
 }