public CytologySlideDisposalReport(DateTime disposalDate) { this.m_Document = YellowstonePathology.Business.Gateway.SlideDisposalReportGateway.GetCytologySlideDisposalReport(disposalDate); InitializeComponent(); this.DataContext = this; }
public void UpdateVenueTest() { Venue testVenue = Venue.GetVenueByID(-1); if (testVenue.IsNew) { testVenue.VenueID = -1; } testVenue.VenueName = "Adage"; BsoArchiveEntities.Current.Save(); var venueID = Helper.CreateXElement(Constants.Venue.venueIDElement, "-1"); var venueName = Helper.CreateXElement(Constants.Venue.venueNameElement, "Test"); var venueItem = new System.Xml.Linq.XElement(Constants.Venue.venueElement, venueID, venueName); var eventItem = new System.Xml.Linq.XElement(Constants.Event.eventElement, venueItem); var doc = new System.Xml.Linq.XDocument(eventItem); Venue typeVenue = Venue.NewVenue(); typeVenue.UpdateData(doc, "VenueName", Constants.Venue.venueNameElement); Assert.IsTrue(testVenue.VenueName == "Test"); BsoArchiveEntities.Current.DeleteObject(testVenue); BsoArchiveEntities.Current.DeleteObject(typeVenue); BsoArchiveEntities.Current.Save(); }
public void UpdateArtistTest() { Artist testArtist = Artist.GetArtistByID(-1); if (testArtist.IsNew) { testArtist.ArtistID = -1; } testArtist.ArtistFirstName = "Adage"; testArtist.ArtistLastName = "Tech"; BsoArchiveEntities.Current.Save(); var artistId = Helper.CreateXElement(Constants.Artist.artistIDElement, "-1"); var artistFirstName = Helper.CreateXElement(Constants.Artist.artistFirstNameElement, "Test"); var artistItem = new System.Xml.Linq.XElement("eventArtistItem", artistId, artistFirstName); var eventItem = new System.Xml.Linq.XElement("eventItem", artistItem); System.Xml.Linq.XDocument doc = new System.Xml.Linq.XDocument(new System.Xml.Linq.XElement(eventItem)); Artist artist = Artist.NewArtist(); artist.UpdateData(doc, "ArtistFirstName", "eventArtistFirstname"); Assert.IsTrue(testArtist.ArtistFirstName == "Test"); BsoArchiveEntities.Current.DeleteObject(artist); BsoArchiveEntities.Current.DeleteObject(testArtist); BsoArchiveEntities.Current.Save(); }
public void UpdateTypeTest() { Bso.Archive.BusObj.EventType testType = Bso.Archive.BusObj.EventType.GetEventTypeByID(-1); if (testType.IsNew) { testType.TypeID = -1; } testType.TypeName = "Adage"; BsoArchiveEntities.Current.Save(); var typeID = Helper.CreateXElement(Constants.EventType.typeIDElement, "-1"); var typeName2 = Helper.CreateXElement(Constants.EventType.typeName2Element, "Test"); var typeItem = new System.Xml.Linq.XElement(Constants.EventType.typeElement, typeID, typeName2); var eventItem = new System.Xml.Linq.XElement(Constants.Event.eventElement, typeItem); var doc = new System.Xml.Linq.XDocument(eventItem); Bso.Archive.BusObj.EventType typeGroup = Bso.Archive.BusObj.EventType.NewEventType(); typeGroup.UpdateData(doc, "TypeName2", "eventTypeName2"); Assert.IsTrue(testType.TypeName2 == "Test"); BsoArchiveEntities.Current.DeleteObject(testType); BsoArchiveEntities.Current.DeleteObject(typeGroup); BsoArchiveEntities.Current.Save(); }
public void UpdateWorkArtistTest() { WorkArtist testArtist = WorkArtist.GetWorkArtistByID(-1, -1); if (testArtist.IsNew) { testArtist.ArtistID = -1; testArtist.WorkID = -1; } testArtist.Artist.ArtistFirstName = "Adage"; BsoArchiveEntities.Current.Save(); WorkArtist testWorkArtist = new WorkArtist(); var workArtistId = Helper.CreateXElement(Constants.WorkArtist.workArtistIDElement, "-1"); var workArtistFirstName = Helper.CreateXElement(Constants.WorkArtist.workArtistFirstNameElement, "Test"); var workArtistItem = new System.Xml.Linq.XElement(Constants.WorkArtist.workArtistElement, workArtistId, workArtistFirstName); var workID = new System.Xml.Linq.XElement(Constants.Work.workIDElement, "-1"); var workGroupID = new System.Xml.Linq.XElement(Constants.Work.workGroupIDElement, "-1"); var workItem = new System.Xml.Linq.XElement(Constants.Work.workElement, workID, workGroupID, workArtistItem); var eventItem = new System.Xml.Linq.XElement(Constants.Event.eventElement, workItem); System.Xml.Linq.XDocument doc = new System.Xml.Linq.XDocument(eventItem); testWorkArtist.UpdateData(doc, "WorkArtistFirstName", "workArtistFirstname"); Assert.IsTrue(testArtist.Artist.ArtistFirstName == "Test"); BsoArchiveEntities.Current.DeleteObject(testWorkArtist); BsoArchiveEntities.Current.DeleteObject(testArtist); BsoArchiveEntities.Current.DeleteObject(Work.GetWorkByID(-1)); BsoArchiveEntities.Current.Save(); }
/// <exception cref="System.ArgumentNullException" /> /// <exception cref="System.Net.WebException" /> public static System.Xml.Linq.XDocument GetMsg(int threadId, int commeAmount, int userId, Uri commeServer, System.Net.CookieContainer cookie) { if(commeServer == null) throw new ArgumentNullException("commeServer", "nullにする事は出来ません。"); var reqXml = new System.Xml.Linq.XElement( "thread", //new System.Xml.Linq.XAttribute("no_compress", 0), new System.Xml.Linq.XAttribute("fork", "0"),//投票者コメント:1 new System.Xml.Linq.XAttribute("user_id", userId), //new System.Xml.Linq.XAttribute("when", 0), new System.Xml.Linq.XAttribute("res_from", commeAmount), new System.Xml.Linq.XAttribute("version", "20061206"), new System.Xml.Linq.XAttribute("thread", threadId)); var reqMsg = reqXml.ToString(); try { using (var strm = HttpConect(commeServer, reqMsg, cookie)) using (var reader = new System.IO.StreamReader(strm)) return System.Xml.Linq.XDocument.Load(reader); } catch (System.Net.WebException e) { throw new System.Net.WebException("コメントサーバへの接続に失敗しました。", e); } }
public void UpdateConductorTest() { Conductor testConductor = Conductor.GetConductorByID(-1); if (testConductor.IsNew) { testConductor.ConductorID = -1; } testConductor.ConductorFirstName = "Adage"; testConductor.ConductorLastName = "Tech"; BsoArchiveEntities.Current.Save(); var conductorID = Helper.CreateXElement(Constants.Conductor.conductorIDElement, "-1"); var conductorFirstName = Helper.CreateXElement(Constants.Conductor.conductorFirstNameElement, "Test"); var conductorItem = new System.Xml.Linq.XElement(Constants.Conductor.conductorElement, conductorID, conductorFirstName); var eventItem = new System.Xml.Linq.XElement(Constants.Event.eventElement, conductorItem); var doc = new System.Xml.Linq.XDocument(eventItem); Conductor conductor = Conductor.NewConductor(); conductor.UpdateData(doc, "ConductorFirstName", "eventConductorFirstname"); Assert.IsTrue(testConductor.ConductorFirstName == "Test"); BsoArchiveEntities.Current.DeleteObject(testConductor); BsoArchiveEntities.Current.DeleteObject(conductor); BsoArchiveEntities.Current.Save(); }
public static System.Xml.Linq.XElement AddAnchorElement(this System.Xml.Linq.XElement parent, string href, string text) { var el_anchor = new System.Xml.Linq.XElement("a"); el_anchor.SetAttributeValue("href", href); el_anchor.Value = text; parent.Add(el_anchor); return el_anchor; }
public static System.Xml.Linq.XElement RemoveAllNamespaces(System.Xml.Linq.XElement rootElement) { System.Xml.Linq.XElement xElement = new System.Xml.Linq.XElement(rootElement.Name.LocalName); if (rootElement.HasAttributes) { foreach (System.Xml.Linq.XAttribute attribute in rootElement.Attributes()) { if (!attribute.IsNamespaceDeclaration) { if (rootElement.Name.LocalName == "Category") { xElement.Add(attribute); } else { if (attribute.Name.ToString() == "{http://www.w3.org/2001/XMLSchema-instance}type" || attribute.Name.ToString() == "{http://www.w3.org/2001/XMLSchema-instance}nil") { // We dont want xsi: attribute // except for certain types where we will inject our own value if (rootElement.Name.LocalName == "Activity" && attribute.Name.ToString() == "{http://www.w3.org/2001/XMLSchema-instance}type" && attribute.Value.EndsWith("RepairAndMaintenanceActivity")) { attribute.Value = "RepairAndMaintenanceActivity"; xElement.Add(attribute); } if (rootElement.Name.LocalName == "Activity" && attribute.Name.ToString() == "{http://www.w3.org/2001/XMLSchema-instance}type" && attribute.Value.EndsWith("CustomerActivity")) { attribute.Value = "CustomerActivity"; xElement.Add(attribute); } } else { xElement.Add(attribute); } } } } } if (rootElement.HasElements) { // Recurse the structure foreach (System.Xml.Linq.XElement childElement in rootElement.Elements()) { xElement.Add(RemoveAllNamespaces(childElement)); } } else { // Take the current value across xElement.Value = rootElement.Value; } return xElement; }
public void AddPlaylist(String playlistName) { try { System.Xml.Linq.XElement newTag = new System.Xml.Linq.XElement("Playlist", new System.Xml.Linq.XAttribute("name", playlistName)); xelement.Add(newTag); } catch { Console.WriteLine("FAILED AddPlaylist catch"); } }
public POCRetensionReport(DateTime startDate, DateTime endDate) { this.m_DataContext = new YellowstonePathology.Business.DataContext.YpiData(); YellowstonePathology.Business.Domain.XElementFromSql xelement = this.m_DataContext.GetPOCRetensionReport(startDate, endDate).Single<Domain.XElementFromSql>(); this.m_Document = xelement.Document; InitializeComponent(); this.DataContext = this; }
public static System.Xml.Linq.XElement AddParagraphElement(this System.Xml.Linq.XElement el_body, string text) { var el_para = new System.Xml.Linq.XElement("p"); el_body.Add(el_para); if (text != null) { el_para.Value = text; } return el_para; }
public System.Xml.Linq.XElement ToXML() { System.Xml.Linq.XElement ele = new System.Xml.Linq.XElement("Stop"); ele.Add(new System.Xml.Linq.XAttribute("Name", this.Name)); ele.Add(new System.Xml.Linq.XAttribute("Time", this.Time)); ele.Add(new System.Xml.Linq.XAttribute("PickUp", this.PickUp)); ele.Add(new System.Xml.Linq.XAttribute("DropOff", this.DropOff)); ele.Add(new System.Xml.Linq.XAttribute("Normal", this.Normal)); return ele; }
public void Load(String filename) { try { xelement = System.Xml.Linq.XElement.Load(filename); } catch (Exception) { xelement = new System.Xml.Linq.XElement("Medias"); } }
public void GetParticipantFromNodeItemTest() { var participantID = Helper.CreateXElement(Constants.Participant.participantIDElement, "-1"); var participantFirstName = Helper.CreateXElement(Constants.Participant.participantFirstNameElement, "TestFName"); var participantLastName = Helper.CreateXElement(Constants.Participant.participantLastNameElement, "TestLName"); var participantGroup = Helper.CreateXElement(Constants.Participant.participantGroupNameElement, "TestGroup"); var participantItem = new System.Xml.Linq.XElement(Constants.Participant.participantElement, participantID, participantFirstName, participantLastName, participantGroup); Participant participant = Participant.GetParticipantFromNode(participantItem); Assert.IsNotNull(participant); Assert.IsTrue(participant.ParticipantID == -1); }
public static void SaveBlogConnectionInfo(MP.BlogConnectionInfo coninfo, string filename) { var doc = new System.Xml.Linq.XDocument(); var p = new System.Xml.Linq.XElement("blogconnectioninfo"); doc.Add(p); p.Add(new System.Xml.Linq.XElement("blogurl", coninfo.BlogUrl)); p.Add(new System.Xml.Linq.XElement("blogid", coninfo.BlogId)); p.Add(new System.Xml.Linq.XElement("metaweblog_url", coninfo.MetaWeblogUrl)); p.Add(new System.Xml.Linq.XElement("username", coninfo.Username)); p.Add(new System.Xml.Linq.XElement("password", coninfo.Password)); doc.Save(filename); }
/* LOAD XML MEDIAS FILE */ public void LoadXML(String FileName) { try { XElement = System.Xml.Linq.XElement.Load(FileName); } /* CREATING XML IF NOT EXISTS */ catch { XElement = new System.Xml.Linq.XElement("Medias"); } }
public void GetVenueFromNodeTest() { var venueID = Helper.CreateXElement(Constants.Venue.venueIDElement, "-1"); var venueName = Helper.CreateXElement(Constants.Venue.venueNameElement, "TestName"); var venueCode = Helper.CreateXElement(Constants.Venue.venueCodeElement, "Test Venue Code"); var venueElement = new System.Xml.Linq.XElement(Constants.Venue.venueElement, venueID, venueName, venueCode); System.Xml.Linq.XElement node = new System.Xml.Linq.XElement(Constants.Event.eventElement, venueElement); Venue venue = Venue.GetVenueFromNode(node); Assert.IsNotNull(venue); Assert.IsTrue(venue.VenueID == -1); }
public void GetSeasonFromNodeItemTest() { var seasonID = Helper.CreateXElement(Constants.Season.seasonIDElement, "-1"); var seasonName = Helper.CreateXElement(Constants.Season.seasonNameElement, "TestSeasonName"); var seasonCode = Helper.CreateXElement(Constants.Season.seasonCodeElement, "TestSeasonCode"); var seasonItem = new System.Xml.Linq.XElement(Constants.Season.seasonElement, seasonID, seasonName, seasonCode); var node = new System.Xml.Linq.XElement(Constants.Event.eventElement, seasonItem); Season season = Season.GetSeasonFromNode(node); Assert.IsNotNull(season); Assert.IsTrue(season.SeasonID == -1); }
public void GetTypeGroupFromNodeItemTest() { System.Xml.Linq.XElement node = new System.Xml.Linq.XElement(Constants.Event.eventElement, new System.Xml.Linq.XElement(Constants.EventTypeGroup.typeGroupElement, new System.Xml.Linq.XElement(Constants.EventTypeGroup.typeGroupIDElement, "-1"), new System.Xml.Linq.XElement(Constants.EventTypeGroup.typeGroupNameElement, "TestTypeGroupName"), new System.Xml.Linq.XElement(Constants.EventTypeGroup.typeGroupName2Element, "TestTypeGroupName2"))); EventTypeGroup typeGroup = EventTypeGroup.NewEventTypeGroup(); typeGroup = EventTypeGroup.GetEventTypeGroupFromNode(node); Assert.IsNotNull(typeGroup); Assert.IsTrue(typeGroup.TypeGroupID == -1); }
public void GetOrchestraFromNodeItemTest() { var orchestraID = Helper.CreateXElement(Constants.Orchestra.orchestraIDElement, "-1"); var orchestraName = Helper.CreateXElement(Constants.Orchestra.orchestraNameElement, "TestOrchestraName"); var orchestraURL = Helper.CreateXElement(Constants.Orchestra.orchestraURLElement, "TestOrchestraURL"); var orchestraNote = Helper.CreateXElement(Constants.Orchestra.orchestraNotesElement, "TestOrchestraNotes"); var orchestraItem = new System.Xml.Linq.XElement(Constants.Orchestra.orchestraElement, orchestraID, orchestraName, orchestraURL, orchestraNote); var node = new System.Xml.Linq.XElement(Constants.Event.eventElement, orchestraItem); Orchestra orchestra = Orchestra.GetOrchestraFromNode(node); Assert.IsNotNull(orchestra); Assert.IsTrue(orchestra.OrchestraID == -1 && orchestra.OrchestraName == "TestOrchestraName"); }
public void GetProjectFromNodeTest() { var projectID = Helper.CreateXElement(Constants.Project.projectIDElement, "-1"); var projectName = Helper.CreateXElement(Constants.Project.projectNameElement, "Test Name"); var projectName2 = Helper.CreateXElement(Constants.Project.projectName2Element, "TestProjectName"); var projectTypeName = Helper.CreateXElement(Constants.Project.projectTypeNameElement, "TestProjectTypeName"); var projectItem = new System.Xml.Linq.XElement(Constants.Project.projectElement, projectID, projectName, projectName2, projectTypeName); var node = new System.Xml.Linq.XElement(Constants.Event.eventElement, projectItem); Project project = Project.GetProjectFromNode(node); Assert.IsNotNull(project); Assert.IsTrue(project.ProjectID == -1); }
public System.Xml.Linq.XElement ToXML() { System.Xml.Linq.XElement ele = new System.Xml.Linq.XElement("Location"); ele.Add(new System.Xml.Linq.XAttribute("RealName", this.RealName)); ele.Add(new System.Xml.Linq.XAttribute("Latitude", this.Latitude)); ele.Add(new System.Xml.Linq.XAttribute("Longtitude", this.Longtitude)); ele.Add(new System.Xml.Linq.XAttribute("LocationType", this.LocationType)); foreach (string s in aliases) { ele.Add(new System.Xml.Linq.XElement("Alias", s)); } return ele; }
public void GetTypeFromNodeTest() { var typeID = Helper.CreateXElement(Constants.EventType.typeIDElement, "-1"); var typeName = Helper.CreateXElement(Constants.EventType.typeNameElement, "Test EventType Name"); var typeName2 = Helper.CreateXElement(Constants.EventType.typeName2Element, "Test EventType Name 2"); var typeItem = new System.Xml.Linq.XElement(Constants.EventType.typeElement, typeID, typeName, typeName2); var node = new System.Xml.Linq.XElement(Constants.Event.eventElement, typeItem); Bso.Archive.BusObj.EventType EventType = Bso.Archive.BusObj.EventType.NewEventType(); EventType = Bso.Archive.BusObj.EventType.GetEventTypeFromNode(node); Assert.IsNotNull(EventType); Assert.IsTrue(EventType.TypeID == -1); }
public void GetArtistFromNodeTest() { var artistId = Helper.CreateXElement(Constants.Artist.artistIDElement, "-1"); var artistFirstName = Helper.CreateXElement(Constants.Artist.artistFirstNameElement, "TestFName"); var artistLastName = Helper.CreateXElement(Constants.Artist.artistLastNameElement, "TestLCode"); var artistNotes = Helper.CreateXElement(Constants.Artist.artistNoteElement, "TestNotes"); var artistName4 = Helper.CreateXElement(Constants.Artist.artistName4Element, "Test4Name"); var artistName5 = Helper.CreateXElement(Constants.Artist.artistName5Element, "Test5Name"); System.Xml.Linq.XElement node = new System.Xml.Linq.XElement(Constants.Artist.artistElement, artistId, artistFirstName, artistLastName, artistNotes, artistName4, artistName5); Artist artist = Artist.GetArtistFromNode(node); Assert.IsNotNull(artist); Assert.IsTrue(artist.ArtistID == -1); }
public void GetConductorFromNodeTest() { var conductorID = Helper.CreateXElement(Constants.Conductor.conductorIDElement, "-1"); var conductorFirstName = Helper.CreateXElement(Constants.Conductor.conductorFirstNameElement, "TestFName"); var conductorLastName = Helper.CreateXElement(Constants.Conductor.conductorLastNameElement, "TestLName"); var conductorNote = Helper.CreateXElement(Constants.Conductor.conductorNoteElement, "TestNotes"); var conductorName4 = Helper.CreateXElement(Constants.Conductor.conductorName4Element, "Test4Name"); var conductorName5 = Helper.CreateXElement(Constants.Conductor.conductorName5Element, "Test5Name"); var conductorItem = new System.Xml.Linq.XElement(Constants.Conductor.conductorElement, conductorID, conductorFirstName, conductorLastName, conductorNote, conductorName4, conductorName5); var node = new System.Xml.Linq.XElement(Constants.Event.eventElement, conductorItem); Conductor conductor = Conductor.GetConductorFromNode(node); Assert.IsNotNull(conductor); Assert.IsTrue(conductor.ConductorID == -1 && conductor.ConductorFirstName == "TestFName"); Assert.IsTrue(conductor.ConductorName4 == "Test4Name"); Assert.IsTrue(conductor.ConductorName5 == "Test5Name"); }
public System.Xml.Linq.XDocument CreateDocument() { var doc = new System.Xml.Linq.XDocument(); var root = new System.Xml.Linq.XElement("methodResponse"); doc.Add(root); var f = new System.Xml.Linq.XElement("fault"); root.Add(f); var struct_ = new XmlRpc.Struct(); struct_["faultCode"] = new XmlRpc.IntegerValue(this.FaultCode); struct_["faultString"] = new XmlRpc.StringValue(this.FaultString); struct_.AddXmlElement(f); return doc; }
public void GetWorkArtistTest() { var workArtistID = Helper.CreateXElement(Constants.WorkArtist.workArtistIDElement, "-1"); var workArtistLastName = Helper.CreateXElement(Constants.WorkArtist.workArtistLastNameElement, "TestL"); var workArtistFirstName = Helper.CreateXElement(Constants.WorkArtist.workArtistFirstNameElement, "TestF"); var workArtistInstrument = Helper.CreateXElement(Constants.WorkArtist.workArtistInstrumentElement, "TestI"); var workArtistInstrument2 = Helper.CreateXElement(Constants.WorkArtist.workArtistInstrument2Element, "TestI2"); var workArtistNotes = Helper.CreateXElement(Constants.WorkArtist.workArtistNoteElement, "Test Notes"); var workArtistCommission = Helper.CreateXElement(Constants.Work.workCommissionElement, "Commission Test"); System.Xml.Linq.XElement artistNode = new System.Xml.Linq.XElement(Constants.WorkArtist.workArtistElement, workArtistID, workArtistLastName, workArtistFirstName, workArtistLastName, workArtistInstrument, workArtistInstrument2, workArtistNotes); System.Xml.Linq.XElement node = new System.Xml.Linq.XElement(Constants.Work.workElement, artistNode); Work work = Work.GetWorkByID(-1); work.WorkArtists.Clear(); Assert.IsTrue(work.WorkArtists.Count == 0); work = Work.GetWorkArtists(node, work); Assert.IsTrue(work.WorkArtists.Count == 1); }
public void AddPlaylistItem(String playlistName, Model.Media media) { try { foreach (var playlist in xelement.Elements("Playlist")) { if (playlist.Attribute("name") != null && playlist.Attribute("name").Value == playlistName) { System.Xml.Linq.XElement newTag = new System.Xml.Linq.XElement("Element", new System.Xml.Linq.XElement("Path", media.Path), new System.Xml.Linq.XElement("Stream", media.Stream), new System.Xml.Linq.XElement("Type", media.Type) ); playlist.Add(newTag); } } } catch { Console.WriteLine("FAILED AddPlaylistItem catch"); } }
public void GetWorkArtistFromNodeTest() { var workArtistId = Helper.CreateXElement(Constants.WorkArtist.workArtistIDElement, "-1"); var workArtistFirstName = Helper.CreateXElement(Constants.WorkArtist.workArtistFirstNameElement, "TestFName"); var workArtistLastName = Helper.CreateXElement(Constants.WorkArtist.workArtistLastNameElement, "TestLCode"); var workArtistInstrument = Helper.CreateXElement(Constants.WorkArtist.workArtistInstrumentElement, "TestI"); var workArtistInstrument2 = Helper.CreateXElement(Constants.WorkArtist.workArtistInstrument2Element, "TestI2"); var workArtistNotes = Helper.CreateXElement(Constants.WorkArtist.workArtistNoteElement, "TestNote"); var workArtistName4 = Helper.CreateXElement(Constants.WorkArtist.workArtistName4Element, "Test4Name"); var workArtistName5 = Helper.CreateXElement(Constants.WorkArtist.workArtistName5Element, "Test5Name"); System.Xml.Linq.XElement node = new System.Xml.Linq.XElement(Constants.WorkArtist.workArtistElement, workArtistId, workArtistFirstName, workArtistLastName, workArtistInstrument, workArtistInstrument2, workArtistNotes, workArtistName4, workArtistName5); WorkArtist workArtist = WorkArtist.GetWorkArtistFromNode(node); Assert.IsNotNull(workArtist); Assert.IsTrue(workArtist.Artist.ArtistFirstName == "TestFName"); Assert.IsTrue(workArtist.Artist.ArtistID == -1); Assert.IsTrue(workArtist.Instrument.Instrument1 == "TestI"); }
private static uint AsUint(System.Xml.Linq.XElement element) { return(uint.Parse(element.Value, CultureInfo.InvariantCulture)); }
public XElement(System.Xml.Linq.XElement other) { }
public Instance Parse(XElement e) { return((Instance)parser.Parse(e)); }
public static string getResourceXPathName(string elementXPath, string elementValue, System.Xml.Linq.XElement xElement) { try { return(Convert.ToString(xElement.XPathSelectElement(elementXPath).Elements().Where(x => x.Value == elementValue).SingleOrDefault().Name)); } catch (Exception) { return(string.Empty); } }
public static string getResourceXPathString(string elementXPath, System.Xml.Linq.XElement xElement) { try { return(Convert.ToString(xElement.XPathSelectElement(elementXPath).Value)); } catch (Exception ex) { return(string.Empty); } }
public static string getResourceXPathAttribute(string elementXPath, string attributeName, System.Xml.Linq.XElement xElement) { try { return(Convert.ToString(xElement.XPathSelectElement(elementXPath).Attribute(attributeName).Value)); } catch (Exception) { return(string.Empty); } }
internal static string getResourceAttribute(string elementName, string attributeName, System.Xml.Linq.XElement xElement) { try { return(Convert.ToString(xElement.Elements(elementName).SingleOrDefault().Attribute(attributeName).Value)); } catch (Exception) { return(string.Empty); } }
public object ParseArgumentValue(System.Xml.Linq.XElement ele) { return(null); }
public static string GetAttributeValueFromNode(System.Xml.Linq.XElement node, string attributeName) { return(GetAttributeValueFromNode <string>(node, attributeName, string.Empty)); }
public nfeAutorizacaoLoteRequest(System.Xml.Linq.XElement nfeDadosMsg) { this.nfeDadosMsg = nfeDadosMsg; }
public System.Threading.Tasks.Task <Fiscal.HAutorizarSVRS.nfeAutorizacaoLoteResponse> nfeAutorizacaoLoteAsync(System.Xml.Linq.XElement nfeDadosMsg) { Fiscal.HAutorizarSVRS.nfeAutorizacaoLoteRequest inValue = new Fiscal.HAutorizarSVRS.nfeAutorizacaoLoteRequest(); inValue.nfeDadosMsg = nfeDadosMsg; return(((Fiscal.HAutorizarSVRS.NFeAutorizacao4Soap)(this)).nfeAutorizacaoLoteAsync(inValue)); }
public System.Xml.Linq.XElement Inquire(string guid, string tokenKey, System.Xml.Linq.XElement billInquiryRequest) { return(base.Channel.Inquire(guid, tokenKey, billInquiryRequest)); }
public bool SendFilledDocument(int compilationRequestId, string username, string service, string token, string dataStr) { XmlDocument data = new XmlDocument(); data.LoadXml(dataStr); Storage.StorageManager manager = new Storage.StorageManager(); Storage.CompilationRequest compilationRequest = manager.getEntityByID <Storage.CompilationRequest>(compilationRequestId); if (compilationRequest == null) { return(false); } Storage.Publication publication = compilationRequest.Publication; IComputableWorkflow cw; if (publication.isPublic) { //pubblico cw = (IComputableWorkflow)manager.getWorkflowByPublication(publication); } else { //privato if (token == null || !compilationRequest.token.Equals(token)) { return(false); } Storage.Contact contact = compilationRequest.Contact; if (username == null || service == null || !(contact.externalUserID.Equals(username) && (contact.Service.nameService.Equals(service)))) { return(false); } if (compilationRequest.compiled) { return(false); } cw = (IComputableWorkflow)manager.getWorkflowByPublication(publication); } cw.setWFname(publication.namePublication); System.Xml.Schema.XmlSchemaSet schema = cw.GetCollectedDocumentSchemas(); data.Schemas = schema; try { data.Validate(null); } catch (XmlSchemaValidationException) { return(false); } Storage.Result res = null; System.Xml.Linq.XElement dataXElement = Storage.StorageManager.xmlDocumentToXElement(data); res = (Storage.Result)manager.addResult(compilationRequest.compilReqID, dataXElement); if (res == null) { return(false); } else { return(true); } }
partial void OnErrorsChanging(System.Xml.Linq.XElement value);
public object ParseArgumentValue(System.Xml.Linq.XElement ele) { return(new StatDimClass((enumStatDimType)Enum.Parse(typeof(enumStatDimType), ckStatDim.Text), (enumStatCompoundType)Enum.Parse(typeof(enumStatCompoundType), ckStatCompound.Text), (enumStatDayMosaicType)Enum.Parse(typeof(enumStatDayMosaicType), cbDayMosaicType.Text))); }
public InteractiveSeries Execute(double price, double time, InteractiveSeries smile, IOptionSeries optSer, double ratePct, int barNum) { int barsCount = ContextBarsCount; if ((barNum < barsCount - 1) || (smile == null) || (optSer == null)) { return(Constants.EmptySeries); } SmileInfo oldInfo = smile.GetTag <SmileInfo>(); if ((oldInfo == null) || (oldInfo.ContinuousFunction == null) || (oldInfo.ContinuousFunctionD1 == null)) { return(Constants.EmptySeries); } int lastBarIndex = optSer.UnderlyingAsset.Bars.Count - 1; DateTime now = optSer.UnderlyingAsset.Bars[Math.Min(barNum, lastBarIndex)].Date; bool wasInitialized = HandlerInitializedToday(now); double futPx = price; double dT = time; if (!DoubleUtil.IsPositive(dT)) { // [{0}] Time to expiry must be positive value. dT:{1} string msg = RM.GetStringFormat("OptHandlerMsg.TimeMustBePositive", GetType().Name, dT); if (wasInitialized) { m_context.Log(msg, MessageType.Error, true); } return(Constants.EmptySeries); } if (!DoubleUtil.IsPositive(futPx)) { // [{0}] Base asset price must be positive value. F:{1} string msg = RM.GetStringFormat("OptHandlerMsg.FutPxMustBePositive", GetType().Name, futPx); if (wasInitialized) { m_context.Log(msg, MessageType.Error, true); } return(Constants.EmptySeries); } if (Double.IsNaN(ratePct)) { //throw new ScriptException("Argument 'ratePct' contains NaN for some strange reason. rate:" + rate); return(Constants.EmptySeries); } double ivAtm, slopeAtm, shape; if ((!oldInfo.ContinuousFunction.TryGetValue(futPx, out ivAtm)) || (!oldInfo.ContinuousFunctionD1.TryGetValue(futPx, out slopeAtm))) { return(Constants.EmptySeries); } if (m_setIvByHands) { ivAtm = m_ivAtmPct.Value / Constants.PctMult; } if (m_setSlopeByHands) { slopeAtm = m_slopePct.Value / Constants.PctMult; //slopeAtm = slopeAtm / F / Math.Pow(dT, Pow + shape); } //if (setShapeByHands) { shape = m_shapePct.Value / Constants.PctMult; } if (!DoubleUtil.IsPositive(ivAtm)) { // [{0}] ivAtm must be positive value. ivAtm:{1} string msg = RM.GetStringFormat("OptHandlerMsg.IvAtmMustBePositive", GetType().Name, ivAtm); if (wasInitialized) { m_context.Log(msg, MessageType.Error, true); } return(Constants.EmptySeries); } if (Double.IsNaN(slopeAtm)) { // [{0}] Smile skew at the money must be some number. skewAtm:{1} string msg = RM.GetStringFormat("OptHandlerMsg.SkewAtmMustBeNumber", GetType().Name, slopeAtm); if (wasInitialized) { m_context.Log(msg, MessageType.Error, true); } return(Constants.EmptySeries); } SmileInfo templateInfo; #region Fill templateInfo if (m_useLocalTemplate) { InteractiveSeries templateSmile = m_context.LoadObject(m_frozenSmileId) as InteractiveSeries; if (templateSmile == null) { // [{0}] There is no LOCAL smile with ID:{1} string msg = RM.GetStringFormat("SmileImitation5.NoLocalSmile", GetType().Name, m_frozenSmileId); if (wasInitialized) { m_context.Log(msg, MessageType.Error, true); } return(Constants.EmptySeries); } SmileInfo locInfo = new SmileInfo(); locInfo.F = futPx; locInfo.dT = dT; locInfo.RiskFreeRate = oldInfo.RiskFreeRate; List <double> locXs = new List <double>(); List <double> locYs = new List <double>(); foreach (InteractiveObject oldObj in templateSmile.ControlPoints) { if (!oldObj.AnchorIsActive) { continue; } double k = oldObj.Anchor.ValueX; double sigma = oldObj.Anchor.ValueY; double x = Math.Log(k / futPx) / Math.Pow(dT, DefaultPow + shape) / ivAtm; double sigmaNormalized = sigma / ivAtm; locXs.Add(x); locYs.Add(sigmaNormalized); } try { NotAKnotCubicSpline spline = new NotAKnotCubicSpline(locXs, locYs); locInfo.ContinuousFunction = spline; locInfo.ContinuousFunctionD1 = spline.DeriveD1(); templateInfo = locInfo; } catch (Exception ex) { m_context.Log(ex.ToString(), MessageType.Error, true); return(Constants.EmptySeries); } } else { //templateSmile = context.LoadGlobalObject(globalSmileID, true) as InteractiveSeries; templateInfo = m_context.LoadGlobalObject(m_globalSmileId, true) as SmileInfo; if (templateInfo == null) { // [{0}] There is no global templateInfo with ID:{1}. I'll try to use default one. string msg = RM.GetStringFormat("SmileImitation5.TemplateWasSaved", GetType().Name, m_globalSmileId); m_context.Log(msg, MessageType.Error, true); System.Xml.Linq.XDocument xDoc = System.Xml.Linq.XDocument.Parse(SmileFunction5.XmlSmileRiz4Nov1); System.Xml.Linq.XElement xInfo = xDoc.Root; SmileInfo templateSmile = SmileInfo.FromXElement(xInfo); // Обновляю уровень IV ATM? if (Double.IsNaN(ivAtm)) { ivAtm = oldInfo.ContinuousFunction.Value(futPx); m_context.Log(String.Format("[DEBUG:{0}] ivAtm was NaN. I'll use value ivAtm:{1}", GetType().Name, ivAtm), MessageType.Warning, true); if (Double.IsNaN(ivAtm)) { throw new Exception(String.Format("[DEBUG:{0}] ivAtm is NaN.", GetType().Name)); } } templateSmile.F = futPx; templateSmile.dT = dT; templateSmile.RiskFreeRate = oldInfo.RiskFreeRate; m_context.StoreGlobalObject(m_globalSmileId, templateSmile, true); // [{0}] Default templateInfo was saved to Global Cache with ID:{1}. msg = RM.GetStringFormat("SmileImitation5.TemplateWasSaved", GetType().Name, m_globalSmileId); m_context.Log(msg, MessageType.Warning, true); templateInfo = templateSmile; } } #endregion Fill templateInfo if (!m_setIvByHands) { m_ivAtmPct.Value = ivAtm * Constants.PctMult; } if (!m_setShapeByHands) { // так я ещё не умею } if (!m_setSlopeByHands) { // Пересчитываю наклон в безразмерку double dSigmaDx = GetDSigmaDx(futPx, dT, slopeAtm, shape); m_slopePct.Value = dSigmaDx * Constants.PctMult; // и теперь апдейчу локальную переменную slopeAtm: slopeAtm = m_slopePct.Value / Constants.PctMult; } // Это функция в нормированных координатах // поэтому достаточно обычной симметризации // PROD-3111: заменяю вызов на SmileFunctionExtended //SimmetrizeFunc simmFunc = new SimmetrizeFunc(templateInfo.ContinuousFunction); //SimmetrizeFunc simmFuncD1 = new SimmetrizeFunc(templateInfo.ContinuousFunctionD1); //SmileFunction5 smileFunc = new SmileFunction5(simmFunc, simmFuncD1, ivAtm, slopeAtm, shape, futPx, dT); SmileFunctionExtended smileFunc = new SmileFunctionExtended( (NotAKnotCubicSpline)templateInfo.ContinuousFunction, ivAtm, slopeAtm, shape, futPx, dT); smileFunc.UseTails = m_useSmileTails; List <double> xs = new List <double>(); List <double> ys = new List <double>(); IOptionStrikePair[] pairs = optSer.GetStrikePairs().ToArray(); if (pairs.Length < 2) { string msg = String.Format("[{0}] optSer must contain few strike pairs. pairs.Length:{1}", GetType().Name, pairs.Length); if (wasInitialized) { m_context.Log(msg, MessageType.Warning, true); } return(Constants.EmptySeries); } double minK = pairs[0].Strike; double maxK = pairs[pairs.Length - 1].Strike; double futStep = optSer.UnderlyingAsset.Tick; double dK = pairs[1].Strike - pairs[0].Strike; double width = (SigmaMult * ivAtm * Math.Sqrt(dT)) * futPx; width = Math.Max(width, 10 * dK); // Нельзя вылезать за границу страйков??? width = Math.Min(width, Math.Abs(futPx - minK)); width = Math.Min(width, Math.Abs(maxK - futPx)); // Generate left invisible tail if (m_generateTails) { GaussSmile.AppendLeftTail(smileFunc, xs, ys, minK, dK, false); } SortedDictionary <double, IOptionStrikePair> strikePrices; if (!TryPrepareImportantPoints(pairs, futPx, futStep, width, out strikePrices)) { string msg = String.Format("[{0}] It looks like there is no suitable points for the smile. pairs.Length:{1}", GetType().Name, pairs.Length); if (wasInitialized) { m_context.Log(msg, MessageType.Warning, true); } return(Constants.EmptySeries); } List <InteractiveObject> controlPoints = new List <InteractiveObject>(); //for (int j = 0; j < pairs.Length; j++) foreach (var kvp in strikePrices) { bool showPoint = (kvp.Value != null); //IOptionStrikePair pair = pairs[j]; //// Сверхдалекие страйки игнорируем //if ((pair.Strike < futPx - width) || (futPx + width < pair.Strike)) //{ // showPoint = false; //} //double k = pair.Strike; double k = kvp.Key; double sigma; if (!smileFunc.TryGetValue(k, out sigma)) { continue; } double vol = sigma; if (!DoubleUtil.IsPositive(sigma)) { continue; } //InteractivePointActive ip = new InteractivePointActive(k, vol); //ip.Color = (optionPxMode == OptionPxMode.Ask) ? Colors.DarkOrange : Colors.DarkCyan; //ip.DragableMode = DragableMode.None; //ip.Geometry = Geometries.Rect; // (optionPxMode == OptionPxMode.Ask) ? Geometries.Rect : Geometries.Rect; // Иначе неправильно выставляются координаты??? //ip.Tooltip = String.Format("K:{0}; IV:{1:0.00}", k, PctMult * sigma); InteractivePointLight ip; if (showPoint) { var tip = new InteractivePointActive(k, vol); if (k <= futPx) // Puts { SmileImitation3.FillNodeInfo(tip, futPx, dT, kvp.Value, StrikeType.Put, OptionPxMode.Mid, sigma, false, m_showNodes, ratePct); } else // Calls { SmileImitation3.FillNodeInfo(tip, futPx, dT, kvp.Value, StrikeType.Call, OptionPxMode.Mid, sigma, false, m_showNodes, ratePct); } ip = tip; } else { ip = new InteractivePointLight(k, vol); } InteractiveObject obj = new InteractiveObject(ip); //if (showPoint) // Теперь мы понимаем, что точки либо рисуются // потому что это страйки (и тогда они автоматом InteractivePointActive) // либо они присутствуют, но не рисуются их узлы. Потому что они InteractivePointLight. { controlPoints.Add(obj); } xs.Add(k); ys.Add(vol); } // ReSharper disable once UseObjectOrCollectionInitializer InteractiveSeries res = new InteractiveSeries(); res.ControlPoints = new ReadOnlyCollection <InteractiveObject>(controlPoints); // Generate right invisible tail if (m_generateTails) { GaussSmile.AppendRightTail(smileFunc, xs, ys, maxK, dK, false); } var baseSec = optSer.UnderlyingAsset; DateTime scriptTime = baseSec.Bars[baseSec.Bars.Count - 1].Date; // ReSharper disable once UseObjectOrCollectionInitializer SmileInfo info = new SmileInfo(); info.F = futPx; info.dT = dT; info.RiskFreeRate = ratePct; info.IvAtm = ivAtm; info.SkewAtm = slopeAtm; info.Shape = shape; info.SmileType = GetType().FullName; info.ScriptTime = scriptTime; info.Expiry = optSer.ExpirationDate; info.BaseTicker = baseSec.Symbol; info.ContinuousFunction = smileFunc; info.ContinuousFunctionD1 = smileFunc.DeriveD1(); res.Tag = info; SetHandlerInitialized(now); return(res); }
partial void OnXMLDataChanging(System.Xml.Linq.XElement value);
public Point[] DeserializeFromElement(System.Xml.Linq.XElement element) { return(Deserialize(element.Value)); }
partial void OnlogChanging(System.Xml.Linq.XElement value);
public void Initialize(System.Xml.Linq.XElement xmlSettings) { try { gatewaySettings = new GatewaySettings(); //get transaction url attribute if (xmlSettings.Attribute("TransactionUrl") != null) { gatewaySettings.TransactionUrl = xmlSettings.Attribute("TransactionUrl").Value; } if (xmlSettings.Attribute("User") != null) { gatewaySettings.User = xmlSettings.Attribute("User").Value; } if (xmlSettings.Attribute("Password") != null) { gatewaySettings.Password = xmlSettings.Attribute("Password").Value; } if (xmlSettings.Attribute("Signature") != null) { gatewaySettings.Signature = xmlSettings.Attribute("Signature").Value; } if (xmlSettings.Attribute("Version") != null) { gatewaySettings.Version = xmlSettings.Attribute("Version").Value; } if (xmlSettings.Attribute("PaymentAction") != null) { gatewaySettings.PaymentAction = xmlSettings.Attribute("PaymentAction").Value; } if (xmlSettings.Attribute("ErrorLanguage") != null) { gatewaySettings.ErrorLanguage = xmlSettings.Attribute("ErrorLanguage").Value; } if (xmlSettings.Attribute("CurrencyCode") != null) { gatewaySettings.CurrencyCode = xmlSettings.Attribute("CurrencyCode").Value; } if (xmlSettings.Attribute("RedirectUrl") != null) { gatewaySettings.RedirectUrl = xmlSettings.Attribute("RedirectUrl").Value; } if (xmlSettings.Attribute("DelimChar") != null) { gatewaySettings.DelimChar = xmlSettings.Attribute("DelimChar").Value; } if (string.IsNullOrEmpty(gatewaySettings.TransactionUrl)) { throw new PaymentProviderException("TransactionUrl cannot be null"); } if (string.IsNullOrEmpty(gatewaySettings.User)) { throw new PaymentProviderException("User cannot be null"); } if (string.IsNullOrEmpty(gatewaySettings.Password)) { throw new PaymentProviderException("Password cannot be null"); } if (string.IsNullOrEmpty(gatewaySettings.Signature)) { throw new PaymentProviderException("Signature cannot be null"); } if (string.IsNullOrEmpty(gatewaySettings.DelimData)) { gatewaySettings.DelimData = "TRUE"; } if (string.IsNullOrEmpty(gatewaySettings.DelimChar)) { gatewaySettings.DelimChar = "|"; } } catch (Exception ex) { throw new PaymentProviderException("An error occured while reading the gateway settings", ex); } }
//Update Sequences of ClientDefinedRuleGroups public void UpdateClientDefinedRuleGroupSequences(System.Xml.Linq.XElement xmlElement) { string adminUserGuid = HttpContext.Current.User.Identity.Name.Split(new[] { '|' })[0]; db.spDesktopDataAdmin_UpdateClientDefinedRuleGroupSequences_v1(xmlElement, adminUserGuid); }
public static void Validate(this System.Xml.Linq.XElement source, System.Xml.Schema.XmlSchemaObject partialValidationType, System.Xml.Schema.XmlSchemaSet schemas, System.Xml.Schema.ValidationEventHandler validationEventHandler, bool addSchemaInfo) { }
void IEwavDashboardRule.CreateFromXml(System.Xml.Linq.XElement element) { throw new NotImplementedException(); }
public static System.Xml.Schema.IXmlSchemaInfo GetSchemaInfo(this System.Xml.Linq.XElement source) { throw null; }
protected override System.Xml.Linq.XDocument SaveToXmlDocument(System.Xml.Linq.XElement rootPropsElement, L3dFilePath filePath) { throw new NotImplementedException(); }
public nfeAutorizacaoLoteZipResponse(System.Xml.Linq.XElement nfeResultMsg) { this.nfeResultMsg = nfeResultMsg; }
public override void ReadXml(System.Xml.Linq.XElement element) { base.ReadXml(element); XExpression.Text = element.ReadString("X"); YExpression.Text = element.ReadString("Y"); }
partial void OnDashboardXMLChanging(System.Xml.Linq.XElement value);
partial void OnExceptionDataChanging(System.Xml.Linq.XElement value);
public void SerializeToElement(Point[] objectToSerialize, System.Xml.Linq.XElement elemToFill) { elemToFill.Value = Serialize(objectToSerialize); }