public void Equals_string_to_rid(string rid) { var value = rid; var expected = new Rid(rid); Assert.True(value == expected); Assert.True(expected == value); }
/// <summary> /// Returns true if QueryResponseBody instances are equal /// </summary> /// <param name="other">Instance of QueryResponseBody to be compared</param> /// <returns>Boolean</returns> public bool Equals(QueryResponseBody other) { // credit: http://stackoverflow.com/a/10454552/677735 if (other == null) { return(false); } return (( Rid == other.Rid || Rid != null && Rid.Equals(other.Rid) ) && ( Count == other.Count || Count != null && Count.Equals(other.Count) ) && ( ResourceArray == other.ResourceArray || ResourceArray != null && ResourceArray.Equals(other.ResourceArray) )); }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { // credit: http://stackoverflow.com/a/263416/677735 unchecked // Overflow is fine, just wrap { var hash = 41; // Suitable nullity checks etc, of course :) if (Rid != null) { hash = hash * 57 + Rid.GetHashCode(); } if (Count != null) { hash = hash * 57 + Count.GetHashCode(); } if (ResourceArray != null) { hash = hash * 57 + ResourceArray.GetHashCode(); } return(hash); } }
public static void Main(String[] args) { JobQueue jq = new JobQueue(); // One user submits three jobs at time=27 Rid rid1 = jq.Submit(new Ip("62.150.83.11"), 27); _ = jq.Submit(new Ip("62.150.83.11"), 27); // One user submits three jobs at time=27 Rid rid3 = jq.Submit(new Ip("62.150.83.11"), 27); // One job is executed jq.ExecuteOne(); // Another user submits two jobs at time=55 _ = jq.Submit(new Ip("130.225.17.5"), 55); _ = jq.Submit(new Ip("130.225.17.5"), 55); // One more job is executed jq.ExecuteOne(); // The first user tries to cancel his first and last job jq.Cancel(rid1); jq.Cancel(rid3); // The remaining jobs are executed while (jq.ExecuteOne() != null) { } }
private int GetNeueNummer() { int Rid; string RechnungID = (DateTime.Now.Year).ToString() + "5000"; Int32.TryParse(RechnungID, out Rid); var q = this.priProRechnungTableAdapter.ScalarQueryMaxID(); if (q != null) { int liefer; if (Int32.TryParse(q.ToString(), out liefer)) { Rid = liefer + 1; } // die Jahreszahlumstellung string LidJahrString = Rid.ToString().Substring(0, 4); string aktuellesJahrString = (DateTime.Now.Year).ToString(); if (LidJahrString.Equals(aktuellesJahrString) == false) { string neuLid = (DateTime.Now.Year).ToString() + "0001"; Int32.TryParse(neuLid, out Rid); } } return(Rid); }
public static byte[] UploadSalt(this IOMSConnection conn) { byte[] data = null; Rid rid = new Rid(37U); Aid aid = new Aid(2449U); Value obj = null; int requestID = -1; Error error = conn.ClientSession.GetVariableRemote(rid, aid, ref obj, ref requestID); if (error.Failed) { return(null); } using (obj) { Blob blob = null; error = obj.GetValue(ref blob); if (error.Succeeded) { if (blob != null) { error = blob.GetData(ref data); blob.Dispose(); } } } if (!error.Failed) { return(data); } return(null); }
public static void TestStop(this ClientSession clientSession) { Rid rid = new Rid(52U); Value obj = new Value(1); Aid aid = new Aid(2167U); int requestID = 0; Error error = clientSession.SetVariableRemote(rid, aid, obj, 1, ref requestID); }
public void Cancel(Rid rid) { if (jobs.Remove(rid, out IPriorityQueueHandle <Job> h)) { Job job = jobQueue.Delete(h); userJobs.Remove(job.ip); Console.WriteLine("Cancelled {0}", job); } }
public void Cancel(Rid rid) { if (_jobs.Remove(rid, out IPriorityQueueHandle <Job> h)) { var job = _jobQueue.Delete(h); _userJobs.Remove(job.Ip); Console.WriteLine($"Cancelled {job}"); } }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { // credit: http://stackoverflow.com/a/263416/677735 unchecked // Overflow is fine, just wrap { var hash = 41; // Suitable nullity checks etc, of course :) if (Rid != null) { hash = hash * 57 + Rid.GetHashCode(); } if (Count != null) { hash = hash * 57 + Count.GetHashCode(); } if (ResourceArray != null) { hash = hash * 57 + ResourceArray.GetHashCode(); } if (Date != null) { hash = hash * 57 + Date.GetHashCode(); } if (XMsItemCount != null) { hash = hash * 57 + XMsItemCount.GetHashCode(); } if (XMsContinuation != null) { hash = hash * 57 + XMsContinuation.GetHashCode(); } if (XMsRequestCharge != null) { hash = hash * 57 + XMsRequestCharge.GetHashCode(); } if (XMsActivityId != null) { hash = hash * 57 + XMsActivityId.GetHashCode(); } if (XMsSessionToken != null) { hash = hash * 57 + XMsSessionToken.GetHashCode(); } return(hash); } }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { // credit: http://stackoverflow.com/a/263416/677735 unchecked // Overflow is fine, just wrap { var hash = 41; // Suitable nullity checks etc, of course :) if (ContentType != null) { hash = hash * 57 + ContentType.GetHashCode(); } if (Slug != null) { hash = hash * 57 + Slug.GetHashCode(); } if (UserAgent != null) { hash = hash * 57 + UserAgent.GetHashCode(); } if (Id != null) { hash = hash * 57 + Id.GetHashCode(); } if (Rid != null) { hash = hash * 57 + Rid.GetHashCode(); } if (Ts != null) { hash = hash * 57 + Ts.GetHashCode(); } if (Self != null) { hash = hash * 57 + Self.GetHashCode(); } if (Etag != null) { hash = hash * 57 + Etag.GetHashCode(); } if (Permissions != null) { hash = hash * 57 + Permissions.GetHashCode(); } return(hash); } }
public void Deserializes_string_to_rid(string ridString) { var sut = GetSut(); var settings = new JsonSerializerSettings(); settings.Converters.Add(sut); var json = JsonConvert.SerializeObject(new Dummy { Rid = ridString }, settings); var rid = JsonConvert.DeserializeObject<Dummy>(json, settings); var expected = new Rid(12, 0); Assert.Equal(expected, rid.Rid); }
public void Serializes_rid_to_string() { var sut = GetSut(); var rid = new Rid(12, 0); var settings = new JsonSerializerSettings(); settings.Converters.Add(sut); var json = JsonConvert.SerializeObject(rid, settings); Assert.Equal(@"""#12:0""", json); }
/// <summary> /// Returns true if AttachmentRaw instances are equal /// </summary> /// <param name="other">Instance of AttachmentRaw to be compared</param> /// <returns>Boolean</returns> public bool Equals(AttachmentRaw other) { // credit: http://stackoverflow.com/a/10454552/677735 if (other == null) { return(false); } return (( ContentType == other.ContentType || ContentType != null && ContentType.Equals(other.ContentType) ) && ( Slug == other.Slug || Slug != null && Slug.Equals(other.Slug) ) && ( UserAgent == other.UserAgent || UserAgent != null && UserAgent.Equals(other.UserAgent) ) && ( Id == other.Id || Id != null && Id.Equals(other.Id) ) && ( Rid == other.Rid || Rid != null && Rid.Equals(other.Rid) ) && ( Ts == other.Ts || Ts != null && Ts.Equals(other.Ts) ) && ( Self == other.Self || Self != null && Self.Equals(other.Self) ) && ( Etag == other.Etag || Etag != null && Etag.Equals(other.Etag) ) && ( Permissions == other.Permissions || Permissions != null && Permissions.Equals(other.Permissions) )); }
/// <summary> /// Returns true if QueryResourceResponseBody instances are equal /// </summary> /// <param name="other">Instance of QueryResourceResponseBody to be compared</param> /// <returns>Boolean</returns> public bool Equals(QueryResourceResponseBody other) { // credit: http://stackoverflow.com/a/10454552/677735 if (other == null) { return(false); } return (( Rid == other.Rid || Rid != null && Rid.Equals(other.Rid) ) && ( Count == other.Count || Count != null && Count.Equals(other.Count) ) && ( ResourceArray == other.ResourceArray || ResourceArray != null && ResourceArray.Equals(other.ResourceArray) ) && ( Date == other.Date || Date != null && Date.Equals(other.Date) ) && ( XMsItemCount == other.XMsItemCount || XMsItemCount != null && XMsItemCount.Equals(other.XMsItemCount) ) && ( XMsContinuation == other.XMsContinuation || XMsContinuation != null && XMsContinuation.Equals(other.XMsContinuation) ) && ( XMsRequestCharge == other.XMsRequestCharge || XMsRequestCharge != null && XMsRequestCharge.Equals(other.XMsRequestCharge) ) && ( XMsActivityId == other.XMsActivityId || XMsActivityId != null && XMsActivityId.Equals(other.XMsActivityId) ) && ( XMsSessionToken == other.XMsSessionToken || XMsSessionToken != null && XMsSessionToken.Equals(other.XMsSessionToken) )); }
public void Equals_between_different_references() { var value = new Rid(0, 0); var expected = new Rid(0, 0); Assert.True(value == expected); Assert.True(expected == value); Assert.True(value.Equals(expected)); Assert.True(expected.Equals(value)); Assert.Equal(value, expected); Assert.Equal(expected, value); }
private Context BuildContext() { var context = new Context(); context.CurrentPlatform = Rid == null?Platform.Current() : Rid.StartsWith("win") ? Platform.Value.Windows : Rid.StartsWith("osx") ? Platform.Value.MacOs : Platform.Value.Linux; context.TempPublishPath = Path.Combine(ProjectFileOrFolder, "dotnetwarp_temp"); return(context); }
public Rid Submit(Ip ip, int time) { int jobCount = userJobs.ContainsCount(ip); Rid rid = new Rid(); Job job = new Job(rid, ip, time + 60 * jobCount); IPriorityQueueHandle <Job> h = null; jobQueue.Add(ref h, job); userJobs.Add(ip); jobs.Add(rid, h); Console.WriteLine("Submitted {0}", job); return(rid); }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { // credit: http://stackoverflow.com/a/263416/677735 unchecked // Overflow is fine, just wrap { var hash = 41; // Suitable nullity checks etc, of course :) if (Id != null) { hash = hash * 57 + Id.GetHashCode(); } if (PermissionMode != null) { hash = hash * 57 + PermissionMode.GetHashCode(); } if (Resource != null) { hash = hash * 57 + Resource.GetHashCode(); } if (Rid != null) { hash = hash * 57 + Rid.GetHashCode(); } if (Ts != null) { hash = hash * 57 + Ts.GetHashCode(); } if (Self != null) { hash = hash * 57 + Self.GetHashCode(); } if (Etag != null) { hash = hash * 57 + Etag.GetHashCode(); } if (Token != null) { hash = hash * 57 + Token.GetHashCode(); } return(hash); } }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { // credit: http://stackoverflow.com/a/263416/677735 unchecked // Overflow is fine, just wrap { var hash = 41; // Suitable nullity checks etc, of course :) if (Id != null) { hash = hash * 57 + Id.GetHashCode(); } if (Rid != null) { hash = hash * 57 + Rid.GetHashCode(); } if (Databases != null) { hash = hash * 57 + Databases.GetHashCode(); } if (Ts != null) { hash = hash * 57 + Ts.GetHashCode(); } if (Self != null) { hash = hash * 57 + Self.GetHashCode(); } if (Etag != null) { hash = hash * 57 + Etag.GetHashCode(); } if (Colls != null) { hash = hash * 57 + Colls.GetHashCode(); } if (Users != null) { hash = hash * 57 + Users.GetHashCode(); } return(hash); } }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { // credit: http://stackoverflow.com/a/263416/677735 unchecked // Overflow is fine, just wrap { var hash = 41; // Suitable nullity checks etc, of course :) if (Id != null) { hash = hash * 57 + Id.GetHashCode(); } if (Body != null) { hash = hash * 57 + Body.GetHashCode(); } if (TriggerOperation != null) { hash = hash * 57 + TriggerOperation.GetHashCode(); } if (TriggerType != null) { hash = hash * 57 + TriggerType.GetHashCode(); } if (Rid != null) { hash = hash * 57 + Rid.GetHashCode(); } if (Ts != null) { hash = hash * 57 + Ts.GetHashCode(); } if (Self != null) { hash = hash * 57 + Self.GetHashCode(); } if (Etag != null) { hash = hash * 57 + Etag.GetHashCode(); } return(hash); } }
/// <summary> /// Returns true if Permission instances are equal /// </summary> /// <param name="other">Instance of Permission to be compared</param> /// <returns>Boolean</returns> public bool Equals(Permission other) { // credit: http://stackoverflow.com/a/10454552/677735 if (other == null) { return(false); } return (( Id == other.Id || Id != null && Id.Equals(other.Id) ) && ( PermissionMode == other.PermissionMode || PermissionMode != null && PermissionMode.SequenceEqual(other.PermissionMode) ) && ( Resource == other.Resource || Resource != null && Resource.Equals(other.Resource) ) && ( Rid == other.Rid || Rid != null && Rid.Equals(other.Rid) ) && ( Ts == other.Ts || Ts != null && Ts.Equals(other.Ts) ) && ( Self == other.Self || Self != null && Self.Equals(other.Self) ) && ( Etag == other.Etag || Etag != null && Etag.Equals(other.Etag) ) && ( Token == other.Token || Token != null && Token.Equals(other.Token) )); }
/// <summary> /// Returns true if Offer instances are equal /// </summary> /// <param name="other">Instance of Offer to be compared</param> /// <returns>Boolean</returns> public bool Equals(Offer other) { // credit: http://stackoverflow.com/a/10454552/677735 if (other == null) { return(false); } return (( OfferType == other.OfferType || OfferType != null && OfferType.Equals(other.OfferType) ) && ( Resource == other.Resource || Resource != null && Resource.Equals(other.Resource) ) && ( OfferResourceId == other.OfferResourceId || OfferResourceId != null && OfferResourceId.Equals(other.OfferResourceId) ) && ( Id == other.Id || Id != null && Id.Equals(other.Id) ) && ( Rid == other.Rid || Rid != null && Rid.Equals(other.Rid) ) && ( Ts == other.Ts || Ts != null && Ts.Equals(other.Ts) ) && ( Self == other.Self || Self != null && Self.Equals(other.Self) ) && ( Etag == other.Etag || Etag != null && Etag.Equals(other.Etag) )); }
/// <summary> /// Returns true if DatabaseCollection instances are equal /// </summary> /// <param name="other">Instance of DatabaseCollection to be compared</param> /// <returns>Boolean</returns> public bool Equals(DatabaseCollection other) { // credit: http://stackoverflow.com/a/10454552/677735 if (other == null) { return(false); } return (( Id == other.Id || Id != null && Id.Equals(other.Id) ) && ( Rid == other.Rid || Rid != null && Rid.Equals(other.Rid) ) && ( Databases == other.Databases || Databases != null && Databases.SequenceEqual(other.Databases) ) && ( Ts == other.Ts || Ts != null && Ts.Equals(other.Ts) ) && ( Self == other.Self || Self != null && Self.Equals(other.Self) ) && ( Etag == other.Etag || Etag != null && Etag.Equals(other.Etag) ) && ( Colls == other.Colls || Colls != null && Colls.Equals(other.Colls) ) && ( Users == other.Users || Users != null && Users.Equals(other.Users) )); }
/// <summary> /// Returns true if Trigger instances are equal /// </summary> /// <param name="other">Instance of Trigger to be compared</param> /// <returns>Boolean</returns> public bool Equals(Trigger other) { // credit: http://stackoverflow.com/a/10454552/677735 if (other == null) { return(false); } return (( Id == other.Id || Id != null && Id.Equals(other.Id) ) && ( Body == other.Body || Body != null && Body.Equals(other.Body) ) && ( TriggerOperation == other.TriggerOperation || TriggerOperation != null && TriggerOperation.Equals(other.TriggerOperation) ) && ( TriggerType == other.TriggerType || TriggerType != null && TriggerType.Equals(other.TriggerType) ) && ( Rid == other.Rid || Rid != null && Rid.Equals(other.Rid) ) && ( Ts == other.Ts || Ts != null && Ts.Equals(other.Ts) ) && ( Self == other.Self || Self != null && Self.Equals(other.Self) ) && ( Etag == other.Etag || Etag != null && Etag.Equals(other.Etag) )); }
public static uint GetProtectionLevelOnline(this ClientSession session) { uint m_OnlineProtectionLevel = 0; Rid rid = new Rid(50U); Aid aid = new Aid(3451U); Value obj = new Value(); int requestID = -1; if (session.GetVariableRemote(rid, aid, ref obj, ref requestID).Succeeded) { obj.GetValue(ref m_OnlineProtectionLevel); } return(m_OnlineProtectionLevel); }
public Rid Submit(Ip ip, int time) { var jobCount = _userJobs.ContainsCount(ip); var rid = new Rid(); var job = new Job(rid, ip, time + 60 * jobCount); IPriorityQueueHandle <Job> h = default; _jobQueue.Add(ref h, job); _userJobs.Add(ip); _jobs.Add(rid, h); Console.WriteLine($"Submitted {job}"); return(rid); }
public async Task RefreshItem(Dictionary <string, string> result, OrientConnection setupConnection, IRestClient setupClient) { var rid = new Rid(Item.IsNew() ? result[Identifier.Sql] : Item.Rid); var select = new Select(new From(rid)); var batch = new OrientQueryBatch(setupConnection, select); var command = new Batch <List <T> >(batch, setupClient); var res = await command.Execute() switch { Result <List <T>, Exception> .OkCase o => o.Payload, Result <List <T>, Exception> .ErrCase e => throw e.Payload, _ => throw new InvalidCastException() }; DbItem = res.FirstOrDefault(); } }
/// <summary> /// Returns true if AttachmentResponse instances are equal /// </summary> /// <param name="other">Instance of AttachmentResponse to be compared</param> /// <returns>Boolean</returns> public bool Equals(AttachmentResponse other) { // credit: http://stackoverflow.com/a/10454552/677735 if (other == null) { return(false); } return (( Id == other.Id || Id != null && Id.Equals(other.Id) ) && ( ContentType == other.ContentType || ContentType != null && ContentType.Equals(other.ContentType) ) && ( Media == other.Media || Media != null && Media.Equals(other.Media) ) && ( Rid == other.Rid || Rid != null && Rid.Equals(other.Rid) ) && ( Ts == other.Ts || Ts != null && Ts.Equals(other.Ts) ) && ( Self == other.Self || Self != null && Self.Equals(other.Self) ) && ( Etag == other.Etag || Etag != null && Etag.Equals(other.Etag) )); }
private void UpdtBTN_Click(object sender, EventArgs e) { using (SqlConnection Connection = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|mainDatabase.mdf;Integrated Security=True;Connect Timeout=30")) { if (Rid.Text == string.Empty) { MessageBox.Show("Missing values"); } else { try { Connection.Open(); SqlCommand cmd = new SqlCommand(@"DELETE FROM Staff where id=Rid.text"); //SQL to delete row from DB int i = cmd.ExecuteNonQuery(); Connection.Close(); if (i == 1) //confirms success or fail { MessageBox.Show("Employee has been removed"); Rid.Clear(); } else { MessageBox.Show("Employee couldn't be removed"); } } catch (Exception ex) { MessageBox.Show("Unexpected error:" + ex.Message); } } } }
private void A_FineReader_Load(object sender, EventArgs e) { SqlConnection conn = SQLbase.getConn(); try { if (conn.State == ConnectionState.Open) { conn.Close(); } conn.Open(); string selectStr = "select * from readers where Rstate > 0"; SqlCommand SelectCmd = new SqlCommand(selectStr, conn); SqlDataReader datareader = SelectCmd.ExecuteReader(); string Rid, Rname, Rgender, Runit, Rtype, Rstate; int rowindex = 0; this.datagridview.Rows.Clear(); while (datareader.Read()) { Rid = datareader["RID"].ToString(); Rname = datareader["Rname"].ToString(); Rgender = datareader["Rgender"].ToString(); Runit = datareader["Runit"].ToString(); Rtype = datareader["Rtype"].ToString(); Rstate = datareader["Rstate"].ToString(); rowindex = this.datagridview.Rows.Add(); //trim函数同于去除字符串两头的空格 this.datagridview.Rows[rowindex].Cells[0].Value = Rid.Trim(); this.datagridview.Rows[rowindex].Cells[1].Value = Rname.Trim(); this.datagridview.Rows[rowindex].Cells[2].Value = Rgender.Trim(); this.datagridview.Rows[rowindex].Cells[3].Value = Runit.Trim(); this.datagridview.Rows[rowindex].Cells[4].Value = Rtype.Trim(); this.datagridview.Rows[rowindex].Cells[5].Value = Rstate.Trim(); } } catch { MessageBox.Show("操作错误!"); } }
/// <summary> /// Returns true if StoredProcedure instances are equal /// </summary> /// <param name="other">Instance of StoredProcedure to be compared</param> /// <returns>Boolean</returns> public bool Equals(StoredProcedure other) { // credit: http://stackoverflow.com/a/10454552/677735 if (other == null) { return(false); } return (( Id == other.Id || Id != null && Id.Equals(other.Id) ) && ( Body == other.Body || Body != null && Body.Equals(other.Body) ) && ( Rid == other.Rid || Rid != null && Rid.Equals(other.Rid) ) && ( Ts == other.Ts || Ts != null && Ts.Equals(other.Ts) ) && ( Self == other.Self || Self != null && Self.Equals(other.Self) ) && ( Etag == other.Etag || Etag != null && Etag.Equals(other.Etag) )); }
/// <summary> /// Returns true if Document instances are equal /// </summary> /// <param name="other">Instance of Document to be compared</param> /// <returns>Boolean</returns> public bool Equals(Document other) { // credit: http://stackoverflow.com/a/10454552/677735 if (other == null) { return(false); } return (( Id == other.Id || Id != null && Id.Equals(other.Id) ) && ( Rid == other.Rid || Rid != null && Rid.Equals(other.Rid) ) && ( Ts == other.Ts || Ts != null && Ts.Equals(other.Ts) ) && ( Self == other.Self || Self != null && Self.Equals(other.Self) ) && ( Etag == other.Etag || Etag != null && Etag.Equals(other.Etag) ) && ( Attachments == other.Attachments || Attachments != null && Attachments.Equals(other.Attachments) )); }
/// <summary> /// Returns true if User instances are equal /// </summary> /// <param name="other">Instance of User to be compared</param> /// <returns>Boolean</returns> public bool Equals(User other) { // credit: http://stackoverflow.com/a/10454552/677735 if (other == null) { return(false); } return (( Id == other.Id || Id != null && Id.Equals(other.Id) ) && ( Rid == other.Rid || Rid != null && Rid.Equals(other.Rid) ) && ( Ts == other.Ts || Ts != null && Ts.Equals(other.Ts) ) && ( Self == other.Self || Self != null && Self.Equals(other.Self) ) && ( Etag == other.Etag || Etag != null && Etag.Equals(other.Etag) ) && ( Permissions == other.Permissions || Permissions != null && Permissions.Equals(other.Permissions) )); }
public void Not_equals_between_different_references() { var value = new Rid(0, 0); var expected = new Rid(0, 1); Assert.True(value != expected); Assert.True(expected != value); Assert.False(value.Equals(expected)); Assert.False(expected.Equals(value)); Assert.NotEqual(value, expected); Assert.NotEqual(expected, value); }
public void Not_equals_string_to_rid(string rid, string rid2) { var value = rid; var expected = new Rid(rid2); Assert.True(value != expected); Assert.True(expected != value); }
public void New_instance_is_Indeternimate() { var result = new Rid(); Assert.True(result.IsIndeterminated); }
public void Indeterninatable_rid_values(short clusterId, long rowId) { var result = new Rid(clusterId, rowId); Assert.True(result.IsIndeterminated); }
public void Indeterminatable_rid_string(string rid) { var result = new Rid(rid); Assert.True(result.IsIndeterminated); }