Пример #1
0
        public static List<HRStaffRecord> GetList(string query, object[] parms)
        {
            if (parms == null)
                return new List<HRStaffRecord>();

            if (parms.Count() == 0)
                return new List<HRStaffRecord>();

            try
            {
                HRStaffContext db = new HRStaffContext(Properties.Settings.Default.ConnectionString);

                List<HRStaffRecord> items = db.HRStaffRecords.Where(query, parms)
                    .OrderBy(x => x.LastName + x.FirstName + x.MiddleInitial)
                    .ToList();

                return items;
            }
            catch (Exception ex)
            {
                Anvil.v2015.v001.Domain.Exceptions.AnvilExceptionCollector ec = new Anvil.v2015.v001.Domain.Exceptions.AnvilExceptionCollector("Error getting staff members");
                ec.Add(query);
                ec.Add(ex);
                throw ec.ToException();

            }
        }
Пример #2
0
        public void Import(LcpsDbContext context)
        {
            if (this.CrudStatus == ImportCrudStatus.InsertMember)
            {
                try
                {
                    EmailAccount e = new EmailAccount()
                    {
                        RecordId = Guid.NewGuid(),
                        EmailAddress = this.EmailAddress,
                        InitialPassword = this.InitialPassword,
                        UserLink = _userId
                    };
                    context.EmailAccounts.Add(e);
                    context.SaveChanges();

                    ImportStatus = ImportRecordStatus.success;
                }
                catch (Exception ex)
                {
                    Anvil.v2015.v001.Domain.Exceptions.AnvilExceptionCollector ec = new Anvil.v2015.v001.Domain.Exceptions.AnvilExceptionCollector(ex);
                    ImportStatus = ImportRecordStatus.danger;
                    ImportReport = ec.ToUL();
                }
            }
        }