17
17
Data;
using System.Text;
using System;
using Microsoft.Data.SqlClient;
using Microsoft.Extensions.Configuration;
using System.IO;
namespace TURN.Services
{
public class DynamicFormService
{
private readonly string _connectionString;
// Add Label for all except "VAR" (hidden) and "IMG" (image button)
if (controlType != "VAR" && controlType != "IMG")
{
razorPageContent.AppendLine($@"
<div class=""col-md-4 text-start py-2"" style=""background-color:
#f5f5f5; border-right: 2px solid #ddd; font-weight: bold;"">
<label id=""{labelId}"" for=""{labelId}"" class=""form-
label"">{fieldLabel}</label>
</div>");
}
// Input Section
razorPageContent.AppendLine($@"<div class=""col-md-8"">");
// Generate dropdown
razorPageContent.AppendLine($@"
<select id=""{textBoxId}"" name=""{textBoxId}"" class=""form-
control"" style=""height: {height}; width: {width};"">
<option value="""">Select an option</option>");
razorPageContent.AppendLine("</select>");
}
break;
*/
case "DAT": // Date Picker
razorPageContent.AppendLine($@"<input type=""date""
id=""{textBoxId}"" name=""{textBoxId}"" class=""form-control"" style=""height:
{height}; width: {width};"" />");
break;
/// <summary>
/// Fetches dropdown values from a lookup table
/// </summary>
private List<DropdownItem> GetDropdownValues(string tableName, string type,
string valueField, string displayField)
{
List<DropdownItem> dropdownValues = new List<DropdownItem>();
return dropdownValues;
}
}