Exemplo n.º 1
0
        public void ValidateBinaryParsing()
        {
            string [] code = new [] {
                "      B'1010101111'",
                "      b\"111\"",
                "      B'121'"
            };
            FortranOptions opts = new FortranOptions();
            MessageCollection messages = new MessageCollection(opts);
            Lexer ls = new Lexer(code, opts, messages);

            SimpleToken token = ls.GetToken();
            Assert.IsTrue(token.ID == TokenID.INTEGER);
            IntegerToken intToken = (IntegerToken)token;
            Assert.AreEqual(intToken.Value, 687);

            Assert.IsTrue(ls.GetToken().ID == TokenID.EOL);

            token = ls.GetToken();
            Assert.IsTrue(token.ID == TokenID.INTEGER);
            intToken = (IntegerToken)token;
            Assert.AreEqual(intToken.Value, 7);

            Assert.IsTrue(ls.GetToken().ID == TokenID.EOL);

            ls.GetToken();
            Assert.IsTrue(messages.ErrorCount > 0);
            Assert.IsTrue(messages[0].Line == 3);
            Assert.IsTrue(messages[0].Code == MessageCode.BADNUMBERFORMAT);
        }
		public void FixtureSetUp () 
		{
			string unit = Assembly.GetExecutingAssembly ().Location;
			assembly = AssemblyFactory.GetAssembly (unit);
			rule = new AvoidLargeClassesRule ();
			messageCollection = null;
		}
		public void FixtureSetUp ()
		{
			string unit = Assembly.GetExecutingAssembly ().Location;
			assembly = AssemblyFactory.GetAssembly (unit);
			rule = new AttributeEndsWithAttributeSuffixRule ();
			messageCollection = null;
		}
		public MessageCollection CheckMethod(MethodDefinition method, Runner runner)
		{
			MessageCollection messageCollection = new MessageCollection();

			if (method.Body == null || method.Body.Instructions == null)
			{
				return null;
			}

			foreach (Instruction instruction in method.Body.Instructions)
			{
				if (instruction.OpCode.Code == Code.Pop)
				{
					Message message = CheckForViolation(instruction.Previous);

					if (message != null)
					{
						messageCollection.Add(message);
					}
				}
			}
			

			return messageCollection.Count == 0 ? runner.RuleSuccess : messageCollection;
		}
		public void FixtureSetUp ()
		{
			string unit = Assembly.GetExecutingAssembly ().Location;
			assembly = AssemblyFactory.GetAssembly (unit);
			rule = new UsePluralNameInEnumFlagsRule ();
			messageCollection = null;
		}
        public ChatWindow(Chat parrent, RoomLink link)
        {
            InitializeComponent();

            DataContext = this;  //aby šel bindovat title okna
            Parrent = parrent;
            Link = link;
            RefreshTime = 20;
            refresher = new System.Timers.Timer(RefreshTime * 1000);
            refresher.Elapsed += (object sender, ElapsedEventArgs ea) => {
                Logger.dbgOut("Refresh");

                //tohle tu je, protoze potrebuju kolekci updatovat z jinýho vlákna
                Dispatcher.Invoke(DispatcherPriority.Normal, (ThreadStart)delegate() {
                        List<Message> ms = parrent.getMessages();
                        Messages.Clear();
                        foreach(Message m in ms)
                        {
                            Messages.Add(m);
                        }
                    }
                );
            };

            Messages = new MessageCollection(parrent.getMessages());
            lbChatView.ItemsSource = Messages;

            //zapnutí obnovování zpráv
            refresher.Start();
        }
Exemplo n.º 7
0
        static void Main(string[] args)
        {
            FortranOptions opts = new FortranOptions();
            MessageCollection messages = new MessageCollection(opts);

            opts.Messages = messages;
            if (opts.Parse(args)) {
                Compiler comp = new Compiler(opts);
                comp.Messages = messages;

                foreach (string srcfile in opts.SourceFiles) {
                    if (!File.Exists(srcfile)) {
                        messages.Error(MessageCode.SOURCEFILENOTFOUND, String.Format("File '{0}' not found", srcfile));
                        break;
                    }
                    comp.Compile(srcfile);
                }
                if (messages.ErrorCount == 0) {
                    comp.Save();
                    if (opts.Run && messages.ErrorCount == 0) {
                        comp.Execute();
                    }
                }
            }
            foreach (Message msg in messages) {
                if (msg.Level == MessageLevel.Error) {
                    Console.ForegroundColor = ConsoleColor.Red;
                }
                Console.WriteLine(msg);
                Console.ResetColor();
            }
            if (messages.ErrorCount > 0) {
                Console.WriteLine(String.Format("*** {0} errors found. Compilation stopped.", messages.ErrorCount));
            }
        }
Exemplo n.º 8
0
 void _ProcessMessages (MessageCollection messages, IRule rule, object target)                                                                 
          {                                                                                                                                            
                  if (messages == RuleSuccess)                                                                                                         
                          return;                                                                                                                      
                                                                                                                                                       
                  Violations.Add (rule, target, messages);                                                                                             
          }              
Exemplo n.º 9
0
        public void CanCreateTransaction()
        {
            SendPipelineWrapper pipeline =
            PipelineFactory.CreateSendPipeline(typeof(XMLTransmit));

             using ( TransactionControl control = pipeline.EnableTransactions() )
             {
            // Create the input message to pass through the pipeline
            Stream stream = DocLoader.LoadStream("SampleDocument.xml");
            IBaseMessage inputMessage = MessageHelper.CreateFromStream(stream);

            // Add the necessary schemas to the pipeline, so that
            // disassembling works
            pipeline.AddDocSpec(typeof(Schema1_NPP));
            pipeline.AddDocSpec(typeof(Schema2_WPP));

            MessageCollection inputMessages = new MessageCollection();
            inputMessages.Add(inputMessage);

            // Execute the pipeline, and check the output
            IBaseMessage outputMessage = pipeline.Execute(inputMessages);

            Assert.IsNotNull(outputMessage);
            control.SetComplete();
             }
        }
Exemplo n.º 10
0
        public MessageCollection<Dominio.Models.Cliente> ObterClientesIncompleto()
        {
            MessageCollection<Dominio.Models.Cliente> msg = new MessageCollection<Dominio.Models.Cliente>();

            try
            {
                var clientes = Integracao.XYZ.XYZClientes.ClientesIncompletos();

                if (clientes.Resultado != TipoResultado.Sucesso)
                    throw clientes.Exception;

                msg.Instances = clientes.Instances.Select(s => new Dominio.Models.Cliente()
                {
                    Id = s.Idk__BackingField,
                    Nome = s.Nomek__BackingField,
                    Endereco = s.Enderecok__BackingField,
                    TelefoneResidencial = s.TelefoneResidencialk__BackingField,
                    TelefoneCelular = s.TelefoneCelulark__BackingField,
                    DataNascimento = s.DataNascimentok__BackingField
                }).ToList();
            }
            catch (Exception ex)
            {
                msg.Exception = ex;
            }

            return msg;
        }
