Ejemplo n.º 1
0
 public void Clean_1_office_cleanedSpaces_should_be_1()
 {
     int expected = 1;
     Office office = new Office();
     office.Clean(new Coordinate(0, 0));
     Assert.AreEqual(expected, office.CleanSpaces);
 }
Ejemplo n.º 2
0
 public void Initialize()
 {
     _market = new Market();
     _office = new Office();
     _buildings = new BuildingBase<TraderParameters>[] { _office };
     _market.SellGood(Goods.Corn, _buildings);
 }
Ejemplo n.º 3
0
        public void LazyLoaded_Implicit_Conversion_When_Not_IsLoad_Should_Call_DB_Once()
        {
            // Arrange
            IDataMapper db = MockRepository.GenerateMock<IDataMapper>();
            Office office1 = new Office { Number = 1 };
            Office office2 = new Office { Number = 2 };
            List<Office> offices = new List<Office> { office1, office2 };
            db.Expect(d => d.Query<Office>().ToList()).Return(offices);

            Building building = new Building();
            var lazyProxy = new LazyLoaded<Building, List<Office>>((d,b) => d.Query<Office>().ToList());
            lazyProxy.Prepare(() => db, building);
            building._offices = lazyProxy;

            // Act
            int count = building.Offices.Count;

            // Assert
            Assert.IsTrue(count == 2);

            // Act
            count = building.Offices.Count;

            // Assert
            db.AssertWasCalled(d => d.Query<Office>(), o => o.Repeat.Once()); // Should hit DB once
        }
Ejemplo n.º 4
0
 public void InitializeCorrectlyInitialize()
 {
     Office office = new Office
                             {
                                 Name = Name
                             };
     Assert.AreEqual(Name, office.Name);
 }
Ejemplo n.º 5
0
 public void LazyLoaded_Implicit_Conversion_When_IsLoad_Should_Return_Value()
 {
     Building building = new Building();
     Office office1 = new Office { Number = 1 };
     Office office2 = new Office { Number = 2 };
     building._offices = new LazyLoaded<Building, List<Office>>(new List<Office> { office1, office2 });
     int count = building.Offices.Count;
     Assert.IsTrue(count == 2);
 }
Ejemplo n.º 6
0
 public void Clean_5_different_offices_cleanedSpaces_should_be_5()
 {
     int expected = 5;
     Office office = new Office();
     office.Clean(new Coordinate(0, 0));
     office.Clean(new Coordinate(100000, 100000));
     office.Clean(new Coordinate(-100000, 100000));
     office.Clean(new Coordinate(100000, -100000));
     office.Clean(new Coordinate(-100000, -100000));
     Assert.AreEqual(expected, office.CleanSpaces);
 }
Ejemplo n.º 7
0
 public void Clean_repeated_offices_should_not_increase()
 {
     int expected = 4;
     Office office = new Office();
     office.Clean(new Coordinate(0, 0));
     office.Clean(new Coordinate(77, 77));
     office.Clean(new Coordinate(100000, 100000));
     office.Clean(new Coordinate(-100000, 100000));
     office.Clean(new Coordinate(77, 77));
     office.Clean(new Coordinate(-100000, 100000));
     Assert.AreEqual(expected, office.CleanSpaces);
 }
Ejemplo n.º 8
0
        public void GetAll()
        {
            Office officeEntity1 = new Office(){Name = "Name1"};
            Office officeEntity2 = new Office() { Name = "Name2" };
            officeRepository.Save(officeEntity1);
            officeRepository.Save(officeEntity2);

            IList<Office> resultEntities = officeRepository.GetAll().ToList();

            Assert.AreEqual(2, resultEntities.Count);
            CollectionAssert.Contains(resultEntities.ToList(), officeEntity1);
            CollectionAssert.Contains(resultEntities.ToList(), officeEntity2);
        }
Ejemplo n.º 9
0
 public static IEstate CreateEstate(EstateType type)
 {
     IEstate estate = null;
     switch (type)
     {
         case EstateType.Apartment:
             estate = new Apartment();
             break;
         case EstateType.Office:
             estate = new Office();
             break;
         case EstateType.House:
             estate = new House();
             break;
         case EstateType.Garage:
             estate = new Garage();
             break;
         default:
             break;
     }
     return estate;
 }
        public static IEstate CreateEstate(EstateType type)
        {
            Estate estate;
            switch (type)
            {
                   case EstateType.Apartment:
                    estate =  new Apartment();
                    break;
                    case EstateType.Garage:
                    estate = new Garage();
                    break;
                    case EstateType.House:
                    estate =  new House();
                    break;
                    case EstateType.Office:
                    estate = new Office();
                    break;
                default:
                    throw new ArgumentException("Invalid type for estste.");
            }

            return estate;
        }
Ejemplo n.º 11
0
        /// <summary>
        ///     Returns true if StockInfo instances are equal
        /// </summary>
        /// <param name="other">Instance of StockInfo to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(StockInfo other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Type == other.Type ||
                     Type != null &&
                     Type.Equals(other.Type)
                     ) &&
                 (
                     Industry == other.Industry ||
                     Industry != null &&
                     Industry.Equals(other.Industry)
                 ) &&
                 (
                     Classification == other.Classification ||
                     Classification != null &&
                     Classification.Equals(other.Classification)
                 ) &&
                 (
                     ListedDate == other.ListedDate ||
                     ListedDate != null &&
                     ListedDate.Equals(other.ListedDate)
                 ) &&
                 (
                     DelistedDate == other.DelistedDate ||
                     DelistedDate != null &&
                     DelistedDate.Equals(other.DelistedDate)
                 ) &&
                 (
                     RegisteredCapital == other.RegisteredCapital ||
                     RegisteredCapital != null &&
                     RegisteredCapital.Equals(other.RegisteredCapital)
                 ) &&
                 (
                     LegalRepresentative == other.LegalRepresentative ||
                     LegalRepresentative != null &&
                     LegalRepresentative.Equals(other.LegalRepresentative)
                 ) &&
                 (
                     GeneralManager == other.GeneralManager ||
                     GeneralManager != null &&
                     GeneralManager.Equals(other.GeneralManager)
                 ) &&
                 (
                     Secretary == other.Secretary ||
                     Secretary != null &&
                     Secretary.Equals(other.Secretary)
                 ) &&
                 (
                     EmployeeCount == other.EmployeeCount ||
                     EmployeeCount != null &&
                     EmployeeCount.Equals(other.EmployeeCount)
                 ) &&
                 (
                     Province == other.Province ||
                     Province != null &&
                     Province.Equals(other.Province)
                 ) &&
                 (
                     City == other.City ||
                     City != null &&
                     City.Equals(other.City)
                 ) &&
                 (
                     Office == other.Office ||
                     Office != null &&
                     Office.Equals(other.Office)
                 ) &&
                 (
                     Email == other.Email ||
                     Email != null &&
                     Email.Equals(other.Email)
                 ) &&
                 (
                     Website == other.Website ||
                     Website != null &&
                     Website.Equals(other.Website)
                 ) &&
                 (
                     BusinessScope == other.BusinessScope ||
                     BusinessScope != null &&
                     BusinessScope.Equals(other.BusinessScope)
                 ) &&
                 (
                     MainBusiness == other.MainBusiness ||
                     MainBusiness != null &&
                     MainBusiness.Equals(other.MainBusiness)
                 ) &&
                 (
                     Introduction == other.Introduction ||
                     Introduction != null &&
                     Introduction.Equals(other.Introduction)
                 ));
        }
