public void RaiseCallbackEvent(string eventArgument) { Security.Contact tempcontact; string newgroupname = ""; List <Security.Contact> contacts = new List <Security.Contact>(); Security.Token tok = (Security.Token)Page.Session["Token"]; Dictionary <string, string> services = (Dictionary <string, string>)Page.Session["services"]; if (tok != null && tok.Authenticated && tok.GetCurrentUser().Registered) { Security.User user = tok.GetCurrentUser(); if (user.Registered) { string contactsadded = ""; if (eventArgument != null && !eventArgument.Equals("")) { string[] args = eventArgument.Split('β'); string[] argcontact; newgroupname = args[0]; if (args.Length > 1) { for (int i = 1; i < args.Length; i++) { argcontact = args[i].Split('γ'); contactsadded += "β" + args[i]; string servicename = services[argcontact[2]]; tempcontact = new Security.Contact(argcontact[0], argcontact[1], new Security.Service(servicename, Convert.ToInt32(argcontact[2]))); contacts.Add(tempcontact); } if (user.CreateGroup(newgroupname, contacts)) { result = "trueβ" + newgroupname + contactsadded; } } else if (user.CreateGroup(newgroupname)) { result = "trueβ" + newgroupname; } } } else { result = "unrβ"; } } }
public void RaiseCallbackEvent(string eventArgument) { string ingroupname = ""; string outgroupname = ""; List <Security.Contact> contacts = new List <Security.Contact>(); Security.Contact tempcontact; Security.Token tok = (Security.Token)Page.Session["Token"]; Dictionary <string, string> services = (Dictionary <string, string>)Page.Session["services"]; string groupandcontacts = ""; if (tok != null && tok.Authenticated) { Security.User user = tok.GetCurrentUser(); if (user.Registered) { if (eventArgument != null && !eventArgument.Equals("")) { string[] args = eventArgument.Split('β'); string[] argcontact; if (args.Length > 2) { ingroupname = args[0]; outgroupname = args[1]; groupandcontacts = "β" + ingroupname + "β" + outgroupname; for (int i = 2; i < args.Length; i++) { argcontact = args[i].Split('γ'); string servicename = services[argcontact[2]]; tempcontact = new Security.Contact(argcontact[0], argcontact[1], new Security.Service(servicename, Convert.ToInt32(argcontact[2]))); contacts.Add(tempcontact); groupandcontacts += "β" + args[i]; } if (user.MoveContacts(outgroupname, ingroupname, contacts)) { result = "true" + groupandcontacts; } } } } else { result = "unrβ"; } } }
public void RaiseCallbackEvent(string eventArgument) { result = ""; try { Security.Token tok = (Security.Token)Page.Session["Token"]; Security.User usr = tok.GetCurrentUser(); List <Security.FilledWorkflowReference> list = usr.GetCompiledForms(); Security.FilledWorkflowReference work = list[Int32.Parse(eventArgument)]; XmlSchemaSet bh = work.GetWorkflow().GetCollectedDocumentSchemas(); XmlSchema schemaTemp = new XmlSchema(); foreach (XmlSchemaObject tp in bh.GlobalAttributes.Values) { schemaTemp.Items.Add(tp); } foreach (XmlSchemaObject s in bh.GlobalElements.Values) { schemaTemp.Items.Add(s); } foreach (XmlSchemaObject tp in bh.GlobalTypes.Values) { schemaTemp.Items.Add(tp); } string schemaContent = Utils.WriteSchema(schemaTemp); List <Storage.StorageManager.Pair <Security.Contact, XmlDocument> > doc2 = work.getFilledDocument(); XmlDocument finaldoc = new XmlDocument(); XmlDeclaration dec = finaldoc.CreateXmlDeclaration("1.0", "utf-8", null); XmlNode firstNode = finaldoc.CreateElement("ExportResults"); finaldoc.InsertBefore(dec, finaldoc.DocumentElement); finaldoc.AppendChild(firstNode); XmlNode schema = finaldoc.CreateElement("Schema"); XmlDocument fi = new XmlDocument(); fi.LoadXml(schemaContent); fi.RemoveChild(fi.FirstChild); schema.InnerXml = fi.FirstChild.InnerXml; firstNode.AppendChild(schema); XmlNode data = finaldoc.CreateElement("Data"); firstNode.AppendChild(data); int i = 0; string url = HttpContext.Current.Request.PhysicalApplicationPath + "FormFillier\\result.xml"; foreach (Storage.StorageManager.Pair <Security.Contact, XmlDocument> coppia in doc2) { i++; Security.Contact c = coppia.First; if (c != null) { XmlNode compiler = finaldoc.CreateElement("Compiler"); XmlNode mail = finaldoc.CreateElement("Mail"); XmlNode name = finaldoc.CreateElement("Name"); mail.InnerText = c.Email; name.InnerText = c.Name; compiler.AppendChild(name); compiler.AppendChild(mail); data.AppendChild(compiler); } XmlDocument doc = coppia.Second; XmlNode nodeData = doc.DocumentElement; data.AppendChild(finaldoc.ImportNode(nodeData, true)); } Page.Session["resultXml"] = finaldoc; } catch (Exception e) { result = "no"; } }