Exemplo n.º 11
0
		internal MimePartCollection ConcatMessagesAsPart(MessageCollection input)
		{
			MimePartCollection output = new MimePartCollection();
			foreach(MimePart part in this) output.Add(part);
			foreach(Message message in input) output.Add(message.ToMimePart());
            return output;			
		}
		public MessageCollection CheckType(TypeDefinition type, Runner runner)
		{
			MessageCollection messageCollection = new MessageCollection();

			foreach (MethodDefinition method in type.Methods)
			{
				if (!method.IsStatic)
				{
					return null;
				}
			}

			foreach (FieldDefinition field in type.Fields)
			{
				if (!field.IsStatic)
				{
					return null;
				}
			}
			
			foreach (MethodDefinition ctor in type.Constructors)
			{
				if (!ctor.IsStatic && (ctor.Attributes & MethodAttributes.Public) == MethodAttributes.Public)
				{
					Location location = new Location(type.Name, ctor.Name, 0);
					Message message = new Message(MessageString, location, MessageType.Error);
					messageCollection.Add(message);
				}
			}

			return messageCollection.Count > 0 ? messageCollection : null;
			
		}
Exemplo n.º 13
0
		public void AddMessages(MessageCollection messageCollection)
		{
			foreach (var message in messageCollection)
			{
				this.AddMessage(message);
			}
		}
		public void FixtureSetUp ()
		{
			string unit = Assembly.GetExecutingAssembly ().Location;
			assembly = AssemblyFactory.GetAssembly (unit);
			rule = new DontSwallowErrorsCatchingNonspecificExceptions ();
			type = assembly.MainModule.Types ["Test.Rules.Exceptions.DontSwallowErrorsCatchingNonspecificExceptionsTest"];
			messageCollection = null;
		}
Exemplo n.º 15
0
        public Account(dynamic oAccount)
        {
            _account = oAccount;

            dynamic oMessages = _account.Messages;

            _messageCollection = new MessageCollection(oMessages);
        }
		private void CheckMessageType (MessageCollection messageCollection, MessageType messageType) 
		{
			IEnumerator enumerator = messageCollection.GetEnumerator ();
			if (enumerator.MoveNext ()) {
				Message message = (Message) enumerator.Current;
				Assert.AreEqual (message.Type, messageType);
			}
		}
Exemplo n.º 17
0
    /// <summary>
    /// Initializes a new instance of the <see cref="DiagramController"/> class.
    /// </summary>
    internal DiagramController()
    {
      this.modelCollection = DiagramContext.DiagramObjects;
      this.messageCollection = DiagramContext.Messages;
      this.relationCollection = DiagramContext.Relations;

      this.Clear();
    }
		public void SwallowErrorsCatchingExceptionsNoEmptyCatchBlockTest () 
		{
			method = type.Methods.GetMethod ("SwallowErrorsCatchingExceptionNoEmptyCatchBlock", Type.EmptyTypes);
			messageCollection = rule.CheckMethod (method, new MinimalRunner ());
			Assert.IsNotNull (messageCollection);
			Assert.AreEqual (messageCollection.Count, 1);
			CheckMessageType (messageCollection, MessageType.Error);
		}
Exemplo n.º 19
0
 /// <summary>
 /// This constructor will create an empty class, normally
 /// used when the Node property is assigned
 /// </summary>
 public TraceScan()
 {
     m_id = Guid.NewGuid();
     m_messages = new MessageCollection();
     m_machine = Environment.MachineName;
     m_messages.MachineName = m_machine;
     m_user = Environment.UserName;
     m_mailBox = Environment.UserName;
 }
		private void AddExistingMessages (MessageCollection existingMessages) {
			if (existingMessages == null)
				return;

			foreach (Message violation in existingMessages) {
				Message message = new Message ("This method contains unused parameters.  This is a sign for the Speculative Generality smell.",violation.Location, MessageType.Error);
				messageCollection.Add (message);
			}
		}
Exemplo n.º 21
0
 /// <summary>
 /// Initialises an instance of the <c>Lexer</c> class.
 /// </summary>
 /// <param name="lines">An array of input strings</param>
 /// <param name="opts">An instance of the <c>Options</c> class</param>
 /// <param name="messages">An instance of the <c>MessageCollection</c> class</param>
 public Lexer(string[] lines, FortranOptions opts, MessageCollection messages)
 {
     _lines = lines;
     _index = -1;
     _tindex = 0;
     _opts = opts;
     _messages = messages;
     _tokens = new List<SimpleToken>();
 }
Exemplo n.º 22
0
 /// <summary>
 /// Constructs a Fortran compiler object with the given options.
 /// </summary>
 /// <param name="opts">Compiler options</param>
 public Compiler(FortranOptions opts)
 {
     _globalSymbols = new SymbolCollection("Global"); // Functions and Subroutines
     _localSymbols = new SymbolCollection("Local"); // Everything else including labels
     _ptree = new CollectionParseNode();
     _messages = new MessageCollection(opts);
     _entryPointName = "Main";
     _opts = opts;
 }
Exemplo n.º 23
0
        private static void DumpOutputToFile(MessageCollection outputs)
        {
            var outputStream = new MemoryStream();

            outputs.First().BodyPart.GetOriginalDataStream().CopyTo(outputStream);

            string outputFileName = string.Format("{0}.xml", new StackTrace().GetFrame(1).GetMethod().Name);
            File.WriteAllBytes(outputFileName, outputStream.ToArray());
        }
		public MessageCollection CheckType (TypeDefinition type, Runner runner) 
		{
			messageCollection = new MessageCollection ();
			codeDuplicatedLocator = new CodeDuplicatedLocator ();
			
			ICollection siblingClasses = Utilities.GetInheritedClassesFrom (type);
			if (siblingClasses.Count >= 2) 
				CompareSiblingClasses (siblingClasses);

			if (messageCollection.Count == 0)
				return null;
			return messageCollection;
		}
		public MessageCollection CheckType (TypeDefinition type, Runner runner)
		{
			MessageCollection messageCollection = new MessageCollection ();
			
			if (!ImplementsInternalsVisibleToAttribute (type) && (type.GetType ().IsAnsiClass || type.GetType ().IsClass || type.GetType ().IsAutoClass) && type.Name != "<Module>" && IsInstantiable (type) && !IsInstantiated (type, type)) {
				Location location = new Location (type.FullName, type.Name, 0);
				Message message = new Message ("There is no call for any of the types constructor found", location, MessageType.Error);
				messageCollection.Add (message);
			}
			
			if (messageCollection.Count == 0)
				return null;
			return messageCollection;
		}
		public MessageCollection CheckType (TypeDefinition typeDefinition, Runner runner)
		{
			MessageCollection messageCollection = new MessageCollection ();
			if (InheritsFromAttribute (typeDefinition)) {
				if (!typeDefinition.Name.EndsWith ("Attribute")) {
					Location location = new Location (typeDefinition.FullName, typeDefinition.Name, 0);
					Message message = new Message ("The class name doesn't end with Attribute Suffix", location, MessageType.Error);
					messageCollection.Add (message);                        
				}
			}
			if (messageCollection.Count == 0)
				return null;
			return messageCollection;
		}
		public MessageCollection CheckMethod (MethodDefinition method, Runner runner) 
		{
			MessageCollection messageCollection = new MessageCollection ();
			
			if (HasLongParameterList (method)) {
				Location location = new Location (method.DeclaringType.Name, method.Name, 0);		
				Message message = new Message ("The method contains a long parameter list.",location, MessageType.Error);
				messageCollection.Add (message);
			}

			if (messageCollection.Count == 0)
				return null;
			return messageCollection;
		}