Ejemplo n.º 12
0
        private void MockGetBookDetails()
        {
            var user1 = new ApplicationUser
            {
                Id        = "testUser1",
                FirstName = "name1",
                LastName  = "surname1"
            };

            var user2 = new ApplicationUser
            {
                Id        = "testUser2",
                FirstName = "name2",
                LastName  = "surname2"
            };

            var office1 = new Office
            {
                Id             = 1,
                Name           = "Office1",
                OrganizationId = 2
            };

            var office2 = new Office
            {
                Id             = 2,
                Name           = "Office2",
                OrganizationId = 2,
            };

            var book1 = new Book
            {
                Author         = "test1",
                Id             = 1,
                OrganizationId = 2,
                Title          = "test1"
            };

            var bookLogs1 = new List <BookLog>
            {
                new BookLog
                {
                    OrganizationId    = 2,
                    ApplicationUserId = "testUser1",
                    BookOfficeId      = 1,
                    Id              = 1,
                    Returned        = null,
                    ApplicationUser = user1
                },
                new BookLog
                {
                    OrganizationId    = 2,
                    ApplicationUserId = "testUser2",
                    BookOfficeId      = 2,
                    Returned          = null,
                    ApplicationUser   = user2
                }
            };

            var bookOffice = new List <BookOffice>
            {
                new BookOffice
                {
                    Id             = 1,
                    OrganizationId = 2,
                    OfficeId       = 1,
                    BookLogs       = new List <BookLog>(),
                    Book           = book1,
                    Office         = office1,
                    BookId         = 1,
                    Quantity       = 2
                },
                new BookOffice
                {
                    Id             = 2,
                    OrganizationId = 2,
                    OfficeId       = 2,
                    BookLogs       = bookLogs1,
                    Book           = book1,
                    Office         = office1,
                    BookId         = 1,
                    Quantity       = 2
                }
            };

            _bookOfficesDbSet.SetDbSetData(bookOffice.AsQueryable());
        }
Ejemplo n.º 13
0
 public void Update(Office office)
 {
     dao.UpdateDAO(office);
 }
Ejemplo n.º 14
0
 void awake()
 {
     Current = this;
 }
Ejemplo n.º 15
0
 public void MapTest()
 {
     Office Temp = new Office() { Name = "Test Office" };
     Temp.User = new User() { Email = "*****@*****.**" };
     Temp.User2 = new User() { Email = "*****@*****.**" };
     Temp.Save();
     Assert.Equal(1, Office.All().Count());
     Temp = Office.Any();
     Assert.Equal("Test Office", Temp.Name);
     Assert.Equal("*****@*****.**", Temp.User.Email);
     Assert.Equal("*****@*****.**", Temp.User2.Email);
     Temp.Save();
     Temp.Name = "Test Office2";
     Temp.User.Email = "*****@*****.**";
     Temp.User2.Email = "*****@*****.**";
     Temp.Save();
     Assert.Equal(1, Office.All().Count());
     Temp = Office.Any();
     Assert.Equal("Test Office2", Temp.Name);
     Assert.Equal("*****@*****.**", Temp.User.Email);
     Assert.Equal("*****@*****.**", Temp.User2.Email);
 }
Ejemplo n.º 16
0
        public void TestInitialize()
        {
            initializingDate = DateTime.UtcNow;

            EFContext.ClearDatabase();

            var context = new EFContext();

            admin = new Admin()
            {
                Data = "data", CreatedOn = initializingDate, LastUpdateOn = initializingDate
            };
            context.Admins.Add(admin);

            office1 = new Office()
            {
                Data = "data", Admin = admin, CreatedOn = initializingDate, LastUpdateOn = initializingDate
            };
            office2 = new Office()
            {
                Data = "data", Admin = admin, CreatedOn = initializingDate, LastUpdateOn = initializingDate
            };
            context.Offices.Add(office1);
            context.Offices.Add(office2);

            car1 = new Car()
            {
                Data = "data", Admin = admin, CreatedOn = initializingDate, LastUpdateOn = initializingDate
            };
            car2 = new Car()
            {
                Data = "data", Admin = admin, CreatedOn = initializingDate, LastUpdateOn = initializingDate
            };
            context.Cars.Add(car1);
            context.Cars.Add(car2);

            project1 = new Project()
            {
                Data = "data", Admin = admin, CreatedOn = initializingDate, LastUpdateOn = initializingDate
            };
            project2 = new Project()
            {
                Data = "data", Admin = admin, CreatedOn = initializingDate, LastUpdateOn = initializingDate
            };
            context.Projects.Add(project1);
            context.Projects.Add(project2);

            director = new Director()
            {
                Data = "data", CreatedOn = initializingDate, LastUpdateOn = initializingDate
            };
            context.Directors.Add(director);

            directorTracker = new DirectorTracker()
            {
                Data         = "data",
                Director     = director,
                CreatedOn    = initializingDate,
                LastUpdateOn = initializingDate
            };
            context.DirectorTrackers.Add(directorTracker);

            context.SaveChanges();
        }
Ejemplo n.º 17
0
 public void Setup()
 {
     this.office = new Office();
     this.office.VisitedLocationsCount.Should().Be(0);
 }
        private static void OfficeChoiceAdapterPropertiesWork()
        {
            var re = new Office();

            Assert.Null(re.Item);
            Assert.Null(re.ConstructionYear);
            re.ConstructionYear = 1900;
            Assert.Equal(1900, re.Item);
            Assert.Equal(1900, re.ConstructionYear);
            re.ConstructionYear = null;
            Assert.Null(re.ConstructionYear);
            Assert.True(re.ConstructionYearUnknown);
            re.ConstructionYearUnknown = true;
            Assert.IsType<bool>(re.Item);
            Assert.True((bool)re.Item);
            Assert.Null(re.ConstructionYear);

            Assert.Null(re.Item1);
            Assert.Null(re.HeatingType);
            Assert.Null(re.HeatingTypeEnev2014);
            re.HeatingType = HeatingType.STOVE_HEATING;
            Assert.IsType<HeatingType>(re.Item1);
            Assert.Equal(HeatingType.STOVE_HEATING, re.Item1);
            re.HeatingTypeEnev2014 = HeatingTypeEnev2014.FLOOR_HEATING;
            Assert.IsType<HeatingTypeEnev2014>(re.Item1);
            Assert.Equal(HeatingTypeEnev2014.FLOOR_HEATING, re.Item1);
            Assert.Null(re.HeatingType);

            Assert.Null(re.Item2);
            Assert.Null(re.FiringTypes);
            Assert.Null(re.EnergySourcesEnev2014);
            re.FiringTypes = new FiringTypes();
            Assert.IsType<FiringTypes>(re.Item2);
            Assert.Null(re.EnergySourcesEnev2014);
            re.EnergySourcesEnev2014 = new EnergySourcesEnev2014();
            Assert.IsType<EnergySourcesEnev2014>(re.Item2);
            Assert.Null(re.FiringTypes);
        }
Ejemplo n.º 19
0
 public AbstractDepartment(Office office)
 {
     _office = office;
 }
