コード例 #1
0
 public EventLog(ISessionContext sessionContext, BranchContext branchContext, IHttpContextAccessor accessor, EventLogRepository repository)
 {
     _sessionContext = sessionContext;
     _branchContext  = branchContext;
     _accessor       = accessor;
     _repository     = repository;
 }
コード例 #2
0
 public InsuranceController(InsuranceRepository insuranceRepository, ContractRepository contractRepository, BranchContext branchContext, ISessionContext sessionContext)
 {
     _insuranceRepository = insuranceRepository;
     _contractRepository  = contractRepository;
     _branchContext       = branchContext;
     _sessionContext      = sessionContext;
 }
コード例 #3
0
        protected BranchContext BuildSimpleNode(Node nextShapeNode, BranchContext thisBranchContext)
        {
            var newBranchContext = DropNextShape(nextShapeNode, thisBranchContext);

            ConnectLastDroppedShape(newBranchContext);
            return(newBranchContext);
        }
コード例 #4
0
 public DictionaryController(ISessionContext sessionContext, BranchContext branchContext,
                             GroupRepository groupRepository, RoleRepository roleRepository,
                             BankRepository bankRepository, CarRepository carRepository,
                             ClientRepository clientRepository, PositionRepository positionRepository,
                             CategoryRepository categoryRepository, AccountRepository accountRepository,
                             UserRepository userRepository, PurityRepository purityRepository,
                             ExpenseGroupRepository expenseGroupRepository, ExpenseTypeRepository expenseTypeRepository,
                             MachineryRepository machineryRepository, OrganizationRepository organizationRepository,
                             ClientBlackListReasonRepository clientBlackListReasonRepository, InnerNotificationRepository innerNotificationRepository)
 {
     _sessionContext                  = sessionContext;
     _branchContext                   = branchContext;
     _groupRepository                 = groupRepository;
     _roleRepository                  = roleRepository;
     _bankRepository                  = bankRepository;
     _carRepository                   = carRepository;
     _clientRepository                = clientRepository;
     _positionRepository              = positionRepository;
     _categoryRepository              = categoryRepository;
     _accountRepository               = accountRepository;
     _userRepository                  = userRepository;
     _purityRepository                = purityRepository;
     _expenseGroupRepository          = expenseGroupRepository;
     _expenseTypeRepository           = expenseTypeRepository;
     _machineryRepository             = machineryRepository;
     _organizationRepository          = organizationRepository;
     _clientBlackListReasonRepository = clientBlackListReasonRepository;
     _innerNotificationRepository     = innerNotificationRepository;
 }
コード例 #5
0
        public BranchContext BuildWhile(Node nextShapeNode, BranchContext thisBranchContext)
        {
            var nextLoopName = LoopNameGenerator.GetNextName();

            return(BuildAnyWhileLoop(nextShapeNode, thisBranchContext, $"{nextShapeNode.NodeText}\n{nextLoopName}",
                                     nextLoopName));
        }
コード例 #6
0
        public ActionResult Index()
        {
            // in case a user is logged in but the session variable is lost
            if (db == null)
            {
                return(RedirectToAction("Logout", "Account"));
            }

            List <Employee> people;

            if (db.GetType() == typeof(AppContext))
            { // connected to application DB and not branch specific DB instance (admin account)
                people = new List <Employee>();
                foreach (var branchID in db.Branches.Select(b => b.ID))
                {
                    BranchContext branchDB          = new BranchContext("b-" + branchID);
                    var           employeesInBranch = branchDB.Employees
                                                      .Include(e => e.Branch)
                                                      .Include(e => e.Name)
                                                      .Include(e => e.ReportRecipient).ToList();
                    people.AddRange(employeesInBranch);
                }
                return(View("ViewAllEmployee", people));
            }
            else
            {
                people = db.Employees.Include(e => e.Branch).Include(e => e.Name).Include(e => e.HomeAddress).Include(e => e.ReportRecipient).ToList();
            }
            return(View(people));
        }
