still hardcoding test app for now
This commit is contained in:
parent
90af30c76e
commit
6ed80b56ad
@ -81,16 +81,30 @@ public abstract class MochaWebApplication : WebApplication
|
|||||||
|
|
||||||
Console.WriteLine("req app path: " + e.Context.Request.Path);
|
Console.WriteLine("req app path: " + e.Context.Request.Path);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (e.Context.Request.Form != null)
|
if (e.Context.Request.Form != null)
|
||||||
{
|
{
|
||||||
if (e.Context.Request.Form.ContainsKey("a_Name"))
|
// FIXME: hardcoded, should be Process Update Method call
|
||||||
|
if (e.Context.Request.Form.ContainsKey("cls__a_Name"))
|
||||||
{
|
{
|
||||||
string className = e.Context.Request.Form["a_Name"];
|
string className = e.Context.Request.Form["cls__a_Name"];
|
||||||
// name of new classs
|
if (!String.IsNullOrEmpty(className))
|
||||||
Oms oms = (Oms)((MochaWebApplication)Application.Instance).Oms;
|
{
|
||||||
oms.CreateClass(className);
|
// name of new classs
|
||||||
|
Oms oms = (Oms)((MochaWebApplication)Application.Instance).Oms;
|
||||||
|
oms.CreateClass(className);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (e.Context.Request.Form.ContainsKey("att__a_Name"))
|
||||||
|
{
|
||||||
|
string className = e.Context.Request.Form["att__a_Name"];
|
||||||
|
if (!String.IsNullOrEmpty(className))
|
||||||
|
{
|
||||||
|
// name of new classs
|
||||||
|
Oms oms = (Oms)((MochaWebApplication)Application.Instance).Oms;
|
||||||
|
InstanceHandle ihAttr = oms.CreateInstanceOf(oms.GetInstance(KnownInstanceGuids.Classes.TextAttribute));
|
||||||
|
InstanceHandle a_Name = oms.GetInstance(KnownAttributeGuids.Text.Name);
|
||||||
|
oms.SetAttributeValue(ihAttr, a_Name, className);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -108,32 +122,62 @@ public abstract class MochaWebApplication : WebApplication
|
|||||||
string loginHeaderText = oms.GetTranslationValue(i_Tenant, oms.GetInstance(KnownRelationshipGuids.Tenant__has_login_header__Translation));
|
string loginHeaderText = oms.GetTranslationValue(i_Tenant, oms.GetInstance(KnownRelationshipGuids.Tenant__has_login_header__Translation));
|
||||||
|
|
||||||
Controls.Add(new Heading(1, loginHeaderText));
|
Controls.Add(new Heading(1, loginHeaderText));
|
||||||
|
|
||||||
Controls.Add(new Heading(3, "Create Class"));
|
|
||||||
Controls.Add(new FormView(new FormView.FormViewItem[]
|
|
||||||
{
|
{
|
||||||
new FormView.FormViewItem("Class Name", new TextBox() { Name = "a_Name" })
|
Controls.Add(new Heading(3, "Create Class"));
|
||||||
}));
|
Controls.Add(new FormView(new FormView.FormViewItem[]
|
||||||
Controls.Add(new Button("_OK"));
|
|
||||||
|
|
||||||
InstanceHandle c_Class = oms.GetInstance(KnownInstanceGuids.Classes.Class);
|
|
||||||
|
|
||||||
ListView lv = new ListView(new ListViewColumn[]
|
|
||||||
{
|
|
||||||
new ListViewColumn("lvcClass", "Class")
|
|
||||||
});
|
|
||||||
|
|
||||||
var i_Classes = oms.GetInstancesOf(c_Class);
|
|
||||||
foreach (InstanceHandle i_Class in i_Classes)
|
|
||||||
{
|
|
||||||
ListViewItem lvi = new ListViewItem(new ListViewItemColumn[]
|
|
||||||
{
|
{
|
||||||
new ListViewItemColumn("lvcClass", oms.GetInstanceText(i_Class))
|
new FormView.FormViewItem("Class Name", new TextBox() { Name = "cls__a_Name" })
|
||||||
|
}));
|
||||||
|
Controls.Add(new Button("_OK"));
|
||||||
|
|
||||||
|
InstanceHandle c_Class = oms.GetInstance(KnownInstanceGuids.Classes.Class);
|
||||||
|
|
||||||
|
ListView lv = new ListView(new ListViewColumn[]
|
||||||
|
{
|
||||||
|
new ListViewColumn("lvcClass", "Class")
|
||||||
});
|
});
|
||||||
lv.Items.Add(lvi);
|
|
||||||
|
var i_Classes = oms.GetInstancesOf(c_Class);
|
||||||
|
foreach (InstanceHandle i_Class in i_Classes)
|
||||||
|
{
|
||||||
|
ListViewItem lvi = new ListViewItem(new ListViewItemColumn[]
|
||||||
|
{
|
||||||
|
new ListViewItemColumn("lvcClass", oms.GetInstanceText(i_Class))
|
||||||
|
});
|
||||||
|
lv.Items.Add(lvi);
|
||||||
|
}
|
||||||
|
|
||||||
|
Controls.Add(lv);
|
||||||
}
|
}
|
||||||
|
|
||||||
Controls.Add(lv);
|
Controls.Add(new Heading(1, loginHeaderText));
|
||||||
|
{
|
||||||
|
Controls.Add(new Heading(3, "Create Attribute"));
|
||||||
|
Controls.Add(new FormView(new FormView.FormViewItem[]
|
||||||
|
{
|
||||||
|
new FormView.FormViewItem("Attribute Name", new TextBox() { Name = "att__a_Name" })
|
||||||
|
}));
|
||||||
|
Controls.Add(new Button("_OK"));
|
||||||
|
|
||||||
|
InstanceHandle c_Attribute = oms.GetInstance(KnownInstanceGuids.Classes.TextAttribute);
|
||||||
|
|
||||||
|
ListView lv = new ListView(new ListViewColumn[]
|
||||||
|
{
|
||||||
|
new ListViewColumn("lvcClass", "Text Attribute")
|
||||||
|
});
|
||||||
|
|
||||||
|
var i_Classes = oms.GetInstancesOf(c_Attribute);
|
||||||
|
foreach (InstanceHandle i_Class in i_Classes)
|
||||||
|
{
|
||||||
|
ListViewItem lvi = new ListViewItem(new ListViewItemColumn[]
|
||||||
|
{
|
||||||
|
new ListViewItemColumn("lvcClass", oms.GetInstanceText(i_Class))
|
||||||
|
});
|
||||||
|
lv.Items.Add(lvi);
|
||||||
|
}
|
||||||
|
|
||||||
|
Controls.Add(lv);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user