Ejemplo n.º 20
0
        public MockDbContext()
        {
            CreateOrganizations();

            CreateApplicationUsers();

            CreateRoles();

            #region Rooms

            Room room1 = new Room
            {
                Id      = 1,
                Name    = "A-Room",
                Number  = "1",
                FloorId = 1,
                Floor   = new Floor
                {
                    Id             = 1,
                    Name           = "A-Floor",
                    OfficeId       = 1,
                    OrganizationId = TestConstants.DefaultOrganizationId
                },
                RoomTypeId       = 1,
                OrganizationId   = TestConstants.DefaultOrganizationId,
                ApplicationUsers = new List <ApplicationUser> {
                    ApplicationUsers[0], ApplicationUsers[1]
                }
            };

            Room room2 = new Room
            {
                Id             = 2,
                Name           = "Z-Room",
                FloorId        = 1,
                OrganizationId = TestConstants.DefaultOrganizationId,
                Floor          = new Floor
                {
                    Id             = 1,
                    Name           = "A-Floor",
                    OfficeId       = 1,
                    OrganizationId = TestConstants.DefaultOrganizationId
                },
                Number           = "2",
                ApplicationUsers = new List <ApplicationUser> {
                    ApplicationUsers[2]
                }
            };

            Room room3 = new Room
            {
                Id             = 3,
                Name           = "B-Room",
                Number         = "3",
                FloorId        = 2,
                OrganizationId = TestConstants.DefaultOrganizationId,
                Floor          = new Floor
                {
                    Id             = 2,
                    Name           = "B-Floor",
                    OfficeId       = 1,
                    OrganizationId = TestConstants.DefaultOrganizationId
                },
                ApplicationUsers = new List <ApplicationUser>()
            };

            Room room4 = new Room
            {
                Id             = 4,
                Name           = "D-Room",
                FloorId        = 1,
                OrganizationId = TestConstants.DefaultOrganizationId,
                Floor          = new Floor
                {
                    Id             = 1,
                    Name           = "A-Floor",
                    OfficeId       = 1,
                    OrganizationId = TestConstants.DefaultOrganizationId
                },
                ApplicationUsers = new List <ApplicationUser>()
            };

            Room room5 = new Room
            {
                Id             = 5,
                Name           = "5-Room",
                FloorId        = 2,
                OrganizationId = TestConstants.DefaultOrganizationId,
                Floor          = new Floor()
                {
                    Id             = 2,
                    Name           = "B-Floor",
                    OfficeId       = 1,
                    OrganizationId = TestConstants.DefaultOrganizationId
                },
                ApplicationUsers = new List <ApplicationUser>()
            };

            #endregion Rooms

            #region Floors

            Floor floor1 = new Floor
            {
                Id       = 1,
                Name     = "A-Floor",
                OfficeId = 1,
                Office   = new Office {
                    Id = 1
                },
                OrganizationId = TestConstants.DefaultOrganizationId,
                Rooms          = new List <Room> {
                    room1, room2, room4
                }
            };

            Floor floor2 = new Floor
            {
                Id       = 2,
                Name     = "Z-Floor",
                OfficeId = 1,
                Office   = new Office {
                    Id = 1
                },
                Rooms = new List <Room> {
                    room3
                },
                OrganizationId = TestConstants.DefaultOrganizationId
            };

            Floor floor3 = new Floor
            {
                Id       = 3,
                Name     = "D-Floor",
                OfficeId = 2,
                Office   = new Office {
                    Id = 2
                },
                OrganizationId = TestConstants.DefaultOrganizationId
            };

            Floor floor4 = new Floor
            {
                Id       = 4,
                Name     = "4floor",
                OfficeId = 3,
                Office   = new Office {
                    Id = 3
                },
                OrganizationId = TestConstants.DefaultOrganizationId
            };

            #endregion Floors

            #region Offices

            Office office1 = new Office
            {
                Id      = 1,
                Name    = "B-Office",
                Address = new Address
                {
                    Country  = "Lithuania",
                    City     = "Vilnius",
                    Street   = "Lvovo",
                    Building = "25"
                },
                Floors = new List <Floor> {
                    floor1, floor3
                },
                OrganizationId = TestConstants.DefaultOrganizationId
            };

            Office office2 = new Office
            {
                Id      = 2,
                Name    = "Z-Office",
                Address = new Address
                {
                    Country  = "Lithuania",
                    City     = "Vilnius",
                    Street   = "Lvovo",
                    Building = "25"
                },
                Floors = new List <Floor> {
                    floor2
                },
                IsDefault      = true,
                OrganizationId = TestConstants.DefaultOrganizationId
            };

            Office office3 = new Office
            {
                Id             = 3,
                Name           = "A-Office",
                OrganizationId = TestConstants.DefaultOrganizationId,
                Address        = new Address
                {
                    Country  = "Lithuania",
                    City     = "Kaunas",
                    Street   = "Lvovo",
                    Building = "25"
                }
            };

            Office office4 = new Office
            {
                Id      = 4,
                Name    = "W-Office",
                Address = new Address
                {
                    Country  = "Lithuania",
                    City     = "Kaunas",
                    Street   = "Lvovo",
                    Building = "25"
                },
                OrganizationId = TestConstants.DefaultOrganizationId
            };

            #endregion Offices

            #region RoomTypes

            RoomTypes = new List <RoomType>
            {
                new RoomType
                {
                    Id    = 1,
                    Name  = "Room",
                    Color = "#FFFFFF",
                    Rooms = new List <Room> {
                        room1, room2
                    },
                    OrganizationId = TestConstants.DefaultOrganizationId
                },
                new RoomType
                {
                    Id             = 2,
                    Name           = "Meeting Room",
                    Color          = "#FF0000",
                    Rooms          = new List <Room>(),
                    OrganizationId = TestConstants.DefaultOrganizationId
                },
                new RoomType
                {
                    Id    = 3,
                    Name  = "Kitchen",
                    Color = "#00FF00",
                    Rooms = new List <Room> {
                        room3, room4
                    },
                    OrganizationId = TestConstants.DefaultOrganizationId
                },
                new RoomType
                {
                    Id    = 4,
                    Name  = "WC",
                    Color = "#808080",
                    Rooms = new List <Room> {
                        room5
                    },
                    OrganizationId = TestConstants.DefaultOrganizationId
                },
                new RoomType
                {
                    Id             = 10,
                    Name           = "Unknown",
                    Color          = "#000000",
                    Rooms          = new List <Room>(),
                    OrganizationId = TestConstants.DefaultOrganizationId
                }
            };

            #endregion RoomTypes

            #region QualificationLevels
            var qualificationLevel1 = new QualificationLevel
            {
                Id               = 1,
                Name             = "Junior",
                ApplicationUsers = new List <ApplicationUser> {
                    ApplicationUsers[0], ApplicationUsers[1]
                },
                OrganizationId = TestConstants.DefaultOrganizationId
            };

            var qualificationLevel2 = new QualificationLevel
            {
                Id               = 2,
                Name             = "Senior",
                ApplicationUsers = new List <ApplicationUser> {
                    ApplicationUsers[2], ApplicationUsers[3]
                },
                OrganizationId = TestConstants.DefaultOrganizationId
            };
            #endregion

            Rooms = new List <Room> {
                room1, room2, room3, room4, room5
            };
            Floors = new List <Floor> {
                floor1, floor2, floor3, floor4
            };
            Offices = new List <Office> {
                office1, office2, office3, office4
            };
            QualificationLevels = new List <QualificationLevel> {
                qualificationLevel1, qualificationLevel2
            };
        }
Ejemplo n.º 21
0
        protected void SetupResponsibleOfficeInfo()
        {
            Office office = db.Offices.Where(p => p.office_id == OfficeID).FirstOrDefault();

            ltlOfficeInfo.Text = String.Format("<a href='{0}SIMSWSCHome.aspx?wsc_id={1}&office_id={2}'>{3}</a><br />{4}<br />{5}<br />{6}", Config.SIMSURL, WSCID, OfficeID, office.office_nm, office.street_addrs, office.city_st_zip, office.ph_no);
        }
Ejemplo n.º 22
0
 public async Task RemoveOffice(Office o)
 {
     _context.Offices.Remove(o);
     await _context.SaveChangesAsync();
 }
Ejemplo n.º 23
0
        public Task <ResourceCreationResult <Office, int> > CreateAsync(Office resource, IRequestContext context, CancellationToken cancellation)
        {
            var newOffice = _officeservice.Add(_toTransportMapper.Map(resource));

            return(Task.FromResult(new ResourceCreationResult <Model.Office, int>(_toResourceMapper.Map(newOffice))));
        }
        private static void OfficeChoiceAdapterPropertiesWork()
        {
            var re = new Office();

            Assert.Null(re.Item);
            Assert.Null(re.ConstructionYear);
            re.ConstructionYear = 1900;
            Assert.Equal(1900, re.Item);
            Assert.Equal(1900, re.ConstructionYear);
            re.ConstructionYear = null;
            Assert.Null(re.ConstructionYear);
            Assert.True(re.ConstructionYearUnknown);
            re.ConstructionYearUnknown = true;
            Assert.IsType<bool>(re.Item);
            Assert.True((bool)re.Item);
            Assert.Null(re.ConstructionYear);
        }