Exemplo n.º 28
0
        public MessageCollection GlobalMessages()
        {
            MessageCollection messageCollection = new MessageCollection();

            lock(lockObject)
            {
                foreach(Message message in globalMessages)
                {
                    messageCollection.Add(message);
                }
            }

            return(messageCollection);
        }
		private void CheckStack(Instruction instruction, MethodDefinition method, MessageCollection messageCollection)
		{
			
			switch (instruction.OpCode.Code)
			{
				
				case Code.Ldloc_0:
					CheckTypeReference(method.Body.Variables[0].VariableType, method, instruction, messageCollection);
					break;
				case Code.Ldloc_1:
					CheckTypeReference(method.Body.Variables[1].VariableType, method, instruction, messageCollection);
					break;
				case Code.Ldloc_2:
					CheckTypeReference(method.Body.Variables[2].VariableType, method, instruction, messageCollection);
					break;
				case Code.Ldloc_3:
					CheckTypeReference(method.Body.Variables[3].VariableType, method, instruction, messageCollection);
					break;
				case Code.Ldloc_S:
					VariableReference local = instruction.Operand as VariableReference;
					CheckTypeReference(local.VariableType, method, instruction, messageCollection);
					break;
				case Code.Ldarg_1:
					CheckTypeReference(method.Parameters[0].ParameterType, method, instruction, messageCollection);
					break;
				case Code.Ldarg_2:
					CheckTypeReference(method.Parameters[1].ParameterType, method, instruction, messageCollection);
					break;
				case Code.Ldarg_3:
					CheckTypeReference(method.Parameters[2].ParameterType, method, instruction, messageCollection);
					break;
				case Code.Ldarg:
					ParameterReference parameter = instruction.Operand as ParameterReference;
					CheckTypeReference(parameter.ParameterType, method, instruction, messageCollection);
					break;
				case Code.Call:
				case Code.Calli:
				case Code.Callvirt:
					MethodReference call = instruction.Operand as MethodReference;
					CheckTypeReference(call.ReturnType.ReturnType, method, instruction, messageCollection);
					break;
				case Code.Ldfld:
				case Code.Ldsfld:
					FieldReference field = instruction.Operand as FieldReference;
					CheckTypeReference(field.FieldType, method, instruction, messageCollection);
					break;
			}

		}
		public MessageCollection CheckMethod (MethodDefinition method, Runner runner)
		{
			MessageCollection messageCollection = new MessageCollection ();
			TypeDefinition type = method.DeclaringType as TypeDefinition;
			
			if (MemberIsCallable (type, method) && !MemberIsCalled (type, method)) {
				Location location = new Location (method.DeclaringType.FullName, method.Name, 0);
				Message message = new Message ("The private or internal code is not called", location, MessageType.Error);
				messageCollection.Add (message);
			}
			
			if (messageCollection.Count == 0)
				return null;
			return messageCollection;
		}
Exemplo n.º 31
0
 public injectionParser.ExpressionContext ParseExpression(string sourceCode, out MessageCollection messages)
 => Parse(sourceCode, (parser) => parser.expression(), out messages);
Exemplo n.º 32
0
 public ReadTransaction(BlockContainer blocks, MessageCollection messages)
 {
     _blocks   = blocks;
     _messages = messages;
 }
Exemplo n.º 33
0
 public MessageCollectionEventArgs(MessageCollection messageCollection)
 {
     _messageCollection = messageCollection;
 }
Exemplo n.º 34
0
 public long GetMessageCount(DateTime from)
 => MessageCollection.CountDocuments(x => x.AuthorId == this.Id && x.Time > from);
