Inheritance: SenseNet.ContentRepository.ContentList
Ejemplo n.º 1
0
 protected string GetSenderOfSubmiter(Form form)
 {
     var sender = form.EmailFromSubmitter;
     return !string.IsNullOrEmpty(sender) ? sender : Repository.EmailSenderAddress;
 }
Ejemplo n.º 2
0
		private string GetCSV(Form form)
		{
			StringBuilder sb = new StringBuilder();

			DateTime? fromDate = GetDate(tbFrom.Text);
			DateTime? toDate = GetDate(tbTo.Text);

			if (fromDate == null || toDate == null)
			{
				throw new Exception(HttpContext.GetGlobalResourceObject("FormPortlet", "IncorrectDateFormat") as string);
			}

			SenseNet.ContentRepository.Storage.Security.AccessProvider.ChangeToSystemAccount();

			NodeQuery query = new NodeQuery();
			query.Add(new StringExpression(StringAttribute.Path, StringOperator.StartsWith, string.Concat(form.Path, "/")));
			query.Add(new TypeExpression(ActiveSchema.NodeTypes["FormItem"]));
			query.Add(new DateTimeExpression(DateTimeAttribute.CreationDate, ValueOperator.GreaterThanOrEqual, fromDate));
			query.Add(new DateTimeExpression(DateTimeAttribute.CreationDate, ValueOperator.LessThan, toDate));
			var result = query.Execute();

			SenseNet.ContentRepository.Storage.Security.AccessProvider.RestoreOriginalUser();

            if (result != null && result.Count > 0)
			{
				bool first = true;
                foreach (Node node in result.Nodes)
				{
					if (node is FormItem)
					{
						FormItem fi = node as FormItem;
						if (first)
						{
							CreateHeader(fi, sb);
							first = false;
						}
						CreateLine(fi, sb);
					}
				}
			}
			return sb.ToString();
		}