コード例 #7
0
        public ActionResult Create(Customer customer, FullName name, FullAddress ha, System.Web.HttpPostedFileBase image)
        {
            if (ModelState.IsValid)
            {
                customer.ID          = Guid.NewGuid();
                ha.ID                = Guid.NewGuid();
                customer.Name        = name;
                customer.HomeAddress = ha;
                ha.PersonID          = customer.ID;

                if (image != null)
                {
                    System.IO.Stream imgStream = image.InputStream;
                    int    size     = (int)imgStream.Length;
                    byte[] imgBytes = new byte[size];
                    imgStream.Read(imgBytes, 0, size);
                    customer.Picture = imgBytes;
                }
                else
                {
                    customer.Picture = new byte[] { 0 };
                }

                BranchContext branchDb = new BranchContext("b-" + customer.BranchID);
                branchDb.Customers.Add(customer);
                branchDb.FullAddresses.Add(ha);
                branchDb.SaveChanges();
                return(RedirectToAction("Index"));
            }
            ViewBag.BranchID = new SelectList(db.Branches, "ID", "Name", customer.BranchID);
            ViewBag.ID       = new SelectList(db.FullNames, "ID", "Title", customer.ID);
            return(View(customer));
        }
コード例 #8
0
 public ContractWordBuilder(IStorage storage, BranchContext branchContext, ISessionContext sessionContext, UserRepository userRepository)
 {
     _storage        = storage;
     _branchContext  = branchContext;
     _sessionContext = sessionContext;
     _userRepository = userRepository;
 }
コード例 #9
0
 public AnnuityContractWordBuilder(IStorage storage, BranchContext branchContext, ISessionContext sessionContext, UserRepository userRepository, LoanPercentRepository loanPercentRepository)
 {
     _storage               = storage;
     _branchContext         = branchContext;
     _sessionContext        = sessionContext;
     _userRepository        = userRepository;
     _loanPercentRepository = loanPercentRepository;
 }
コード例 #10
0
ファイル: EventLogController.cs プロジェクト: NurTur/ATM_CBS
 public EventLogController(EventLogRepository repository, ISessionContext sessionContext,
                           BranchContext branchContext, EventLogExcelBuilder excelBuilder, IStorage storage)
 {
     _repository     = repository;
     _sessionContext = sessionContext;
     _branchContext  = branchContext;
     _excelBuilder   = excelBuilder;
     _storage        = storage;
 }
コード例 #11
0
        public NotificationReceiverController(NotificationReceiverRepository notificationReceiverRepository,
                                              NotificationLogRepository notificationLogRepository,
                                              ISessionContext sessionContext, BranchContext branchContext)
        {
            _notificationReceiverRepository = notificationReceiverRepository;
            _notificationLogRepository      = notificationLogRepository;

            _sessionContext = sessionContext;
            _branchContext  = branchContext;
        }
コード例 #12
0
        private BranchContext BuildSubTree(List <Node> nodes, BranchContext context)
        {
            var tmpContext = context;

            foreach (var node in nodes)
            {
                tmpContext = BuildTree(node, tmpContext);
            }
            return(tmpContext);
        }
コード例 #13
0
        protected void ConnectToParent(BranchContext branchContext)
        {
            var lastDroppedShape = branchContext.ShapeToContinueThree;

            if (branchContext.BranchParent != null && lastDroppedShape != null)
            {
                var branchParent = branchContext.BranchParent;
                VisioManipulator.ConnectShapes(lastDroppedShape, branchParent, NodesBranchRelation.PARENT);
            }
        }
コード例 #14
0
        public async Task <ActionResult> Login(LoginViewModel model, string returnUrl)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            // This doesn't count login failures towards account lockout
            // To enable password failures to trigger account lockout, change to shouldLockout: true
            var result = await SignInManager.PasswordSignInAsync(model.Email, model.Password, model.RememberMe, shouldLockout : false);

            switch (result)
            {
            case SignInStatus.Success:
                // Stores the user's branch id and authorized actions as session variables
                // so that it can be accessed anywhere within the application
                ApplicationUser user     = UserManager.FindByName(model.Email);
                Guid?           branchID = user.BranchID;
                if (branchID.HasValue)
                {
                    System.Web.HttpContext.Current.Session["branch"] = branchID;
                    BranchContext db = new BranchContext("b-" + branchID);
                    Employee      e  = db.Employees.Find(Guid.Parse(user.Id));
                    if (e == null)
                    {
                        AuthenticationManager.SignOut(DefaultAuthenticationTypes.ApplicationCookie);
                        ModelState.AddModelError("", "Employee does not exist in the Branch database.");
                        return(View(model));
                    }
                    string[] actions = e.AuthorizedActions.Split('.');
                    System.Diagnostics.Debug.WriteLine("Authorized Actions:");
                    foreach (string action in actions)
                    {
                        System.Diagnostics.Debug.WriteLine("\t" + action);
                    }
                    System.Web.HttpContext.Current.Session["authorized"] = actions;
                }
                else
                {
                    System.Web.HttpContext.Current.Session["branch"] = "admin";
                }
                return(RedirectToLocal(returnUrl));

            case SignInStatus.LockedOut:
                return(View("Lockout"));

            case SignInStatus.RequiresVerification:
                return(RedirectToAction("SendCode", new { ReturnUrl = returnUrl, RememberMe = model.RememberMe }));

            case SignInStatus.Failure:
            default:
                ModelState.AddModelError("", "Invalid login attempt.");
                return(View(model));
            }
        }