Exemplo n.º 35
0
        public DocumentListPage(DocumentListType documentType, String icon, RefreshItems refreshCallback, MessageCollection <SignatureRequest> requestsGroup)
        {
            mySignatureRequests = requestsGroup;

            NavigationPage.SetHasBackButton(this, false);

            listView = new CustomListView
            {
                ItemsSource            = mySignatureRequests,
                RowHeight              = 100,
                IsPullToRefreshEnabled = true,
                Margin       = new Thickness(Device.OnPlatform(0, 5, 5), Device.OnPlatform(5, 0, 0), 5, 0),
                ItemTemplate = new DataTemplate(() =>
                {
                    Grid gridTitle = new Grid
                    {
                        VerticalOptions   = LayoutOptions.FillAndExpand,
                        HorizontalOptions = LayoutOptions.FillAndExpand,
                        RowDefinitions    =
                        {
                            new RowDefinition {
                                Height = GridLength.Auto
                            }
                        },
                        ColumnDefinitions =
                        {
                            new ColumnDefinition {
                                Width = new GridLength(1, GridUnitType.Star)
                            },
                            new ColumnDefinition {
                                Width = 80
                            }
                        }
                    };

                    Grid gridStatus = new Grid
                    {
                        VerticalOptions = LayoutOptions.FillAndExpand,
                        RowDefinitions  =
                        {
                            new RowDefinition {
                                Height = GridLength.Star
                            }
                        },
                        ColumnDefinitions =
                        {
                            new ColumnDefinition {
                                Width = new GridLength(1, GridUnitType.Star)
                            },
                            new ColumnDefinition {
                                Width = 120
                            }
                        }
                    };

                    Label labelTitle = new Label();
                    labelTitle.SetBinding(Label.TextProperty, "Title");
                    labelTitle.HorizontalOptions = LayoutOptions.FillAndExpand;
                    labelTitle.FontSize          = 18;
                    labelTitle.LineBreakMode     = LineBreakMode.TailTruncation;
                    labelTitle.SetBinding(Label.FontAttributesProperty, "Read", BindingMode.Default, new ReadFontAttributeConverter());

                    Label labelData = new Label();
                    labelData.SetBinding(Label.TextProperty, "DateStr");
                    labelData.HorizontalOptions       = LayoutOptions.FillAndExpand;
                    labelData.FontSize                = 12;
                    labelData.HorizontalTextAlignment = TextAlignment.End;
                    labelData.TextColor               = Color.FromHex("#0A80D0");
                    labelData.Margin = new Thickness(0, 2, 0, 0);
                    labelData.SetBinding(Label.FontAttributesProperty, "Read", BindingMode.Default, new ReadFontAttributeConverter());

                    Label labelDescription = new Label();
                    labelDescription.SetBinding(Label.TextProperty, "Description");
                    labelDescription.FontSize          = 14;
                    labelDescription.HorizontalOptions = LayoutOptions.FillAndExpand;
                    labelDescription.VerticalOptions   = LayoutOptions.FillAndExpand;
                    labelDescription.LineBreakMode     = LineBreakMode.TailTruncation;
                    labelDescription.SetBinding(Label.FontAttributesProperty, "Read", BindingMode.Default, new ReadFontAttributeConverter());

                    Label labelAuthors = new Label();
                    labelAuthors.SetBinding(Label.TextProperty, "Author");
                    labelAuthors.TextColor               = Color.FromHex("#0A80D0");
                    labelAuthors.FontSize                = 12;
                    labelAuthors.HorizontalOptions       = LayoutOptions.FillAndExpand;
                    labelAuthors.VerticalOptions         = LayoutOptions.EndAndExpand;
                    labelAuthors.Margin                  = new Thickness(0, 5, 0, 0);
                    labelAuthors.LineBreakMode           = LineBreakMode.TailTruncation;
                    labelAuthors.VerticalTextAlignment   = TextAlignment.End;
                    labelAuthors.HorizontalTextAlignment = TextAlignment.Start;
                    labelAuthors.SetBinding(Label.FontAttributesProperty, "Read", BindingMode.Default, new ReadFontAttributeConverter());

                    Label labelStatus = new Label();
                    labelStatus.SetBinding(Label.TextProperty, "Status");
                    labelStatus.FontAttributes          = FontAttributes.Italic;
                    labelStatus.FontSize                = 12;
                    labelStatus.HorizontalOptions       = LayoutOptions.FillAndExpand;
                    labelStatus.VerticalOptions         = LayoutOptions.EndAndExpand;
                    labelStatus.HorizontalTextAlignment = TextAlignment.End;
                    labelStatus.VerticalTextAlignment   = TextAlignment.End;
                    labelStatus.Margin = new Thickness(0, 5, 0, 0);

                    gridTitle.Children.Add(labelTitle, 0, 0);
                    gridTitle.Children.Add(labelData, 1, 0);

                    gridStatus.Children.Add(labelAuthors, 0, 0);
                    gridStatus.Children.Add(labelStatus, 1, 0);
                    gridStatus.HeightRequest = 50;

                    var vc = new ViewCell
                    {
                        View = new StackLayout
                        {
                            VerticalOptions   = LayoutOptions.CenterAndExpand,
                            Padding           = new Thickness(Device.OnPlatform(10, 0, 0), 5),
                            Orientation       = StackOrientation.Horizontal,
                            HorizontalOptions = LayoutOptions.FillAndExpand,
                            Children          =
                            {
                                new StackLayout
                                {
                                    VerticalOptions   = LayoutOptions.FillAndExpand,
                                    HorizontalOptions = LayoutOptions.FillAndExpand,
                                    Spacing           = 0,
                                    Children          =
                                    {
                                        gridTitle,
                                        labelDescription,
                                        gridStatus
                                    }
                                }
                            }
                        }
                    };

                    /*var mine = documentType == DocumentListType.PENDING_MINE;
                     * var ignoreAction = new MenuItem { Text = mine ? AppResources.CANCEL : AppResources.IGNORE, IsDestructive = true };
                     * ignoreAction.SetBinding(MenuItem.CommandParameterProperty, new Binding("."));
                     * ignoreAction.Clicked += async (sender, e) => {
                     *
                     *  var mi = ((MenuItem)sender);
                     *  var sig = (SignatureRequest)mi.CommandParameter;
                     *
                     *  if (mine)
                     *  {
                     *      await CancelRequest(sig);
                     *  }
                     *  else
                     *  {
                     *      await IgnoreRequest(sig);
                     *  }
                     * };
                     *
                     * //TODO: Check https://bugzilla.xamarin.com/show_bug.cgi?id=45027
                     * vc.ContextActions.Add(ignoreAction);*/
                    return(vc);
                })
            };

            Label labelEmpty = new Label();

            labelEmpty.Text = AppResources.NO_REQUESTS;
            labelEmpty.HorizontalOptions       = LayoutOptions.FillAndExpand;
            labelEmpty.VerticalOptions         = LayoutOptions.Start;
            labelEmpty.Margin                  = new Thickness(20);
            labelEmpty.HorizontalTextAlignment = TextAlignment.Center;
            labelEmpty.FontSize                = 16;

            this.documentType = documentType;
            this.Title        = (documentType == DocumentListType.PENDING_MINE ? AppResources.MY_DOCUMENTS:AppResources.OTHER_DOCUMENTS);

            if (Device.OS == TargetPlatform.iOS)
            {
                this.Icon = (FileImageSource)FileImageSource.FromFile(icon);
            }

            var view = new StackLayout
            {
                Orientation       = StackOrientation.Vertical,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Children          =
                {
                    labelEmpty,
                    listView
                }
            };

            this.Content = view;

            mySignatureRequests.CollectionChanged += (sender, e) =>
            {
                Device.BeginInvokeOnMainThread(() =>
                {
                    reloadBadgeCount();
                    labelEmpty.IsVisible = mySignatureRequests.Count == 0;
                    view.ForceLayout();
                    Refreshing = false;
                });
            };

            refreshSignatures = async() =>
            {
                try
                {
                    await refreshCallback(DocumentListType.ALL, 0);
                } catch (Exception e)
                {
                    Device.BeginInvokeOnMainThread(() =>
                    {
                        UserDialogs.Instance.Alert(AppResources.ERROR_UNABLE_TO_REACH_REQUEST_LIST_API, AppResources.APP_TITLE, AppResources.OK);
                    });
                }
            };

            listView.RefreshCommand = new Command(() => refreshSignatures());

            listView.ItemSelected += async delegate(object sender, SelectedItemChangedEventArgs e)
            {
                SignatureRequest signatureRequest = (SignatureRequest)e.SelectedItem;

                ((ListView)sender).SelectedItem = null;

                if (signatureRequest == null)
                {
                    return;
                }

                bool reload = false;

                if (!signatureRequest.Read)
                {
                    signatureRequest.Read = true;
                    signatureRequestController.MarkAsRead(signatureRequest);
                    mySignatureRequests.NotReadCount--;
                    reloadBadgeCount();
                }

                if (signatureRequest.Documents.Count > 1)
                {
                    var childPage = new ChildDocumentPage(signatureRequest, signatureRequest.CanBeSigned);
                    await Navigation.PushAsync(childPage);

                    reload = await childPage.PageClosedTask;
                }
                else
                {
                    try
                    {
                        Document doc = signatureRequest.Documents.First();
                        using (var progress = DialogHelper.ShowProgress(AppResources.LOADING_DOCUMENT))
                        {
                            await doc.LoadXmlDocument();
                        }

                        SignaturePage assinarPage = new SignaturePage(AppResources.SIGN_DOCUMENT, signatureRequest, doc, signatureRequest.CanBeSigned);
                        await Navigation.PushAsync(assinarPage);

                        reload = await assinarPage.PageClosedTask;
                    } catch (Exception ex)
                    {
                        UserDialogs.Instance.Alert(AppResources.DOCUMENT_LOADING_FAILED, AppResources.APP_TITLE, AppResources.OK);
                    }
                }

                if (reload)
                {
                    await refreshSignatures();
                }
            };

            listView.ItemAppearing += (sender, e) =>
            {
                var selected = e.Item as SignatureRequest;

                if (mySignatureRequests.MoreAvailable && mySignatureRequests.ToList().Last() == selected)
                {
                    refreshCallback(documentType, mySignatureRequests.CurrentPage + 1);
                }
            };


            bool showingActionSheet = false;

            listView.LongClicked += async(sender, e) =>
            {
                if (showingActionSheet)
                {
                    return;
                }

                SignatureRequest selected = (SignatureRequest)e.Item;

                List <string> buttons = new List <string>
                {
                    AppResources.DOCUMENT_METADATA
                };

                if (selected.AttachmentCount > 0)
                {
                    buttons.Add(AppResources.ATTACHMENTS);
                }

                if (!selected.Archived)
                {
                    buttons.Add(AppResources.ARCHIVE);
                }

                Dictionary <string, InboxMessageAction> dictActions = selected.Actions.
                                                                      Where(a => AppResources.ResourceManager.GetString(a.Name) != null).
                                                                      ToDictionary(x => AppResources.ResourceManager.GetString(x.Name),
                                                                                   x => x);

                if (dictActions.Keys.Count > 0)
                {
                    buttons.AddRange(dictActions.Keys);
                }

                showingActionSheet = true;
                var selectedActionName = await this.DisplayActionSheet(AppResources.ACTIONS, AppResources.CLOSE, null, buttons.ToArray());

                showingActionSheet = false;

                if (string.IsNullOrEmpty(selectedActionName))
                {
                    return;
                }

                if (selectedActionName == AppResources.ATTACHMENTS)
                {
                    await Navigation.PushAsync(new AttachmentsPage(selected));
                }
                else if (selectedActionName == AppResources.DOCUMENT_METADATA)
                {
                    await Navigation.PushAsync(new DocumentInfo(selected));
                }
                else if (selectedActionName == AppResources.ARCHIVE)
                {
                    await ArchiveRequest(selected);
                }
                else if (dictActions.ContainsKey(selectedActionName))
                {
                    var action = dictActions[selectedActionName];
                    if (action != null)
                    {
                        await actionController.ExecuteAction(action, refreshSignatures);
                    }
                }
            };

            //CreateFilterToolbar(this);

            MessagingCenter.Subscribe <string>(this, "Notification", s => refreshSignatures(), null);
        }
 public void neitherUsingCloneNorImplementingICloneableTest()
 {
     type = GetTest("NeitherUsingCloneNorImplementingICloneable");
     messageCollection = typeRule.CheckType(type, new MinimalRunner());
     Assert.IsNull(messageCollection);
 }
