示例#1
0
        public Ware CreateDomainModel(ISqlDbHandler dbHandler, int startingIndex, out int nextStartingIndex)
        {
            var placeBuilder = new PlaceBuilder();
            var ware         = new Ware {
                Id           = dbHandler.GetValue <long>(0 + startingIndex),
                Name         = dbHandler.GetValue <string>(1 + startingIndex),
                Description  = dbHandler.GetValue <string>(2 + startingIndex),
                SerialNumber = dbHandler.GetValue <string>(3 + startingIndex),
                PlaceId      = dbHandler.GetValue <long>(4 + startingIndex),
                InStorage    = dbHandler.GetValue <bool>(5 + startingIndex)
            };

            ware.Place = placeBuilder.CreateDomainModel(dbHandler, 6 + startingIndex, out nextStartingIndex);
            return(ware);
        }
示例#2
0
 public Subscription CreateDomainModel(ISqlDbHandler dbHandler, int startingIndex, out int nextStartingIndex)
 {
     var subTypeBuilder = new SubscriptionTypeBuilder();
     var clientBuilder = new UserBuilder();
     var placeBuilder = new PlaceBuilder();
     var sub = new Subscription();
     sub.Id = dbHandler.GetValue<long>(0 + startingIndex);
     sub.TypeId = dbHandler.GetValue<long>(1 + startingIndex);
     sub.LatestRenewal = dbHandler.GetValue<DateTime>(2 + startingIndex);
     sub.ClientId = dbHandler.GetValue<long>(3 + startingIndex);
     sub.PlaceId = dbHandler.GetValue<long>(4 + startingIndex);
     sub.FixedContract = dbHandler.GetValue<bool>(5 + startingIndex);
     sub.Type = subTypeBuilder.CreateDomainModel(dbHandler, 6 + startingIndex, out nextStartingIndex);
     sub.Place = placeBuilder.CreateDomainModel(dbHandler, nextStartingIndex, out nextStartingIndex);
     sub.Client = clientBuilder.CreateDomainModel(dbHandler, nextStartingIndex, out nextStartingIndex);
     return sub;
 }
示例#3
0
        public Room CreateDomainModel(ISqlDbHandler dbHandler, int startingIndex, out int nextStartingIndex)
        {
            var placeBuilder   = new PlaceBuilder();
            var successParsing =
                Enum.TryParse <RoomType>(dbHandler.GetValue <long>(3 + startingIndex).ToString(), out var type);

            if (!successParsing)
            {
                throw new Exception("Error parsing RoomType");
            }
            var room = new Room {
                Id      = dbHandler.GetValue <long>(0 + startingIndex),
                Name    = dbHandler.GetValue <string>(1 + startingIndex),
                PlaceId = dbHandler.GetValue <long>(2 + startingIndex),
                Type    = type
            };

            room.Place = placeBuilder.CreateDomainModel(dbHandler, 4 + startingIndex, out nextStartingIndex);
            return(room);
        }
示例#4
0
        public TimeSlot CreateDomainModel(ISqlDbHandler dbHandler, int startingIndex, out int nextStartingIndex)
        {
            var placeBuilder   = new PlaceBuilder();
            var successParsing =
                Enum.TryParse <DayOfWeek>(dbHandler.GetValue <long>(1 + startingIndex).ToString(), out var day);

            if (!successParsing)
            {
                throw new Exception("Error parsing RoomType");
            }
            var timeslot = new TimeSlot {
                Id           = dbHandler.GetValue <long>(0 + startingIndex),
                StartHour    = dbHandler.GetValue <short>(2 + startingIndex),
                StartMinutes = dbHandler.GetValue <short>(3 + startingIndex),
                EndHour      = dbHandler.GetValue <short>(4 + startingIndex),
                EndMinutes   = dbHandler.GetValue <short>(5 + startingIndex),
                PlaceId      = dbHandler.GetValue <long>(6 + startingIndex),
                Day          = day
            };

            timeslot.Place = placeBuilder.CreateDomainModel(dbHandler, 7 + startingIndex, out nextStartingIndex);
            return(timeslot);
        }
示例#5
0
        public Ticket CreateDomainModel(ISqlDbHandler dbHandler, int startingIndex, out int nextStartingIndex)
        {
            var placeBuilder   = new PlaceBuilder();
            var userBuilder    = new UserBuilder();
            var successParsing =
                Enum.TryParse <TicketState>(dbHandler.GetValue <long>(2 + startingIndex).ToString(), out var state);

            if (!successParsing)
            {
                throw new Exception("Error parsing TicketState");
            }
            var ticket = new Ticket();

            ticket.Id          = dbHandler.GetValue <long>(0 + startingIndex);
            ticket.OpenedById  = dbHandler.GetValue <long>(1 + startingIndex);
            ticket.State       = state;
            ticket.Description = dbHandler.GetValue <string>(3 + startingIndex);
            ticket.PlaceId     = dbHandler.GetValue <long>(4 + startingIndex);
            ticket.Title       = dbHandler.GetValue <string>(5 + startingIndex);
            ticket.Created     = dbHandler.GetValue <DateTime>(6 + startingIndex);
            ticket.OpenedBy    = userBuilder.CreateDomainModel(dbHandler, 7 + startingIndex, out nextStartingIndex);
            ticket.Place       = placeBuilder.CreateDomainModel(dbHandler, nextStartingIndex, out nextStartingIndex);
            return(ticket);
        }