/* Decrease Remaining, Update Button, and Close with Yes Result on 0. */ private void TmrConfirm_Tick(object sender, EventArgs e) { Remaining--; btnYes.Text = Remaining.ToString(); if (Remaining == 0) { DialogResult = DialogResult.Yes; Close(); } }
protected void Page_Load(object sender, EventArgs e) { SqlCommand cmd = new SqlCommand("select AccountMaster.MemberID ,tblmembermaster.UserName,Sum(case when dateoftransaction>=getdate()then isnull(Credit,0) else 0 end) as Remaining, Sum(case when dateoftransaction<getdate()then isnull(Credit,0) else 0 end) as Paid,Sum(Credit) as Total from AccountMaster Inner Join tblMemberMaster on AccountMaster.MemberID=tblMemberMaster.UserCode WHERE TxnType=3 Group by AccountMaster.MemberID,tblmembermaster.UserName", con); SqlDataAdapter da = new SqlDataAdapter(cmd); using (DataTable dt = new DataTable()) { da.Fill(dt); GridView1.DataSource = dt; GridView1.DataBind(); total = dt.AsEnumerable().Sum(row => row.Field <decimal>("Total")); Paid = dt.AsEnumerable().Sum(row => row.Field <decimal>("Paid")); Remaining = dt.AsEnumerable().Sum(row => row.Field <decimal>("Remaining")); GridView1.FooterRow.Cells[2].Text = "Total"; GridView1.FooterRow.Cells[3].Text = total.ToString(); GridView1.FooterRow.Cells[4].Text = Paid.ToString(); GridView1.FooterRow.Cells[5].Text = Remaining.ToString(); } }
public override void GetProperties(ObjectPropertyList list) { if (Expires > DateTime.UtcNow) { if (DisplaySeconds) { list.Add(1072517, Remaining.ToString()); // Lifespan: ~1_val~ seconds } else { TimeSpan t = Expires - DateTime.UtcNow; int weeks = t.Days / 7; int days = t.Days; int hours = t.Hours; int minutes = t.Minutes; if (weeks > 1) { list.Add(1153092, (t.Days / 7).ToString()); // Lifespan: ~1_val~ weeks } else if (days > 1) { list.Add(1153091, t.Days.ToString()); // Lifespan: ~1_val~ days } else if (hours > 1) { list.Add(1153090, t.Hours.ToString()); // Lifespan: ~1_val~ hours } else if (minutes > 1) { list.Add(1153089, t.Minutes.ToString()); // Lifespan: ~1_val~ minutes } else { list.Add(1072517, t.Seconds.ToString()); // Lifespan: ~1_val~ seconds } } } }
/// <summary> /// Saves the door definition /// </summary> /// <param name="writer">XML writer handle</param> /// <returns></returns> public override bool Save(XmlWriter writer) { if (writer == null) { return(false); } writer.WriteStartElement(Tag); writer.WriteAttributeString("color", MessageColor.ToArgb().ToString()); writer.WriteAttributeString("mustface", MustFace.ToString()); writer.WriteAttributeString("direction", Direction.ToString()); writer.WriteAttributeString("remaining", Remaining.ToString()); writer.WriteAttributeString("soundname", SoundName); writer.WriteAttributeString("loopsound", LoopSound.ToString()); writer.WriteAttributeString("displayborder", DisplayBorder.ToString()); writer.WriteAttributeString("intelligence", Intelligence.ToString()); writer.WriteAttributeString("message", Message); writer.WriteAttributeString("picturename", PictureName); // writer.WriteStartElement("text"); writer.WriteString(Text); writer.WriteEndElement(); foreach (ScriptChoice choice in Choices) { choice.Save(writer); } base.Save(writer); writer.WriteEndElement(); return(true); }
public bool PeekWord(string word) { return(Start + word.Length <= Remaining.Length && Remaining.ToString(Start, word.Length) == word); }
/* Start Timer and Change Button to Time Remaining. */ private void BtnYes_MouseDown(object sender, MouseEventArgs e) { tmrConfirm.Enabled = true; btnYes.Text = Remaining.ToString(); }