Exemplo n.º 37
0
 public void ShortMethodTest()
 {
     method            = GetMethodForTest("ShortMethod");
     messageCollection = rule.CheckMethod(method, new MinimalRunner());
     Assert.IsNull(messageCollection);
 }
 public void anotherExampleOfNotUsingBothTest()
 {
     type = GetTest("AnotherExampleOfNotUsingBoth");
     messageCollection = typeRule.CheckType(type, new MinimalRunner());
     Assert.IsNull(messageCollection);
 }
Exemplo n.º 39
0
 public void FormInitializeComponentTest()
 {
     method            = GetMethodForTestFrom("Test.Rules.Smells.MainForm", "InitializeComponent");
     messageCollection = rule.CheckMethod(method, new MinimalRunner());
     Assert.IsNull(messageCollection);
 }
 public MailingProcessor(MessageCollection messageCollection) : base(messageCollection)
 {
     validationHandler.messageCollection = this.messageCollection;
 }
Exemplo n.º 41
0
 public injectionParser.FileContext ParseFile(string sourceCode, out MessageCollection messages)
 => Parse(sourceCode, (parser) => parser.file(), out messages);
Exemplo n.º 42
0
 public Program()
 {
     _messages = new MessageCollection();
 }
    public static void Main()
    {
        Console.WriteLine("");
        Console.WriteLine("MessagePartCollection Sample");
        Console.WriteLine("============================");
        Console.WriteLine("");

        ServiceDescription myServiceDescription =
            ServiceDescription.Read("MathService.wsdl");

        // Get the message collection.
        MessageCollection myMessageCollection = myServiceDescription.Messages;

        Console.WriteLine("Total Messages in the document = " +
                          myServiceDescription.Messages.Count);
        Console.WriteLine("");
        Console.WriteLine("Enumerating PartCollection for each message...");
        Console.WriteLine("");
// <Snippet1>
// <Snippet2>
        // Get the message part collection for each message.
        for (int i = 0; i < myMessageCollection.Count; ++i)
        {
            Console.WriteLine("Message      : " + myMessageCollection[i].Name);

            // Get the message part collection.
            MessagePartCollection myMessagePartCollection =
                myMessageCollection[i].Parts;

            // Display the part collection.
            for (int k = 0; k < myMessagePartCollection.Count; k++)
            {
                Console.WriteLine("\t       Part Name     : " +
                                  myMessagePartCollection[k].Name);
                Console.WriteLine("\t       Message Name  : " +
                                  myMessagePartCollection[k].Message.Name);
            }
            Console.WriteLine("");
        }
// </Snippet2>
// </Snippet1>
        Console.WriteLine("Displaying the array copied from the " +
                          "MessagePartCollection for the message AddHttpGetIn.");
// <Snippet3>
// <Snippet4>
        Message myLocalMessage = myServiceDescription.Messages["AddHttpPostOut"];

        if (myMessageCollection.Contains(myLocalMessage))
        {
            Console.WriteLine("Message      : " + myLocalMessage.Name);

            // Get the message part collection.
            MessagePartCollection myMessagePartCollection = myLocalMessage.Parts;
            MessagePart[]         myMessagePart           =
                new MessagePart[myMessagePartCollection.Count];

            // Copy the MessagePartCollection to an array.
            myMessagePartCollection.CopyTo(myMessagePart, 0);
            for (int k = 0; k < myMessagePart.Length; k++)
            {
                Console.WriteLine("\t       Part Name : " +
                                  myMessagePartCollection[k].Name);
            }
            Console.WriteLine("");
        }
// </Snippet4>
// </Snippet3>

// <Snippet5>
// <Snippet6>
// <Snippet7>
        Console.WriteLine("Checking if message is AddHttpPostOut...");
        Message myMessage = myServiceDescription.Messages["AddHttpPostOut"];

        if (myMessageCollection.Contains(myMessage))
        {
            // Get the message part collection.
            MessagePartCollection myMessagePartCollection = myMessage.Parts;

            // Get the part named Body.
            MessagePart myMessagePart = myMessage.Parts["Body"];
            if (myMessagePartCollection.Contains(myMessagePart))
            {
                // Get the index of the part named Body.
                Console.WriteLine("Index of Body in MessagePart collection = " +
                                  myMessagePartCollection.IndexOf(myMessagePart));
                Console.WriteLine("Deleting Body from MessagePart collection...");
                myMessagePartCollection.Remove(myMessagePart);
                if (myMessagePartCollection.IndexOf(myMessagePart) == -1)
                {
                    Console.WriteLine("MessagePart Body successfully deleted " +
                                      "from the message AddHttpPostOut.");
                }
            }
        }
// </Snippet7>
// </Snippet6>
// </Snippet5>
    }
