public void ListenRelay(string relayIp, int relayPort, NetworkID netGuid, SourceID sourceId, NodeID nodeId) { Initialize(); m_ServerHostId = NetworkTransport.AddHost(m_HostTopology, listenPort); if (LogFilter.logDebug) { Debug.Log("Server Host Slot Id: " + m_ServerHostId); } Update(); byte error; NetworkTransport.ConnectAsNetworkHost( m_ServerHostId, relayIp, relayPort, netGuid, sourceId, nodeId, out error); m_RelaySlotId = 0; if (LogFilter.logDebug) { Debug.Log("Relay Slot Id: " + m_RelaySlotId); } }
public SendRec() { m_PresenceVector = 0; m_ReliableDelivery = 0; m_DestinationID = new DestinationID(); m_SourceID = new SourceID(); m_Priority = 0; m_MessagePayload = new MessagePayload(); }
public ReceiveRec(ReceiveRec value) { m_SourceID = new SourceID(); m_MessagePayload = new MessagePayload(); // Copy the values m_SourceID = value.getSourceID(); m_MessagePayload = value.getMessagePayload(); }
public SourceID(SourceID value) { /// Initiliaze the protected variables m_parent = null; m_SubFields = 0; /// Copy the values this.m_SubFields = value.m_SubFields; }
public BroadcastRec() { m_parent = null; m_PresenceVector = 0; m_DestinationID = new DestinationID(); m_DestinationID.setParent(this); m_SourceID = new SourceID(); m_SourceID.setParent(this); m_Priority = 0; m_MessagePayload = new MessagePayload(); m_MessagePayload.setParent(this); }
public void FixSourceID(int length) { try { if (!string.IsNullOrEmpty(SourceID)) { SourceID = SourceID.Substring(0, 1) + SourceID.Substring(1).PadLeft(length, '0'); } } catch (Exception) { // don't error if SourceID is not of format Sxxxx } }
SyncSource findSource(SourceID oSrcID) { for (int i = 0; i < (int)m_sources.size(); i++) { SyncSource src = (SyncSource)m_sources.elementAt(i); if (oSrcID.isEqual(src)) { return(src); } } return(null); }
public void FixSourceID(int length) { try { if (SourceID != null || SourceID.Length > 0) { SourceID = SourceID.Substring(0, 1) + SourceID.Substring(1).PadLeft(length, '0'); } } catch (Exception) { // don't error if SourceID is not of format Sxxxx } }
/// <summary> /// Print the object's XML to the XmlWriter. /// </summary> /// <param name="objWriter">XmlTextWriter to write with.</param> /// <param name="objCulture">Culture in which to print.</param> /// <param name="strLanguageToPrint">Language in which to print</param> public void Print(XmlTextWriter objWriter, CultureInfo objCulture, string strLanguageToPrint) { objWriter.WriteStartElement("lifestyle"); objWriter.WriteElementString("name", CustomName); objWriter.WriteElementString("cost", Cost.ToString(_objCharacter.Options.NuyenFormat, objCulture)); objWriter.WriteElementString("totalmonthlycost", TotalMonthlyCost.ToString(_objCharacter.Options.NuyenFormat, objCulture)); objWriter.WriteElementString("totalcost", TotalCost.ToString(_objCharacter.Options.NuyenFormat, objCulture)); objWriter.WriteElementString("dice", Dice.ToString(objCulture)); objWriter.WriteElementString("multiplier", Multiplier.ToString(_objCharacter.Options.NuyenFormat, objCulture)); objWriter.WriteElementString("months", Increments.ToString(objCulture)); objWriter.WriteElementString("purchased", Purchased.ToString()); objWriter.WriteElementString("type", StyleType.ToString()); objWriter.WriteElementString("increment", IncrementType.ToString()); objWriter.WriteElementString("sourceid", SourceID.ToString("D")); objWriter.WriteElementString("bonuslp", BonusLP.ToString(objCulture)); string strBaseLifestyle = string.Empty; // Retrieve the Advanced Lifestyle information if applicable. if (!string.IsNullOrEmpty(BaseLifestyle)) { XmlNode objXmlAspect = GetNode(); if (objXmlAspect != null) { strBaseLifestyle = objXmlAspect["translate"]?.InnerText ?? objXmlAspect["name"]?.InnerText ?? strBaseLifestyle; } } objWriter.WriteElementString("baselifestyle", strBaseLifestyle); objWriter.WriteElementString("trustfund", TrustFund.ToString()); objWriter.WriteElementString("source", CommonFunctions.LanguageBookShort(Source, strLanguageToPrint)); objWriter.WriteElementString("page", DisplayPage(strLanguageToPrint)); objWriter.WriteStartElement("qualities"); // Retrieve the Qualities for the Advanced Lifestyle if applicable. foreach (LifestyleQuality objQuality in LifestyleQualities) { objQuality.Print(objWriter, objCulture, strLanguageToPrint); } // Retrieve the free Grids for the Advanced Lifestyle if applicable. foreach (LifestyleQuality objQuality in FreeGrids) { objQuality.Print(objWriter, objCulture, strLanguageToPrint); } objWriter.WriteEndElement(); if (_objCharacter.Options.PrintNotes) { objWriter.WriteElementString("notes", Notes); } objWriter.WriteEndElement(); }
public SendRec(SendRec value) { m_DestinationID = new DestinationID(); m_SourceID = new SourceID(); m_MessagePayload = new MessagePayload(); // Copy the values m_PresenceVector = value.getPresenceVector(); m_ReliableDelivery = value.getReliableDelivery(); m_DestinationID = value.getDestinationID(); m_SourceID = value.getSourceID(); m_Priority = value.getPriority(); m_MessagePayload = value.getMessagePayload(); }
void prepareSync(int eState, SourceID oSrcID) { setState(eState); m_bIsSearch = eState == esSearch; m_bStopByUser = false; m_nErrCode = RhoAppAdapter.ERR_NONE; m_strError = ""; m_strServerError = ""; m_bIsSchemaChanged = false; loadAllSources(); m_strSession = loadSession(); if (isSessionExist()) { m_clientID = loadClientID(); if (m_nErrCode == RhoAppAdapter.ERR_NONE) { getNotify().cleanLastSyncObjectCount(); doBulkSync(); return; } } else { m_nErrCode = RhoAppAdapter.ERR_CLIENTISNOTLOGGEDIN; } SyncSource src = null; if (oSrcID != null) { src = findSource(oSrcID); } if (src != null) { src.m_nErrCode = m_nErrCode; src.m_strError = m_strError; getNotify().fireSyncNotification(src, true, src.m_nErrCode, ""); } else { getNotify().fireAllSyncNotifications(true, m_nErrCode, m_strError, ""); } stopSync(); }
public void doSyncSource(SourceID oSrcID, String strQueryParams) { SyncSource src = null; try { prepareSync(esSyncSource, oSrcID); if (isContinueSync()) { src = findSource(oSrcID); if (src != null) { LOG.INFO("Started synchronization of the data source: " + src.getName()); src.m_strQueryParams = strQueryParams; src.sync(); getNotify().fireSyncNotification(src, true, src.m_nErrCode, src.m_nErrCode == RhoAppAdapter.ERR_NONE ? RhoAppAdapter.getMessageText("sync_completed") : ""); } else { // LOG.ERROR( "Sync one source : Unknown Source " + oSrcID.toString() ); src = new SyncSource(this, getUserDB()); //src.m_strError = "Unknown sync source."; src.m_nErrCode = RhoAppAdapter.ERR_RUNTIME; throw new Exception("Sync one source : Unknown Source " + oSrcID.toString()); } } } catch (Exception exc) { LOG.ERROR("Sync source " + oSrcID.toString() + " failed.", exc); if (src != null && src.m_nErrCode == RhoAppAdapter.ERR_NONE) { src.m_nErrCode = RhoAppAdapter.ERR_RUNTIME; } getNotify().fireSyncNotification(src, true, src.m_nErrCode, ""); } getNotify().cleanCreateObjectErrors(); if (getState() != esExit) { setState(esNone); } }
/// <summary> /// Save the object's XML to the XmlWriter. /// </summary> /// <param name="objWriter">XmlTextWriter to write with.</param> public void Save(XmlTextWriter objWriter) { objWriter.WriteStartElement("lifestyle"); objWriter.WriteElementString("guid", _guiID.ToString("D")); objWriter.WriteElementString("name", _strName); objWriter.WriteElementString("cost", _decCost.ToString(GlobalOptions.InvariantCultureInfo)); objWriter.WriteElementString("dice", _intDice.ToString(GlobalOptions.InvariantCultureInfo)); objWriter.WriteElementString("baselifestyle", _strBaseLifestyle); objWriter.WriteElementString("multiplier", _decMultiplier.ToString(GlobalOptions.InvariantCultureInfo)); objWriter.WriteElementString("months", _intIncrements.ToString(GlobalOptions.InvariantCultureInfo)); objWriter.WriteElementString("roommates", _intRoommates.ToString(GlobalOptions.InvariantCultureInfo)); objWriter.WriteElementString("percentage", _decPercentage.ToString(GlobalOptions.InvariantCultureInfo)); objWriter.WriteElementString("area", _intArea.ToString(GlobalOptions.InvariantCultureInfo)); objWriter.WriteElementString("comforts", _intComforts.ToString(GlobalOptions.InvariantCultureInfo)); objWriter.WriteElementString("security", _intSecurity.ToString(GlobalOptions.InvariantCultureInfo)); objWriter.WriteElementString("basearea", _intBaseArea.ToString(GlobalOptions.InvariantCultureInfo)); objWriter.WriteElementString("basecomforts", _intBaseComforts.ToString(GlobalOptions.InvariantCultureInfo)); objWriter.WriteElementString("basesecurity", _intBaseSecurity.ToString(GlobalOptions.InvariantCultureInfo)); objWriter.WriteElementString("costforearea", _decCostForArea.ToString(GlobalOptions.InvariantCultureInfo)); objWriter.WriteElementString("costforcomforts", _decCostForComforts.ToString(GlobalOptions.InvariantCultureInfo)); objWriter.WriteElementString("costforsecurity", _decCostForSecurity.ToString(GlobalOptions.InvariantCultureInfo)); objWriter.WriteElementString("allowbonuslp", _blnAllowBonusLP.ToString()); objWriter.WriteElementString("bonuslp", _intBonusLP.ToString(GlobalOptions.InvariantCultureInfo)); objWriter.WriteElementString("source", _strSource); objWriter.WriteElementString("page", _strPage); objWriter.WriteElementString("trustfund", _blnTrustFund.ToString()); objWriter.WriteElementString("primarytenant", _blnIsPrimaryTenant.ToString()); objWriter.WriteElementString("type", _eType.ToString()); objWriter.WriteElementString("increment", _eIncrement.ToString()); objWriter.WriteElementString("sourceid", SourceID.ToString("D")); objWriter.WriteStartElement("lifestylequalities"); foreach (LifestyleQuality objQuality in _lstLifestyleQualities) { objQuality.Save(objWriter); } objWriter.WriteEndElement(); objWriter.WriteStartElement("freegrids"); foreach (LifestyleQuality objQuality in _lstFreeGrids) { objQuality.Save(objWriter); } objWriter.WriteEndElement(); objWriter.WriteElementString("notes", _strNotes); objWriter.WriteElementString("sortorder", _intSortOrder.ToString()); objWriter.WriteEndElement(); _objCharacter.SourceProcess(_strSource); }
private IEnumerator Reconn() { byte error; NetworkID network = NetworkID.Invalid; SourceID source = SourceID.Invalid; NodeID node = NodeID.Invalid; NetworkTransport.RemoveHost(NetSide.singleton.client.connection.hostId); //Закрыть открытый сокет, закрыть все соединение, принадлежащее этому сокету NetSide.singleton.client.Shutdown(); NetSide.singleton.client = null; NetworkTransport.ConnectAsNetworkHost(NetworkManager.singleton.client.connection.hostId, "", 7777, network, source, node, out error); yield return(new WaitForSeconds(1.0f)); NetworkTransport.Shutdown(); NetSide.singleton.StartClient(); }
/// <summary> /// Save the object's XML to the XmlWriter. /// </summary> /// <param name="objWriter">XmlTextWriter to write with.</param> public void Save(XmlTextWriter objWriter) { objWriter.WriteStartElement("lifestyle"); objWriter.WriteElementString("guid", _guiID.ToString()); objWriter.WriteElementString("name", _strName); objWriter.WriteElementString("cost", _decCost.ToString(CultureInfo.InvariantCulture)); objWriter.WriteElementString("dice", _intDice.ToString(CultureInfo.InvariantCulture)); objWriter.WriteElementString("baselifestyle", _strBaseLifestyle); objWriter.WriteElementString("multiplier", _decMultiplier.ToString(CultureInfo.InvariantCulture)); objWriter.WriteElementString("months", _intMonths.ToString(CultureInfo.InvariantCulture)); objWriter.WriteElementString("roommates", _intRoommates.ToString(CultureInfo.InvariantCulture)); objWriter.WriteElementString("percentage", _decPercentage.ToString(CultureInfo.InvariantCulture)); objWriter.WriteElementString("purchased", _blnPurchased.ToString()); objWriter.WriteElementString("area", _intArea.ToString(CultureInfo.InvariantCulture)); objWriter.WriteElementString("comforts", _intComforts.ToString(CultureInfo.InvariantCulture)); objWriter.WriteElementString("security", _intSecurity.ToString(CultureInfo.InvariantCulture)); objWriter.WriteElementString("basearea", _intBaseArea.ToString(CultureInfo.InvariantCulture)); objWriter.WriteElementString("basecomforts", _intBaseComforts.ToString(CultureInfo.InvariantCulture)); objWriter.WriteElementString("basesecurity", _intBaseSecurity.ToString(CultureInfo.InvariantCulture)); objWriter.WriteElementString("entertainment", _intEntertainment.ToString(CultureInfo.InvariantCulture)); objWriter.WriteElementString("costforearea", _costForArea.ToString(CultureInfo.InvariantCulture)); objWriter.WriteElementString("costforcomforts", _costForComforts.ToString(CultureInfo.InvariantCulture)); objWriter.WriteElementString("costforsecurity", _costForSecurity.ToString(CultureInfo.InvariantCulture)); objWriter.WriteElementString("source", _strSource); objWriter.WriteElementString("page", _strPage); objWriter.WriteElementString("trustfund", _blnTrustFund.ToString()); objWriter.WriteElementString("primarytenant", _primaryTenant.ToString()); objWriter.WriteElementString("type", _objType.ToString()); objWriter.WriteElementString("sourceid", SourceID.ToString()); objWriter.WriteStartElement("lifestylequalities"); foreach (var objQuality in _lstLifestyleQualities) { objQuality.Save(objWriter); } objWriter.WriteEndElement(); objWriter.WriteStartElement("freegrids"); foreach (var objQuality in FreeGrids) { objQuality.Save(objWriter); } objWriter.WriteEndElement(); objWriter.WriteElementString("notes", _strNotes); objWriter.WriteEndElement(); _objCharacter.SourceProcess(_strSource); }
/// <summary> /// <para>Starts a server using a Relay server. This is the manual way of using the Relay server, as the regular NetworkServer.Connect() will automatically use the Relay server if a match exists.</para> /// </summary> /// <param name="relayIp">Relay server IP Address.</param> /// <param name="relayPort">Relay server port.</param> /// <param name="netGuid">GUID of the network to create.</param> /// <param name="sourceId">This server's sourceId.</param> /// <param name="nodeId">The node to join the network with.</param> public void ListenRelay(string relayIp, int relayPort, NetworkID netGuid, SourceID sourceId, NodeID nodeId) { byte num; this.Initialize(); this.m_ServerHostId = NetworkTransport.AddHost(this.m_HostTopology, this.listenPort); if (LogFilter.logDebug) { Debug.Log("Server Host Slot Id: " + this.m_ServerHostId); } this.Update(); NetworkTransport.ConnectAsNetworkHost(this.m_ServerHostId, relayIp, relayPort, netGuid, sourceId, nodeId, out num); this.m_RelaySlotId = 0; if (LogFilter.logDebug) { Debug.Log("Relay Slot Id: " + this.m_RelaySlotId); } }
/// <summary> /// Save the object's XML to the XmlWriter. /// </summary> /// <param name="objWriter">XmlTextWriter to write with.</param> public void Save(XmlTextWriter objWriter) { objWriter.WriteStartElement("lifestyle"); objWriter.WriteElementString("guid", _guiID.ToString()); objWriter.WriteElementString("name", _strName); objWriter.WriteElementString("cost", _intCost.ToString()); objWriter.WriteElementString("dice", _intDice.ToString()); objWriter.WriteElementString("baselifestyle", _strBaseLifestyle.ToString()); objWriter.WriteElementString("multiplier", _intMultiplier.ToString()); objWriter.WriteElementString("months", _intMonths.ToString()); objWriter.WriteElementString("roommates", _intRoommates.ToString()); objWriter.WriteElementString("percentage", _intPercentage.ToString()); objWriter.WriteElementString("lifestylename", _strLifestyleName); objWriter.WriteElementString("purchased", _blnPurchased.ToString()); objWriter.WriteElementString("comforts", _intComforts.ToString()); objWriter.WriteElementString("area", _intArea.ToString()); objWriter.WriteElementString("security", _intSecurity.ToString()); objWriter.WriteElementString("comfortsentertainment", _intComfortsEntertainment.ToString()); objWriter.WriteElementString("areaentertainment", _intAreaEntertainment.ToString()); objWriter.WriteElementString("securityentertainment", _intSecurityEntertainment.ToString()); objWriter.WriteElementString("entertainment", _intEntertainment.ToString()); objWriter.WriteElementString("baselifestyle", _strBaseLifestyle); objWriter.WriteElementString("source", _strSource); objWriter.WriteElementString("page", _strPage); objWriter.WriteElementString("trustfund", _blnTrustFund.ToString()); objWriter.WriteElementString("type", _objType.ToString()); objWriter.WriteElementString("sourceid", SourceID.ToString()); objWriter.WriteStartElement("lifestylequalities"); foreach (LifestyleQuality objQuality in _lstLifestyleQualities) { objQuality.Save(objWriter); } objWriter.WriteEndElement(); objWriter.WriteStartElement("freegrids"); foreach (LifestyleQuality objQuality in _lstFreeGrids) { objQuality.Save(objWriter); } objWriter.WriteEndElement(); objWriter.WriteElementString("notes", _strNotes); objWriter.WriteEndElement(); _objCharacter.SourceProcess(_strSource); }
public BroadcastRec(BroadcastRec value) { /// Initiliaze the protected variables m_parent = null; m_PresenceVector = 0; m_DestinationID = new DestinationID(); m_DestinationID.setParent(this); m_SourceID = new SourceID(); m_SourceID.setParent(this); m_Priority = 0; m_MessagePayload = new MessagePayload(); m_MessagePayload.setParent(this); /// Copy the values m_PresenceVector = value.m_PresenceVector; m_DestinationID = value.getDestinationID(); m_SourceID = value.getSourceID(); m_Priority = value.m_Priority; m_MessagePayload = value.getMessagePayload(); }
/// <summary> /// Возвращает словарь параметров. /// </summary> public override Dictionary <string, string> GetParameters() { var parameters = base.GetParameters(); if (SourceID > 0) { parameters["source_uid"] = SourceID.ToString(); } if (Order.Value == VKFriendsOrder.Random) { parameters["order"] = "random"; } if (IsSingle) { parameters["target_uid"] = TargetID.ToString(); } else { parameters["target_uids"] = String.Join(",", TargetIDs); } return(parameters); }
string GetArgs(string hash, Node node) { var args = new Dictionary <string, string> (); args["source-id"] = SourceID.ToString(); if (node != null) { switch (GetNodeType(node)) { case EcmaNodeType.Namespace: args["show"] = "namespace"; args["namespace"] = node.Element.Substring("N:".Length); break; } } if (!string.IsNullOrEmpty(hash)) { args["hash"] = hash; } return("?" + string.Join("&", args.Select(kvp => kvp.Key == kvp.Value ? kvp.Key : kvp.Key + '=' + kvp.Value))); }
public override string GetInternalIdForUrl(string url, out Node node, out Dictionary <string, string> context) { var id = string.Empty; node = null; context = null; if (!url.StartsWith(UriPrefix, StringComparison.OrdinalIgnoreCase)) { node = MatchNode(url); if (node == null) { return(null); } id = node.GetInternalUrl(); } string hash; id = GetInternalIdForInternalUrl(id, out hash); context = EcmaDoc.GetContextForEcmaNode(hash, SourceID.ToString(), node); return(id); }
/* * @param the value the SourceID will be set to. */ public void setSourceID(SourceID value) { m_SourceID.setAs(value); }
public static int ConnectToNetworkPeer(int hostId, string address, int port, int exceptionConnectionId, int relaySlotId, NetworkID network, SourceID source, NodeID node, out byte error) { return NetworkTransport.ConnectToNetworkPeer(hostId, address, port, exceptionConnectionId, relaySlotId, network, source, node, 0, 0.0f, out error); }
private void InternalListenRelay(string relayIp, int relayPort, NetworkID netGuid, SourceID sourceId, NodeID nodeId) { this.m_SimpleServerSimple.ListenRelay(relayIp, relayPort, netGuid, sourceId, nodeId); s_Active = true; this.RegisterMessageHandlers(); }
public BroadcastLocal.Body.BroadcastRec setBroadcastRec(BroadcastRec value) { m_PresenceVector = value.m_PresenceVector; m_DestinationID = value.getDestinationID(); m_SourceID = value.getSourceID(); m_Priority = value.m_Priority; m_MessagePayload = value.getMessagePayload(); return this; }
public bool notEquals(SourceID value) { return !this.isEqual(value); }
internal void InternalListenRelay(string relayIp, int relayPort, NetworkID netGuid, SourceID sourceId, NodeID nodeId, int listenPort) { if (this.m_hostTopology == null) { ConnectionConfig defaultConfig = new ConnectionConfig(); int num1 = (int) defaultConfig.AddChannel(QosType.Reliable); int num2 = (int) defaultConfig.AddChannel(QosType.Unreliable); this.m_hostTopology = new HostTopology(defaultConfig, 8); } this.m_ServerId = NetworkTransport.AddHost(this.m_hostTopology, listenPort); if (LogFilter.logDebug) Debug.Log((object) ("Server Host Slot Id: " + (object) this.m_ServerId)); NetworkServer.Update(); byte error; NetworkTransport.ConnectAsNetworkHost(this.m_ServerId, relayIp, relayPort, netGuid, sourceId, nodeId, out error); this.m_RelaySlotId = 0; if (LogFilter.logDebug) Debug.Log((object) ("Relay Slot Id: " + (object) this.m_RelaySlotId)); if ((int) error != 0) Debug.Log((object) ("ListenRelay Error: " + (object) error)); NetworkServer.s_Active = true; this.m_MessageHandlers.RegisterHandlerSafe((short) 35, new NetworkMessageDelegate(this.OnClientReadyMessage)); this.m_MessageHandlers.RegisterHandlerSafe((short) 5, new NetworkMessageDelegate(this.OnCommandMessage)); this.m_MessageHandlers.RegisterHandlerSafe((short) 6, new NetworkMessageDelegate(NetworkTransform.HandleTransform)); this.m_MessageHandlers.RegisterHandlerSafe((short) 40, new NetworkMessageDelegate(NetworkAnimator.OnAnimationServerMessage)); this.m_MessageHandlers.RegisterHandlerSafe((short) 41, new NetworkMessageDelegate(NetworkAnimator.OnAnimationParametersServerMessage)); this.m_MessageHandlers.RegisterHandlerSafe((short) 42, new NetworkMessageDelegate(NetworkAnimator.OnAnimationTriggerServerMessage)); }
/// <summary> /// /// <para> /// UnderlyingModel.MemDoc.MemDocModelStarts a server using a relay server. This is the manual way of using the relay server, as the regular NetworkServer.Connect() will automatically use the relay server if a UMatch exists. /// </para> /// /// </summary> /// <param name="relayIp">Relay server IP Address.</param><param name="relayPort">Relay server port.</param><param name="netGuid">GUID of the network to create.</param><param name="sourceId">This server's sourceId.</param><param name="nodeId">The node to join the network with.</param> public static void ListenRelay(string relayIp, int relayPort, NetworkID netGuid, SourceID sourceId, NodeID nodeId) { NetworkServer.instance.InternalListenRelay(relayIp, relayPort, netGuid, sourceId, nodeId, 0); }
private void Button_Click(object sender, RoutedEventArgs e) { //Check to see if everything was filled in if ((cidBox.Text == "") || (sourceSoftwareBox.Text == "") || (destinationSoftwareBox.Text == "") || (packagesBox.Text == "")) { MessageBox.Show("Please fill in all the boxes"); } else { string connectionString = getConnString(); //need to make it also insert the softwareID SourceID sourceID = new SourceID(); SqlConnection sqlConnection1 = new SqlConnection(connectionString); SqlCommand cmd = new SqlCommand(); SqlDataReader reader; cmd.CommandText = "SELECT Id FROM Software WHERE SoftwareName = '" + sourceSoftwareBox.Text + "'"; cmd.CommandType = CommandType.Text; cmd.Connection = sqlConnection1; sqlConnection1.Open(); reader = cmd.ExecuteReader(); while (reader.Read()) { sourceID.sourceID = reader.GetInt32(0); } sqlConnection1.Close(); int result = 0; using (SqlConnection connect = new SqlConnection(connectionString)) { string insertQuery = @"INSERT Conversions (CID, Source, Destination, Packages, CreatedBy, SourceID, Comments, Status) OUTPUT inserted.ID, @Status, @Comments, GETDATE(), @CreatedBy INTO HistoricalData (ID, Status, Comments, Date, CreatedBy) VALUES (@CID, @Source, @Destination, @Packages, @CreatedBy, @SourceID, @Comments, @Status)"; //string insertQuery = @"Insert Into Conversions (CID, Source, Destination, Packages, Comments, CreatedBy, SourceID) //SELECT @CID, @Source, @Destination, @Packages, @Comments, @CreatedBy, @SourceID"; SqlCommand command = new SqlCommand(insertQuery, connect); command.Parameters.AddWithValue("CID", cidBox.Text); command.Parameters.AddWithValue("Source", sourceSoftwareBox.Text); command.Parameters.AddWithValue("Destination", destinationSoftwareBox.Text); command.Parameters.AddWithValue("Packages", packagesBox.Text); command.Parameters.AddWithValue("Comments", commentsBox.Text); command.Parameters.AddWithValue("CreatedBy", Environment.UserName); command.Parameters.AddWithValue("SourceID", sourceID.sourceID); command.Parameters.AddWithValue("Status", statusBox.Text); connect.Open(); result = Convert.ToInt32(command.ExecuteScalar()); } this.Close(); } //Sends email sendEmail(cidBox.Text, Environment.UserName); }
public bool isEqual(SourceID value) { return(this.m_SubFields == value.getSubsystemID()); }
public static extern void ConnectAsNetworkHost(int hostId, string address, int port, NetworkID network, SourceID source, NodeID node, out byte error);
public static extern int ConnectToNetworkPeer(int hostId, string address, int port, int exceptionConnectionId, int relaySlotId, NetworkID network, SourceID source, NodeID node, int bytesPerSec, float bucketSizeFactor, out byte error);
public BroadcastLocal.Body.BroadcastRec.SourceID setSourceID(SourceID value) { this.m_SubFields = value.m_SubFields; return this; }
public bool isEqual(SourceID value) { return (this.m_SubFields == value.getSubsystemID()); }
public void setSourceID(SourceID value) { m_SourceID = value; setPresenceVector(0); setParentPresenceVector(); }
public SourceID(SourceID value) { m_SubFields = value.getSubFields(); }
public void updateButton_Click(object sender, RoutedEventArgs e) { //This grabs the SourceID of the selected source software and stores it in sourceID.sourceID string connectionString = getConnString(); SourceID sourceID = new SourceID(); SqlConnection sqlConnection1 = new SqlConnection(connectionString); SqlCommand cmd = new SqlCommand(); SqlDataReader reader; cmd.CommandText = "SELECT Id FROM Software WHERE SoftwareName = '" + sourceSoftwareBox.Text + "'"; cmd.CommandType = CommandType.Text; cmd.Connection = sqlConnection1; sqlConnection1.Open(); reader = cmd.ExecuteReader(); while (reader.Read()) { sourceID.sourceID = reader.GetInt32(0); } sqlConnection1.Close(); //This updates the database with the info in the boxes AND the sourceID gotten above, also inserts into the historical table int result = 0; using (SqlConnection connect = new SqlConnection(connectionString)) { string updateQueryHistorical = ""; string updateQuery = @"Update Conversions SET CID = @CID, Source = @Source, Destination = @Destination, Packages = @Packages, Comments = @Comments, SourceID = @SourceID, Completed = @Completed, Status = @Status WHERE ID = " + item1.ID; if (completeCheckBox.IsChecked == true) { updateQueryHistorical = @"INSERT INTO HistoricalData (ID, Status, Comments, Date, CreatedBy) VALUES (@ID, 'Completed', @Comments, GETDATE(), @CreatedBy)"; } else if (completeCheckBox.IsChecked == false) { updateQueryHistorical = @"INSERT INTO HistoricalData (ID, Status, Comments, Date, CreatedBy) VALUES (@ID, @Status, @Comments, GETDATE(), @CreatedBy)"; } SqlCommand command = new SqlCommand(updateQuery, connect); command.Parameters.AddWithValue("CID", cidBox.Text); command.Parameters.AddWithValue("Source", sourceSoftwareBox.Text); command.Parameters.AddWithValue("Destination", destinationSoftwareBox.Text); command.Parameters.AddWithValue("Packages", packagesBox.Text); command.Parameters.AddWithValue("Comments", commentsBox.Text); command.Parameters.AddWithValue("SourceID", sourceID.sourceID); command.Parameters.AddWithValue("Completed", completeCheckBox.IsChecked); command.Parameters.AddWithValue("Status", statusBox.Text); connect.Open(); result = Convert.ToInt32(command.ExecuteScalar()); SqlCommand command2 = new SqlCommand(updateQueryHistorical, connect); command2.Parameters.AddWithValue("ID", item1.ID); command2.Parameters.AddWithValue("Status", statusBox.Text); command2.Parameters.AddWithValue("Comments", commentsBox.Text); command2.Parameters.AddWithValue("CreatedBy", Environment.UserName); result = Convert.ToInt32(command2.ExecuteScalar()); connect.Close(); } //This checks to see if the completed box is checked and wasn't previously and adds the current date to datecompleted if it was if ((originalCompleteState.originalCompleteState == "False") && (completeCheckBox.IsChecked == true)) { //Wasn't checked but is now using (SqlConnection connect = new SqlConnection(connectionString)) { /*string updateQueryCompletedDate = @"Update Conversions SET CompletedDate = GETDATE(), Status = 'Completed' WHERE ID = @ID"; */ //THIS IS WHERE I WAS I need to do math on the two dates item1.createddate and completeddatefromquery and insert completion time //so that I can pull it for the report later on and use AVG() in sql string updateQueryCompletedDate = @"DECLARE @completedDate datetime = GETDATE(); UPDATE Conversions SET CompletedDate = @completedDate, Status = 'Completed' WHERE Id = @id; SELECT @completedDate;"; SqlCommand command1 = new SqlCommand(updateQueryCompletedDate, connect); command1.Parameters.AddWithValue("ID", item1.ID); connect.Open(); DateTime completedDateFromQuery = Convert.ToDateTime(command1.ExecuteScalar()); string completionTimeSeconds = calculateCompletionTime(item1.CreatedDate, completedDateFromQuery.ToString()); string insertCompletionTime = @"UPDATE Conversions SET CompletionTime = @completiontime WHERE Id = @id"; SqlCommand command3 = new SqlCommand(insertCompletionTime, connect); command3.Parameters.AddWithValue("ID", item1.ID); command3.Parameters.AddWithValue("completiontime", completionTimeSeconds); int resultInsertCompletionTime = Convert.ToInt32(command3.ExecuteScalar()); connect.Close(); } } else if ((originalCompleteState.originalCompleteState == "True") && (completeCheckBox.IsChecked == false)) { //Was checked but now isn't using (SqlConnection connect = new SqlConnection(connectionString)) { string updateQueryCompletedDate = @"Update Conversions SET CompletedDate = NULL WHERE ID = @ID"; SqlCommand command2 = new SqlCommand(updateQueryCompletedDate, connect); command2.Parameters.AddWithValue("ID", item1.ID); connect.Open(); int resultCompletedDate = Convert.ToInt32(command2.ExecuteScalar()); connect.Close(); } } //Close Update Window this.Close(); }
public BroadcastGlobal.Body.BroadcastRec.SourceID setSourceID(SourceID value) { this.m_SubFields = value.m_SubFields; return(this); }
public bool notEquals(SourceID value) { return(!this.isEqual(value)); }
void prepareSync(int eState, SourceID oSrcID) { setState(eState); m_bIsSearch = eState == esSearch; m_bStopByUser = false; m_nErrCode = RhoAppAdapter.ERR_NONE; m_strError = ""; m_strServerError = ""; m_bIsSchemaChanged = false; loadAllSources(); m_strSession = loadSession(); if ( isSessionExist() ) { m_clientID = loadClientID(); if ( m_nErrCode == RhoAppAdapter.ERR_NONE ) { getNotify().cleanLastSyncObjectCount(); doBulkSync(); return; } }else m_nErrCode = RhoAppAdapter.ERR_CLIENTISNOTLOGGEDIN; SyncSource src = null; if ( oSrcID != null ) src = findSource(oSrcID); if ( src != null ) { src.m_nErrCode = m_nErrCode; src.m_strError = m_strError; getNotify().fireSyncNotification(src, true, src.m_nErrCode, ""); }else { getNotify().fireAllSyncNotifications(true, m_nErrCode, m_strError, ""); } stopSync(); }
public void doSyncSource(SourceID oSrcID) { SyncSource src = null; try { prepareSync(esSyncSource, oSrcID); if ( isContinueSync() ) { src = findSource(oSrcID); if ( src != null ) { LOG.INFO("Started synchronization of the data source: " + src.getName() ); src.sync(); getNotify().fireSyncNotification(src, true, src.m_nErrCode, src.m_nErrCode == RhoAppAdapter.ERR_NONE ? RhoAppAdapter.getMessageText("sync_completed") : ""); }else { // LOG.ERROR( "Sync one source : Unknown Source " + oSrcID.toString() ); src = new SyncSource(this, getUserDB()); //src.m_strError = "Unknown sync source."; src.m_nErrCode = RhoAppAdapter.ERR_RUNTIME; throw new Exception("Sync one source : Unknown Source " + oSrcID.toString() ); } } } catch(Exception exc) { LOG.ERROR("Sync source " + oSrcID.toString() + " failed.", exc); if ( src != null && src.m_nErrCode == RhoAppAdapter.ERR_NONE ) src.m_nErrCode = RhoAppAdapter.ERR_RUNTIME; getNotify().fireSyncNotification(src, true, src.m_nErrCode, "" ); } getNotify().cleanCreateObjectErrors(); if ( getState() != esExit ) setState(esNone); }
SyncSource findSource(SourceID oSrcID) { for( int i = 0; i < (int)m_sources.size(); i++ ) { SyncSource src = (SyncSource)m_sources.elementAt(i); if ( oSrcID.isEqual(src) ) return src; } return null; }
/* * @param value - the value this ID should be set to. */ public void setAs(SourceID value) { this.m_SubFields = value.getSubFields(); }
/// <summary> /// Print the object's XML to the XmlWriter. /// </summary> /// <param name="objWriter">XmlTextWriter to write with.</param> public void Print(XmlTextWriter objWriter) { objWriter.WriteStartElement("lifestyle"); objWriter.WriteElementString("name", DisplayNameShort); objWriter.WriteElementString("cost", _intCost.ToString()); objWriter.WriteElementString("totalmonthlycost", TotalMonthlyCost.ToString()); objWriter.WriteElementString("totalcost", TotalCost.ToString()); objWriter.WriteElementString("dice", _intDice.ToString()); objWriter.WriteElementString("multiplier", _intMultiplier.ToString()); objWriter.WriteElementString("months", _intMonths.ToString()); objWriter.WriteElementString("purchased", _blnPurchased.ToString()); objWriter.WriteElementString("lifestylename", _strLifestyleName); objWriter.WriteElementString("type", _objType.ToString()); objWriter.WriteElementString("sourceid", SourceID.ToString()); string strBaseLifestyle = string.Empty; // Retrieve the Advanced Lifestyle information if applicable. if (!string.IsNullOrEmpty(_strBaseLifestyle)) { XmlDocument objXmlDocument = XmlManager.Instance.Load("lifestyles.xml"); XmlNode objXmlAspect = objXmlDocument.SelectSingleNode("/chummer/lifestyles/lifestyle[id = \"" + SourceID + "\"]"); if (objXmlAspect != null) { if (objXmlAspect["translate"] != null) { strBaseLifestyle = objXmlAspect["translate"].InnerText; } else if (objXmlAspect["name"] != null) { strBaseLifestyle = objXmlAspect["name"].InnerText; } } } objWriter.WriteElementString("baselifestyle", strBaseLifestyle); objWriter.WriteElementString("trustfund", _blnTrustFund.ToString()); objWriter.WriteElementString("source", _objCharacter.Options.LanguageBookShort(_strSource)); objWriter.WriteElementString("page", Page); objWriter.WriteStartElement("qualities"); // Retrieve the Qualities for the Advanced Lifestyle if applicable. if (_lstLifestyleQualities.Count > 0) { foreach (LifestyleQuality objQuality in _lstLifestyleQualities) { objQuality.Print(objWriter); } } // Retrieve the free Grids for the Advanced Lifestyle if applicable. if (FreeGrids.Count > 0) { foreach (LifestyleQuality objQuality in FreeGrids) { string strThisQuality = objQuality.DisplayName; objWriter.WriteElementString("quality", strThisQuality); } } objWriter.WriteEndElement(); if (_objCharacter.Options.PrintNotes) { objWriter.WriteElementString("notes", _strNotes); } objWriter.WriteEndElement(); }
/* * @param value - the ID this should be compared to. */ public bool isEquals(SourceID value) { return (m_SubFields == value.getSubFields()); }
public static int ConnectToNetworkPeer(int hostId, string address, int port, int exceptionConnectionId, int relaySlotId, NetworkID network, SourceID source, NodeID node, out byte error) => ConnectToNetworkPeer(hostId, address, port, exceptionConnectionId, relaySlotId, network, source, node, 0, 0f, out error);
/* * @param value - the ID this should be compared to. */ public bool notEquals(SourceID value) { return (m_SubFields != value.getSubFields()); }
/// <summary> /// Print the object's XML to the XmlWriter. /// </summary> /// <param name="objWriter">XmlTextWriter to write with.</param> public void Print(XmlTextWriter objWriter, CultureInfo objCulture) { objWriter.WriteStartElement("lifestyle"); objWriter.WriteElementString("name", Name); objWriter.WriteElementString("cost", _decCost.ToString(_objCharacter.Options.NuyenFormat, objCulture)); objWriter.WriteElementString("totalmonthlycost", TotalMonthlyCost.ToString(_objCharacter.Options.NuyenFormat, objCulture)); objWriter.WriteElementString("totalcost", TotalCost.ToString(_objCharacter.Options.NuyenFormat, objCulture)); objWriter.WriteElementString("dice", _intDice.ToString(objCulture)); objWriter.WriteElementString("multiplier", _decMultiplier.ToString(_objCharacter.Options.NuyenFormat, objCulture)); objWriter.WriteElementString("months", _intMonths.ToString(objCulture)); objWriter.WriteElementString("purchased", _blnPurchased.ToString()); objWriter.WriteElementString("type", _objType.ToString()); objWriter.WriteElementString("sourceid", SourceID.ToString()); string strBaseLifestyle = string.Empty; // Retrieve the Advanced Lifestyle information if applicable. if (!string.IsNullOrEmpty(_strBaseLifestyle)) { XmlNode objXmlAspect = MyXmlNode; if (objXmlAspect != null) { if (objXmlAspect["translate"] != null) { strBaseLifestyle = objXmlAspect["translate"].InnerText; } else if (objXmlAspect["name"] != null) { strBaseLifestyle = objXmlAspect["name"].InnerText; } } } objWriter.WriteElementString("baselifestyle", strBaseLifestyle); objWriter.WriteElementString("trustfund", _blnTrustFund.ToString()); objWriter.WriteElementString("source", _objCharacter.Options.LanguageBookShort(_strSource)); objWriter.WriteElementString("page", Page); objWriter.WriteStartElement("qualities"); // Retrieve the Qualities for the Advanced Lifestyle if applicable. if (_lstLifestyleQualities.Count > 0) { foreach (LifestyleQuality objQuality in _lstLifestyleQualities) { objQuality.Print(objWriter, objCulture); } } // Retrieve the free Grids for the Advanced Lifestyle if applicable. if (FreeGrids.Count > 0) { foreach (LifestyleQuality objQuality in FreeGrids) { string strThisQuality = objQuality.DisplayName; objWriter.WriteElementString("quality", strThisQuality); } } objWriter.WriteEndElement(); if (_objCharacter.Options.PrintNotes) { objWriter.WriteElementString("notes", _strNotes); } objWriter.WriteEndElement(); }
public ReceiveRec() { m_SourceID = new SourceID(); m_MessagePayload = new MessagePayload(); }