Ejemplo n.º 25
0
 public async Task <bool> EditOffice([FromBody] Office office)
 {
     return(await this.officeLogic.EditOffice(office));
 }
Ejemplo n.º 26
0
        private void DecryptButton_Click(Office.CommandBarButton Ctrl, ref bool CancelDefault)
        {
            // Get the selected item in Outlook and determine its type.
              Outlook.Selection outlookSelection = Application.ActiveExplorer().Selection;
              if (outlookSelection.Count <= 0)
            return;

              object selectedItem = outlookSelection[1];
              Outlook.MailItem mailItem = selectedItem as Outlook.MailItem;

              if (mailItem == null)
              {
            MessageBox.Show(
            "OutlookGnuPG can only decrypt mails.",
            "Invalid Item Type",
            MessageBoxButtons.OK,
            MessageBoxIcon.Error);

            return;
              }

              // Force open of mailItem with auto decrypt.
              _autoDecrypt = true;
              mailItem.Display(true);
            //      DecryptEmail(mailItem);
        }
Ejemplo n.º 27
0
 public GenerateSchedule()
 {
     InitializeComponent();
     office           = EventMenuControl.office;
     this.DataContext = office;
 }
Ejemplo n.º 28
0
 /// <summary>
 /// Updates data of users.
 /// </summary>
 public void UpdateArrangementsData()
 {
     try
     {
         if (string.IsNullOrEmpty(ServiceURL))
             return;
         try
         {
             // Create service wrapper.
             Office of = new Office();
             of.Load(OfficeID);
             using (ArrangementServiceProxy c = new ArrangementServiceProxy("http://localhost:59874/ArrangementService.svc", Page.CurrentUser.ID))
             {
                 List<XMLSerializableConferenceHall> coll = new List<XMLSerializableConferenceHall>();
                 XMLSerializableConferenceHall[] chs = c.GetConferenceHallsList(OfficeID);
                 if (chs != null)
                 {
                     coll.AddRange(chs);
                 }
                 grdConferenceHallsList.DataSource = coll.ToArray();
                 grdConferenceHallsList.DataBind();
             }
         }
         catch (Exception ex)
         { UlterSystems.PortalLib.Logger.Log.Error(ex.Message, ex); }
     }
     finally
     { }
 }
Ejemplo n.º 29
0
            protected override void Seed(DatabaseContext context)
            {
                if (context.Persons.Any())
                {
                    return;
                }

                var addresses = new Address[]
                {
                    new Address("New Orchard Road", 1),
                    new Address("One Microsoft Way", 17),
                    new Address("Amphitheatre Parkway", 1600)
                };

                var offices = new Office[]
                {
                    new Office("IBM", addresses[0]),
                    new Office("Microsoft", addresses[1]),
                    new Office("Google", addresses[2])
                };

                var persons = new Person[]
                {
                    new Person("Tiger Nixon", "System Architect", offices[0], "5421", "2011/04/25", "320800"),
                    new Person("Garrett Winters", "Accountant", offices[0], "8422", "2011/07/25", "170750"),
                    new Person("Ashton Cox", "Junior Technical Author", offices[1], "1562", "2009/01/12", "86000"),
                    new Person("Cedric Kelly", "Senior Javascript Developer", offices[0], "6224", "2012/03/29", "433060"),
                    new Person("Airi Satou", "Accountant", offices[0], "5407", "2008/11/28", "162700"),
                    new Person("Brielle Williamson", "Integration Specialist", offices[0], "4804", "2012/12/02", "372000"),
                    new Person("Herrod Chandler", "Sales Assistant", offices[0], "9608", "2012/08/06", "137500"),
                    new Person("Rhona Davidson", "Integration Specialist", offices[0], "6200", "2010/10/14", "327900"),
                    new Person("Colleen Hurst", "Javascript Developer", offices[1], "2360", "2009/09/15", "205500"),
                    new Person("Sonya Frost", "Software Engineer", offices[1], "1667", "2008/12/13", "103600"),
                    new Person("Jena Gaines", "Office Manager", offices[0], "3814", "2008/12/19", "90560"),
                    new Person("Quinn Flynn", "Support Lead", offices[1], "9497", "2013/03/03", "342000"),
                    new Person("Charde Marshall", "Regional Director", offices[1], "6741", "2008/10/16", "470600"),
                    new Person("Haley Kennedy", "Senior Marketing Designer", offices[0], "3597", "2012/12/18", "313500"),
                    new Person("Tatyana Fitzpatrick", "Regional Director", offices[0], "1965", "2010/03/17", "385750"),
                    new Person("Michael Silva", "Marketing Designer", offices[2], "1581", "2012/11/27", "198500"),
                    new Person("Paul Byrd", "Chief Financial Officer (CFO)", offices[0], "3059", "2010/06/09", "725000"),
                    new Person("Gloria Little", "Systems Administrator", offices[2], "1721", "2009/04/10", "237500"),
                    new Person("Bradley Greer", "Software Engineer", offices[0], "2558", "2012/10/13", "132000"),
                    new Person("Dai Rios", "Personnel Lead", offices[0], "2290", "2012/09/26", "217500"),
                    new Person("Jenette Caldwell", "Development Lead", offices[0], "1937", "2011/09/03", "345000"),
                    new Person("Yuri Berry", "Chief Marketing Officer (CMO)", offices[2], "6154", "2009/06/25", "675000"),
                    new Person("Caesar Vance", "Pre-Sales Support", offices[0], "8330", "2011/12/12", "106450"),
                    new Person("Doris Wilder", "Sales Assistant", offices[0], "3023", "2010/09/20", "85600"),
                    new Person("Angelica Ramos", "Chief Executive Officer (CEO)", offices[0], "5797", "2009/10/09", "1200000"),
                    new Person("Gavin Joyce", "Developer", offices[0], "8822", "2010/12/22", "92575"),
                    new Person("Jennifer Chang", "Regional Director", offices[2], "9239", "2010/11/14", "357650"),
                    new Person("Brenden Wagner", "Software Engineer", offices[0], "1314", "2011/06/07", "206850"),
                    new Person("Fiona Green", "Chief Operating Officer (COO)", offices[0], "2947", "2010/03/11", "850000"),
                    new Person("Shou Itou", "Regional Marketing", offices[1], "8899", "2011/08/14", "163000"),
                    new Person("Michelle House", "Integration Specialist", offices[0], "2769", "2011/06/02", "95400"),
                    new Person("Suki Burks", "Developer", offices[0], "6832", "2009/10/22", "114500"),
                    new Person("Prescott Bartlett", "Technical Author", offices[1], "3606", "2011/05/07", "145000"),
                    new Person("Gavin Cortez", "Team Leader", offices[0], "2860", "2008/10/26", "235500"),
                    new Person("Martena Mccray", "Post-Sales support", offices[1], "8240", "2011/03/09", "324050"),
                    new Person("Unity Butler", "Marketing Designer", offices[0], "5384", "2009/12/09", "85675"),
                    new Person("Howard Hatfield", "Office Manager", offices[2], "7031", "2008/12/16", "164500"),
                    new Person("Hope Fuentes", "Secretary", offices[0], "6318", "2010/02/12", "109850"),
                    new Person("Vivian Harrell", "Financial Controller", offices[0], "9422", "2009/02/14", "452500"),
                    new Person("Timothy Mooney", "Office Manager", offices[0], "7580", "2008/12/11", "136200"),
                    new Person("Jackson Bradshaw", "Director", offices[0], "1042", "2008/09/26", "645750"),
                    new Person("Olivia Liang", "Support Engineer", offices[2], "2120", "2011/02/03", "234500"),
                    new Person("Bruno Nash", "Software Engineer", offices[0], "6222", "2011/05/03", "163500"),
                    new Person("Sakura Yamamoto", "Support Engineer", offices[1], "9383", "2009/08/19", "139575"),
                    new Person("Thor Walton", "Developer", offices[0], "8327", "2013/08/11", "98540"),
                    new Person("Finn Camacho", "Support Engineer", offices[0], "2927", "2009/07/07", "87500"),
                    new Person("Serge Baldwin", "Data Coordinator", offices[0], "8352", "2012/04/09", "138575"),
                    new Person("Zenaida Frank", "Software Engineer", offices[0], "7439", "2010/01/04", "125250"),
                    new Person("Zorita Serrano", "Software Engineer", offices[0], "4389", "2012/06/01", "115000"),
                    new Person("Jennifer Acosta", "Junior Javascript Developer", offices[0], "3431", "2013/02/01", "75650"),
                    new Person("Cara Stevens", "Sales Assistant", offices[0], "3990", "2011/12/06", "145600"),
                    new Person("Hermione Butler", "Regional Director", offices[0], "1016", "2011/03/21", "356250"),
                    new Person("Lael Greer", "Systems Administrator", offices[1], "6733", "2009/02/27", "103500"),
                    new Person("Jonas Alexander", "Developer", offices[1], "8196", "2010/07/14", "86500"),
                    new Person("Shad Decker", "Regional Director", offices[0], "6373", "2008/11/13", "183000"),
                    new Person("Michael Bruce", "Javascript Developer", offices[0], "5384", "2011/06/27", "183000"),
                    new Person("Donna Snider", "Customer Support", offices[0], "4226", "2011/01/25", "112000")
                };


                context.Persons.AddRange(persons);
                context.SaveChanges();

                base.Seed(context);
            }
        public static void InitializeStore()
        {
            var country1 = new Country {
                Id = 1, Name = "France"
            };
            var country2 = new Country {
                Id = 2, Name = "USA"
            };
            var country3 = new Country {
                Id = 3, Name = "China"
            };

            var location1 = new Location {
                Id = 1, DisplayName = "Paris by night", City = "Paris", AddressLine1 = "12 rue des étoiles", ZipCode = "75008", Country = country1
            };
            var location2 = new Location {
                Id = 2, DisplayName = "NY", City = "NewYork", AddressLine1 = "block 5", ZipCode = "123 M", Country = country2
            };
            var location3 = new Location {
                Id = 3, DisplayName = "Space X Headquarters", City = "Hawthorne", AddressLine1 = "Rocket Rd", ZipCode = "CA 90250", Country = country2
            };

            var office1 = new Office {
                Id = 1, Name = "Paris - Busieness", Address = location1
            };
            var office2 = new Office {
                Id = 2, Name = "Paris - IT", Address = location1
            };
            var office3 = new Office {
                Id = 3, Name = "NY", Address = location2
            };
            var office4 = new Office {
                Id = 3, Name = "Space X", Address = location3
            };

            var per1 = new Person {
                Id = 1, ExternalId = Guid.NewGuid().ToString(), DefaultOffice = office1, Firstname = "Thomas", Lastname = "Carter", Offices = new List <Office>()
                {
                    office1, office4
                }
            };
            var per2 = new Person {
                Id = 2, ExternalId = Guid.NewGuid().ToString(), DefaultOffice = office2, Firstname = "Luck", Lastname = "Skywalker", Offices = new List <Office>()
                {
                    office2
                }
            };
            var per3 = new Person {
                Id = 3, ExternalId = Guid.NewGuid().ToString(), DefaultOffice = office3, Firstname = "Ben", Lastname = "Kenobi", Offices = new List <Office>()
                {
                    office3, office4
                }
            };
            var per4 = new Person {
                Id = 4, ExternalId = Guid.NewGuid().ToString(), DefaultOffice = office4, Firstname = "Han", Lastname = "Solo", Offices = new List <Office>()
                {
                    office4
                }
            };
            var per5 = new Person {
                Id = 5, ExternalId = Guid.NewGuid().ToString(), DefaultOffice = office4, Firstname = "Leia", Lastname = "Organa", Offices = new List <Office>()
                {
                    office4
                }
            };
            var per6 = new Person {
                Id = 6, ExternalId = Guid.NewGuid().ToString(), DefaultOffice = office4, Firstname = "Chewbacca", Lastname = "", Offices = new List <Office>()
                {
                    office1, office4
                }
            };
            var per7 = new Person {
                Id = 7, ExternalId = Guid.NewGuid().ToString(), DefaultOffice = office1, Firstname = "Yoda", Lastname = "", Offices = new List <Office>()
                {
                    office1, office4
                }
            };

            ViewModelStore.Countries = new List <Country>()
            {
                country1, country2, country3
            };
            ViewModelStore.Locations = new List <Location>()
            {
                location1, location2, location3
            };
            ViewModelStore.Offices = new List <Office>()
            {
                office1, office2, office3, office4
            };
            ViewModelStore.People = new List <Person>()
            {
                per1, per2, per3, per4, per5, per6, per7
            };
        }
