public BranchRepositoryTests() { _request = Substitute.For <IRequest>(); _requestFactory = Substitute.For <IRequestFactory>(); _requestFactory.Create(Arg.Any <string>(), Arg.Any <Method>(), Arg.Any <bool>()).Returns(_request); _sut = new BranchRepository(_requestFactory); }
public ActionResult ConfirmAddBranch(string Branch_Location, string Pass) { if (Session["Password"].ToString() == Pass) { BranchRepository repo = new BranchRepository(); repo.Get(Branch_Location); if (repo.Get(Branch_Location) == null) { Branch br = new Branch(); br.Branch_Location = Branch_Location; repo.Insert(br); ViewData["Message"] = "Branch inserted successfully"; } else { ViewData["Message"] = "Branch alread Exist"; } } else { ViewData["Message"] = "Wrong Password"; } return(View("Empty")); }
public JsonResult SelectBranch(Branch obj) { BranchRepository objRep = new BranchRepository(); DataSet ds = objRep.sp_select_coursebranch(obj); List <Branch> _list = new List <Branch>(); if (ds != null) { if (ds.Tables[0].Rows.Count > 0) { foreach (DataRow row in ds.Tables[0].Rows) { Branch objBasic = new Branch(); objBasic.Natureofcourse_Id = row["Natureofcourse_Id"].ToString(); objBasic.Branchname = row["Branchname"].ToString(); objBasic.Branch_Id = row["Branch_Id"].ToString(); _list.Add(objBasic); } } } return(Json(new { List = _list }, JsonRequestBehavior.AllowGet )); }
public static Branch LoadSingle(long userId, long pin) { var repository = new BranchRepository(); var toRet = repository.LoadSingle(pin); return(toRet); }
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 void GetCurrentNonMaster() { using (var dir = new SelfDeletingDirectory(Path.GetFullPath(Path.Combine(basePath, nameof(this.GetCurrentNonMaster))))) { Repository.Init(dir.Path, false); using (var repo = new Repository(dir.Path)) { var testFilePath = Path.Combine(dir.Path, "test.txt"); File.WriteAllText(testFilePath, "Some test data."); Commands.Stage(repo, testFilePath); var identity = new Identity("Test Bot", "*****@*****.**"); var signature = new Signature(identity, DateTime.Now); repo.Commit("Added test data", signature, signature); var branchRepo = new BranchRepository(repo, mockup.Get <ICommitRepository>()); branchRepo.Add("side"); branchRepo.Checkout("side", new Signature(identity, DateTime.Now)); var current = branchRepo.GetCurrent(); Assert.Equal("side", current.FriendlyName); Assert.Equal("refs/heads/side", current.CanonicalName); } } }
public UnitOfWork(RestaurantContext context) { _context = context; Adjustments = new AdjustmentRepository(_context); AdjustmentsItems = new AdjustmentItemRepository(_context); Branches = new BranchRepository(_context); Categories = new CategoryRepository(_context); Customers = new CustomerRepository(_context); Deliveries = new DeliveryRepository(_context); DeliveryItems = new DeliveryItemRepository(_context); Divisions = new DivisionRepository(_context); Expirations = new ExpirationRepository(_context); Groups = new GroupRepository(_context); Stocks = new InventoryItemRepository(_context); Locations = new LocationRepository(_context); Units = new MeasurementUnitRepository(_context); Productions = new ProductionRepository(_context); Ingredients = new ProductionItemRepository(_context); Products = new ProductRepository(_context); Purchases = new PurchaseRepository(_context); PurchaseItems = new PurchaseItemRepository(_context); PurchaseOrders = new PurchaseOrderRepository(_context); PurchaseOrderItems = new PurchaseOrderItemRepository(_context); SalesInvoices = new SalesInvoiceRepository(_context); SalesInvoiceItems = new SalesInvoiceItemRepository(_context); Suppliers = new SupplierRepository(_context); Transfers = new TransferRepository(_context); TransferItems = new TransferItemRepository(_context); Wastages = new WastageRepository(_context); WastageItems = new WastageItemRepository(_context); Workers = new WorkerRepository(_context); ItemLocation = new ItemLocationRepository(_context); StockHistory = new StockHistoryRepository(_context); Currencies = new CurrencyRepository(_context); }
public static SelectList GetSelectList_Branch(object sValue, string NullOrNameEmpty) { var selectListItems = new List <SelectListItem>(); BranchRepository branchRepository = new BranchRepository(new Domain.Sale.ErpSaleDbContext()); if (NullOrNameEmpty != null) { SelectListItem itemEmpty = new SelectListItem(); itemEmpty.Text = NullOrNameEmpty; itemEmpty.Value = null; selectListItems.Add(itemEmpty); } try { var q = branchRepository.GetAllBranch().OrderBy(item => item.Id); foreach (var i in q) { SelectListItem item = new SelectListItem(); item.Text = i.Name; item.Value = i.Id.ToString(); selectListItems.Add(item); } } catch { } var selectList = new SelectList(selectListItems, "Value", "Text", sValue); return(selectList); }
public IHttpActionResult GetBranchNotAssignedForProduct(int id /*productId*/) //this method is called to get branch info where the particular product is not assigned { BranchRepository branchRepository = new BranchRepository(); List <Branch> branchInfo = branchRepository.GetBranchInfo(id); return(Ok(branchInfo)); }
public IHttpActionResult SingleBranchMonthlySales(int id, int year) { BranchRepository branchRepository = new BranchRepository(); List <SumGroupByModel> brvm = branchRepository.SingleBranchMonthlySales(id, year); List <BarChartModel> chart = new List <BarChartModel>(); string[] months = { "Jan", "Feb", "March", "April", "May", "June", "July", "Aug", "Sep", "Oct", "Nov", "Dec" }; int i, j; int count = brvm.Count(); //Adding All the Months and Giving the Sum Amount Zero to the chart for (i = 0; i < 12; i++) { BarChartModel barChartModel = new BarChartModel(months[i], 0); chart.Add(barChartModel); } //Now the Assigning Value to the months where the Sum Amount exists for that particular month for (i = 0; i < count; i++) { chart[brvm[i].Id - 1].Y = brvm[i].Column1; } return(Ok(chart)); }
public async Task ListUpstreamOnlyMaster() { using (var dir = new SelfDeletingDirectory(Path.GetFullPath(Path.Combine(basePath, nameof(this.ListUpstreamOnlyMaster))))) { var upstreamPath = Path.Combine(dir.Path, "Upstream"); var authorPath = Path.Combine(dir.Path, "Author"); var downstreamPath = Path.Combine(dir.Path, "Downstream"); Repository.Init(upstreamPath, true); Repository.Clone(upstreamPath, authorPath); using (var repo = new Repository(authorPath)) { var testFilePath = Path.Combine(dir.Path, "Author/test.txt"); File.WriteAllText(testFilePath, "Some test data."); Commands.Stage(repo, testFilePath); var signature = new Signature("Test Bot", "*****@*****.**", DateTime.Now); repo.Commit("Added test data", signature, signature); var syncRepo = new SyncRepository(repo, mockup.Get <ICommitRepository>(), mockup.Get <IGitCredentialsProvider>(), mockup.Get <IProcessRunner>()); await syncRepo.Push(); } Repository.Clone(upstreamPath, downstreamPath); using (var repo = new Repository(downstreamPath)) { var branchRepo = new BranchRepository(repo, mockup.Get <ICommitRepository>()); var branches = branchRepo.List(); Assert.Single(branches.Items); Assert.Equal("master", branches.Items.First().FriendlyName); Assert.Equal("refs/heads/master", branches.Items.First().CanonicalName); } } }
public IHttpActionResult DiscountReportByBranch() { List <DiscountViewModel> discountModels = new List <DiscountViewModel>(); List <DiscountReportViewModel> model = new List <DiscountReportViewModel>(); model = invoiceRepository.DiscountReportByBranch(); foreach (var item in model) { DiscountViewModel discount = new DiscountViewModel(); discount.Branch_Id = item.BranchId; discount.Column1 = item.Discount; discountModels.Add(discount); } List <BarChartModel> barCharts = new List <BarChartModel>(); foreach (DiscountViewModel item in discountModels) { DiscountViewModel dvm = new DiscountViewModel(); BranchRepository branch = new BranchRepository(); string branchName = branch.Get(item.Branch_Id).Name; dvm.Column1 = item.Column1; BarChartModel barChart = new BarChartModel(branchName, (double)dvm.Column1); barCharts.Add(barChart); } var lsitOfData = Newtonsoft.Json.JsonConvert.SerializeObject(barCharts); return(Ok(barCharts)); }
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 DataManager() { cont = new ModelContainer(); branchRepository = new BranchRepository(cont); categoryRepository = new CategoryRepository(cont); checkDishRepository = new CheckDishRepository(cont); checkMerchandiseRepository = new CheckMerchandiseRepository(cont); clientRepository = new ClientRepository(cont); companyOwnerRepository = new CompanyOwnerRepository(cont); companyRepository = new CompanyRepository(cont); contactPersonRepository = new ContactPersonRepository(cont); dishRepository = new DishRepository(cont); documentRepository = new DocumentRepository(cont); ejectionRepository = new EjectionRepository(cont); employeeRepository = new EmployeeRepository(cont); encashmentRepository = new EncashmentRepository(cont); landlordRepository = new LandlordRepository(cont); orderRepository = new OrderRepository(cont); personRepository = new PersonRepository(cont); positionRepository = new PositionRepository(cont); prepackRepository = new PrepackRepository(cont); productRepository = new ProductRepository(cont); purchaseRepository = new PurchaseRepository(cont); recipeDishIngrRepository = new RecipeDishIngrRepository(cont); recipeDishPrepRepository = new RecipeDishPrepRepository(cont); recipePrepIngrRepository = new RecipePrepIngrRepository(cont); recipePrepPrepRepository = new RecipePrepPrepRepository(cont); roomRepository = new RoomRepository(cont); shiftRepository = new ShiftRepository(cont); tableRepository = new TableRepository(cont); warehouseRepository = new WarehouseRepository(cont); }
public BranchController() { m_branchRepository = new BranchRepository(); m_federationRepository = new FederationRepository(); m_federations = m_federationRepository.GetAllFederations(); }
public ActionResult Annual_Repots_md_show() { BranchRepository trepo = new BranchRepository(); List <Branch> ll = trepo.GetAll(); return(View(ll)); }
private void SaveBranch(IPropertyBranch branch) { using (DatabaseContext context = CreateDatabaseContext()) { BranchRepository branchRepository = new BranchRepository(context); TBranch existingBranch = branchRepository.GetBranch(branch.BranchId, branch.Type); if (existingBranch == null) { existingBranch = context.Branch.Add(new TBranch { BranchId = branch.BranchId, Name = branch.Name, Reference = branch.Reference, Type = branch.Type }); } else { existingBranch.Name = branch.Name; existingBranch.Reference = branch.Reference; } context.SaveChanges(); // set the branchGuid back to the calling branch branch.BranchGuid = existingBranch.BranchGuid; } }
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 EmployeeController() { repository = new EmployeeRepository(); services = new EmployeeServices(); deptRepository = new DepartmentRepository(); branchRepository = new BranchRepository(); desigRepository = new DesignationRepository(); }
public void GetWarehousesThroughWarehouseRepo() { var repo = new BranchRepository(); var order = repo.GetAll(); Assert.IsNotNull(order); Assert.IsTrue(order.Count > 2); }
public void TestSetup() { AppDbContext dbContext = new AppDbContext(); //ApplicationDbInitialize db = new ApplicationDbInitialize(); //System.Data.Entity.Database.SetInitializer(db); repo = new BranchRepository(dbContext); }
private void LoadBranchesToCombobox() { var branches = BranchRepository.GetAllBranches(); foreach (var branch in branches) { comboBranch.Items.Add($"{branch.Id} - {branch.Name}"); } }
public GameController() { m_gameRepository = new GameRepository(); BranchRepository branchRepo = new BranchRepository(); PriceCategoryRepository priceRepo = new PriceCategoryRepository(); m_branches = branchRepo.GetAllBranches(); m_priceCategories = priceRepo.GetAllPriceCategories(); }
public IQueryable <T> GetBranchDetails <T>(Expression <Func <T, bool> > predicate = null) where T : Branch { var query = BranchRepository.FindAll().OfType <T>(); if (predicate != null) { query = query.Where(predicate); } return(query); }
public async Task <IResult <BranchRepository> > BranchFind(BranchRepository inputDTO) { ProxyNLuxPayment.BranchRepositoryInput input = new ProxyNLuxPayment.BranchRepositoryInput { BranchRepository = inputDTO, InputContext = this.UpdateContext <ProxyNLuxPayment.Context>() }; var result = await InvokeMethodAsync <BranchRepository, ProxyNLuxPayment.WSPaymentClient>("BranchFind", input); return(result); }
private void FirstStart() { ModelContainer cont = new ModelContainer(); BranchRepository branchRepository = new BranchRepository(cont); CategoryRepository categoryRepository = new CategoryRepository(cont); CompanyOwnerRepository companyOwnerRepository = new CompanyOwnerRepository(cont); PersonRepository personRepository = new PersonRepository(cont); PositionRepository positionRepository = new PositionRepository(cont); RoomRepository roomRepository = new RoomRepository(cont); TableRepository tableRepository = new TableRepository(cont); ClientRepository clientRepository = new ClientRepository(cont); if (positionRepository.Positions().Count() == 0) { positionRepository.AddPosition("Суперпользователь", true, true, true, true, true, true); } CompanyOwner co = new CompanyOwner(); if (personRepository.Persones().Count() == 0) { co = companyOwnerRepository.AddCompanyOwner("Суперпользователь", "", "", "", "", "super", "super".GetHashCode().ToString(), "", "", "", positionRepository.GetPositionByName("Суперпользователь")); } Branch b = new Branch(); if (branchRepository.Branches().Count() == 0) { b = branchRepository.AddBranch("", "", DateTime.Now, DateTime.Now, "", "", "", "", "", co, null); } Room r = new Room(); if (roomRepository.Rooms().Count() == 0) { r = roomRepository.AddRoom("", b); } if (categoryRepository.Categotyes().Count() == 0) { categoryRepository.AddCategory(""); } if (tableRepository.Tables().Count() == 0) { tableRepository.AddTable(1, "", r); } if (clientRepository.Clients().Count() == 0) { clientRepository.AddClient("Клиент", "", "", "", "", "", "", "", "", "", "", ""); } }
public ServicesHistoryController(IServicesHistoryRepository servicesHistoryRepository) { this.servicesHistoryRepository = new ServiceHistoryRepository(); this.serviceHistoryMapper = new ServicesHistoryMapper(); clientRepository = new ClientRepository(); clientMapper = new ClientMapper(); serviceHistoryRepository = new ServiceHistoryRepository(); branchRepository = new BranchRepository(); employeeRepository = new EmployeeRepository(); servicesDirectoryRepository = new ServiceDirectoryRepository(); }
public async Task ListUpstreamMultiple() { using (var dir = new SelfDeletingDirectory(Path.GetFullPath(Path.Combine(basePath, nameof(this.ListUpstreamMultiple))))) { var upstreamPath = Path.Combine(dir.Path, "Upstream"); var authorPath = Path.Combine(dir.Path, "Author"); var downstreamPath = Path.Combine(dir.Path, "Downstream"); var identity = new Identity("Test Bot", "*****@*****.**"); Repository.Init(upstreamPath, true); Repository.Clone(upstreamPath, authorPath); using (var repo = new Repository(authorPath)) { var testFilePath = Path.Combine(dir.Path, "Author/test.txt"); File.WriteAllText(testFilePath, "Some test data."); Commands.Stage(repo, testFilePath); var signature = new Signature(identity, DateTime.Now); repo.Commit("Added test data", signature, signature); //Sync main branch var syncRepo = new SyncRepository(repo, mockup.Get <ICommitRepository>(), mockup.Get <IGitCredentialsProvider>(), mockup.Get <IProcessRunner>()); await syncRepo.Push(); var authorBranchRepo = new BranchRepository(repo, mockup.Get <ICommitRepository>()); //Create side branch authorBranchRepo.Add("sidebranch"); authorBranchRepo.Checkout("sidebranch", new Signature(identity, DateTime.Now)); File.WriteAllText(testFilePath, "Some test data sidebranch."); Commands.Stage(repo, testFilePath); signature = new Signature(identity, DateTime.Now); repo.Commit("Added test data", signature, signature); await syncRepo.Push(); //Create another branch authorBranchRepo.Add("another"); authorBranchRepo.Checkout("another", new Signature(identity, DateTime.Now)); File.WriteAllText(testFilePath, "Some test data another."); Commands.Stage(repo, testFilePath); signature = new Signature(identity, DateTime.Now); repo.Commit("Added test data", signature, signature); await syncRepo.Push(); } Repository.Clone(upstreamPath, downstreamPath); using (var repo = new Repository(downstreamPath)) { var branchRepo = new BranchRepository(repo, mockup.Get <ICommitRepository>()); var branches = branchRepo.List(); Assert.Equal(3, branches.Items.Count()); } } }
static void Main(string[] args) { var account = Radio7.ConfigReader.ConfigFactory.Instance.Resolve<AccountRepository>(); var setttings = Radio7.ConfigReader.ConfigFactory.Instance.Resolve<Settings>(); var logger = new ConsoleLogger(); var branchRepository = new BranchRepository(account, logger); var branches = branchRepository.Get(); var commitRepository = new CommitRepository(account, logger); var commits = commitRepository.Get(setttings.BranchName); var prRepository = new PullRequestRepository(account, logger); var pullRequests = prRepository.Get(); var sql = new SqlRepository(setttings.ConnectionString); sql.LoadTable(branches); sql.LoadTable(commits); sql.LoadTable(pullRequests); }