public async Task GetAll_ValidParameters_AddsProjectIdUrlSegment() { const uint expected = 0; await _sut.GetAll(expected); _request.Received().AddUrlSegment("projectId", expected); }
public ActionResult AllBranch() { if (Session["uid"] == null || Convert.ToInt32(Session["type"]) != 0) { TempData["errmsg"] = "You are not allowed to see the page without login"; return(RedirectToAction("index", "login")); } return(View(branchRepo.GetAll())); }
// GET: /GlAccount/Create public ActionResult Create(string message) { ViewBag.Msg = message; ViewBag.GlCategoryId = new SelectList(glCatRepo.GetAll(), "ID", "Name"); ViewBag.BranchId = new SelectList(branchRepo.GetAll(), "ID", "Name"); var model = new AddGlActViewModel(); return(View(model)); }
public ActionResult AddAccount() { ViewBag.BranchId = new SelectList(branchRepo.GetAll(), "ID", "Name"); ViewBag.CustomerId = new SelectList(custRepo.GetAll(), "ID", "FullName"); var config = configRepo.GetFirst(); ViewBag.LoanInterestRate = config.LoanDebitInterestRate.ToString(); ViewBag.Msg = ""; return(View()); }
//GET: CustomerAccount/Create public ActionResult Create(int id) { var cust = _contextCustomer.Get(id); var viewmodel = new CustomerAccountViewModels { Branches = _contextBranch.GetAll(), Customers = cust }; return(View(viewmodel)); }
public ActionResult Create() { // Groups var groups = StoreData.ListGroup ?? GroupRepository.GetAll(); var model = new UserModel { UserInfo = new UserInfo(), PostedRole = new PostedRole(), PostedBranch = new PostedBranch(), AllRole = RoleRepository.GetAll(), AllBranch = BranchRepository.GetAll(), SelectedRole = new Collection <RoleInfo>(), SelectedBranch = new Collection <BranchInfo>(), PostedGroupConsultant = new PostedGroup(), PostedGroupConsultantType = new PostedGroupType(), SelectedGroupConsultants = new Collection <GroupInfo>(), SelectedGroupConsultantTypes = new Collection <GroupTypeInfo>(), AllGroupConsultants = groups.Where(c => c.EmployeeTypeId == (int)EmployeeType.Consultant), AllGroupConsultantTypes = StoreData.ListGroupType.Where(c => c.EmployeeTypeId == (int)EmployeeType.Consultant), PostedGroupCollaborator = new PostedGroup(), PostedGroupCollaboratorType = new PostedGroupType(), SelectedGroupCollaborators = new Collection <GroupInfo>(), SelectedGroupCollaboratorTypes = new Collection <GroupTypeInfo>(), AllGroupCollaborators = groups.Where(c => c.EmployeeTypeId == (int)EmployeeType.Collaborator), AllGroupCollaboratorTypes = StoreData.ListGroupType.Where(c => c.EmployeeTypeId == (int)EmployeeType.Collaborator), }; return(View(model)); }
public ActionResult Half_Year_Repot() { BranchRepository trepo = new BranchRepository(); List <Branch> ll = trepo.GetAll(); return(View(ll)); }
public JsonResult GetAll() { var response = new JsonResultBody(); response.Status = System.Net.HttpStatusCode.OK; try { var data = _repository.GetAll(); response.Data = Mapper.Map <IEnumerable <Branch>, IEnumerable <BranchViewModel> >(data); } catch (DbEntityValidationException ex) { response.Status = System.Net.HttpStatusCode.InternalServerError; foreach (DbEntityValidationResult result in ex.EntityValidationErrors) { response.Errors = (from ve in result.ValidationErrors select ve.ErrorMessage).ToList(); } } catch (Exception ex) { response.Status = System.Net.HttpStatusCode.InternalServerError; response.Errors.Add(ex.Message); } return(Json(response, JsonRequestBehavior.AllowGet)); }
public ActionResult Annual_Repots_md_show() { BranchRepository trepo = new BranchRepository(); List <Branch> ll = trepo.GetAll(); return(View(ll)); }
public ActionResult Index() { //ViewBag.Roles = RoleRepository.GetAll(); var model = new RolePermisionModel() { AllBranch = BranchRepository.GetAll(), AllRole = RoleRepository.GetAll(), SelectedBranch = new Collection <BranchInfo>(), SelectedRole = new Collection <RoleInfo>(), PostedBranch = new PostedBranch(), PostedRole = new PostedRole(), PostedFunction = new PostedFunction() }; var rootFuncs = FunctionRepository.GetChild(0); var lstFunctions = new List <FunctionInfo>(); foreach (FunctionInfo func in rootFuncs) { func.SetLevel(0); lstFunctions.Add(func); LoadChildFunctions(lstFunctions, func); } model.AllFunction = lstFunctions; return(View(model)); }
public ActionResult Index(RolePermisionModel model) { if (model.PostedFunction != null && model.PostedFunction.FunctionID != null) { model.AllBranch = BranchRepository.GetAll(); model.AllRole = RoleRepository.GetAll(); var rootFuncs = FunctionRepository.GetChild(0); var lstFunctions = new List <FunctionInfo>(); foreach (FunctionInfo func in rootFuncs) { lstFunctions.Add(func); LoadChildFunctions(lstFunctions, func); } model.AllFunction = lstFunctions; var deleteFunctions = model.PostedFunction.FunctionID.Where(p => !model.PostedFunction.FunctionID.Any(p2 => p2 == p)); int curUserId = UserRepository.GetCurrentUserInfo().UserID; foreach (int roleId in model.PostedRole.Id) { foreach (int branchId in model.PostedBranch.Id) { RolePermisionRepository.Clear(roleId, branchId); foreach (int functionId in model.PostedFunction.FunctionID) { RolePermisionRepository.Create(roleId, branchId, functionId, curUserId); } } } } return(View(model)); }
public ActionResult Edit(int id) { var userInfo = UserRepository.GetInfo(id); if (userInfo != null) { // Collaborator var selectedGroupCollaboratorType = new List <GroupTypeInfo>(); var groupCollaboratorTypeInfo = StoreData.ListGroupType.FirstOrDefault(c => c.Id == userInfo.GroupCollaboratorType); if (groupCollaboratorTypeInfo != null) { selectedGroupCollaboratorType.Add(new GroupTypeInfo { Id = userInfo.GroupCollaboratorType, Name = groupCollaboratorTypeInfo.Name, }); } // Consultant var selectedGroupConsultantType = new List <GroupTypeInfo>(); var groupConsultantTypeInfo = StoreData.ListGroupType.FirstOrDefault(c => c.Id == userInfo.GroupConsultantType); if (groupConsultantTypeInfo != null) { selectedGroupConsultantType.Add(new GroupTypeInfo { Id = userInfo.GroupConsultantType, Name = groupConsultantTypeInfo.Name, }); } // Groups var groups = StoreData.ListGroup ?? GroupRepository.GetAll(); var selectedGroups = GroupRepository.GetByUser(id) ?? new List <GroupInfo>(); var model = new UserModel { UserInfo = userInfo, AllRole = RoleRepository.GetAll(), SelectedRole = RoleRepository.GetRoleOfUser(id), SelectedBranch = UserRepository.GetBranchOfUser(id), AllBranch = StoreData.ListBranch ?? BranchRepository.GetAll(), SelectedGroupCollaboratorTypes = selectedGroupCollaboratorType, AllGroupCollaborators = groups.Where(c => c.EmployeeTypeId == (int)EmployeeType.Collaborator), SelectedGroupCollaborators = selectedGroups.Where(c => c.EmployeeTypeId == (int)EmployeeType.Collaborator), AllGroupCollaboratorTypes = StoreData.ListGroupType.Where(c => c.EmployeeTypeId == (int)EmployeeType.Collaborator), SelectedGroupConsultantTypes = selectedGroupConsultantType, AllGroupConsultants = groups.Where(c => c.EmployeeTypeId == (int)EmployeeType.Consultant), SelectedGroupConsultants = selectedGroups.Where(c => c.EmployeeTypeId == (int)EmployeeType.Consultant), AllGroupConsultantTypes = StoreData.ListGroupType.Where(c => c.EmployeeTypeId == (int)EmployeeType.Consultant), }; if (model.SelectedGroupConsultants != null && model.SelectedGroupConsultants.Any()) { model.UserInfo.IsConsultant = true; } return(View(model)); } return(RedirectToAction("Index")); }
public ActionResult Index() { Session["BranchCount"] = _branchRepository.GetAll().Count; Session["TPostCount"] = _tellerPostingRepo.GetAll().Count; Session["TCount"] = _tellerRepo.GetAll().Count; return(View()); }
public void GetWarehousesThroughWarehouseRepo() { var repo = new BranchRepository(); var order = repo.GetAll(); Assert.IsNotNull(order); Assert.IsTrue(order.Count > 2); }
public ActionResult Create(string message) { ViewBag.Msg = message; ViewBag.Branches = branchRepo.GetAll().AsEnumerable().Select(i => new SelectListItem { Text = i.Name, Value = i.ID.ToString() }); ViewBag.Roles = roleRepo.GetAll().AsEnumerable().Select(i => new SelectListItem { Text = i.Name, Value = i.ID.ToString() }); var model = new AddNewUserViewModel(); return(View(model)); }
public IEnumerable <Branch> GetAll(int id) { try { return(branchRepository.GetAll()); } catch (Exception ex) { throw ex; } }
public void BranchesController_GetBranches_OK() { // Arrange var controller = new BranchesController(repo); // Act var result = controller.GetBranches(); // Assert Assert.IsNotNull(result, "Controller returned null data"); Assert.AreEqual(repo.GetAll().Count(), result.Count()); }
public void GetAll_Test() { // Arrange TestKolgraphEntities context = new TestKolgraphEntities(); var repository = new BranchRepository(context); // Act IEnumerable <branch> result = repository.GetAll(); // Assert Assert.IsNotNull(result); Assert.AreEqual(context.branch.Count(), result.Count()); }
// // GET: /Admin/ImportExcel/ public ActionResult Index() { ViewBag.DefaultBranchId = UserContext.GetDefaultBranch(); ViewBag.Collectors = CollectorRepository.GetAll(); ViewBag.Channels = ChannelRepository.GetAll(); ViewBag.SourceTypes = SourceTypeRepository.GetAll(); var levels = LevelRepository.GetAll(); var L1n2 = levels.Where(x => x.LevelId < 3).ToList(); ViewBag.Levels = L1n2; ViewBag.Branches = BranchRepository.GetAll(); return(View()); }
public void BranchRepository_GetAll_OK() { // Arrange TestJsonDataService json = new TestJsonDataService(); BranchRepository repo = new BranchRepository(json); // Act var branchItems = repo.GetAll(); // Assert Assert.IsNotNull(branchItems, "GetAll returned null data"); Assert.IsTrue(branchItems.Count() == 2, "GetAll returned wrong number of records"); }
public long GetSortCode() { //get the sortcode of the last item in branch var branches = branchRepo.GetAll().OrderByDescending(b => b.ID); long lastCode = 10001234; //assume no branch initially if (branches != null && branches.Count() > 0) { lastCode = branches.First().SortCode + 1; //sortcode of the last branch + 1 } return(lastCode); }
public ActionResult Edit(int?id) { if (id == 0) { return(HttpNotFound()); } User users = _context.Get(id); if (users == null) { return(HttpNotFound()); } NewUserViewModel viewModels = new NewUserViewModel { Branches = BranchContext.GetAll(), user = users }; return(View(viewModels)); }
public ActionResult AddEmployee() { BranchRepository repo = new BranchRepository(); return(View(repo.GetAll())); }
// // GET: /Branch/ public ActionResult Index() { return(View(branchRepo.GetAll())); }
// GET api/<controller> public IEnumerable <BranchInfo> Get() { return(BranchRepository.GetAll()); }
public List <Branch> GetBranches() { return(_branchRepository.GetAll().ToList()); }
public List <Branch> GetAll() { return(_branchReository.GetAll()); }
public IEnumerable <Branch> GetBranches() { return(_branch.GetAll()); }
public IHttpActionResult Get() //Get Product List { return(Ok(branchRepository.GetAll())); }