Esempio n. 1
0
 public IPagedResponse <IAssetType> GetAll(int page, int size)
 {
     using (AssetTypeRepository repo = new AssetTypeRepository())
     {
         return(repo.GetAll(page, size));
     }
 }
        public IActionResult Edit(DepotModel obj)
        {
            ViewData["UserNameM"]  = HttpContext.Session.GetString("name") + " " + HttpContext.Session.GetString("surname");
            ViewData["department"] = HttpContext.Session.GetString("department");
            if (ModelState.IsValid)
            {
                DepotModel before     = DepotRepository.FindByID((int)obj.Id);
                int        difference = obj.totalcount - before.totalcount;

                obj.notusecount = before.notusecount + difference;

                obj.inusecount = before.inusecount;
                DepotRepository.Update(obj);
                return(RedirectToAction("Index"));
            }
            AssetTypeRepository assetTypeRepository = new AssetTypeRepository(configuration);

            System.Collections.Generic.IEnumerable <AssetTypeModel> assets = assetTypeRepository.FindAll();


            List <SelectListItem> temp = new List <SelectListItem>
            {
            };

            temp.Add(new SelectListItem {
                Text = "Yok", Value = "" + 0
            });
            foreach (AssetTypeModel item in assets)
            {
                temp.Add(new SelectListItem {
                    Text = item.name, Value = "" + item.Id
                });
            }
            ViewBag.types = temp;


            BrandRepository brandRepository = new BrandRepository(configuration);

            System.Collections.Generic.IEnumerable <BrandModel> brands = brandRepository.FindAll();


            List <SelectListItem> tempBrands = new List <SelectListItem>
            {
            };

            tempBrands.Add(new SelectListItem {
                Text = "Yok", Value = "" + 0
            });
            foreach (BrandModel item in brands)
            {
                tempBrands.Add(new SelectListItem {
                    Text = item.name, Value = "" + item.Id
                });
            }
            ViewBag.brands = tempBrands;
            return(View(obj));
        }
        // GET: /Depot/Edit/1
        public IActionResult Edit(int?id)
        {
            AssetTypeRepository assetTypeRepository = new AssetTypeRepository(configuration);

            System.Collections.Generic.IEnumerable <AssetTypeModel> assets = assetTypeRepository.FindAll();


            List <SelectListItem> temp = new List <SelectListItem>
            {
            };

            temp.Add(new SelectListItem {
                Text = "Yok", Value = "" + 0
            });
            foreach (AssetTypeModel item in assets)
            {
                temp.Add(new SelectListItem {
                    Text = item.name, Value = "" + item.Id
                });
            }
            ViewBag.types = temp;


            BrandRepository brandRepository = new BrandRepository(configuration);

            System.Collections.Generic.IEnumerable <BrandModel> brands = brandRepository.FindAll();


            List <SelectListItem> tempBrands = new List <SelectListItem>
            {
            };

            tempBrands.Add(new SelectListItem {
                Text = "Yok", Value = "" + 0
            });
            foreach (BrandModel item in brands)
            {
                tempBrands.Add(new SelectListItem {
                    Text = item.name, Value = "" + item.Id
                });
            }
            ViewBag.brands         = tempBrands;
            ViewData["UserNameM"]  = HttpContext.Session.GetString("name") + " " + HttpContext.Session.GetString("surname");
            ViewData["department"] = HttpContext.Session.GetString("department");
            if (id == null)
            {
                return(NotFound());
            }
            DepotModel obj = DepotRepository.FindByID(id.Value);

            if (obj == null)
            {
                return(NotFound());
            }
            return(View(obj));
        }
Esempio n. 4
0
        public AssetSetupUnitOfWork(AssetDbContext context)
        {
            _context = context;

            AssetType = new AssetTypeRepository(_context);

            AssetGroup = new AssetGroupRepository(_context);

            AssetManufacurer = new AssetManufactureRepository(_context);

            AssetModel = new AssetModelRepository(_context);
        }
        public IActionResult Create()
        {
            ViewData["UserNameM"]  = HttpContext.Session.GetString("name") + " " + HttpContext.Session.GetString("surname");
            ViewData["department"] = HttpContext.Session.GetString("department");
            AssetTypeRepository assetTypeRepository = new AssetTypeRepository(configuration);

            System.Collections.Generic.IEnumerable <AssetTypeModel> assets = assetTypeRepository.FindAll();


            List <SelectListItem> temp = new List <SelectListItem>
            {
            };

            temp.Add(new SelectListItem {
                Text = "Yok", Value = "" + 0
            });
            foreach (AssetTypeModel item in assets)
            {
                temp.Add(new SelectListItem {
                    Text = item.name, Value = "" + item.Id
                });
            }
            ViewBag.types = temp;


            BrandRepository brandRepository = new BrandRepository(configuration);

            System.Collections.Generic.IEnumerable <BrandModel> brands = brandRepository.FindAll();


            List <SelectListItem> tempBrands = new List <SelectListItem>
            {
            };

            tempBrands.Add(new SelectListItem {
                Text = "Yok", Value = "" + 0
            });
            foreach (BrandModel item in brands)
            {
                tempBrands.Add(new SelectListItem {
                    Text = item.name, Value = "" + item.Id
                });
            }
            ViewBag.brands = tempBrands;

            ViewData["department"] = HttpContext.Session.GetString("department");
            return(View());
        }
