public ActionResult PickTable(AttributeModel atrmodel) { if (atrmodel.pomocnicza == null) { atrmodel.pomocnicza = new List <FlowExtension>(); } FlowExtension flowex = new FlowExtension(); flow.id_flow = 1072; flowdef.id_flowDefinition = 83; if (atrmodel.atributechilds == null) { atrmodel.atributechilds = operation.GetChildsAttribute(atrmodel.Id_attribute); atrmodel.Attributeslist = operation.GetTableAttributes(flowdef.id_flowDefinition); } if (atrmodel.flowextensionlist == null) { atrmodel.flowextensionlist = new List <FlowExtension>(); atrmodel.flowextensionlist = operation.flowextensionAttributesTable(1072, atrmodel.atributechilds); atrmodel.MaxRow = atrmodel.flowextensionlist.OrderBy(x => x.RowIndex).Last().RowIndex; } if (Request.Form["Add"] != null) { for (int i = 0; i < atrmodel.atributechilds.Count; i++) { flowex.id_attribute = atrmodel.atributechilds[i]; flowex.id_flow = flow; flowex.Value = ""; flowex.RowIndex = atrmodel.MaxRow + 1; operation.AddElement <FlowExtension>(flowex); } atrmodel.flowextensionlist = operation.flowextensionAttributesTable(1072, atrmodel.atributechilds); foreach (var item in atrmodel.atributechilds) { atrmodel.flowextensionlist = operation.flowextensionAttributesTable(1072, atrmodel.atributechilds); atrmodel.MaxRow = atrmodel.flowextensionlist.OrderBy(x => x.RowIndex).Last().RowIndex; } return(View("Index", atrmodel)); } if (Request.Form["newValue"] != null) { for (int items = 0; items < atrmodel.pomocnicza.Count; items++) { flowex = operation.Flowextension(atrmodel.pomocnicza[items].id_flowextension); flowex.Value = atrmodel.pomocnicza[items].Value; operation.Update <FlowExtension>(flowex); } } if (Request.Form["Delete"] != null) { } return(View("Index", atrmodel)); }
public void createExtension(Flow id_flow, Attributes id_attr, string value) { FlowExtension ext = new FlowExtension(); ext.id_flow = id_flow; ext.id_attribute = id_attr; ext.Value = value; NH.NHibernateOperation operation = new NH.NHibernateOperation(); operation.AddElement <FlowExtension>(ext); }
public FlowExtension Flowextension(int id) { using (ISession session = InitNH.OppenSession()) { using (ITransaction transaction = session.BeginTransaction()) { FlowExtension fe = session.QueryOver <FlowExtension>().Where(x => x.id_attribute.Id_attribute == id).List().First(); transaction.Commit(); return(fe); } } }
private static void writeAll(ProgramPointGraph graph, ref HashSet <ProgramPointGraph> processedPPGraphs, ref HashSet <ProgramPointBase> processedPPoints) { processedPPGraphs.Add(graph); ProgramPointBase lastPPoint = null; foreach (ProgramPointBase p in graph.Points) { foreach (ProgramPointBase processedPoint in processedPPoints) { if (processedPoint == p) { continue; } } processedPPoints.Add(p); if (p.Partial == null || !p.Partial.Position.IsValid) { continue; } //only first and last program point from one line is shown if (lastPPoint != null && lastPPoint.Partial.Position.FirstLine == p.Partial.Position.FirstLine) { lastPPoint = p; } else { // For efficiency reasons, information about instate of program points are now not printed if (lastPPoint != null) // show the last program point { //writeProgramPointInformation(lastPPoint, true); } //writeProgramPointInformation(p, false); writeProgramPointInformation(p, true); lastPPoint = p; } // for each program poind resolve extensions FlowExtension ext = p.Extension; foreach (ExtensionPoint extPoint in ext.Branches) { writeExtension(extPoint, ref processedPPGraphs, ref processedPPoints); } } writeProgramPointInformation(lastPPoint, true); }
public FlowExtension FindExtension(int id_flow, int id_attr) { using (ISession session = InitNH.OppenSession()) { using (ITransaction transaction = session.BeginTransaction()) { try { FlowExtension ext = session.QueryOver <FlowExtension>().Where(x => (x.id_attribute.Id_attribute == id_attr && x.id_flow.id_flow == id_flow)).List().First(); transaction.Commit(); return(ext); } catch (Exception e) { return(null); } } } }
private void walkExtension(FlowExtension extension, Queue <ProgramPointBase> pointsToVisit, HashSet <ProgramPointBase> visitedPoints) { foreach (var branch in extension.Branches) { switch (branch.Type) { case ExtensionType.ParallelCall: walkCall(branch.Graph, visitedPoints); break; case ExtensionType.ParallelInclude: visitPoint(branch.Graph.Start, pointsToVisit, visitedPoints); break; case ExtensionType.ParallelEval: visitPoint(branch.Graph.Start, pointsToVisit, visitedPoints); break; default: throw new NotImplementedException("Walking of this extension type is not implemented yet"); } } }
internal ExtensionSinkPoint(FlowExtension owningExtension) { OwningExtension = owningExtension; }
public ActionResult Execute(int number) { string id = (string)RouteData.Values["id"]; int position = Int32.Parse(id); User user = (User)Session["users"]; if (user == null) { return(RedirectToAction("Index", "Login")); } NH.NHibernateOperation operation = new NH.NHibernateOperation(); List <int> users = operation.GetUsersByPosition(position); if (!users.Contains(user.Id_user)) { ViewBag.Result = 403; } Position p = operation.FindPositionById(position); IList <Flow> flows = operation.GetUserActiveFlows(p); Flow flow = new Flow(); foreach (Flow f in flows) { if (f.id_flow == number) { ViewBag.Flow = f; flow = f; break; } } FlowDefinition fl = operation.GetFlowDefinition(flow.id_flowdefinition.id_flowDefinition); Document doc = operation.GetDocumentByName(fl.Flow_name); byte[] data = doc.Data; string str2 = System.Text.Encoding.UTF8.GetString(data, 0, data.Length); string sub = str2.Substring(1); XmlSerializer deserializer = new XmlSerializer(typeof(Items)); XmlDocument docxml = new XmlDocument(); docxml.LoadXml(sub); XmlNodeReader node = new XmlNodeReader(docxml); object obj = deserializer.Deserialize(node); Items XmlData = (Items)obj; node.Close(); Dictionary <string, Item> itemMap = new Dictionary <string, Item>(); foreach (Item it in XmlData.itemList) { if (it.id.name.Equals("Item ")) { it.id.name = "check"; } itemMap.Add(it.id.name, it); } IList <Attributes> attrList = operation.GetAttributesByFlow(flow.id_flowdefinition.id_flowDefinition); FullFlowModel model = new FullFlowModel(); model.list = new List <FlowModel <string> >(); model.list_int = new List <FlowModel <int> >(); model.values = new List <string>(); model.items = XmlData; foreach (Attributes a in attrList) { Access acc = operation.GetAttributeAccess(position, a.Id_attribute); if (acc.Read_property == 1 && (acc.Required_change == 1 || acc.Optional_change == 1)) { if (a.Type.Equals("int")) { FlowModel <int> f = new FlowModel <int>(); f.name = a.Name; f.required = acc.Required_change; f.type = a.Type; f.item = itemMap[a.Name]; model.list_int.Add(f); } else { FlowModel <string> f = new FlowModel <string>(); f.name = a.Name; f.required = acc.Required_change; f.type = a.Type; f.item = itemMap[a.Name]; if (a.Type.Equals("list")) { IList <ListElement> ll = operation.GetAttributeList(a.Id_attribute); List <string> str = new List <string>(); str.Add(null); foreach (ListElement l in ll) { str.Add(l.Name); } f.list = str; } model.list.Add(f); } } else if (acc.Read_property == 1) { FlowExtension ext = operation.FindExtension(flow.id_flow, a.Id_attribute); if (ext != null) { model.values.Add(a.Id_attribute.ToString() + " = " + ext.Value); } } } ViewBag.Test = model; int max = 0; foreach (Item i in XmlData.itemList) { if ((i.location.y + i.size.height) > max) { max = (i.location.y + i.size.height); } } max = max + 70; ViewBag.Max = max.ToString() + "px"; ViewBag.Tekst = ""; return(View(model)); }