コード例 #15
0
        protected void ConnectLastDroppedShape(BranchContext thisBranchContext)
        {
            var prevShape        = thisBranchContext.ShapeToContinueThree;
            var lastDroppedShape = thisBranchContext.LastBranchShape;

            if (prevShape != null && lastDroppedShape != null)
            {
                VisioManipulator.ConnectShapes(lastDroppedShape, prevShape, thisBranchContext.BranchRelation);
                thisBranchContext.ContinueTreeWithShape(lastDroppedShape);
            }
        }
コード例 #16
0
        private void PlaceEndShape(BranchContext context)
        {
            var lastShape   = context.LastBranchShape;
            var endShapePos = new Point(lastShape.CurrentPos.X, lastShape.CurrentPos.Y);

            endShapePos.Offset(0, -0.7);
            var endShapeText = "Конец";
            var endShape     = VisioManipulator.DropSimpleShape(endShapeText, endShapePos, ShapeForm.BEGIN_END);

            VisioManipulator.ConnectShapes(endShape, context.ShapeToContinueThree, NodesBranchRelation.OTHER_BRANCH);
        }
コード例 #17
0
        public InnerNotificationController(InnerNotificationRepository innerNotificationRepository,
                                           ISessionContext sessionContext, BranchContext branchContext,
                                           EmailSender emailSender, SmsSender smsSender)
        {
            _innerNotificationRepository = innerNotificationRepository;

            _sessionContext = sessionContext;
            _branchContext  = branchContext;
            _emailSender    = emailSender;
            _smsSender      = smsSender;
        }
コード例 #18
0
 public InvestmentController(InvestmentRepository investmentRepository,
                             CashOrderRepository orderRepository,
                             CashOrderNumberCounterRepository counterRepository,
                             BranchContext branchContext,
                             ISessionContext sessionContext)
 {
     _investementRepository = investmentRepository;
     _orderRepository       = orderRepository;
     _counterRepository     = counterRepository;
     _branchContext         = branchContext;
     _sessionContext        = sessionContext;
 }
コード例 #19
0
        protected BranchContext BuildSubTreeNodes(List <Node> nodes, BranchContext context)
        {
            var lastParent = context.BranchParent;
            var tmpContext = context;

            foreach (var node in nodes)
            {
                tmpContext = BuildTree(node, tmpContext);
            }
            tmpContext.ChangeBranchParent(lastParent);
            return(tmpContext);
        }
コード例 #20
0
ファイル: CashOrderController.cs プロジェクト: NurTur/ATM_CBS
 public CashOrderController(CashOrderRepository repository,
                            CashOrderNumberCounterRepository counterRepository, CashOrdersExcelBuilder excelBuilder,
                            IStorage storage, BranchContext branchContext,
                            ISessionContext sessionContext)
 {
     _repository        = repository;
     _counterRepository = counterRepository;
     _excelBuilder      = excelBuilder;
     _storage           = storage;
     _branchContext     = branchContext;
     _sessionContext    = sessionContext;
 }
        public void Visit(BranchContext parserRule, IObjectContext <IVar, IVar> context)
        {
            var newContext = context.CreateChildContext();

            if (!globalContext.IfDefineType(parserRule.typeText))
            {
                errorLogger.LogError($"({parserRule.type.Line},{parserRule.type.Column + 1}) - Type Error : The type {parserRule.typeText} could not be found in the program");
            }
            newContext.Define(parserRule.idText, globalContext.GetType(parserRule.typeText));
            Visit(parserRule.expression, newContext);
            parserRule.computedType = parserRule.expression.computedType;
        }
コード例 #22
0
        public BranchContext BuildFor(Node nextShapeNode, BranchContext thisBranchContext)
        {
            var newShapePos    = GetNextShapePos(thisBranchContext);
            var firstLoopShape = VisioManipulator.DropSimpleShape(nextShapeNode.NodeText, newShapePos, ShapeForm.FOR);

            VisioManipulator.ConnectShapes(firstLoopShape, thisBranchContext.ShapeToContinueThree, thisBranchContext.BranchRelation);
            var newBranchContext = new BranchContext(firstLoopShape);

            newBranchContext = BuildSubTreeNodes(nextShapeNode.PrimaryChildNodes, newBranchContext);
            ConnectToParent(newBranchContext);
            newBranchContext.ContinueTreeWithShape(firstLoopShape);
            return(newBranchContext);
        }