Esempio n. 6
0
 public UnitOfWork(AladonContext context)
 {
     Context         = context;
     Users           = new UsersRepository(context);
     Roles           = new RolesRepository(context);
     UserRoles       = new UserRolesRepository(context);
     Permissions     = new PermissionsRepository(context);
     Modules         = new ModulesRepository(context);
     LocationTypes   = new LocationTypesRepository(context);
     AssetStructures = new AssetStructureRepository(context);
     AssetPartInfors = new AssetPartInforRepository(context);
     AssetTypes      = new AssetTypeRepository(context);
     Documents       = new DocumentRepository(context);
     Parts           = new PartRepository(context);
     AssetTags       = new AssetTagRepository(context);
 }
Esempio n. 7
0
 private void SetRepositories()
 {
     AssetSettings                = new AssetSettingRepository(_context);
     AssetRelationships           = new AssetRelationshipRepository(_context);
     Assets                       = new AssetRepository(_context);
     AssetTransactions            = new AssetTransactionRepository(_context);
     AssetTypeSettingTypes        = new AssetTypeSettingTypeRepository(_context);
     AssetTypeRelationshipTypes   = new AssetTypeRelationshipTypeRepository(_context);
     AssetTypes                   = new AssetTypeRepository(_context);
     ParentChildRelationshipTypes = new ParentChildRelationshipTypeRepository(_context);
     RelationshipTypes            = new RelationshipTypeRepository(_context);
     SettingTypes                 = new SettingTypeRepository(_context);
     TransactionCategories        = new TransactionCategoryRepository(_context);
     TransactionDescriptions      = new TransactionDescriptionRepository(_context);
     TransactionTypes             = new TransactionTypeRepository(_context);
 }
Esempio n. 8
0
        public void SetUp()
        {
            // setup fake model
            _dbAssetType = new AssetType {
                Id = 1, Name = "a", IsActive = true
            };
            _dbAsset = new Asset {
                Id = 2, AssetTypeId = _dbAssetType.Id, Name = "b", IsActive = true
            };

            // setup DbContext
            Setup_FakeDbContext();

            // set up repository
            _repository = new AssetTypeRepository(_fakeDbContext);
        }
Esempio n. 9
0
 public AssetTypeController(IConfiguration configuration)
 {
     AssetTypeRepository = new AssetTypeRepository(configuration);
 }
 public void Init()
 {
     _dbSet = new FakeDbSet<AssetType>();
     _mockDb = new Mock<IIrvingDbContext>();
     _mockDb.Setup(m => m.Set<AssetType>())
            .Returns(_dbSet);
     _mockAssetTypePropertyRepo = new Mock<IRepository<AssetTypeProperty>>();
     _assetTypeRepo = new AssetTypeRepository(_mockDb.Object, _mockAssetTypePropertyRepo.Object);
 }
