Esempio n. 1
0
        private void AddAccountWithProfile(RaisinsContext _context, string userName, string password, string name, string title, string beneficiary)
        {
            if (!_context.Accounts.Any(a => a.UserName == userName))
            {
                var role                = _context.Roles.FirstOrDefault(r => r.Name == title);
                var salt                = GetSalt();
                var assigned            = _context.Beneficiaries.FirstOrDefault(b => b.Name == beneficiary);
                List <Beneficiary> list = new List <Beneficiary>();
                list.Add(assigned);


                Account account = new Account
                {
                    UserName = userName,
                    Salt     = salt,
                    Password = GetHash(password, salt),
                    RoleID   = role.RoleID,
                    Profile  = new AccountProfile
                    {
                        Name          = name,
                        Beneficiaries = list,
                        IsLocal       = true
                    }
                };
                _context.Accounts.Add(account);
                _context.SaveChanges();
            }
        }
Esempio n. 2
0
 public void Seed(RaisinsContext context)
 {
     AddPayment(context, "payment1", 1000.5M, 1, 1, 1, "International", "Cash");      //1
     AddPayment(context, "payment2", 2000.25M, 2, 1, 1, "Local", "PayPal");           //2
     AddPayment(context, "payment3", 1500, 2, 1, 1, "International", "Bank Deposit"); //3
     context.SaveChanges();
 }
Esempio n. 3
0
 public void Seed(RaisinsContext context)
 {
     foreach (var seeder in Seeders)
     {
         seeder.Seed(context);
     }
 }
Esempio n. 4
0
        private void AddPayment(RaisinsContext context,
                                string name,
                                decimal amount,
                                int beneficiaryID,
                                int currencyID,
                                int createdByID,
                                string sourceName,
                                string typeName)
        {
            if (!context.Payments.Any(c => c.Name == name))
            {
                //context.Payments.Add(new Payment()
                //{
                //    Name = name,
                //    Amount = amount,
                //    BeneficiaryID = beneficiaryID,
                //    CurrencyID = currencyID,
                //    CreatedByID = createdByID
                //});
                var source = context.Sources.FirstOrDefault(x => x.Source.ToLower() == sourceName.ToLower());
                var type   = context.Types.FirstOrDefault(x => x.Type.ToLower() == typeName.ToLower());

                if (source == null)
                {
                    throw new InvalidDataSeedException("Source not found!" + source);
                }
                if (type == null)
                {
                    throw new InvalidDataSeedException("Type not found!" + type);
                }

                context.Payments.Add(new Payment()
                {
                    Name            = name,
                    Amount          = amount,
                    BeneficiaryID   = beneficiaryID,
                    CurrencyID      = currencyID,
                    CreatedByID     = createdByID,
                    CreatedDate     = DateTime.Now,
                    PaymentDate     = DateTime.Now,
                    PaymentSourceID = source.PaymentSourceID,
                    PaymentTypeID   = type.PaymentTypeID
                });


                //Payment payment = new Payment
                //{
                //    Name = name,
                //    Amount = amount,
                //    BeneficiaryID = beneficiaryID,
                //    CurrencyID = currencyID,
                //    CreatedByID = createdByID,
                //    CreatedDate = DateTime.Now,
                //    PaymentDate = DateTime.Now
                //};
                //context.Payments.Add(payment);
                //context.SaveChanges();
            }
        }
Esempio n. 5
0
        public void Seed(RaisinsContext context)
        {
            _context = context;

            AddAccount("Super", "1234", "Super", "super");
            AddAccount("eugene", "1234", "Super Admin", "superadmin");
            AddAccount("superuser", "1234", "Super User", "superuser");
            //AddAccountWithProfile(context, "Super", "1234", "Super", "super", "Funny Is The New Pogi");
        }
Esempio n. 6
0
 public void Seed(RaisinsContext context)
 {
     AddCurrency(context, "PHP", 1.0M, 50.0M); //1
     AddCurrency(context, "USD", 44.0M, 1.0M); //2
     AddCurrency(context, "AUD", 39.0M, 1.0M); //3
     AddCurrency(context, "GBP", 71.0M, 1.0M); //4
     AddCurrency(context, "HKD", 5.0M, 9.0M);  //5
     AddCurrency(context, "SGD", 34.0M, 2.0M); //6
     AddCurrency(context, "EUR", 56.0M, 1.0M); //7
 }