コード例 #23
0
 public ActionResult Edit(Branch branch)
 {
     if (ModelState.IsValid)
     {
         db.Entry(branch).State = EntityState.Modified;
         db.SaveChanges();
         // connect with database instance for this branch
         BranchContext branchContext = new BranchContext("b-" + branch.ID);
         branchContext.Entry(branch).State = EntityState.Modified; // set modified state
         branchContext.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(branch));
 }
コード例 #24
0
 public RemittanceController(RemittanceRepository remittanceRepository, CashOrderRepository orderRepository,
                             CashOrderNumberCounterRepository cashCounterRepository, RemittanceSettingRepository remittanceSettingRepository,
                             MemberRepository memberRepository,
                             BranchContext branchContext, ISessionContext sessionContext, EventLog eventLog)
 {
     _remittanceRepository        = remittanceRepository;
     _orderRepository             = orderRepository;
     _cashCounterRepository       = cashCounterRepository;
     _remittanceSettingRepository = remittanceSettingRepository;
     _memberRepository            = memberRepository;
     _branchContext  = branchContext;
     _sessionContext = sessionContext;
     _eventLog       = eventLog;
 }
コード例 #25
0
        public NotificationController(NotificationRepository notificationRepository,
                                      NotificationReceiverRepository notificationReceiverRepository,
                                      NotificationLogRepository notificationLogRepository,
                                      ISessionContext sessionContext, BranchContext branchContext,
                                      EmailSender emailSender, SmsSender smsSender)
        {
            _notificationRepository         = notificationRepository;
            _notificationReceiverRepository = notificationReceiverRepository;
            _notificationLogRepository      = notificationLogRepository;

            _sessionContext = sessionContext;
            _branchContext  = branchContext;
            _emailSender    = emailSender;
            _smsSender      = smsSender;
        }
コード例 #26
0
        public ActionResult Create(Branch branch)
        {
            if (ModelState.IsValid)
            {
                branch.ID = Guid.NewGuid();
                db.Branches.Add(branch);
                db.SaveChanges();
                BranchContext branchDB = new BranchContext("b-" + branch.ID);
                branchDB.Branches.Add(branch);
                branchDB.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(branch));
        }
コード例 #27
0
        protected BranchContext DropNextShape(Node node, BranchContext thisBranchContext)
        {
            var newShapePos = GetNextShapePos(thisBranchContext, node);

            if (thisBranchContext.BranchOffset != default)
            {
                newShapePos.Offset(thisBranchContext.BranchOffset.X, thisBranchContext.BranchOffset.Y);
                thisBranchContext.ResetOffset();
            }

            var lastDroppedShape = VisioManipulator.DropShape(node, newShapePos);

            thisBranchContext.SetLastShape(lastDroppedShape);
            return(thisBranchContext);
        }
コード例 #28
0
        protected BranchContext BuildTree(Node node, BranchContext thisBranchContext)
        {
            BranchContext newBranchContext;

            if (BuildRules.ContainsKey(node.NodeType))
            {
                newBranchContext = BuildRules[node.NodeType].Invoke(node, thisBranchContext);
            }
            else
            {
                newBranchContext = BuildSimpleNode(node, thisBranchContext);
            }

            return(newBranchContext);
        }
コード例 #29
0
 public AuthController(
     TokenProvider tokenProvider, SaltedHash saltedHash, ISessionContext sessionContext,
     UserRepository userRepository, MemberRepository memberRepository,
     OrganizationRepository organizationRepository, GroupRepository groupRepository, BranchContext branchContext,
     IOptions <EnviromentAccessOptions> options)
 {
     _tokenProvider          = tokenProvider;
     _saltedHash             = saltedHash;
     _sessionContext         = sessionContext;
     _userRepository         = userRepository;
     _memberRepository       = memberRepository;
     _organizationRepository = organizationRepository;
     _groupRepository        = groupRepository;
     _branchContext          = branchContext;
     _options = options.Value;
 }
コード例 #30
0
 public InsuranceActionController(InsuranceActionRepository actionRepository,
                                  InsuranceRepository insuranceRepository,
                                  CashOrderRepository orderRepository,
                                  CashOrderNumberCounterRepository cashCounterRepository,
                                  BranchContext branchContext,
                                  ISessionContext sessionContext,
                                  EventLog eventLog)
 {
     _actionRepository      = actionRepository;
     _insuranceRepository   = insuranceRepository;
     _orderRepository       = orderRepository;
     _cashCounterRepository = cashCounterRepository;
     _branchContext         = branchContext;
     _sessionContext        = sessionContext;
     _eventLog = eventLog;
 }