Ejemplo n.º 31
0
        public async Task <Office> AddOffice(Office office)
        {
            var addedEntity = await _officeRepository.Add(OfficeMapper.Map(office));

            return(OfficeMapper.Map(addedEntity));
        }
Ejemplo n.º 32
0
 public void CreateNew(Office office)
 {
     dao.CreateNewDAO(office);
 }
Ejemplo n.º 33
0
        public async Task <Office> UpdateOffice(Office office)
        {
            var updated = await _officeRepository.Update(OfficeMapper.Map(office));

            return(OfficeMapper.Map(updated));
        }
Ejemplo n.º 34
0
        private void insertOffice()
        {
            Office office = getOfficeFromControls();

            officeControl.saveOffice(office);
        }
Ejemplo n.º 35
0
 public void AddOffice(Office newOffice)
 {
     CompanyOffices.Add(newOffice);
 }
 public void UpdateOffice(Office office)
 {
     _db.Update(office);
     _db.SaveChanges();
 }
Ejemplo n.º 37
0
 public IHttpActionResult EditOffice([FromBody] Office office)
 {
     Call_Func.EditOffice(office);
     return(Created <Office>("Created Successfully", office));
 }
Ejemplo n.º 38
0
 /// <summary>
 ///     Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked            // Overflow is fine, just wrap
     {
         int hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (Type != null)
         {
             hashCode = hashCode * 59 + Type.GetHashCode();
         }
         if (Industry != null)
         {
             hashCode = hashCode * 59 + Industry.GetHashCode();
         }
         if (Classification != null)
         {
             hashCode = hashCode * 59 + Classification.GetHashCode();
         }
         if (ListedDate != null)
         {
             hashCode = hashCode * 59 + ListedDate.GetHashCode();
         }
         if (DelistedDate != null)
         {
             hashCode = hashCode * 59 + DelistedDate.GetHashCode();
         }
         if (RegisteredCapital != null)
         {
             hashCode = hashCode * 59 + RegisteredCapital.GetHashCode();
         }
         if (LegalRepresentative != null)
         {
             hashCode = hashCode * 59 + LegalRepresentative.GetHashCode();
         }
         if (GeneralManager != null)
         {
             hashCode = hashCode * 59 + GeneralManager.GetHashCode();
         }
         if (Secretary != null)
         {
             hashCode = hashCode * 59 + Secretary.GetHashCode();
         }
         if (EmployeeCount != null)
         {
             hashCode = hashCode * 59 + EmployeeCount.GetHashCode();
         }
         if (Province != null)
         {
             hashCode = hashCode * 59 + Province.GetHashCode();
         }
         if (City != null)
         {
             hashCode = hashCode * 59 + City.GetHashCode();
         }
         if (Office != null)
         {
             hashCode = hashCode * 59 + Office.GetHashCode();
         }
         if (Email != null)
         {
             hashCode = hashCode * 59 + Email.GetHashCode();
         }
         if (Website != null)
         {
             hashCode = hashCode * 59 + Website.GetHashCode();
         }
         if (BusinessScope != null)
         {
             hashCode = hashCode * 59 + BusinessScope.GetHashCode();
         }
         if (MainBusiness != null)
         {
             hashCode = hashCode * 59 + MainBusiness.GetHashCode();
         }
         if (Introduction != null)
         {
             hashCode = hashCode * 59 + Introduction.GetHashCode();
         }
         return(hashCode);
     }
 }
