public override string ToString() { StringBuilder sb = new StringBuilder(base.ToString()); sb.Append(" - Symbol:").Append(Symbol); sb.Append("; RootSymbol:").Append(RootSymbol); sb.Append("; Strike:").Append(Strike); sb.Append("; Expiry:").Append(Expiry.ToString("yyyy-MM-dd")); sb.Append("; OptionType:").Append(OptionType); sb.Append("; Bid:").Append(Bid); sb.Append("; Ask:").Append(Ask); sb.Append("; Last:").Append(Last); sb.Append("; Close:").Append(Close); sb.Append("; Change:").Append(Change); sb.Append("; Volume:").Append(Volume); sb.Append("; Multiplier:").Append(Multiplier); sb.Append("; Description:").Append(Description); sb.Append("; ExpirationFrequencyCode:").Append(ExpirationFrequencyCode); sb.Append("; SettlementStyle:").Append(SettlementStyle); sb.Append("; OpenInterest:").Append(OpenInterest); sb.Append("; ImpliedVolatility:").Append(ImpliedVolatility); sb.Append("; Delta:").Append(Delta); sb.Append("; Gamma:").Append(Gamma); sb.Append("; Theta:").Append(Theta); sb.Append("; Vega:").Append(Vega); sb.Append("; TimeValue:").Append(TimeValue); return(sb.ToString()); }
public override Contract ToIbContract() { var contract = base.ToIbContract(); if (OptionType != EOptionType.None) { contract.Right = OptionType == EOptionType.Call ? "C" : "P"; } contract.Expiry = Expiry < DateTime.Now ? null : Expiry.ToString("yyyyMMdd"); contract.Strike = Strike; contract.Multiplier = Multiplier.ToString(); return(contract); }
public override string ToString() { StringBuilder sb = new StringBuilder(base.ToString()); sb.Append(" - Strike:").Append(Strike); sb.Append("; Multiplier:").Append(Multiplier); sb.Append("; Expiry:").Append(Expiry.ToString("yyyy-MM-dd")); sb.Append("; Call:{").Append(Call).Append('}'); sb.Append("; Put:{").Append(Put).Append('}'); sb.Append("; ExpirationFreqCode:").Append(ExpirationFreqCode); sb.Append("; SettlementStyle:").Append(SettlementStyle); return(sb.ToString()); }
public override string ToString() { return(string.Format("{0}{1}{2}{3:00000000}", Symbol.ID.Symbol, Expiry.ToString(DateFormat.EightCharacter), Right.ToString()[0], Strike * 1000m)); }
public void ReadCard() { //read balance 80 32 00 03 04 00 00 00 00 //received: Deposit(BCD) // vvvvv // 05 11 11 25 02 03 12 15 37 20 00 25 09 08 60 00 00 0A 00 18 00 00 00 00 90 00 // ^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^ ^^ // CAN issue date months of validity // 2009/08 60 mths APDUCommand apduCmd = new APDUCommand(0x80, 0x32, 0, 3, new byte[4], 0); APDUResponse apdu1 = iCard.Transmit(apduCmd); byte[] balanceBytes = new byte[4]; balanceBytes[0] = apdu1.Data[3]; balanceBytes[1] = apdu1.Data[2]; balanceBytes[2] = apdu1.Data[1]; balanceBytes[3] = apdu1.Data[0]; //balance is in cents. divide by 100 to get dollars Balance = BitConverter.ToInt32(balanceBytes, 0) / 100.0f; //dunno what the heck is this command, probably selecting something apduCmd = new APDUCommand(0, 0xa4, 2, 0, new byte[] { 0, 1 }, 0); apdu1 = iCard.Transmit(apduCmd); //read CAN, expiry date, deposit 00 B0 00 00 18 apduCmd = new APDUCommand(0x00, 0xb0, 0, 0, null, 0x18); apdu1 = iCard.Transmit(apduCmd); //card number (CAN) Number = ConvertBCDCardNumber(apdu1.Data, 1, 8); //get the string form XXXX-XXXX-XXXX-XXXX StringBuilder sb = new StringBuilder(); sb.Append(ConvertBCDCardNumber(apdu1.Data, 1, 2).ToString("D4")); sb.Append("-"); sb.Append(ConvertBCDCardNumber(apdu1.Data, 3, 2).ToString("D4")); sb.Append("-"); sb.Append(ConvertBCDCardNumber(apdu1.Data, 5, 2).ToString("D4")); sb.Append("-"); sb.Append(ConvertBCDCardNumber(apdu1.Data, 7, 2).ToString("D4")); NumberString = sb.ToString(); //read expiry date int year = apdu1.Data[12]; //year, from 1900 or 2000 if (year > 90 && year < 100) { year += 1900; } else { year += 2000; } byte month = apdu1.Data[13]; byte validity = (byte)ConvertBCDCardNumber(apdu1.Data, 14, 1); //validity in months DateTime issueDate = new DateTime(year, month, 1); Expiry = issueDate.AddMonths(validity); ExpiryString = Expiry.ToString("dd MMM yyyy"); Deposit = ConvertBCDCardNumber(apdu1.Data, 15, 2) / 100.0f; //get transaction log //read number of total entries in log apduCmd = new APDUCommand(0, 0xb0, 0, 2, null, 4); apdu1 = iCard.Transmit(apduCmd); if (apdu1.SW1 != 0x90) { throw new Exception("Read NETS log size fail"); } short logSize = (short)ConvertBCDCardNumber(new byte[] { apdu1.Data[2], apdu1.Data[3] }, 0, 2); apduCmd = new APDUCommand(0, 0xa4, 2, 0, new byte[] { 0, 5 }, 0); apdu1 = iCard.Transmit(apduCmd); if (apdu1.SW1 != 0x90) { throw new Exception("Read NETS transaction fail"); } //read the current log entry number short endOffs = (short)(logSize * 4); byte endP1 = (byte)((endOffs >> 8) & 0xff); byte endP2 = (byte)(endOffs & 0xff); apduCmd = new APDUCommand(0, 0xb0, endP1, endP2, null, 2); apdu1 = iCard.Transmit(apduCmd); if (apdu1.SW1 != 0x90) { throw new Exception("Read NETS current log number fail"); } short currentLogNum = (short)ConvertBCDCardNumber(new byte[] { apdu1.Data[0], apdu1.Data[1] }, 0, 2); currentLogNum -= 2; //read each log entry from the ring buffer, starting from current for (byte n = 0; n < logSize; n++) { int i = currentLogNum - n; if (i < 0) { i += logSize; } short logOffs = (short)(i * 4); byte logP1 = (byte)((logOffs >> 8) & 0xff); byte logP2 = (byte)(logOffs & 0xff); //read binary 0xb0, offset logOffs, size 16 apduCmd = new APDUCommand(0, 0xb0, logP1, logP2, null, 16); apdu1 = iCard.Transmit(apduCmd); if (apdu1.SW1 != 0x90) { throw new Exception("Read NETS log entry fail"); } NETSTransaction logEntry = new NETSTransaction(apdu1.Data); if (logEntry.Type != 0) { TransactionLog.Add(logEntry); } } }
public override string ToString() { return(Expiry.ToString()); }
private void btnAlter_Click(object sender, EventArgs e) { clsUtility.ExecuteSQLQuery(" SELECT * FROM Users WHERE USER_ID = '" + clsUtility.UserID + "' AND Can_Edit = 'Y' "); if (clsUtility.sqlDT.Rows.Count > 0) { /////////////////////////////////////////// if (string.IsNullOrWhiteSpace(this.txtItemID.Text) | string.IsNullOrWhiteSpace(this.txtItemName.Text) | string.IsNullOrWhiteSpace(this.txtUnit.Text) | cmbGroup.SelectedValue == null | cmbGroup.SelectedIndex == -1 | cmbDefaultWarehouse.SelectedValue == null | cmbDefaultWarehouse.SelectedIndex == -1) { errorProvider.SetError(txtItemName, "Required"); errorProvider.SetError(txtUnit, "Required"); errorProvider.SetError(cmbGroup, "Required"); errorProvider.SetError(cmbDefaultWarehouse, "Required"); } else { /////////////////////////////// errorProvider.Clear(); string VATapplicable = null; string Expiry, ExpiryDate; if (chkExp.Checked) { ExpiryDate = dtpExpDate.Value.Date.ToString("yyyy-MM-dd"); Expiry = "Y"; } else { ExpiryDate = ""; Expiry = "N"; } if (cbVATapplicable.Checked) { VATapplicable = "Y"; } else { VATapplicable = "N"; } try { clsUtility.ExecuteSQLQuery(" UPDATE ItemInformation SET ItemName='" + txtItemName.Text + "',UnitOfMeasure='" + txtUnit.Text + "',Batch='" + txtBatch.Text + "',GROUP_ID='" + cmbGroup.SelectedValue.ToString() + "',Barcode='" + txtBarcode.Text + "',Cost='" + clsUtility.num_repl(txtPurchaseCost.Text) + "',Price='" + clsUtility.num_repl(txtSalesPrice.Text) + "',ReorderPoint='" + clsUtility.num_repl(txtReorderPoint.Text) + "',VAT_Applicable='" + VATapplicable + "', WarehouseID = '" + cmbDefaultWarehouse.SelectedValue.ToString() + "' " + " WHERE ITEM_ID ='" + ITEM_ID + "' "); clsUtility.ExecuteSQLQuery("UPDATE Stock SET Quantity='" + clsUtility.num_repl(txtOpeningStock.Text) + "', ExpiryDate='" + ExpiryDate.ToString() + "', WarehouseID='" + cmbWarehouse.SelectedValue.ToString() + "', SHELF_ID='" + clsUtility.fltr_combo(cmbShelf).ToString() + "', Expiry='" + Expiry.ToString() + "' WHERE ITEM_ID ='" + ITEM_ID + "' AND WarehouseID='" + WarehouseID + "' "); UploadImage(txtItemID.Text); btnReset.PerformClick(); txtItemID.Text = ""; clsUtility.MesgBoxShow("msgUpdate", "info"); } catch (Exception ex) { MessageBox.Show(ex.Message); } ////////////////////////////// } /////////////////////////////////////////// } else { clsUtility.MesgBoxShow("msgPermission", "err"); } }