Esempio n. 11
0
 public AssetTypeUnitOfWork(AssetDbContext context)
 {
     _context  = context;
     AssetType = new AssetTypeRepository(_context);
 }
        public IActionResult Edit(AssetModel obj)
        {
            ViewData["department"] = HttpContext.Session.GetString("department");
            ViewData["UserNameM"]  = HttpContext.Session.GetString("name") + " " + HttpContext.Session.GetString("surname");
            ViewData["department"] = HttpContext.Session.GetString("department");
            if (ModelState.IsValid)
            {
                AssetModel assetModelOrigin = assetRepository.FindByID((int)obj.Id);
                Boolean    depoResponse     = updateDepo(false, obj, assetModelOrigin);
                if (depoResponse)
                {
                    assetRepository.Update(obj);
                    return(RedirectToAction("Index"));
                }
            }

            AssetTypeRepository assetTypeRepository = new AssetTypeRepository(configuration);

            System.Collections.Generic.IEnumerable <AssetTypeModel> types = assetTypeRepository.FindAll();


            List <SelectListItem> temp = new List <SelectListItem>
            {
            };

            temp.Add(new SelectListItem {
                Text = "Yok", Value = "" + 0
            });
            foreach (AssetTypeModel item in types)
            {
                temp.Add(new SelectListItem {
                    Text = item.name, Value = "" + item.Id
                });
            }
            ViewBag.types = temp;


            BrandRepository brandRepository = new BrandRepository(configuration);

            System.Collections.Generic.IEnumerable <BrandModel> brands = brandRepository.FindAll();


            List <SelectListItem> tempBrands = new List <SelectListItem>
            {
            };

            tempBrands.Add(new SelectListItem {
                Text = "Yok", Value = "" + 0
            });
            foreach (BrandModel item in brands)
            {
                tempBrands.Add(new SelectListItem {
                    Text = item.name, Value = "" + item.Id
                });
            }
            ViewBag.brands = tempBrands;

            RoomRepository roomRepository = new RoomRepository(configuration);

            System.Collections.Generic.IEnumerable <RoomModel> rooms = roomRepository.FindAll();


            List <SelectListItem> temproom = new List <SelectListItem>
            {
            };

            temproom.Add(new SelectListItem {
                Text = "Yok", Value = "" + 0
            });
            foreach (RoomModel item in rooms)
            {
                temproom.Add(new SelectListItem {
                    Text = item.roomname, Value = "" + item.Id
                });
            }
            ViewBag.rooms = temproom;

            DepotRepository depotRepository = new DepotRepository(configuration);

            System.Collections.Generic.IEnumerable <DepotModel> depots = depotRepository.FindAll();


            List <SelectListItem> tempdepots = new List <SelectListItem>
            {
            };

            tempdepots.Add(new SelectListItem {
                Text = "Yok", Value = "" + 0
            });
            foreach (DepotModel item in depots)
            {
                tempdepots.Add(new SelectListItem {
                    Text = item.name, Value = "" + item.Id
                });
            }
            ViewBag.depots = tempdepots;


            OwnerRepository ownerRepository = new OwnerRepository(configuration);

            System.Collections.Generic.IEnumerable <OwnerModel> owners = ownerRepository.FindAll();


            List <SelectListItem> tempowner = new List <SelectListItem>
            {
            };

            tempowner.Add(new SelectListItem {
                Text = "Yok", Value = "" + 0
            });
            foreach (OwnerModel item in owners)
            {
                tempowner.Add(new SelectListItem {
                    Text = item.name, Value = "" + item.Id
                });
            }
            ViewBag.owners = tempowner;
            return(View(obj));
        }
        public IActionResult Create()
        {
            ViewData["department"] = HttpContext.Session.GetString("department");
            ViewData["UserNameM"]  = HttpContext.Session.GetString("name") + " " + HttpContext.Session.GetString("surname");
            AssetTypeRepository assetTypeRepository = new AssetTypeRepository(configuration);

            System.Collections.Generic.IEnumerable <AssetTypeModel> types = assetTypeRepository.FindAll();


            List <SelectListItem> temp = new List <SelectListItem>
            {
            };

            temp.Add(new SelectListItem {
                Text = "Yok", Value = "" + 0
            });
            foreach (AssetTypeModel item in types)
            {
                temp.Add(new SelectListItem {
                    Text = item.name, Value = "" + item.Id
                });
            }
            ViewBag.types = temp;


            OwnerRepository ownerRepository = new OwnerRepository(configuration);

            System.Collections.Generic.IEnumerable <OwnerModel> owners = ownerRepository.FindAll();


            List <SelectListItem> tempowner = new List <SelectListItem>
            {
            };

            tempowner.Add(new SelectListItem {
                Text = "Yok", Value = "" + 0
            });
            foreach (OwnerModel item in owners)
            {
                tempowner.Add(new SelectListItem {
                    Text = item.name, Value = "" + item.Id
                });
            }
            ViewBag.owners = tempowner;

            DepotRepository depotRepository = new DepotRepository(configuration);

            System.Collections.Generic.IEnumerable <DepotModel> depots = depotRepository.FindAll();


            List <SelectListItem> tempdepot = new List <SelectListItem>
            {
            };

            tempdepot.Add(new SelectListItem {
                Text = "Yok", Value = "" + 0
            });
            foreach (DepotModel item in depots)
            {
                tempdepot.Add(new SelectListItem {
                    Text = item.name, Value = "" + item.Id
                });
            }
            ViewBag.depots = tempdepot;


            RoomRepository roomRepository = new RoomRepository(configuration);

            System.Collections.Generic.IEnumerable <RoomModel> rooms = roomRepository.FindAll();


            List <SelectListItem> temproom = new List <SelectListItem>
            {
            };

            temproom.Add(new SelectListItem {
                Text = "Yok", Value = "" + 0
            });
            foreach (RoomModel item in rooms)
            {
                temproom.Add(new SelectListItem {
                    Text = item.roomname, Value = "" + item.Id
                });
            }
            ViewBag.rooms = temproom;


            BrandRepository brandRepository = new BrandRepository(configuration);

            System.Collections.Generic.IEnumerable <BrandModel> brands = brandRepository.FindAll();


            List <SelectListItem> tempBrands = new List <SelectListItem>
            {
            };

            tempBrands.Add(new SelectListItem {
                Text = "Yok", Value = "" + 0
            });
            foreach (BrandModel item in brands)
            {
                tempBrands.Add(new SelectListItem {
                    Text = item.name, Value = "" + item.Id
                });
            }
            ViewBag.brands = tempBrands;


            ViewData["department"] = HttpContext.Session.GetString("department");
            return(View());
        }
        public IActionResult Create(AssetModel cust)
        {
            ViewData["department"] = HttpContext.Session.GetString("department");
            ViewData["UserNameM"]  = HttpContext.Session.GetString("name") + " " + HttpContext.Session.GetString("surname");
            cust.acquisition_date  = DateTime.Now;
            ViewData["department"] = HttpContext.Session.GetString("department");
            if (ModelState.IsValid)
            {
                Boolean success = changeDepo(false, cust);
                if (success)
                {
                    assetRepository.Add(cust);
                    return(RedirectToAction("Index"));
                }
            }
            ViewData["error"]      = "İşlem Başarısız";
            ViewData["department"] = HttpContext.Session.GetString("department");
            ViewData["UserNameM"]  = HttpContext.Session.GetString("name") + " " + HttpContext.Session.GetString("surname");
            AssetTypeRepository assetTypeRepository = new AssetTypeRepository(configuration);

            System.Collections.Generic.IEnumerable <AssetTypeModel> types = assetTypeRepository.FindAll();


            List <SelectListItem> temp = new List <SelectListItem>
            {
            };

            temp.Add(new SelectListItem {
                Text = "Yok", Value = "" + 0
            });
            foreach (AssetTypeModel item in types)
            {
                temp.Add(new SelectListItem {
                    Text = item.name, Value = "" + item.Id
                });
            }
            ViewBag.types = temp;


            OwnerRepository ownerRepository = new OwnerRepository(configuration);

            System.Collections.Generic.IEnumerable <OwnerModel> owners = ownerRepository.FindAll();


            List <SelectListItem> tempowner = new List <SelectListItem>
            {
            };

            tempowner.Add(new SelectListItem {
                Text = "Yok", Value = "" + 0
            });
            foreach (OwnerModel item in owners)
            {
                tempowner.Add(new SelectListItem {
                    Text = item.name, Value = "" + item.Id
                });
            }
            ViewBag.owners = tempowner;

            DepotRepository depotRepository = new DepotRepository(configuration);

            System.Collections.Generic.IEnumerable <DepotModel> depots = depotRepository.FindAll();


            List <SelectListItem> tempdepot = new List <SelectListItem>
            {
            };

            tempdepot.Add(new SelectListItem {
                Text = "Yok", Value = "" + 0
            });
            foreach (DepotModel item in depots)
            {
                tempdepot.Add(new SelectListItem {
                    Text = item.name, Value = "" + item.Id
                });
            }
            ViewBag.depots = tempdepot;


            RoomRepository roomRepository = new RoomRepository(configuration);

            System.Collections.Generic.IEnumerable <RoomModel> rooms = roomRepository.FindAll();


            List <SelectListItem> temproom = new List <SelectListItem>
            {
            };

            temproom.Add(new SelectListItem {
                Text = "Yok", Value = "" + 0
            });
            foreach (RoomModel item in rooms)
            {
                temproom.Add(new SelectListItem {
                    Text = item.roomname, Value = "" + item.Id
                });
            }
            ViewBag.rooms = temproom;


            BrandRepository brandRepository = new BrandRepository(configuration);

            System.Collections.Generic.IEnumerable <BrandModel> brands = brandRepository.FindAll();


            List <SelectListItem> tempBrands = new List <SelectListItem>
            {
            };

            tempBrands.Add(new SelectListItem {
                Text = "Yok", Value = "" + 0
            });
            foreach (BrandModel item in brands)
            {
                tempBrands.Add(new SelectListItem {
                    Text = item.name, Value = "" + item.Id
                });
            }
            ViewBag.brands = tempBrands;


            ViewData["department"] = HttpContext.Session.GetString("department");

            return(View(cust));
        }