Ejemplo n.º 39
0
 public void SetUp()
 {
     _office = new Office();
 }
Ejemplo n.º 40
0
 /// <summary>
 /// Create a new Office object.
 /// </summary>
 /// <param name="ID">Initial value of Id.</param>
 /// <param name="officeNumber">Initial value of OfficeNumber.</param>
 /// <param name="floorNumber">Initial value of FloorNumber.</param>
 /// <param name="buildingName">Initial value of BuildingName.</param>
 /// <param name="city">Initial value of City.</param>
 /// <param name="state">Initial value of State.</param>
 /// <param name="isWindowOffice">Initial value of IsWindowOffice.</param>
 public static Office CreateOffice(int ID, int officeNumber, short floorNumber, string buildingName, string city, string state, bool isWindowOffice)
 {
     Office office = new Office();
     office.Id = ID;
     office.OfficeNumber = officeNumber;
     office.FloorNumber = floorNumber;
     office.BuildingName = buildingName;
     office.City = city;
     office.State = state;
     office.IsWindowOffice = isWindowOffice;
     return office;
 }
Ejemplo n.º 41
0
 /// <summary>
 /// Updates data of users.
 /// </summary>
 public void UpdateArrangementsData()
 {
     try
     {
         if (string.IsNullOrEmpty(ServiceURL))
             return;
         try
         {
             // Create service wrapper.
             Office of = new Office();
             of.Load(OfficeID);
             //using (ArrangementServiceProxy c = new ArrangementServiceProxy("http://localhost:59874/ArrangementService.svc", Page.CurrentUser.ID))
             //{
             //    List<XMLSerializableConferenceHall> coll = new List<XMLSerializableConferenceHall>();
             //    XMLSerializableConferenceHall[] chs = c.GetConferenceHallsList(OfficeID);
             //    if (chs != null)
             //    {
             //        coll.AddRange(chs);
             //    }
             //    grdConferenceHallsList.DataSource = coll.ToArray();
             //    grdConferenceHallsList.DataBind();
             //}
         }
         catch (Exception)
         {
         }
     }
     finally
     { }
 }
Ejemplo n.º 42
0
 public void Ctor()
 {
     var office = new Office();
 }
Ejemplo n.º 43
0
 public static Office CreateOffice(int ID, byte[] rowVersion, string name, global::System.DateTime createDate)
 {
     Office office = new Office();
     office.Id = ID;
     office.RowVersion = rowVersion;
     office.Name = name;
     office.CreateDate = createDate;
     return office;
 }
Ejemplo n.º 44
0
 private void AboutButton_Click(Office.CommandBarButton Ctrl, ref bool CancelDefault)
 {
     Globals.OutlookGnuPG.About();
 }
Ejemplo n.º 45
0
        private void VerifyButton_Click(Office.CommandBarButton Ctrl, ref bool CancelDefault)
        {
            // Get the selected item in Outlook and determine its type.
              Outlook.Selection outlookSelection = Application.ActiveExplorer().Selection;
              if (outlookSelection.Count <= 0)
            return;

              object selectedItem = outlookSelection[1];
              Outlook.MailItem mailItem = selectedItem as Outlook.MailItem;

              if (mailItem == null)
              {
            MessageBox.Show(
            "OutlookGnuPG can only verify mails.",
            "Invalid Item Type",
            MessageBoxButtons.OK,
            MessageBoxIcon.Error);

            return;
              }

              VerifyEmail(mailItem);
        }
        public void Setup()
        {
            _rep = new FakeConsoleRepository();

            COB c = new COB() { Id = "CA", Narrative = "Cargo" };
            Office off = new Office() { Id = "LON", Title = "London" };
            List<User> users = new List<User>();
            User u = new User() { DomainLogon = @"talbotdev\murraye" };
            u.FilterCOBs = new List<COB>();
            u.AdditionalCOBs = new List<COB>();
            u.FilterOffices = new List<Office>();
            u.AdditionalOffices = new List<Office>();
            u.FilterMembers = new List<User>();
            u.AdditionalUsers = new List<User>();

            u.AdditionalCOBs.Add(c);

            users.Add(u);
            _rep.Users = users.AsQueryable();

            List<globalVM::Validus.Models.Submission> subs = new List<globalVM::Validus.Models.Submission>();

            for (int i = 0; i < 15; i++)
			{
                subs.Add(new globalVM::Validus.Models.Submission()
                {
                    Id = i,
                    CreatedBy = "InitialSetup",
                    CreatedOn = DateTime.Now,
                    ModifiedBy = "InitialSetup",
                    ModifiedOn = DateTime.Now,
                    InsuredName = (i == 3 || i == 6 ? "Fergus Baillie" : "ALLAN MURRAY"),
                    BrokerCode = String.Format("11{0}", i),
                    BrokerPseudonym = "AAA",
                    BrokerSequenceId = 822,
                    InsuredId = 182396,                    
                    Brokerage = 1,
                    BrokerContact = "ALLAN MURRAY",
                    
                    UnderwriterCode = "AED",
                    UnderwriterContactCode = "JAC",
                    QuotingOfficeId = "LON",
                    Leader = "AG",
                    Domicile = "AD",
                    Title = "Unit Test Submission",
                    Options = new List<Option>()                    
                });
            }

            List<Option> options = new List<Option>();
            Option o = new Option() { Title = "Test", SubmissionId = 3, Submission = subs[3] };
            options.Add(o);

            List<OptionVersion> optionVersions = new List<OptionVersion>();
            OptionVersion ov = new OptionVersion() { Title = "Test", Option = o };
            optionVersions.Add(ov);

            List<Quote> quotes = new List<Quote>();
            Quote q = new Quote() { 
                COB = c, COBId = c.Id, 
                OriginatingOffice = off, 
                OriginatingOfficeId = off.Id, 
                EntryStatus = "PARTIAL",
                OptionVersion = ov,
                SubscribeReference = "BAN169784A13"
            };
            
            quotes.Add(q);

            ov.Quotes = quotes;
            o.OptionVersions = optionVersions;

            for (int i = 0; i < 15; i++)
            {
                subs[i].Options = options;
            }

            _rep.Submissions = subs.AsQueryable();            

            var mockSubscribeService = new Mock<IPolicyService>();
            mockSubscribeService.Setup(s => s.CreateQuote(It.IsAny<CreateQuoteRequest>()))
                                .Returns(new CreateQuoteResponse
                                    {
                                        CreateQuoteResult = new StandardOutput { OutputXml = MvcMockHelpers.CreateQuoteResponseXml() },
                                        objInfoCollection = new InfoCollection { PolId = "BAN165118A13" }
                                    });
            mockSubscribeService.Setup(s => s.GetReference(It.IsAny<GetReferenceRequest>()))
                                .Returns(new GetReferenceResponse
                                    {
                                        GetReferenceResult =
                                            new StandardOutput {OutputXml = MvcMockHelpers.CreateGetReferenceResponseXml()}
                                    });
            var mockPolicyData = new Mock<IPolicyData>();
            var context = new Mock<ICurrentHttpContext>();
            var user = @"talbotdev\murraye";
            //user = user.Replace(@"\\", @"\");
            context.Setup(h => h.CurrentUser).Returns(new GenericPrincipal(new GenericIdentity(user), null));
            context.Setup(h => h.Context).Returns(MvcMockHelpers.FakeHttpContextWithSession());

            _webSiteModuleManager = new WebSiteModuleManager(_rep, context.Object);
            _submissionModule = new SubmissionModule(_rep, mockSubscribeService.Object, new LogHandler(), context.Object, _webSiteModuleManager, mockPolicyData.Object);
            //_submissionModule = new SubmissionModule(rep, null, null, cont);
        }
