コード例 #1
0
        public static void SeedOperators(IOperatorManager operatorManager, ICodeManager codeManager, ITariffManager tariffManager)
        {
            if (operatorManager.GetByName("Vodafone") == null)
            {
                OperatorViewModel oper1 = new OperatorViewModel();
                oper1.Name = "Vodafone";
                operatorManager.Add(oper1);
                oper1 = operatorManager.GetByName("Vodafone");

                CodeViewModel code1 = new CodeViewModel()
                {
                    OperatorId = oper1.Id, OperatorCode = "+38099"
                };
                CodeViewModel code2 = new CodeViewModel()
                {
                    OperatorId = oper1.Id, OperatorCode = "+38066"
                };
                CodeViewModel code3 = new CodeViewModel()
                {
                    OperatorId = oper1.Id, OperatorCode = "+38050"
                };

                codeManager.Add(code1);
                codeManager.Add(code2);
                codeManager.Add(code3);

                SeedTariffs(tariffManager, oper1.Id);
            }

            if (operatorManager.GetByName("Kyivstar") == null)
            {
                OperatorViewModel oper2 = new OperatorViewModel();
                oper2.Name = "Kyivstar";
                operatorManager.Add(oper2);
                oper2 = operatorManager.GetByName("Kyivstar");

                CodeViewModel code4 = new CodeViewModel()
                {
                    OperatorId = oper2.Id, OperatorCode = "+38097"
                };
                CodeViewModel code5 = new CodeViewModel()
                {
                    OperatorId = oper2.Id, OperatorCode = "+38067"
                };
                CodeViewModel code6 = new CodeViewModel()
                {
                    OperatorId = oper2.Id, OperatorCode = "+38096"
                };

                codeManager.Add(code4);
                codeManager.Add(code5);
                codeManager.Add(code6);

                SeedTariffs(tariffManager, oper2.Id);
            }
        }
コード例 #2
0
 private ExpressionTreeNode(string @value, int column, IOperatorManager operatorManager)
 {
     m_operatorManager = operatorManager;
     //Remove whitespace.
     int whiteSpace = CountWhiteSpace(@value);
     m_column = column + whiteSpace;
     int oldLength = @value.Length;
     @value = @value.Trim();
     m_length = @value.Length;
     SetValue(@value);
 }
コード例 #3
0
 public static void SeedData(UserManager <ApplicationUser> userManager, RoleManager <IdentityRole> roleManager,
                             IOperatorManager operatorManager, ICodeManager codeManager, ITariffManager tariffManager,
                             IStopWordManager stopWordManager, IUnitOfWork unitOfWork)
 {
     SeedRoles(roleManager);
     SeedUsers(userManager);
     SeedOperators(operatorManager, codeManager, tariffManager);
     SeedStopWords(stopWordManager);
     SeedCampaigns(unitOfWork);
     SeedEmailCampaigns(unitOfWork);
 }
コード例 #4
0
 public CompanyController(ICompanyManager company, IOperatorManager _operator, ITariffManager tariff,
                          UserManager <ApplicationUser> userManager, IGroupManager groupManager,
                          IRecipientManager recipientManager, IPhoneManager phoneManager,
                          IRecievedMessageManager recievedMessageManager, IAnswersCodeManager answersCodeManager,
                          ISubscribeWordManager subscribeWordManager, IContactManager contactManager)
 {
     this.companyManager         = company;
     this.operatorManager        = _operator;
     this.tariffManager          = tariff;
     this.userManager            = userManager;
     this.groupManager           = groupManager;
     this.phoneManager           = phoneManager;
     this.recipientManager       = recipientManager;
     this.recievedMessageManager = recievedMessageManager;
     this.answersCodeManager     = answersCodeManager;
     this.subscribeWordManager   = subscribeWordManager;
     this.contactManager         = contactManager;
 }
コード例 #5
0
 public CodeController(ICodeManager codeManager, IOperatorManager operatorManager)
 {
     this.codeManager = codeManager;
 }
コード例 #6
0
 //Analyses a cell and creates an expression tree by it.
 //Used internal to avoid circular references.
 public static ExpressionTreeNode Parse(string value, IOperatorManager operatorManager)
 {
     return new ExpressionTreeNode(value, 0, operatorManager);
 }
コード例 #7
0
 public static OperatorMatch FindOperators(string text, IOperatorManager operatorManager)
 {
     char c;
     int depth = 0;
     OperatorMatch topOperator = null;
     string op = "";
     ArrayList matches = new ArrayList();
     for (int i = 0; i <= text.Length - 1; i++)
     {
         c = text[i];
         if (c == '(')
         {
             depth += 1;
         }
         else if (c == ')')
         {
             depth -= 1;
         }
         if (depth == 0 && c != ';' && !char.IsLetter(c) && !char.IsNumber(c) && !char.IsWhiteSpace(c) && c != '(' && c != ')' && c != '.')
         {
             //Found beginning of operator.
             op += c;
         }
         else if (op != "")
         {
             matches.Add(new OperatorMatch(i - op.Length, op.Length));
             op = "";
         }
     }
     if (matches.Count > 0)
     {
         //Find the operators.
         int endIndex = 0;
         OperatorMatch firstMatch = (OperatorMatch)matches[0];
         if (firstMatch.StartIndex == 0)
         {
             op = text.Substring(firstMatch.StartIndex, firstMatch.Length);
             firstMatch.ExpressionOperator = operatorManager.UniOperators[op];
             firstMatch.Unary = true;
             endIndex = 1;
         }
         for (int i = matches.Count - 1; i >= endIndex; i += -1)
         {
             OperatorMatch match = (OperatorMatch)matches[i];
             op = text.Substring(match.StartIndex, match.Length);
             match.ExpressionOperator = operatorManager.BiOperators[op];
             if (match.ExpressionOperator == null)
             {
                 //Could be two operators beside each other.
                 //Check for unary operator.
                 ExpressionOperator[] ops = operatorManager.UniOperators.GetOperators();
                 foreach (ExpressionOperator uniOperator in ops)
                 {
                     if (op.EndsWith(uniOperator.Identifier))
                     {
                         match.ExpressionOperator = operatorManager.BiOperators[op.Substring(0, op.Length - uniOperator.Identifier.Length)];
                         match.Length -= uniOperator.Identifier.Length;
                         if (match.ExpressionOperator != null)
                         {
                             break;
                         }
                     }
                 }
             }
             if (match.ExpressionOperator != null)
             {
                 if (topOperator == null || topOperator.ExpressionOperator.Presedence > match.ExpressionOperator.Presedence)
                 {
                     topOperator = match;
                 }
             }
         }
         if (topOperator == null)
         {
             //Use unary operator if no other matches.
             topOperator = firstMatch;
         }
         if (topOperator.ExpressionOperator == null)
         {
             return null;
         }
     }
     return topOperator;
 }
コード例 #8
0
 protected override void Initialize()
 {
     this.mockWrapper = new Mock <IFileIoWrapper>();
     manager          = new OperatorManager(mockUnitOfWork.Object, mockMapper.Object, mockWrapper.Object);
     TestContext.WriteLine("Overrided");
 }
コード例 #9
0
 public OperatorController(IOperatorManager oper)
 {
     this.operatorManager = oper;
 }