コード例 #31
0
 private void InvokeMultiMatch(ProcessingContext context)
 {
     int counterMarker = context.Processor.CounterMarker;
     BranchContext context2 = new BranchContext(context);
     int count = this.resultTable.Count;
     int num3 = 0;
     while (num3 < count)
     {
         ProcessingContext context3;
         QueryBranchResult result = this.resultTable[num3];
         QueryBranch branch = result.Branch;
         Opcode next = branch.Branch.Next;
         if (next.TestFlag(OpcodeFlags.NoContextCopy))
         {
             context3 = context;
         }
         else
         {
             context3 = context2.Create();
         }
         this.InitResults(context3);
         context3.Values[context3.TopArg[result.ValIndex]].Boolean = true;
         while (++num3 < count)
         {
             result = this.resultTable[num3];
             if (branch.ID != result.Branch.ID)
             {
                 break;
             }
             context3.Values[context3.TopArg[result.ValIndex]].Boolean = true;
         }
         try
         {
             context3.EvalCodeBlock(next);
         }
         catch (XPathNavigatorException exception)
         {
             throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(exception.Process(next));
         }
         catch (NavigatorInvalidBodyAccessException exception2)
         {
             throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(exception2.Process(next));
         }
         context.Processor.CounterMarker = counterMarker;
     }
     context2.Release();
 }
コード例 #32
0
 internal override Opcode Eval(ProcessingContext context)
 {
     QueryProcessor processor = context.Processor;
     SeekableXPathNavigator contextNode = processor.ContextNode;
     int counterMarker = processor.CounterMarker;
     long currentPosition = contextNode.CurrentPosition;
     int num3 = 0;
     int count = this.branches.Count;
     try
     {
         Opcode opcode;
         if (context.StacksInUse)
         {
             if (--count > 0)
             {
                 BranchContext context2 = new BranchContext(context);
                 while (num3 < count)
                 {
                     opcode = this.branches[num3];
                     if ((opcode.Flags & OpcodeFlags.Fx) != OpcodeFlags.None)
                     {
                         opcode.Eval(context);
                     }
                     else
                     {
                         ProcessingContext context3 = context2.Create();
                         while (opcode != null)
                         {
                             opcode = opcode.Eval(context3);
                         }
                     }
                     contextNode.CurrentPosition = currentPosition;
                     processor.CounterMarker = counterMarker;
                     num3++;
                 }
                 context2.Release();
             }
             opcode = this.branches[num3];
             while (opcode != null)
             {
                 opcode = opcode.Eval(context);
             }
         }
         else
         {
             int nodeCount = context.NodeCount;
             while (num3 < count)
             {
                 for (opcode = this.branches[num3]; opcode != null; opcode = opcode.Eval(context))
                 {
                 }
                 context.ClearContext();
                 context.NodeCount = nodeCount;
                 contextNode.CurrentPosition = currentPosition;
                 processor.CounterMarker = counterMarker;
                 num3++;
             }
         }
     }
     catch (XPathNavigatorException exception)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(exception.Process(this.branches[num3]));
     }
     catch (NavigatorInvalidBodyAccessException exception2)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(exception2.Process(this.branches[num3]));
     }
     processor.CounterMarker = counterMarker;
     return base.next;
 }
コード例 #33
0
 internal void InvokeNonMatches(ProcessingContext context, QueryBranchTable nonMatchTable)
 {
     int counterMarker = context.Processor.CounterMarker;
     BranchContext context2 = new BranchContext(context);
     int num2 = 0;
     int num3 = 0;
     while ((num3 < this.resultTable.Count) && (num2 < nonMatchTable.Count))
     {
         QueryBranchResult result = this.resultTable[num3];
         int num4 = result.Branch.ID - nonMatchTable[num2].ID;
         if (num4 > 0)
         {
             ProcessingContext context3 = context2.Create();
             this.InvokeNonMatch(context3, nonMatchTable[num2]);
             context.Processor.CounterMarker = counterMarker;
             num2++;
         }
         else
         {
             if (num4 == 0)
             {
                 num2++;
                 continue;
             }
             num3++;
         }
     }
     while (num2 < nonMatchTable.Count)
     {
         ProcessingContext context4 = context2.Create();
         this.InvokeNonMatch(context4, nonMatchTable[num2]);
         context.Processor.CounterMarker = counterMarker;
         num2++;
     }
     context2.Release();
 }