Exemplo n.º 44
0
 public virtual void HandleConfigure(ConfigureStorageNode e)
 {
     m_messages      = e.Messages;
     m_safetyMonitor = e.SafetyMonitor;
     Self.Established();
 }
    public TreeNode TranslateOperation(Port port, OperationBinding obin, Operation oper, string protocol)
    {
        TreeNode         tnOperation = new TreeNode(oper.Name, 13, 13);
        SoapBindingStyle style       = new SoapBindingStyle();
        SoapBindingUse   inputUse    = new SoapBindingUse();
        SoapBindingUse   outputUse   = new SoapBindingUse();

        string   requestmsg  = string.Empty;
        string   responsemsg = string.Empty;
        TreeNode tnInput     = new TreeNode();
        TreeNode tnOutput    = new TreeNode();
        TreeNode tnFault     = new TreeNode("Faults");

        GetOperationFormat(obin, oper, out style, out inputUse, out outputUse, out requestmsg, out responsemsg, out tnInput, out tnOutput);

        string operDesc = string.Empty;

        operDesc += oper.Documentation + "\n";
        operDesc += "Style: " + style.ToString() + "\n";

        tnOperation.Tag = operDesc;


        MessageCollection messages = _services[0].Messages;

        if (oper.Messages.Input != null)
        {
            Message messageIn = messages[oper.Messages.Input.Message.Name];
            if (messageIn != null)
            {
                if (tnInput == null)
                {
                    tnInput = new TreeNode();
                }
                tnInput.Tag                = requestmsg;
                tnInput.ImageIndex         = 13;
                tnInput.SelectedImageIndex = 13;

                if (oper.Messages.Input.Name != null && oper.Messages.Input.Name != string.Empty)
                {
                    tnInput.Text = "Input: " + oper.Messages.Input.Name;
                }
                else
                {
                    tnInput.Text = "Input: " + oper.Messages.Input.Message.Name;
                }


                if (tnInput != null)
                {
                    tnOperation.Nodes.Add(tnInput);
                }
            }
            ;
        }
        ;

        if (oper.Messages.Output != null)
        {
            Message messageOut = messages[oper.Messages.Output.Message.Name];
            if (messageOut != null)
            {
                if (tnOutput == null)
                {
                    tnOutput = new TreeNode();
                }
                tnOutput.Tag                = responsemsg;
                tnOutput.ImageIndex         = 13;
                tnOutput.SelectedImageIndex = 13;

                if (oper.Messages.Output.Name != null && oper.Messages.Output.Name != string.Empty)
                {
                    tnOutput.Text = "Output: " + oper.Messages.Output.Name;
                }
                else
                {
                    tnOutput.Text = "Output: " + oper.Messages.Output.Message.Name;
                }

                if (tnOutput != null)
                {
                    tnOperation.Nodes.Add(tnOutput);
                }
            }
            ;
        }
        ;

        foreach (OperationFault faultOp in  oper.Faults)
        {
            Message messageFault = messages[faultOp.Message.Name];
            if (messageFault != null)
            {
                TreeNode treeNode = new TreeNode();

                tnFault.ImageIndex         = 14;
                tnFault.SelectedImageIndex = 14;
                if (treeNode != null)
                {
                    tnFault.Nodes.Add(treeNode);
                }
            }
            ;
        }
        ;

        if (tnFault.Nodes.Count > 0)
        {
            tnOperation.Nodes.Add(tnFault);
        }

        return(tnOperation);
    }
Exemplo n.º 46
0
        /// <summary>
        /// TestStepBase.Execute() implementation
        /// </summary>
        /// <param name='context'>The context for the test, this holds state that is passed beteen tests</param>
        public override void Execute(Context context)
        {
            if (_docSpecsRawList.Count > 0)
            {
                var ds = new List <Type>(_docSpecsRawList.Count);
                foreach (var docSpec in _docSpecsRawList)
                {
                    var ass = AssemblyHelper.LoadAssembly((string)docSpec.AssemblyPath);
                    context.LogInfo("Loading DocumentSpec {0} from location {1}.", docSpec.TypeName, ass.Location);
                    var type = ass.GetType(docSpec.TypeName);

                    ds.Add(type);
                }
                _docSpecs = ds.ToArray();
            }

            context.LogInfo("Loading pipeline {0} from location {1}.", _pipelineTypeName, _pipelineAssemblyPath);
            var pipelineType = ObjectCreator.GetType(_pipelineTypeName, _pipelineAssemblyPath);

            var pipelineWrapper = PipelineFactory.CreateReceivePipeline(pipelineType);

            if (!string.IsNullOrEmpty(_instanceConfigFile))
            {
                pipelineWrapper.ApplyInstanceConfig(_instanceConfigFile);
            }

            if (null != _docSpecs)
            {
                foreach (Type docSpec in _docSpecs)
                {
                    pipelineWrapper.AddDocSpec(docSpec);
                }
            }

            MessageCollection mc = null;

            using (Stream stream = new FileStream(_source, FileMode.Open, FileAccess.Read))
            {
                var inputMessage = MessageHelper.CreateFromStream(stream);
                if (!string.IsNullOrEmpty(_sourceEncoding))
                {
                    inputMessage.BodyPart.Charset = _sourceEncoding;
                }

                // Load context file, add to message context.
                if (!string.IsNullOrEmpty(_inputContextFile) && new FileInfo(_inputContextFile).Exists)
                {
                    var mi = MessageInfo.Deserialize(_inputContextFile);
                    mi.MergeIntoMessage(inputMessage);
                }

                mc = pipelineWrapper.Execute(inputMessage);
            }

            for (var count = 0; count < mc.Count; count++)
            {
                string destination = null;
                if (!string.IsNullOrEmpty(_destinationFileFormat))
                {
                    destination = string.Format(_destinationFileFormat, count);
                    if (!string.IsNullOrEmpty(_destinationDir))
                    {
                        destination = Path.Combine(_destinationDir, destination);
                    }

                    PersistMessageHelper.PersistMessage(mc[count], destination);
                }

                if (!string.IsNullOrEmpty(_outputContextFileFormat))
                {
                    var contextDestination = string.Format(_outputContextFileFormat, count);
                    if (!string.IsNullOrEmpty(_destinationDir))
                    {
                        contextDestination = Path.Combine(_destinationDir, contextDestination);
                    }

                    var mi = BizTalkMessageInfoFactory.CreateMessageInfo(mc[count], destination);
                    MessageInfo.Serialize(mi, contextDestination);
                }
            }
        }
 public void TestClassIsDeclaredStatic()
 {
     type = assembly.MainModule.Types["Test.Rules.Correctness.AvoidConstructorsInStaticTypesTest/IsStatic"];
     messageCollection = rule.CheckType(type, new MinimalRunner());
     Assert.IsNull(messageCollection);
 }
