public FormViewModel(HttpRequestBase request, IOrchardServices orchard, PipelineConfigurationPart part, Process process) { _orchard = orchard; Part = part; Process = process; Geo = process.Parameters.Any(p => p.Name.EndsWith(".Latitude", StringComparison.OrdinalIgnoreCase)); Latitude = string.Empty; Longitude = string.Empty; Accuracy = string.Empty; Request = request; Entity = process.Entities.FirstOrDefault(); SectionsDisplayed = new HashSet <string>(); if (Entity != null) { Row = Entity.Rows.FirstOrDefault(); InputFields = Entity.Fields.Where(f => f.Input).ToArray(); HasFile = Entity.Fields.Any(f => f.InputType == "file"); // determine focus if (Request.HttpMethod == "GET") { Focus = InputFields.First(f => !f.PrimaryKey).Alias; } else { var previous = Request.Form["Orchard.Focus"] == "Orchard.Submit" ? InputFields.Last() : InputFields.First(f => f.Name == Request.Form["Orchard.Focus"]); var maxIndex = InputFields.Where(f => !f.PrimaryKey).Max(f => f.Index); if (previous.Index < maxIndex) { var next = InputFields.OrderBy(f => f.Index).FirstOrDefault(f => f.Index > previous.Index); if (next != null) { Focus = next.Alias; } else { var invalid = InputFields.FirstOrDefault(f => f.ValidField != string.Empty && !(bool)Row[f.ValidField]); Focus = invalid == null ? "Orchard.Submit" : invalid.Alias; } } else { var invalid = InputFields.FirstOrDefault(f => f.ValidField != string.Empty && !(bool)Row[f.ValidField]); Focus = invalid == null ? "Orchard.Submit" : invalid.Alias; } } Valid = Entity.ValidField != string.Empty && (Row != null && (bool)Row[Entity.ValidField]); } }
public ReportViewModel(Process process, PipelineConfigurationPart part) { Process = process; Part = part; }
public FormViewModel(PipelineConfigurationPart part, Process process) { Part = part; Process = process; }
public ReportViewModel(Process process, PipelineConfigurationPart part, MapCfg mapCfg = null) { Process = process; Part = part; MapCfg = mapCfg; }