public void AddDefault(RoomModel item)
        {
            try
            {
                if (item == null)
                {
                    throw new ArgumentNullException("item");
                }

                var entity = new Room
                {
                    Id              = item.Id,
                    Name            = item.Name,
                    Description     = item.Description,
                    StoreId         = item.StoreId,
                    CompanyId       = item.CompanyId,
                    CreatedBy       = item.CreatedBy,
                    CreatedOn       = DateTime.UtcNow,
                    Status          = (byte)StatusType.Active,
                    SecondaryStatus = (byte)SecondaryStatusType.Empty
                };
                //add default rack of room.
                entity.Racks.Add(RackHalper.GenerateRack(entity.Id, entity.CompanyId, entity.CreatedBy));
                this._roomRepository.Add(entity);
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Exemple #2
0
        public void Add(RackModel item)
        {
            try
            {
                if (item == null)
                {
                    throw new ArgumentNullException("item");
                }

                var entity = new Rack
                {
                    Id              = item.Id,
                    Name            = item.Name,
                    Description     = item.Description,
                    RoomId          = item.RoomId,
                    CompanyId       = item.CompanyId,
                    Rows            = item.Rows,
                    Columns         = item.Columns,
                    BoxCapacity     = item.BoxCapacity,
                    CreatedBy       = item.CreatedBy,
                    CreatedOn       = DateTime.UtcNow,
                    Status          = (byte)StatusType.Active,
                    SecondaryStatus = (byte)SecondaryStatusType.Empty
                };
                entity.Boxes = RackHalper.GenerateBoxes(item.Rows, item.Columns, item.Id, item.CompanyId);
                this._rackRepository.Add(entity);
            }
            catch (Exception ex)
            {
                throw;
            }
        }
        public void AddDefault(StoreModel item)
        {
            try
            {
                if (item == null)
                {
                    throw new ArgumentNullException("item");
                }

                var entity = new Store
                {
                    Id              = item.Id,
                    Name            = item.Name,
                    Country         = item.Country,
                    Street          = item.Street,
                    Email           = item.Email,
                    Phone           = item.Phone,
                    City            = item.City,
                    ZipCode         = item.ZipCode,
                    Fax             = item.Fax,
                    State           = item.State,
                    Description     = item.Description,
                    CompanyId       = item.CompanyId,
                    CreatedBy       = item.CreatedBy,
                    CreatedOn       = DateTime.UtcNow,
                    Status          = (byte)StatusType.Active,
                    SecondaryStatus = (byte)SecondaryStatusType.Empty
                };
                //add default room of store
                entity.Rooms.Add(RackHalper.GenerateRoom(item.Id, item.CompanyId, item.CreatedBy));
                this._storeRepository.Add(entity);
            }
            catch (Exception ex)
            {
                throw;
            }
        }