Ejemplo n.º 47
0
 public void Add(Office data)
 {
     _context.Add(data);
 }
Ejemplo n.º 48
0
        private void RegisterOfficeConfiguration(Gateway tripThru, Office o)
        {
            List<Fleet> fleets = new List<Fleet>();
            List<Zone> coverage = o.coverage;
            fleets.Add(new Fleet("TDispatch", "TDispatch", o.name, o.name, coverage));
            List<VehicleType> vehicleTypes = new List<VehicleType>();

            TDispatchIntegration partner = new TDispatchIntegration(tripThru, apiKey: o.api_key,
                fleetAuth: o.fleetAuthorizationCode, fleetAccessToken: o.fleetAccessToken,
                fleetRefreshToken: o.fleetRefreshToken,
                passengerAuth: o.passengerAuthorizationCode, passengerAccessToken: o.passengerAccessToken,
                passengerRefreshToken: o.passengerRefreshToken,
                passengerProxyPK: o.passengerProxyPK, fleets: fleets, vehicleTypes: vehicleTypes);
            o.fleetAccessToken = partner.api.FLEET_ACCESS_TOKEN;
            o.fleetRefreshToken = partner.api.FLEET_REFRESH_TOKEN;
            o.passengerAccessToken = partner.api.PASSENGER_ACCESS_TOKEN;
            o.passengerRefreshToken = partner.api.PASSENGER_REFRESH_TOKEN;
            o.ID = partner.ID;
            o.name = partner.name;
            RegisterPartner(new GatewayLocalClient(partner)); // the local client is not necessary, it just encloses the call inside a Begin/End request (for logging)
        }
Ejemplo n.º 49
0
 public void Update(Office data)
 {
     _context.Update(data);
 }
Ejemplo n.º 50
0
 public IActionResult CreateOffice([FromBody] Office office)
 {
     _officeRepo.CreateOffice(office);
     return(Ok("Office Created"));
 }
Ejemplo n.º 51
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string OfficeID = null;

            try
            {
                OfficeID = (string)Page.RouteData.Values[AppRoutes.Village.ValOfficeID];
            }
            catch (Exception ex)
            {
            }

            if (OfficeID != null)
            {
                //CHECK FOR USER ACCESS

                string OfficeTypeID = DbSettings.OfficeType.Village;

                Users          objUsr    = new Users();
                UserKeyDetails objUsrDet = objUsr.GetUserKeyDetails();

                string UserID       = objUsrDet.UserID;
                string UserStatusID = objUsrDet.StatusID;
                string UserRoleID   = objUsrDet.RoleID;

                string UserOfficeID     = objUsrDet.OfficeID;
                string UserOfficeTypeID = objUsrDet.OfficeTypeID;

                if (UserID != null && UserStatusID == DbSettings.UserStatus.Active)
                {
                    //check if user can access this office type

                    DataSet       ds          = objUsr.GetMenusActionsForRoleID(UserRoleID);
                    List <string> MenuActions = ds.Tables[0].AsEnumerable().Select(r => r[0].ToString()).ToList();
                    bool          AccessView  = MenuActions.Contains(DbSettings.AccessOffice.ViewVilTab);

                    if (AccessView)
                    {
                        //check if user can access this office of OfficeID

                        Office objOff = new Office();

                        CustEnum.PageAccess CanAccessOffice = CustEnum.PageAccess.Error;

                        if ((UserOfficeTypeID == OfficeTypeID) && (UserOfficeID == OfficeID))
                        {
                            CanAccessOffice = CustEnum.PageAccess.Yes;
                        }
                        else if (int.Parse(UserOfficeTypeID) < int.Parse(OfficeTypeID))
                        {
                            if (objOff.CheckIfSubOfficeExistUnderOfficeID(UserOfficeID, OfficeID) == "1")
                            {
                                CanAccessOffice = CustEnum.PageAccess.Yes;
                            }
                            else if (objOff.CheckIfSubOfficeExistUnderOfficeID(UserOfficeID, OfficeID) == "0")
                            {
                                CanAccessOffice = CustEnum.PageAccess.No;
                            }
                        }


                        if (CanAccessOffice == CustEnum.PageAccess.Yes)
                        {
                            //user can access this page

                            //Check for MenuActions privileges

                            hdnOid.Value = OfficeID;

                            bool AccessEditVil = MenuActions.Contains(DbSettings.AccessOffice.EditVil);
                            bool AccessViewCen = MenuActions.Contains(DbSettings.AccessCenters.ViewCenterList);
                            bool AccessAddCen  = MenuActions.Contains(DbSettings.AccessCenters.AddCenter);
                            bool AccessDelCen  = MenuActions.Contains(DbSettings.AccessCenters.DelCenter);

                            #region build page data

                            StringBuilder sbrSubOff = new StringBuilder();

                            if (AccessView)
                            {
                                DataSet dsOff = objOff.GetOfficeDetails(OfficeID);
                                if (!DataUtils.IsDataSetNull(dsOff, 0))
                                {
                                    DataRow drOff = dsOff.Tables[0].Rows[0];

                                    string OffName = drOff["OfficeName"].ToString();

                                    spnName.InnerHtml = OffName;

                                    //edit options. must follow only after view is completed
                                    if (!AccessEditVil)
                                    {
                                        editOff.InnerHtml = "";
                                    }
                                }
                                else
                                {
                                    viewRO.InnerHtml = UiMsg.PageRO.ViewVilFetchErr.ErrorWrap();
                                }
                            }
                            else
                            {
                                viewRO.InnerHtml = "";
                            }

                            StringBuilder sbrAddCen = new StringBuilder();

                            if (AccessAddCen)
                            {
                                sbrAddCen.Append("<div>");
                                sbrAddCen.Append("<a class='btn btn-primary' id='btnAddCenter'><i class='icon-white icon-plus'></i>&nbsp;Create New Center</a>");
                                sbrAddCen.Append("</div><br/>");
                                DataSet dsFE = objOff.GetFeByVillageID(OfficeID);
                                if (!DataUtils.IsDataSetNull(dsFE, 0))
                                {
                                    DataTable dtFe = dsFE.Tables[0];

                                    StringBuilder sbrFE = new StringBuilder();
                                    sbrFE.Append("<select id='drpFE'>");
                                    sbrFE.Append("<option value='0'>Select FE</option>");

                                    foreach (DataRow drFE in dtFe.Rows)
                                    {
                                        sbrFE.Append("<option value='" + drFE["UserID"].ToString() + "'>" + drFE["Name"].ToString() + "</option>");
                                    }

                                    sbrFE.Append("</select>");

                                    FE.InnerHtml = sbrFE.ToString();
                                }
                            }

                            if (AccessViewCen)
                            {
                                DataSet dsSubOff = objOff.GetCentersForVillageID(OfficeID);
                                sbrSubOff.Append("<div id='tblCenWrap' class='vil-cent-tbl-wrap'>");

                                if (!DataUtils.IsDataSetNull(dsSubOff, 0))
                                {
                                    sbrSubOff.Append("<table class='table table-bordered vil-cen-tbl display' id='tblCenters'>");
                                    sbrSubOff.Append("<thead>");
                                    sbrSubOff.Append("<tr>");
                                    sbrSubOff.Append("<th class='off'>Center</th>");
                                    sbrSubOff.Append("<th class='off'>Field Executive</th>");
                                    sbrSubOff.Append("<th class='off'>Meeting Location</th>");
                                    sbrSubOff.Append("<th class='off'>Meeting Time</th>");
                                    sbrSubOff.Append("<th class='off'>Created On</th>");
                                    if (AccessDelCen)
                                    {
                                        sbrSubOff.Append("<th><i class='icon-cog'></i>&nbsp;Options</th>");
                                        hdnAcD.Value = "1";
                                    }
                                    sbrSubOff.Append("</tr>");
                                    sbrSubOff.Append("</thead>");
                                    sbrSubOff.Append("<tbody>");

                                    foreach (DataRow dr in dsSubOff.Tables[0].Rows)
                                    {
                                        string CenterID        = dr["CenterID"].ToString();
                                        string CenterName      = "Center " + CenterID;
                                        string MeetingLocation = dr["MeetingLocation"].ToString();
                                        string MeetingTime     = dr["MeetingTime"].ToString();
                                        string FeName          = dr["StaffName"].ToString();
                                        string FeID            = dr["StaffID"].ToString();

                                        DateTime CreatedUTC       = new DateTime();
                                        string   CreatedLocalDate = string.Empty;

                                        CreatedUTC       = DateTime.SpecifyKind(DateTime.Parse(dr["CreatedDateTime"].ToString()), DateTimeKind.Utc);
                                        CreatedLocalDate = TimeZoneInfo.ConvertTimeFromUtc(CreatedUTC, AppSettings.TimeZoneIst).ToDateShortMonth(false, '-');

                                        string SubOffURL = Page.GetRouteUrl(AppRoutes.Center.Name, new { OfficeID = dr["CenterID"].ToString() });

                                        sbrSubOff.Append("<tr id='trCen_" + CenterID + "'>");
                                        sbrSubOff.Append("<td>");

                                        if (int.Parse(CenterID) < 10)
                                        {
                                            sbrSubOff.Append("<a href='" + SubOffURL + "'>Center 0" + CenterID + "</a>");
                                        }
                                        else
                                        {
                                            sbrSubOff.Append("<a href='" + SubOffURL + "'>Center " + CenterID + "</a>");
                                        }


                                        sbrSubOff.Append("</td>");
                                        sbrSubOff.Append("<td><a href='#'>" + FeName + "</a></td>");
                                        sbrSubOff.Append("<td>" + MeetingLocation + "</td>");
                                        sbrSubOff.Append("<td>" + MeetingTime + "</td>");
                                        sbrSubOff.Append("<td>" + CreatedLocalDate + "</td>");

                                        if (AccessDelCen)
                                        {
                                            sbrSubOff.Append("<td><a class='btn btn-danger btn-mini' id='btnDel_" + CenterID + "'><i class='icon-white icon-trash'></i>&nbsp;Remove Center</a></td>");
                                        }
                                        sbrSubOff.Append("</tr>");
                                    }
                                    sbrSubOff.Append("</tbody>");
                                    sbrSubOff.Append("</table>");

                                    //uxCenterList.InnerHtml = sbrSubOff.ToString();
                                }
                                else
                                {
                                    //uxCenterList.InnerHtml = UiMsg.PageVillage.NoCenters.ErrorWrap();
                                    sbrSubOff.Append(UiMsg.PageVillage.NoCenters.ErrorWrap());
                                }
                                sbrSubOff.Append("</div>");
                                uxCenterList.InnerHtml = sbrAddCen.ToString() + sbrSubOff.ToString();
                            }
                            else
                            {
                                viewSubOff.InnerHtml = "";
                            }



                            #endregion build page data
                        }
                        else if (CanAccessOffice == CustEnum.PageAccess.No)
                        {
                            uxOffcontent.InnerHtml = UiMsg.Global.NoPageAccess.ErrorWrap();
                        }
                    } //view access
                    else
                    {
                        uxOffcontent.InnerHtml = UiMsg.Global.NoPageAccess.ErrorWrap();
                    }
                }
                else
                {
                    Sessions objSession = new Sessions();
                    objSession.EndSession("&" + AppSettings.QueryStr.SessionExpired.Name + "=" + AppSettings.QueryStr.SessionExpired.Value);
                }
            }
            else
            {
                //error
                uxOffcontent.InnerHtml = UiMsg.Global.NoOfficeExists.ErrorWrap();
            }
        }
