using System;
using System.Text;
using GZTW.AyaNova.BLL;
namespace ri.Models
{
///
/// This class contains the criteria used for Show All feature
/// so it can be passed around between pages etc
///
public class ShowAllClientWOCriteriaModel
{
public Guid objectId { get; set; }
public string objectName { get; set; }
public string maxRecords { get; set; }
public bool filter { get; set; }
public string serviceCompleted { get; set; }
public string closed { get; set; }
public Guid workorderStatus { get; set; }
public string serviceDateRange { get; set; }
public ShowAllClientWOCriteriaModel()
{
maxRecords = "25";
filter = false;
closed = PickListFactory.JQUICompliantEmptySelectionCharacter;
serviceDateRange = "*";
serviceCompleted = PickListFactory.JQUICompliantEmptySelectionCharacter;
}
public WorkorderServiceList list()
{
StringBuilder sb = new StringBuilder();
if (filter)
{
//APPLY FILTER
//OPEN XML
sb.Append(
" \r\n" +
" \r\n");
//ORDER BY
sb.AppendLine(
" \r\n" +
" "
);
//Client Id
sb.Append(
" \r\n" +
" \r\n" +
" \r\n");
//Workorder status
if (workorderStatus != Guid.Empty)
sb.Append(
" \r\n" +
" \r\n" +
" \r\n");
//Service date
if (serviceDateRange != "*")//* means no selection
sb.Append(
" \r\n" +
" \r\n" +
" \r\n");
//Service completed
if (serviceCompleted != PickListFactory.JQUICompliantEmptySelectionCharacter)
sb.Append(
" \r\n" +
" \r\n" +
" \r\n");
//Closed
if (closed != PickListFactory.JQUICompliantEmptySelectionCharacter)
sb.Append(
" \r\n" +
" \r\n" +
" \r\n");
//CLOSE XML
sb.AppendLine(" ");
WorkorderServiceList l = WorkorderServiceList.GetList(sb.ToString(), int.Parse(maxRecords));
return l;
}
else
{
//ONLY FILTER BY CLIENT ID
//OPEN XML
sb.Append(
" \r\n" +
" \r\n");
//ORDER BY
sb.AppendLine(
" \r\n" +
" "
);
//Client Id
sb.Append(
" \r\n" +
" \r\n" +
" \r\n");
//CLOSE XML
sb.AppendLine(" ");
WorkorderServiceList l = WorkorderServiceList.GetList(sb.ToString(), int.Parse(maxRecords));
return l;
}
}
//eoc
}
}