public void Is_toggled() { var clearing = new Clearing(2, false, true); Assert.IsTrue(clearing.TSpin); Assert.AreEqual(2, clearing.Rows); }
/// <summary> /// Processes the clearing file. /// </summary> public async virtual Task Process() { // Deserialize clearing file into a Clearing object. ClearingParser clearingParser = new ClearingParser(Context.Log); Clearing clearing = clearingParser.Parse(FileName, Stream); if (clearing != null) { foreach (ClearingData clearingData in clearing.DataRecords) { if (clearingData != null) { // Add a redeemed deal record to the data store for the transaction. RedeemedDeal redeemedDeal = new RedeemedDeal(); ResultCode result = AddRedeemedDealRecord(clearingData, redeemedDeal); // If the redeemed deal record was added successfully, update rewards. if (result == ResultCode.Created) { await AddRedemptionRewards(redeemedDeal.Id).ConfigureAwait(false); } } } } }
public void Sets_rows_cleared(int rows) { var clearing = new Clearing(rows, false, false); Assert.IsFalse(clearing.TSpin); Assert.AreEqual(rows, clearing.Rows); }
public AddClearingForm(Clearing newClearing) { InitializeComponent(); controller = new AddClearingController(); clearing = newClearing; dateTimePicker.Text = clearing.Date; weightBefore = clearing.WeightBefore; textBoxWeightAfter.Text = clearing.WeightAfter; }
private void changeClearButton_Click(object sender, EventArgs e) { if (labelDateClear.Text != "") { Clearing clearing = new Clearing(Convert.ToString(dataGridViewRaw.CurrentRow.Cells[0].Value), Convert.ToString(dataGridViewRaw.CurrentRow.Cells[8].Value), labelDateClear.Text, Convert.ToString(dataGridViewRaw.CurrentRow.Cells[7].Value), labelWeightAfterClear.Text); controller.changeButtonClearClick(clearing); selectClear(); } else { MessageBox.Show("Добавьте запись!", "Очистка!", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public static string ReciverName(this Clearing clearing, Requester requester, int requesterId) { if (requester == Requester.Company) { if (clearing.ToCompanyId == requesterId) { if (clearing.FromClient != null) { return(clearing.Note); } } if (clearing.FromCompanyId == requesterId) { return(clearing.Note); } } return(""); }
public static string GetTypeName(this Clearing clearing, Requester requester, int objectId) { if (requester == Requester.Agent) { if (clearing.FromClientId == objectId) { if (clearing.IsIncome) { return("قبض"); } return("صرف"); } if (clearing.ToClientId == objectId) { if (clearing.IsIncome) { return("صرف له"); } return("قبض منه"); } } if (requester == Requester.Company) { if (clearing.FromCompanyId == objectId) { if (clearing.IsIncome) { return("قبض"); } return("صرف"); } if (clearing.ToCompanyId == objectId) { if (clearing.IsIncome) { return("صرف له"); } return("قبض منه"); } } return("GetTypeName"); }
private void saveButton_Click(object sender, EventArgs e) { weightBefore = weightBefore.Replace(",", "."); string weightAfter = textBoxWeightAfter.Text.Replace(",", "."); if (Convert.ToDouble(weightBefore) >= Convert.ToDouble(weightAfter)) { if (clearing == null) { clearing = new Clearing(idRaw, idContractor, dateTimePicker.Text, weightBefore != "" ? weightBefore : "null", weightAfter != "" ? weightAfter : "null"); if (controller.onSaveClick(clearing, raw, false)) { this.Close(); } else { clearing = null; } } else { clearing.Date = dateTimePicker.Text; clearing.WeightBefore = weightBefore != "" ? weightBefore : "null"; clearing.WeightAfter = weightAfter != "" ? weightAfter : "null"; if (controller.onSaveClick(clearing, raw, true)) { this.Close(); } else { clearing = null; } } } else { MessageBox.Show(String.Format("Вес не должен превышать {0} тонн(ы)!", weightBefore), "Сушка!", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public static string GetSenderName(this Clearing clearing, Requester requester, int requeserId) { if (requester == Requester.Company) { if (clearing.ToCompanyId == requeserId) { if (clearing.FromClient != null) { return(clearing.FromClient.FullName); } } if (clearing.FromCompanyId == requeserId) { if (clearing.ToClient != null) { return(clearing.Note + "/" + clearing.ToClient.FullName); } } } return(""); }
public static string GetNote(this Clearing clearing, Requester requester, int objectId) { string note = clearing.Note; if (clearing.ToClientId != null && (clearing.ToClientId != objectId || requester != Requester.Agent)) { return(note + "/" + clearing.ToClient.FullName); } if (clearing.FromClientId != null && (clearing.FromClientId != objectId || requester != Requester.Agent)) { return(note + "/" + clearing.FromClient.FullName); } if (clearing.ToCompanyId != null && (clearing.ToCompanyId != objectId || requester != Requester.Company)) { return(note + "/" + clearing.ToCompany.Name); } if (clearing.FromCompanyId != null && (clearing.FromCompanyId != objectId || requester != Requester.Company)) { return(note + "/" + clearing.FromCompany.Name); } return("GetNoteClearing"); }
private void RemoteTargetCallStackClear() { // Fire clearing event Clearing.Raise(this, EventArgs.Empty); // Reset CurrentStackLevel = 0; // Clear call stack window m_callStackEditor.View = null; // Remote items from the collection if (m_callStackCollection != null) { m_callStackCollection.CallStack.Clear(); } // Rebind with a context m_callStackEditor.View = m_callStackCollection; // Fire cleared event Cleared.Raise(this, EventArgs.Empty); }
public void Clear() { Clearing?.Invoke(this, EventArgs.Empty); }
/// <summary> /// Коллекция в процессе очищения /// </summary> private void OnTaskSendCollectionClearing() { Clearing?.Invoke(this, new AlarmClearCommandEventArgs()); }
public Clearing ObtenerInfoClering(string xPathXML) { Clearing Temporal = new Clearing(); var Registro = from c in XElement.Load(xPathXML).Elements("consulta_documento") select c; // Execute the query foreach (var DatosPersonales in Registro) { Temporal.Nombre = (string)DatosPersonales.Element("nom1"); Temporal.Apellido = (string)DatosPersonales.Element("ape1"); Temporal.Snombre = (string)DatosPersonales.Element("nom2"); Temporal.Documento = (string)DatosPersonales.Element("nro_identificacion"); Temporal.Segundoapellido = (string)DatosPersonales.Element("ape2"); Temporal.Civil = (string)(DatosPersonales.Element("estado_civil")); Temporal.Nacimiento = (string)DatosPersonales.Element("fecha_nacimiento"); Temporal.Sexo = (string)DatosPersonales.Element("sexo"); Temporal.Nacionalidad = (int)DatosPersonales.Element("nacionalidad"); Temporal.Codigo = (string)DatosPersonales.Element("cod_identificacion"); Temporal.Cancelaciones = (int)DatosPersonales.Element("resumen").Element("cancelaciones"); Temporal.Incumplimientos = (int)DatosPersonales.Element("resumen").Element("incumplimientos"); } Registro = from c in XElement.Load(xPathXML).Elements("consulta_incumplimientos").Elements("incumplimiento") select c; List <ClearinIncumplimiento> L = new List <ClearinIncumplimiento>(); foreach (var Incumplimientos in Registro) { ClearinIncumplimiento IC = new ClearinIncumplimiento(); IC.Compra = (string)Incumplimientos.Element("fecha_compra"); IC.Empresa = (string)Incumplimientos.Element("empresa"); IC.Fecha = (string)Incumplimientos.Element("fecha_registro"); IC.Lugar = (string)Incumplimientos.Element("centro"); IC.Moneda = (string)Incumplimientos.Element("moneda_saldo"); IC.Monto = (string)Incumplimientos.Element("monto_saldo"); L.Add(IC); } Temporal.DatosIncumplidos1 = L; Registro = from c in XElement.Load(xPathXML).Elements("consulta_documento").Elements("domicilio") select c; // Execute the query foreach (var Domicilio in Registro) { Temporal.Calle = (string)Domicilio.Element("direccion"); Temporal.Ciudad = (string)Domicilio.Element("localidad"); } return(Temporal); }
public void changeButtonClearClick(Clearing clearing) { new AddClearingForm(clearing).ShowDialog(); }
public void Clear() { Clearing.Execute(); m_data.Clear(); Modified.Execute(); }
public void Clear() { Clearing.Execute(); m_base.Clear(); Modified.Execute(); }
/* ----------------------------------------------------------------- */ /// /// OnClearing /// /// <summary> /// Clearing イベントを発生させます。 /// </summary> /// /* ----------------------------------------------------------------- */ protected virtual void OnClearing(CancelEventArgs e) => Clearing?.Invoke(this, e);
//public int clockVal = 0; // Use this for initialization void Start() { //clock.text = "Clock: " + clockVal.ToString (); _clock = clock.GetComponent <ClockScript>(); s_clear = b_clear.GetComponent <Clearing> (); }
/// <summary>Fires the 'Clearing' event</summary> protected virtual void OnClearing() { Clearing?.Invoke(this, EventArgs.Empty); }
/// <summary> /// Clear all styles from the given element and its descendant nodes /// </summary> /// <param name="element">An OE or T node</param> /// <param name="clearing">Exactly which color stylings to remove</param> public void Clear(XElement element, Clearing clearing) { var attr = element.Attribute("style"); if (attr != null) { if (clearing == Clearing.All) { // discard all styling attr.Remove(); } else if (clearing == Clearing.Gray) { var colorfulCss = ClearGrays(new Style(attr.Value)); if (!string.IsNullOrEmpty(colorfulCss)) { // found explicit colors attr.Value = colorfulCss; } else { // no explicit colors so discard everything else attr.Remove(); } } } if (element.HasElements) { foreach (var child in element.Elements()) { Clear(child, clearing); } } // CData var data = element.Nodes() .Where(n => n.NodeType == XmlNodeType.CDATA && ((XCData)n).Value.Contains("span")) .Cast <XCData>(); if (data?.Any() == true) { var builder = new StringBuilder(); foreach (var cdata in data) { var wrapper = cdata.GetWrapper(); foreach (var node in wrapper.Nodes()) { if (node.NodeType == XmlNodeType.Element) { var e = node as XElement; if (e.Name.LocalName == "span") { // presume spans within cdata are flat and only contain text if (clearing == Clearing.All) { // discard all styling builder.Append(e.Value); } else { // TODO: edit e.Value builder.Append(e.Value); } } } if (node.NodeType == XmlNodeType.Text) { // handle text, whitespace, significant-whitespace, et al? builder.Append(((XText)node).Value); } } // TODO: replace cdata.value here? } } }
public bool onSaveClick(Clearing clearing, string raw, bool forChange) { if (!forChange) { string[] classes = DAO.getInstance().getClasses(raw); if (classes.Length > 0) { LinkedList <FormValue <string, string> > valueH = DAO.getInstance().defineStateForClass(clearing.IdRaw, classes[classes.Length - 1], HarmfulLevelOfQualityNorm.NormAttr, HarmfulLevelOfQualityNorm.NameTable, HarmfulLevelOfQualityNorm.TypeOfLevelQualityAttr); FormValue <string, string>[] valueHarmful = valueH.ToArray <FormValue <string, string> >(); LinkedList <FormValue <string, string> > valueW = DAO.getInstance().defineStateForClass(clearing.IdRaw, classes[classes.Length - 1], WeedLevelOfQualityNorm.NormAttr, WeedLevelOfQualityNorm.NameTable, WeedLevelOfQualityNorm.TypeOfLevelQualityAttr); FormValue <string, string>[] valueWeed = valueW.ToArray <FormValue <string, string> >(); LinkedList <FormValue <string, string> > valueG = DAO.getInstance().defineStateForClass(clearing.IdRaw, classes[classes.Length - 1], GrainLevelOfQualityNorm.NormAttr, GrainLevelOfQualityNorm.NameTable, GrainLevelOfQualityNorm.TypeOfLevelQualityAttr); FormValue <string, string>[] valueGrain = valueG.ToArray <FormValue <string, string> >(); if (!DAO.getInstance().addClearing(clearing.Date, clearing.IdRaw, clearing.WeightBefore, clearing.WeightAfter, valueHarmful, valueWeed, valueGrain, clearing.IdContractor)) { MessageBox.Show("Данная запись уже существует!", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } else { DAO.getInstance().updateNote("Storage", new FormValue <string, string>("id_raw", clearing.IdRaw), new FormValue <string, string>("id_class", Convert.ToString(classes.Length - 1))); return(true); } } else { string[] typeAndSubtype = DAO.getInstance().selectTypeAndSubtype(clearing.IdRaw); string type = typeAndSubtype[0]; LinkedList <FormValue <string, string> > valueH = DAO.getInstance().defineState(clearing.IdRaw, type, HarmfulLevelOfQualityNorm.NormAttr, HarmfulLevelOfQualityNorm.NameTable, HarmfulLevelOfQualityNorm.TypeOfLevelQualityAttr); FormValue <string, string>[] valueHarmful = valueH.ToArray <FormValue <string, string> >(); LinkedList <FormValue <string, string> > valueW = DAO.getInstance().defineState(clearing.IdRaw, type, WeedLevelOfQualityNorm.NormAttr, WeedLevelOfQualityNorm.NameTable, WeedLevelOfQualityNorm.TypeOfLevelQualityAttr); FormValue <string, string>[] valueWeed = valueW.ToArray <FormValue <string, string> >(); LinkedList <FormValue <string, string> > valueG = DAO.getInstance().defineState(clearing.IdRaw, type, GrainLevelOfQualityNorm.NormAttr, GrainLevelOfQualityNorm.NameTable, GrainLevelOfQualityNorm.TypeOfLevelQualityAttr); FormValue <string, string>[] valueGrain = valueG.ToArray <FormValue <string, string> >(); if (!DAO.getInstance().addClearing(clearing.Date, clearing.IdRaw, clearing.WeightBefore, clearing.WeightAfter, valueHarmful, valueWeed, valueGrain, clearing.IdContractor)) { MessageBox.Show("Данная запись уже существует!", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } else { return(true); } } } else { if (!DAO.getInstance().updateClearing(clearing.Date, clearing.IdRaw, clearing.WeightBefore, clearing.WeightAfter, clearing.IdContractor)) { MessageBox.Show("Данная запись уже существует!", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } else { return(true); } } }
/// <summary> /// Clear all styles from the given element and its descendant nodes /// </summary> /// <param name="element">An OE or T node</param> /// <param name="clearing">Exactly which color stylings to remove</param> public bool Clear(XElement element, Clearing clearing) { var cleared = false; var attr = element.Attribute("style"); if (attr != null) { if (clearing == Clearing.All) { // discard all styling attr.Remove(); cleared = true; } else if (clearing == Clearing.Gray) { var colorfulCss = ClearGrays(new Style(attr.Value)); if (!string.IsNullOrEmpty(colorfulCss)) { // found explicit colors attr.Value = colorfulCss; } else { // no explicit colors so discard everything else attr.Remove(); } cleared = true; } } if (element.HasElements) { foreach (var child in element.Elements()) { cleared |= Clear(child, clearing); } } // CData... var data = element.Nodes().OfType <XCData>() .Where(c => c.Value.Contains("span")); if (data == null || !data.Any()) { return(cleared); } foreach (var cdata in data) { var wrapper = cdata.GetWrapper(); if (Clear(wrapper, clearing)) { cdata.Value = wrapper.ToString(SaveOptions.DisableFormatting); cleared = true; } } return(cleared); }
public void Shows_TSpin() { var clearing = new Clearing(1, false, true); Assert.AreEqual("Rows: 1, T-Spin", clearing.ToString()); }
/// <summary> /// Parses the specified clearing file into a clearing object if possible. /// </summary> /// <param name="clearingFileName"> /// The clearing file name to parse into an Clearing object. /// </param> /// <param name="stream"> /// File contents as stream of data /// </param> /// <returns> /// * The Clearing object resulting from the parsing attempt if the specified clearing file could be found. /// * Otherwise returns null. /// </returns> internal Clearing Parse(string clearingFileName, Stream stream) { Clearing = new Clearing(); LineNumber = 0; NumberOfHeaderRecords = 0; NumberOfDataRecords = 0; NumberOfTrailerRecords = 0; if (stream != null) { FileName = Path.GetFileName(clearingFileName); ClearingHeaderParser.FileName = FileName; ClearingDataParser.FileName = FileName; ClearingTrailerParser.FileName = FileName; bool loggedTrailerOutOfPlace = false; // Read the clearing file one line at a time and parse each line as a record. string recordType; using (StreamReader streamReader = new StreamReader(stream)) { while ((Line = streamReader.ReadLine()) != null) { if (Line.Length > ClearingConstants.RecordTypeLength) { LineNumber++; recordType = Line.Substring(0, ClearingConstants.RecordTypeLength); // Log a warning if the trailer record has already been parsed and a warning was not already logged. if (TrailerFound == true && loggedTrailerOutOfPlace == false) { Log.Warning("Error parsing record in line #{0} from file \"{1}\". One or more records found " + "after trailer record parsed.", (int)ResultCode.RecordOutOfPlace, LineNumber, FileName); loggedTrailerOutOfPlace = true; } // Parse the record according to its type and add it to the Clearing object. switch (recordType) { case ClearingHeaderParser.RecordType: ParseHeaderRecord(); break; case ClearingDataParser.RecordType: ParseDataRecord(); break; case ClearingTrailerParser.RecordType: ParseTrailerRecord(); break; default: Log.Warning("Error parsing record in line #{0} from file \"{1}\". Encountered invalid " + "record type \"{2}\".", (int)ResultCode.ExpectedValueNotFound, LineNumber, FileName, recordType); break; } } else { Log.Warning("Error parsing record in line #{0} from file \"{1}\". Unexpected end of record detected.", (int)ResultCode.UnexpectedEndOfRecord, LineNumber, FileName); } } } // Add entries to the log if the clearing file did not have the expected number of records. if (Clearing.Header == null) { Log.Warning("Header for clearing file \"{0}\" missing or corrupted.", (int)ResultCode.FileMissingExpectedRecord, clearingFileName); } if (Clearing.DataRecords.Count == 0) { Log.Information("Clearing file \"{0}\" contained no data records.", clearingFileName); } if (Clearing.Trailer == null) { Log.Warning("Trailer for clearing file \"{0}\" missing or corrupted.", (int)ResultCode.FileMissingExpectedRecord, clearingFileName); } else { if (Clearing.Trailer.RecordCount != NumberOfDataRecords) { Log.Warning("Record count for clearing file \"{0}\" is {1} but trailer indicated it should be {2}.", (int)ResultCode.RecordCountMismatch, clearingFileName, NumberOfDataRecords, Clearing.Trailer.RecordCount); } } } else { Log.Error("Clearing file \"{0}\" could not be found.", null, (int)ResultCode.FileNotFound, clearingFileName); Clearing = null; } return(Clearing); }
public Move(Clearing clearing, Field field) { Clearing = clearing; Field = field; }
// Use this for initialization void Start() { _clock = clock.GetComponent <ClockScript>(); _strobing = b_Strobe.GetComponent <Strobing> (); _clearing = b_Clear.GetComponent <Clearing> (); }
protected override void ClearItems() { Clearing?.Invoke(this, EventArgs.Empty); base.ClearItems(); }
public void DeleteClearing(Clearing clearing) { var deletingItem = db.Clearings.Single(item => item.Id == clearing.Id); db.Clearings.DeleteObject(deletingItem); }
public Task <Uri> CreateTransferAsync(Guid sourceFundingSourceId, Guid destinationFundingSourceId, decimal amount, string idempotencyKey, decimal?fee = null, Guid?chargeTo = null, string sourceAddenda = null, string destinationAddenda = null, string correlationId = null, Clearing clearing = null) => PostAsync("/transfers", new CreateTransferRequest { CorrelationId = correlationId, Amount = new Money { Currency = "USD", Value = amount }, Links = new Dictionary <string, Link> { { "source", new Link { Href = new Uri($"{dwollaClient.BaseAddress}/funding-sources/{sourceFundingSourceId}") } }, { "destination", new Link { Href = new Uri($"{dwollaClient.BaseAddress}/funding-sources/{destinationFundingSourceId}") } } }, Clearing = clearing, Fees = fee == null || fee == 0m ? null : new List <Fee> { new Fee { Amount = new Money { Value = fee.Value, Currency = "USD" }, Links = new Dictionary <string, Link> { { "charge-to", new Link { Href = new Uri($"{dwollaClient.BaseAddress}/customers/{chargeTo}") } } } } }, AchDetails = sourceAddenda == null && destinationAddenda == null ? null : new AchDetails { Source = new SourceAddenda { Addenda = new Addenda { Values = new List <string> { sourceAddenda } } }, Destination = new DestinationAddenda { Addenda = new Addenda { Values = new List <string> { destinationAddenda } } } } }, headers: new Headers { { "Idempotency-Key", idempotencyKey } });
public void InsertClearing(Clearing clearing) { db.Clearings.AddObject(clearing); }
/// <summary> /// Raises the Clearing event. /// </summary> /// <param name="e">An EventArgs instance containing event data.</param> protected virtual void OnClearing(EventArgs e) { Clearing?.Invoke(this, e); }
public void UpdateClearing(Clearing clearing) { throw new NotImplementedException(); }