Esempio n. 7
0
 public void Seed(RaisinsContext context)
 {
     AddBeneficiary(context, "QaiTS", "  NAV QA/TS ");                                       //1
     AddBeneficiary(context, "MANILEÑOS", "NAV Res Dev");                                    //2
     AddBeneficiary(context, "The TimeJumpers", "NAV Product/Taleris");                      //3
     AddBeneficiary(context, "Funny Is The New Pogi", "NAV SS/PMO/Disney");                  //4
     AddBeneficiary(context, "OCSDO Angels", "SUS OC SDO , PMO, SS");                        //5
     AddBeneficiary(context, "The Chronicles of Naina", "SUS PM/NonRes/Res/BusinessGroups"); //6
     AddBeneficiary(context, "*Group TBA*", "SUS IT/Installs/PMO/PerfMon/Security/BusOps");  //7
 }
Esempio n. 8
0
 private void Addsource(
     RaisinsContext context,
     string source)
 {
     if (!context.Sources.Any(c => c.Source == source))
     {
         context.Sources.Add(new PaymentSource()
         {
             Source = source
         });
     }
 }
Esempio n. 9
0
 private void AddType(
     RaisinsContext context,
     string type)
 {
     if (!context.Types.Any(c => c.Type == type))
     {
         context.Types.Add(new PaymentType()
         {
             Type = type
         });
     }
 }
Esempio n. 10
0
        public void Seed(RaisinsContext context)
        {
            _context = context;

            AddRole("Administrator", "payments_lock;payments_unlock;payments_create_new;payments_view_summary");
            AddRole("Accountant", "payments_view_summary");
            AddRole("Manager", "payments_lock;payments_unlock;payments_create_new;payments_view_summary");
            AddRole("User", "payments_create_new");
            AddRole("SuperAccountant", "payments_view_list_all");
            AddRole("SuperAdmininstrator", "beneficiaries_view;beneficiaries_create;beneficiaries_update;");
            AddRole("SuperUser", "accounts_create;accounts_edit;acounts_view");
        }
Esempio n. 11
0
 public void Seed(RaisinsContext context)
 {
     AddPayment(context, "payment1", 1000.5M, 1, 1, 1);  //1
     AddPayment(context, "payment2", 2000.25M, 2, 1, 1); //2
     AddPayment(context, "payment3", 1500, 2, 1, 1);     //3
     AddPayment(context, "payment4", 1000, 2, 1, 1);     //4
     AddPayment(context, "payment5", 1050, 3, 1, 1);     //5
     AddPayment(context, "payment6", 1000.10M, 3, 1, 2); //6
     AddPayment(context, "payment7", 1010, 3, 1, 2);     //7
     AddPayment(context, "payment8", 1000, 4, 1, 2);     //8
     AddPayment(context, "payment9", 1000, 5, 1, 2);     //9
     AddPayment(context, "payment10", 500, 6, 1, 3);     //10
 }
Esempio n. 12
0
 public void Seed(RaisinsContext context)
 {
     AddAccount(context, "marielle", "1234", "Marielle Lapidario", "Administrator");
     AddAccount(context, "natraj", "1234", "Natraj Rajput", "Accountant");
     AddAccount(context, "clarisse", "1234", "Clarisse Cheng", "Manager");
     AddAccount(context, "danica", "1234", "Danica Sevilla", "User");
     AddAccountWithProfile(context, "patricia", "1234", "patricia Honrado", "Accountant", "QaiTS");
     AddAccountWithProfile(context, "gina", "1234", "Gina Co", "Accountant", "MANILEÑOS");
     AddAccountWithProfile(context, "josiah", "1234", "Josiah Barretto", "Accountant", "The Chronicles of Naina");
     AddAccount(context, "geraldine", "1234", "Geraldine Atayan", "SuperAccountant");
     AddAccount(context, "edward", "1234", "Edward Cullen", "SuperAdmininstrator");
     AddAccount(context, "jessica", "1234", "Jessica Sanches", "SuperUser");
 }
