Exemplo n.º 1
0
        private static void Create2Users(IRepositoryLocator locator)
        {
            var user = new User()
                           {
                               Name = "Chris Ranasinghe",
                           };

            locator.Save(user);

            var user2 = new User()
            {
                Name = "Anil De Silva",
            };

            locator.Save(user2);
        }
Exemplo n.º 2
0
        public static TrackingNotification Create(IRepositoryLocator locator, TrackingNotificationDto dto, DispatchNote dispatchNote)
        {
            var instance = Mapper.Map <TrackingNotification>(dto);

            instance.DispatchNote = dispatchNote;
            return(locator.Save(instance));
        }
Exemplo n.º 3
0
        private static void CreateQueries(IRepositoryLocator locator)
        {
            var user = locator.FetchAll<User>().FirstOrDefault();
            if (user == null) throw new InvalidDataException("User is needed before creating query");
            var q1 = new Query
                         {
                             CreatedDateTime = DateTime.Now,
                             DbType = EnumDatabase.Oracle,
                             Description = "Test Query - User Permissions",
                             DisplayOnHomeScreen = true,
                             Name = "RPO - Permissions",
                             Text = "select p.description as User_Or_Group, r.description as RpoMS_Role from role r,principal p,role_principal rp where r.id = rp.role_id and p.id = rp.principal_id",
                             Owner = user,
                             ParameterCount = 0,
                             Published = true
                         };

            var q2 = new Query
                        {
                            CreatedDateTime = DateTime.Now,
                            DbType = EnumDatabase.Oracle,
                            Description = "Test Query - Rail Requirement Manager",
                            Text = "Select * from Query",
                            DisplayOnHomeScreen = true,
                            Name = "RPO - Rail Req",
                            Owner = user,
                            ParameterCount = 1,
                            Published = true
                        };

            var q3 = new Query
            {
                CreatedDateTime = DateTime.Now,
                DbType = EnumDatabase.Oracle,
                Description = "Test Query - PIM All sites",
                Text = "Select * from site",
                DisplayOnHomeScreen = true,
                Name = "PIM - sites",
                Owner = user,
                ParameterCount = 0,
                Published = true
            };
            locator.Save(q1);
            locator.Save(q2);
            locator.Save(q3);
        }
Exemplo n.º 4
0
        public static Haulier Create(IRepositoryLocator locator, HaulierModel model)
        {
            var instance = new Haulier {
                Name = model.Name
            };

            locator.Save(instance);
            return(instance);
        }
Exemplo n.º 5
0
        public Query AddQuery(IRepositoryLocator locator,Query newQuery,string userName)
        {
            //Resolve windows user name to qt user
            var chris = locator.GetById<User>(1);

            var parameters = ExtractParameters(newQuery);
            newQuery.AssociateParameters(parameters);

            return locator.Save(AddDefaultProperties(newQuery,chris));
        }
Exemplo n.º 6
0
        private static void CreateUsersFromCsv(IRepositoryLocator locator)
        {
            var loader = new EntityLoader<User>("user.csv");
            var users = loader.LoadEntities();

            foreach (var user in users)
            {
                locator.Save(user);
            }
        }
Exemplo n.º 7
0
        public static Customer Create(IRepositoryLocator locator, CustomerDto operation)
        {
            var instance = new Customer
            {
                FirstName = operation.FirstName,
                LastName  = operation.LastName,
                Telephone = operation.Telephone
            };

            locator.Save(instance);
            return(instance);
        }
Exemplo n.º 8
0
        public static Customer Create(IRepositoryLocator locator, CustomerDto operation)
        {
            var instance = new Customer
            {
                FirstName = operation.FirstName,
                LastName = operation.LastName,
                Telephone = operation.Telephone
            };

            locator.Save(instance);
            return instance;
        }
Exemplo n.º 9
0
        private void CreateGroups(IRepositoryLocator locator)
        {
            var q1List = locator.FetchAll<Query>().OrderBy(q => q.Id).Take(2).ToList();
            var q2List = locator.FetchAll<Query>().OrderByDescending(q => q.Id).Take(2).ToList();

            var q1Group = new QueryGroup()
                              {
                                  Name = "Group 1",
                                  CreatedDateTime = DateTime.Now,
                              };
            q1Group.AddQueries(q1List);
            locator.Save(q1Group);

            var q2Group = new QueryGroup()
            {
                Name = "Group 2",
                CreatedDateTime = DateTime.Now,
            };
            q2Group.AddQueries(q2List);

            locator.Save(q2Group);
        }
Exemplo n.º 10
0
        public static Customer Create(IRepositoryLocator locator, CustomerDto operation)
        {
            ValidateOperation(locator, operation);
            CheckForDuplicates(locator, operation);
            var instance = new Customer
            {
                FirstName = operation.FirstName,
                LastName  = operation.LastName,
                Telephone = operation.Telephone
            };

            locator.Save(instance);
            return(instance);
        }
Exemplo n.º 11
0
        public static Address Create(IRepositoryLocator locator, AddressDto operation)
        {
            var customer = locator.GetById <Customer>(operation.CustomerId);
            var instance = new Address
            {
                Customer = customer,
                Street   = operation.Street,
                City     = operation.City,
                PostCode = operation.PostCode,
                Country  = operation.Country
            };

            locator.Save(instance);
            return(instance);
        }
        public static DispatchNote Create(IRepositoryLocator locator, DispatchNoteModel model)
        {
            var haulier  = locator.GetById <Haulier>(model.HaulierId);
            var instance = new DispatchNote
            {
                CreationDate       = model.CreationDate,
                LastUpdate         = model.CreationDate,
                DispatchDate       = model.DispatchDate,
                DispatchNoteStatus = New,
                DispatchReference  = model.DispatchReference,
                Haulier            = haulier,
                TruckReg           = model.TruckReg,
                User = model.User
            };

            locator.Save(instance);
            model.Lines.ForEach(l => instance.AddLine(locator, l));
            return(instance);
        }
 public static TrackingNotification Create(IRepositoryLocator locator, TrackingNotificationDto dto, DispatchNote dispatchNote)
 {
     var instance = Mapper.Map<TrackingNotification>(dto);
       instance.DispatchNote = dispatchNote;
       return locator.Save(instance);
 }
Exemplo n.º 14
0
        public static DispatchLine Create(IRepositoryLocator locator, DispatchLineModel dispatchLineModel)
        {
            var instance = Mapper.Map <DispatchLineModel, DispatchLine>(dispatchLineModel);

            return(locator.Save(instance));
        }
Exemplo n.º 15
0
 public static DispatchLine Create(IRepositoryLocator locator, DispatchLineModel dispatchLineModel)
 {
     var instance = Mapper.Map<DispatchLineModel, DispatchLine>(dispatchLineModel);
       return locator.Save(instance);
 }