Exemplo n.º 48
0
 internal MDXParserException(Message m)
 {
     this.m_Messages = new MessageCollection();
     this.m_Messages.Add(m);
 }
Exemplo n.º 49
0
 public SearchTransactionId(MessageCollection messages)
 {
     _messages = messages;
 }
Exemplo n.º 50
0
#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously
        private async Task Client_MessageCreated(DSharpPlus.EventArgs.MessageCreateEventArgs e)
        {
            MessageCollection.Add(e.Message.Content);
        }
Exemplo n.º 51
0
 public void WindowBuildMethodTest()
 {
     method            = GetMethodForTestFrom("Test.Rules.Smells.MainWindow", "Build");
     messageCollection = rule.CheckMethod(method, new MinimalRunner());
     Assert.IsNull(messageCollection);
 }
        public void Portal_EventRegistration_ViewSubmissions_Verify_Resent_Email()
        {
            string mailBox = EmailMailBox.GMAIL.INBOX;
            string confirmationEmailAddr = "*****@*****.**";
            string ccEmailAddr           = "*****@*****.**";
            string password = "******";

            string individualName   = "Matthew Sneeden";
            string formName         = "A Test Form";
            string paymentMethod    = "American Express";
            string creditCardNumber = "378282246310005";
            string date             = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, TimeZoneInfo.FindSystemTimeZoneById("Central Standard Time")).ToString("M/d/yyyy");
            double amount           = 2.00;

            // Login to portal
            TestBaseWebDriver test = base.TestContainer[Gallio.Framework.TestContext.CurrentContext.Test.Name];

            test.Portal.LoginWebDriver("ft.tester", "FT4life!", "DC");

            // Commented out by Mady, replaced with code below it. Weblink process is changed to Infellowship in Portal - Add submission
            // Generate a form submisssion
            // string[] confirmRefNum = test.Portal.Weblink_ViewSubmissions_Register(individualName, formName, paymentMethod, "2.00", "DC", false, false, creditCardNumber, false, confirmationEmailAddr, ccEmailAddr);

            test.Portal.Weblink_ViewSubmissions_OpenRegisterWindow(individualName, formName);
            string confirmCode = Infellowship_Reigster(test, new string[] { individualName }, new List <string>()
            {
                individualName
            }, paymentMethod, false, confirmationEmailAddr, ccEmailAddr);

            test.Portal.WebLink_ViewSubmissions_VerifyNewSubmission(formName, confirmCode, individualName, "DC", paymentMethod, "2.00", false);

            string referenceNumber = test.SQL.WebLink_FetchEventRegistrationReference(15, amount, paymentMethod, confirmCode);

            //Send e-mail through view submission
            test.Portal.Weblink_ViewSubmissions_ProcessEmailReceipt(confirmCode, referenceNumber, individualName, date,
                                                                    confirmationEmailAddr);

            // Logout of portal
            test.Portal.LogoutWebDriver();

            //Retrieve Confirmation Email was sent
            MessageCollection msgs = test.Portal.Retrieve_Email(mailBox, EmailMailBox.SearchParse.ALL, confirmationEmailAddr, password);

            //We should only have one e-mail
            int msgCount = test.Portal.Count_Weblink_Confirmation_Email(msgs, confirmCode);

            if (msgCount == 0)
            {
                //Go to SPAM
                mailBox  = EmailMailBox.GMAIL.SPAM;
                msgs     = test.Portal.Retrieve_Email(mailBox, EmailMailBox.SearchParse.ALL, confirmationEmailAddr, password);
                msgCount = test.Portal.Count_Weblink_Confirmation_Email(msgs, confirmCode);
            }

            Assert.AreEqual(msgCount, 1, string.Format("More than/Less Than one [{0}] Confirmation Email for Event Registration [{1}] was sent", msgs.Count, confirmCode));

            //Verify Confirmation email was delivered
            Message email = test.Portal.Search_Weblink_Confirmation_Email(msgs, confirmCode);

            //Verify Info in Email
            test.Portal.Verify_Weblink_Confirmation_Email(email, "*****@*****.**", confirmCode, referenceNumber,
                                                          individualName, formName, amount, date, creditCardNumber);


            //Verify CC Confirmation email was not delivered
            Message email2 = test.Portal.Retrieve_Search_Email(ccEmailAddr, password, confirmCode);

            //Verify No CC Email was found
            Assert.IsNull(email2, string.Format("Confirmation CC Email for Event Registration [{0}] was sent", confirmCode));
        }
 public void BaseClassWithoutCodeDuplicatedTest()
 {
     type = assembly.MainModule.Types ["Test.Rules.Smells.BaseClassWithoutCodeDuplicated"];
     messageCollection = rule.CheckType(type, new MinimalRunner());
     Assert.IsNull(messageCollection);
 }
Exemplo n.º 54
0
    public static void Main()
    {
        ServiceDescription myServiceDescription = ServiceDescription.Read("MathService_1.wsdl");

        Console.WriteLine("");
        Console.WriteLine("MessageCollection Sample");
        Console.WriteLine("========================");
        Console.WriteLine("");
// <Snippet2>
        // Get Message Collection.
        MessageCollection myMessageCollection = myServiceDescription.Messages;

        Console.WriteLine("Total Messages in the document = " + myServiceDescription.Messages.Count);
        Console.WriteLine("");
        Console.WriteLine("Enumerating Messages...");
        Console.WriteLine("");
        // Print messages to console.
        for (int i = 0; i < myMessageCollection.Count; ++i)
        {
            Console.WriteLine("Message Name : " + myMessageCollection[i].Name);
        }
// </Snippet2>
// <Snippet1>
        // Create a Message Array.
        Message[] myMessages = new Message[myServiceDescription.Messages.Count];
        // Copy MessageCollection to an array.
        myServiceDescription.Messages.CopyTo(myMessages, 0);
        Console.WriteLine("");
        Console.WriteLine("Displaying Messages that were copied to Messagearray ...");
        Console.WriteLine("");
        for (int i = 0; i < myServiceDescription.Messages.Count; ++i)
        {
            Console.WriteLine("Message Name : " + myMessages[i].Name);
        }
// </Snippet1>

// <Snippet3>
// <Snippet4>
// <Snippet5>
// <Snippet6>
        // Get Message by Name = "AddSoapIn".
        Message myMessage = myServiceDescription.Messages["AddSoapIn"];

        Console.WriteLine("");
        Console.WriteLine("Getting Message = 'AddSoapIn' {by Name}");
        if (myMessageCollection.Contains(myMessage))
        {
            Console.WriteLine("");
            // Get Message Name = "AddSoapIn" Index.
            Console.WriteLine("Message 'AddSoapIn' was found in Message Collection.");
            Console.WriteLine("Index of 'AddSoapIn' in Message Collection = " + myMessageCollection.IndexOf(myMessage));
            Console.WriteLine("Deleting Message from Message Collection...");
            myMessageCollection.Remove(myMessage);
            if (myMessageCollection.IndexOf(myMessage) == -1)
            {
                Console.WriteLine("Message 'AddSoapIn' was successfully removed from Message Collection.");
            }
        }
// </Snippet6>
// </Snippet5>
// </Snippet4>
// </Snippet3>
    }