Ejemplo n.º 52
0
        public int CheckDuplicate(Office office)
        {
            int count = _officeRepository.CheckDuplicate(office);

            return(count);
        }
Ejemplo n.º 53
0
 public int Add(Office officeModel)
 {
     return(_officeRepository.Add(officeModel));
 }
Ejemplo n.º 54
0
 /// <summary>
 /// Binding of data to controls.
 /// </summary>
 protected void OnCHBound(object sender, DataGridItemEventArgs e)
 {
     if (e.Item.DataItem == null)
         return;
     if (!(e.Item.DataItem is XMLSerializableConferenceHall))
         return;
     XMLSerializableConferenceHall ch = e.Item.DataItem as XMLSerializableConferenceHall;
     //NumSpanCol = 0;
     //NumLastCol = 0;
     try
     {
         // Create service wrapper.
         Office of = new Office();
         of.Load(OfficeID);
         //using (ArrangementServiceProxy c = new ArrangementServiceProxy("http://localhost:59874/ArrangementService.svc", Page.CurrentUser.ID))
         //{
         //    List<XMLSerializableArrangement> coll = new List<XMLSerializableArrangement>();
         //    XMLSerializableArrangement[] arrList = c.GetDayArragementsList(ch.ConferenceHallID, SelectedDate);
         //    if (arrList != null)
         //    {
         //        coll.AddRange(arrList);
         //    }
         //    HyperLink hlCH = e.Item.Cells[0].FindControl("hlConferenceHallName") as HyperLink;
         //    hlCH.NavigateUrl = "~/Admin/AdminArrangements/AddEditConferenceHall.aspx?officeid=" + OfficeID.ToString() + "&id=" + ch.ConferenceHallID.ToString();
         //    foreach (XMLSerializableArrangement arr in arrList)
         //    {
         //        UnionColumns uc = CountColumns(arr);
         //        if (uc.m_First - NumSpanCol == NumLastCol)
         //            uc.m_First++;
         //        e.Item.Cells[uc.m_First - NumSpanCol].ColumnSpan = uc.m_Len;
         //        string ControlID = "hl" + (uc.m_First).ToString();
         //        HyperLink hl = e.Item.Cells[uc.m_First - NumSpanCol].FindControl(ControlID) as HyperLink;
         //        hl.Text = arr.Name;
         //        hl.NavigateUrl = "~/Admin/AdminArrangements/AddEditArrangement.aspx?officeid=" + OfficeID.ToString() + "&id=" + arr.ArrangementID.ToString() + "&date=" + SelectedDate.Date.ToString("ddMMyyyy");
         //        NumLastCol = uc.m_First - NumSpanCol;
         //        for (int i = 1; i < uc.m_Len - 1; i++)
         //        {
         //            e.Item.Cells.RemoveAt(uc.m_First - NumSpanCol + i);
         //            NumSpanCol++;
         //        }
         //    }
         //}
     }
     catch (Exception ex)
     {
         ConfirmIt.PortalLib.Logger.Logger.Instance.Error(ex.Message, ex);
     }
 }
Ejemplo n.º 55
0
 public int Edit(Office officeModel)
 {
     return(_officeRepository.Edit(officeModel));;
 }
Ejemplo n.º 56
0
 public void AddToOffices(Office office)
 {
     base.AddObject("Offices", office);
 }
Ejemplo n.º 57
0
 private void SettingsButton_Click(Office.CommandBarButton Ctrl, ref bool CancelDefault)
 {
     Globals.OutlookGnuPG.Settings();
 }