Esempio n. 13
0
 private static void AddBeneficiary(
     RaisinsContext context,
     string name,
     string description)
 {
     if (!context.Beneficiaries.Any(b => b.Name == name))
     {
         context.Beneficiaries.Add(new Beneficiary()
         {
             Name        = name,
             Description = description
         });
     }
 }
Esempio n. 14
0
 private void AddCurrency(
     RaisinsContext context,
     string name,
     decimal exchangeRate,
     decimal ratio)
 {
     if (!context.Currencies.Any(c => c.CurrencyCode == name))
     {
         context.Currencies.Add(new Currency()
         {
             CurrencyCode = name,
             ExchangeRate = exchangeRate,
             Ratio        = ratio
         });
     }
 }
Esempio n. 15
0
        public void Seed(RaisinsContext context)
        {
            _context = context;

            AddRole("super", "payments_lock;payments_unlock;payments_create_new;payments_view_summary;" +
                    "payments_create_new;" +
                    "payments_view_list_all;payments_publish;" +
                    "beneficiaries_view;beneficiaries_create;beneficiaries_update;" +
                    "accounts_create;accounts_edit;accounts_view;" +
                    "roles_view;roles_edit;roles_create");
            AddRole("admin", "payments_lock;payments_unlock;payments_create_new;payments_view_summary");
            AddRole("accountant", "payments_view_summary");
            AddRole("manager", "payments_lock;payments_unlock;payments_create_new;payments_view_summary");
            AddRole("user", "payments_create_new");
            AddRole("superaccountant", "payments_view_list_all");
            AddRole("superadmin", "beneficiaries_view;beneficiaries_create;beneficiaries_update");
            AddRole("superuser", "accounts_create;accounts_edit;accounts_view");
        }
Esempio n. 16
0
 private void AddPayment(RaisinsContext context,
                         string name,
                         decimal amount,
                         int beneficiaryID,
                         int currencyID,
                         int createdByID)
 {
     if (!context.Payments.Any(c => c.Name == name))
     {
         context.Payments.Add(new Payment()
         {
             Name          = name,
             Amount        = amount,
             BeneficiaryID = beneficiaryID,
             CurrencyID    = currencyID,
             CreatedByID   = createdByID
         });
     }
 }
Esempio n. 17
0
 private void AddAccount(RaisinsContext _context, string userName, string password, string name, string title)
 {
     if (!_context.Accounts.Any(a => a.UserName == userName))
     {
         var     role    = _context.Roles.FirstOrDefault(r => r.Name == title);
         var     salt    = GetSalt();
         Account account = new Account
         {
             UserName = userName,
             Salt     = salt,
             Password = GetHash(password, salt),
             RoleID   = role.RoleID,
             Profile  = new AccountProfile
             {
                 Name = name
             }
         };
         _context.Accounts.Add(account);
         _context.SaveChanges();
     }
 }
 public void Seed(RaisinsContext context)
 {
     Addsource(context, "Local");
     Addsource(context, "International");
     Addsource(context, "External");
 }
Esempio n. 19
0
 public PaymentSourceRepository(RaisinsContext context)
 {
     _context = context;
 }
Esempio n. 20
0
 public TicketRepository(RaisinsContext context)
 {
     _context = context;
 }
Esempio n. 21
0
 public RoleForAccountRepository(RaisinsContext context)
 {
     _context = context;
 }
Esempio n. 22
0
 public ProfileRepository(RaisinsContext context)
 {
     _context = context;
 }
 public void Seed(RaisinsContext context)
 {
     AddType(context, "Cash");
     AddType(context, "Bank Deposit");
     AddType(context, "PayPal");
 }
Esempio n. 24
0
 public BeneficiaryForPaymentRepository(RaisinsContext context)
 {
     _context = context;
 }
Esempio n. 25
0
 public CurrencyRepository(RaisinsContext context)
 {
     _context = context;
 }
Esempio n. 26
0
 public BeneficiaryForTicketRepository(RaisinsContext context)
 {
     _context = context;
 }
Esempio n. 27
0
 public RoleRepository(RaisinsContext context)
 {
     _context = context;
 }
Esempio n. 28
0
 public MailQueueRepository(RaisinsContext context)
 {
     _context = context;
 }
Esempio n. 29
0
 public BeneficiaryRepository(RaisinsContext context)
 {
     _context = context;
 }