Exemplo n.º 55
0
        MessageCollection <GridStock> ISTOCK.GetAllStockByFilter(Dominio.Mensagens.Filtro.Stock filtroPesquisa)
        {
            var msg = new MessageCollection <Dominio.Mensagens.GridStock>();

            try
            {
                using (var context = new HostelEntities())
                {
                    ////Não pode ser feito o .ToList nesse momento, a query SQL esta esta sendo montada de acordo com os filtros
                    var query = (from s in context.Stocks
                                 join at in context.Action_Type on s.ID_ACTION_TYPE equals at.ID
                                 join pt in context.Product_Type on s.ID_PRODUCT_TYPE equals pt.ID
                                 select new Dominio.Mensagens.GridStock()
                    {
                        ID = s.ID,
                        DT_Reg = s.DT_Entrada,
                        Action_Type = at.DESCRIPTION,
                        Description = pt.Description,
                        LogLogin = s.LOGLOGIN,
                        Amount = s.AMOUNT
                    });

                    //Filtros de Pesquisa
                    //if (!string.IsNullOrEmpty(filtroPesquisa.user))
                    //    query = query.Where(q => q.LogLogin.Trim().ToUpper().Contains(filtroPesquisa.user.Trim().ToUpper()));

                    //if (filtroPesquisa.ID_Calc_Type > 0)
                    //    query = query.Where(q => q.ID_Calc_Type == filtroPesquisa.ID_Calc_Type);

                    if (!string.IsNullOrEmpty(filtroPesquisa.dtInicio))
                    {
                        DateTime dtFim = DateTime.UtcNow;
                        if (!string.IsNullOrEmpty(filtroPesquisa.dtFim))
                        {
                            dtFim = Convert.ToDateTime(filtroPesquisa.dtFim);
                        }

                        DateTime dtInicio = Convert.ToDateTime(filtroPesquisa.dtInicio);

                        query = query.Where(q => q.DT_Reg >= dtInicio && q.DT_Reg <= dtFim);
                    }

                    //ordenação
                    if (filtroPesquisa.sSortDir_0 == "asc")
                    {
                        if (filtroPesquisa.iSortCol_0 == 1)
                        {
                            query = query.OrderBy(q => q.DT_Reg);
                        }
                        else if (filtroPesquisa.iSortCol_0 == 2)
                        {
                            query = query.OrderBy(q => q.LogLogin);
                        }
                        else if (filtroPesquisa.iSortCol_0 == 3)
                        {
                            query = query.OrderBy(q => q.Action_Type);
                        }
                        else if (filtroPesquisa.iSortCol_0 == 4)
                        {
                            query = query.OrderBy(q => q.Description);
                        }
                        else if (filtroPesquisa.iSortCol_0 == 5)
                        {
                            query = query.OrderBy(q => q.Amount);
                        }
                        else
                        {
                            query = query.OrderBy(q => q.DT_Reg);
                        }
                    }
                    else if (filtroPesquisa.sSortDir_0 == "desc")
                    {
                        if (filtroPesquisa.iSortCol_0 == 1)
                        {
                            query = query.OrderByDescending(q => q.DT_Reg);
                        }
                        else if (filtroPesquisa.iSortCol_0 == 2)
                        {
                            query = query.OrderByDescending(q => q.LogLogin);
                        }
                        else if (filtroPesquisa.iSortCol_0 == 3)
                        {
                            query = query.OrderByDescending(q => q.Action_Type);
                        }
                        else if (filtroPesquisa.iSortCol_0 == 4)
                        {
                            query = query.OrderByDescending(q => q.Description);
                        }
                        else if (filtroPesquisa.iSortCol_0 == 5)
                        {
                            query = query.OrderByDescending(q => q.Amount);
                        }
                        else
                        {
                            query = query.OrderByDescending(q => q.DT_Reg);
                        }
                    }
                    else
                    {
                        query = query.OrderByDescending(q => q.DT_Reg);
                    }

                    query = query.Take(100);

                    ////Extract only current page
                    msg.Instances = query.Skip(filtroPesquisa.iDisplayStart).Take(filtroPesquisa.iDisplayLength).ToList();

                    ////Campo improvisado para gerar o total de paginacao

                    msg.Code = query.Count();//Total de registro com filtros aplicados
                    //Total de registro no banco sem filtro aplicado Deve ser feito uma pesquisa direto na Tabela outra Query Deverrá ser informado em outro campo no grid CONtroller eu coloquei fixo 110 pra teste
                }
            }
            catch (Exception ex)
            {
                msg.Exception = ex;
            }
            return(msg);
        }
Exemplo n.º 56
0
        /// <summary>
        /// Gets the total number of messages in thread.
        /// </summary>
        /// <param name="threadID">The thread ID.</param>
        /// <returns></returns>
        public static int GetTotalNumberOfMessagesInThread(int threadID)
        {
            MessageCollection messages = new MessageCollection();

            return(messages.GetDbCount((MessageFields.ThreadID == threadID)));
        }
Exemplo n.º 57
0
 internal MDXParserException(MessageCollection ms)
 {
     this.m_Messages = ms;
 }
Exemplo n.º 58
0
        /// <summary>
        /// Gets the number of postings in all threads of all forums on this system.
        /// </summary>
        /// <returns>the total of all posts on the entire forum system</returns>
        public static int GetTotalNumberOfMessages()
        {
            MessageCollection messages = new MessageCollection();

            return(messages.GetDbCount());
        }
 public void OneMoreExampleTest()
 {
     type = GetTest("OneMoreExample");
     messageCollection = typeRule.CheckType(type, new MinimalRunner());
     Assert.IsNull(messageCollection);
 }
Exemplo n.º 60
0
 protected void ClearMessages()
 {
     Messages = MessageCollection.Empty;
 }