public string formatString() { string text = ""; string nl = "\r\n\r\n"; text += "Product Code: " + ProductCode.ToString() + nl + "Manufacturer: " + Manufacturer + nl + "Type: " + Type + nl + Instruction.formatString() + nl + "Quantity: " + Quantity.ToString() + nl + "Price: " + Price.ToString(); return(text); }
/// <summary> /// Read the license file. /// </summary> /// <param name="productCode">Product code.</param> /// <param name="majorVersion">Major version.</param> /// <param name="licenseKey">The license key.</param> /// <returns> /// <see cref="LicenseInformation"/> object contains the license information. /// </returns> private LicenseInformation _Read(ProductCode productCode, int majorVersion, string licenseKey) { string encryptedInfo = string.Empty; if (licenseKey == null || licenseKey == string.Empty) { string localPathName = ""; string globalPathName = ""; string pathName = ""; string licenseFile = ""; int ndxExtention = _licenseFileName.LastIndexOf(_extention); licenseFile = _licenseFileName.Substring(0, ndxExtention) + "." + productCode.ToString() + majorVersion.ToString() + _extention; localPathName = Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath) + @"\" + licenseFile; if (System.IO.File.Exists(localPathName) == true) { pathName = localPathName; } else if (_globalAssemblyKeyName.Trim() != "") { globalPathName = GetFileNameFromTheGAC() + licenseFile; if (System.IO.File.Exists(globalPathName) == true) { pathName = globalPathName; } else { throw new FileNotFoundException(string.Format("Unable to find the file '{0}'.", globalPathName), globalPathName); } } else { throw new FileNotFoundException(string.Format("Unable to find the file '{0}'", localPathName), localPathName); } StreamReader s = new StreamReader(pathName, ASCIIEncoding.Default); encryptedInfo = s.ReadToEnd(); s.Close(); } else { encryptedInfo = licenseKey; } string info = Cryptography.Decrypt(encryptedInfo, _encryptionKey); return(info); }
public string ProcessTokensInString(string source) { source = source.Replace("{CompanyName}", CompanyName); source = source.Replace("{CompanyNumber}", CompanyNumber); source = source.Replace("{ProductName}", ProductName); source = source.Replace("{ProductDescription}", ProductDescription); source = source.Replace("{ProductCode}", ProductCode.ToString().Cast <char>().SkipWhile(c => c == '{').TakeWhile(c => c != '}').ToString()); source = source.Replace("{ProductVersion}", ProductVersion); source = source.Replace("{ProductLongVersion}", ProductLongVersion); source = source.Replace("{CopyrightNotice}", CopyrightNotice); source = source.Replace("{CompanyUrl}", CompanyUrl); source = source.Replace("{ProductUrl}", ProductUrl); source = source.Replace("{ProductPurchaseUrl}", ProductPurchaseUrl); source = source.Replace("{DefaultProductKey}", DefaultProductKey); source = source.Replace("{StartPath}", System.IO.Path.GetDirectoryName(Tools.Runtime.GetEntryAssembly().Location)); return(source); }
/// <summary> /// Override av ToString(). Returnerar strängrepresentationen av produkten. /// </summary> /// <returns>Strängrepresentationen av produkten</returns> public override string ToString() { //ProductCode;Title;ProductType;Price;Quantity;ReleaseYear;Creator;Publisher;FreeText;Status string productAsString; productAsString = ProductCode.ToString(CultureInfo.CurrentCulture) + ';'; productAsString += Title + ';'; productAsString += Type.ToString() + ';'; productAsString += Price.ToString("0.00", CultureInfo.CurrentCulture) + ';'; productAsString += Quantity.ToString(CultureInfo.CurrentCulture) + ';'; productAsString += ReleaseYear.ToString(CultureInfo.CurrentCulture) + ';'; productAsString += Creator.ToString(CultureInfo.CurrentCulture) + ';'; productAsString += Publisher.ToString(CultureInfo.CurrentCulture) + ';'; productAsString += FreeText.ToString(CultureInfo.CurrentCulture) + ';'; productAsString += Status.ToString(); return(productAsString); }
public MA_INSTRUMENT GetFXInstrumentByCCY(SessionInfo sessioninfo, ProductCode eProductCode, string strCCY1, string strCCY2) { try { MA_INSTRUMENT instrument = null; using (EFUnitOfWork unitOfWork = new EFUnitOfWork()) { instrument = unitOfWork.MA_INSTRUMENTRepository .GetAllByProductCode(eProductCode.ToString()) .FirstOrDefault(p => p.LABEL.Equals(strCCY1 + "/" + strCCY2) || p.LABEL.Equals(strCCY2 + "/" + strCCY1)); } return(instrument); } catch (DataServicesException ex) { throw this.CreateException(ex, null); } }
public MA_INSTRUMENT Create(SessionInfo sessioninfo, MA_INSTRUMENT instrument, ProductCode product) { using (EFUnitOfWork unitOfWork = new EFUnitOfWork()) { var checkDuplicate = unitOfWork.MA_INSTRUMENTRepository.GetAllByProductCode(product.ToString()).FirstOrDefault(p => p.LABEL == instrument.LABEL); if (checkDuplicate != null) throw this.CreateException(new Exception(), "Label is duplicated"); if (product == ProductCode.BOND) { LogBusiness logBusiness = new LogBusiness(); unitOfWork.DA_LOGGINGRepository.Add(logBusiness.CreateLogging(sessioninfo, instrument.ID, LogEvent.INSTRUMENT_AUDIT.ToString(), LookupFactorTables.MA_INSTRUMENT, "BOND", new { })); } unitOfWork.MA_INSTRUMENTRepository.Add(instrument); unitOfWork.Commit(); } return instrument; }
public static string ProductName(ProductCode code, bool extended = true) { return(code switch { ProductCode.Chat => "Chat", ProductCode.DiabloII => "Diablo II", ProductCode.DiabloIILordOfDestruction => "Diablo II " + (extended ? " Lord of Destruction" : " LoD"), ProductCode.DiabloRetail => "Diablo", ProductCode.DiabloShareware => "Diablo Shareware", ProductCode.StarcraftBroodwar => "Starcraft Broodwar", ProductCode.StarcraftJapanese => "Starcraft Japanese", ProductCode.StarcraftOriginal => "Starcraft Original", ProductCode.StarcraftShareware => "Starcraft Shareware", ProductCode.WarcraftII => "Warcraft II" + (extended ? " Battle.net Edition" : " BNE"), ProductCode.WarcraftIIIDemo => "Warcraft III Demo", ProductCode.WarcraftIIIFrozenThrone => "Warcraft III" + (extended ? " The Frozen Throne" : " TFT"), ProductCode.WarcraftIIIReignOfChaos => "Warcraft III" + (extended ? " Reign of Chaos" : " RoC"), _ => "Unknown" + (extended ? " (" + code.ToString() + ")" : ""), });
// {"child_order_acceptance_id":"JRF20161212-104117-716911"} // {"status":-110,"error_message":"The minimum order size is 0.001 BTC.","data":null} private async Task <OrderResult> _BuySell(OrderSide side, double price, double amount) { // リクエスト構築 string body = ""; if (price > 0) // 指値 { var reqobj = new { product_code = PRODUCT_CODE.ToString(), // BTC_JPY, FX_BTC_JPY child_order_type = "LIMIT", // 指値: LIMIT, 成行: MARKET side = side.ToString(), price = price, size = amount }; body = JsonConvert.SerializeObject(reqobj); } else // 成行 { var reqobj = new { product_code = PRODUCT_CODE.ToString(), // BTC_JPY, FX_BTC_JPY child_order_type = "MARKET", // 指値: LIMIT, 成行: MARKET side = side.ToString(), size = amount }; body = JsonConvert.SerializeObject(reqobj); } // リクエスト送信 string json = await m_apiClient.Post("/v1/me/sendchildorder", body); // 応答パース try { RawOrderResult _result = JsonConvert.DeserializeObject <RawOrderResult>(json); if (_result.IsError()) { throw new Exception(_result.error_message); } return(new OrderResult(_result)); } catch (Exception ex) { throw new Exception("OrderError: " + ex.Message); } }
public static OLife LoadByProductCode(ProductCode productCode) { FileHelperEngine engine = new FileHelperEngine(typeof(Funds)); Funds[] funds = (Funds[])engine.ReadFile(HttpContext.Current.Server.MapPath("~/App_Data/Funds.csv")); OLife obj = new OLife(); var lst = from x in funds select new InvestmentProduct { id = String.Concat("STLB_InvestmentProduct_", x.TrustNo), InvestProductSysKey = new String[] { String.Concat("Compass_FundCode{", x.JSECode.ToString(), "}") }, ProductCode = productCode.ToString("F"), FullName = x.FundName, SaleEffectiveDate = x.QuarterEnd }; OLife olife = new OLife(); olife.Items = lst.ToArray(); return(olife); }
public override String ToString() { return(ProductCode.ToString()); }
public MA_INSTRUMENT Update(SessionInfo sessioninfo, MA_INSTRUMENT instrument, ProductCode product) { using (EFUnitOfWork unitOfWork = new EFUnitOfWork()) { var checkDuplicate = unitOfWork.MA_INSTRUMENTRepository.GetAllByProductCode(product.ToString()).FirstOrDefault(p => p.LABEL == instrument.LABEL && p.ID != instrument.ID); if (checkDuplicate != null) throw this.CreateException(new Exception(), "Label is duplicated"); var foundData = unitOfWork.MA_INSTRUMENTRepository.GetAll().FirstOrDefault(p => p.ID == instrument.ID); if (foundData == null) throw this.CreateException(new Exception(), "Data not found!"); else { if (product == ProductCode.BOND) { LogBusiness logBusiness = new LogBusiness(); var oldRecord = new { ISACTIVE = foundData.ISACTIVE, CAL_METHOD = foundData.CAL_METHOD, COUPON = foundData.COUPON, COUPON_FREQ_TYPE = foundData.MA_FREQ_TYPE!= null ?foundData.MA_PRODUCT.LABEL:string.Empty, FLAG_FIXED = foundData.FLAG_FIXED, INS_MKT = foundData.INS_MKT, ISSUER = foundData.ISSUER, LABEL = foundData.LABEL, LOT_SIZE = foundData.LOT_SIZE, MATURITY_DATE = foundData.MATURITY_DATE, PRODUCT = foundData.MA_PRODUCT!= null ? foundData.MA_PRODUCT.LABEL:string.Empty, CURRENCY = foundData.MA_CURRENCY != null ? foundData.MA_CURRENCY.LABEL:string.Empty }; var newRecord = new { ISACTIVE = instrument.ISACTIVE, CAL_METHOD = instrument.CAL_METHOD, COUPON = instrument.COUPON, COUPON_FREQ_TYPE =unitOfWork.MA_FREQ_TYPERepository.All().FirstOrDefault(f=>f.ID==instrument.COUPON_FREQ_TYPE_ID).LABEL, FLAG_FIXED = instrument.FLAG_FIXED, INS_MKT = instrument.INS_MKT, ISSUER = instrument.ISSUER, LABEL = instrument.LABEL, LOT_SIZE = instrument.LOT_SIZE, MATURITY_DATE = instrument.MATURITY_DATE, PRODUCT = unitOfWork.MA_PRODUCTRepository.All().FirstOrDefault(p => p.ID == instrument.PRODUCT_ID).LABEL, CURRENCY = unitOfWork.MA_CURRENCYRepository.All().FirstOrDefault(c => c.ID == instrument.CURRENCY_ID1).LABEL, }; var log = logBusiness.UpdateLogging(sessioninfo, foundData.ID, LogEvent.INSTRUMENT_AUDIT.ToString(), LookupFactorTables.MA_INSTRUMENT, oldRecord, newRecord); if (log != null) unitOfWork.DA_LOGGINGRepository.Add(log); } foundData.ID = instrument.ID; foundData.ISACTIVE = instrument.ISACTIVE; foundData.LOG.MODIFYBYUSERID = sessioninfo.CurrentUserId; foundData.LOG.MODIFYDATE = DateTime.Now; foundData.CAL_METHOD = instrument.CAL_METHOD; foundData.COUPON = instrument.COUPON; foundData.COUPON_FREQ_TYPE_ID = instrument.COUPON_FREQ_TYPE_ID; foundData.FLAG_FIXED = instrument.FLAG_FIXED; foundData.INS_MKT = instrument.INS_MKT; foundData.ISSUER = instrument.ISSUER; foundData.LABEL = instrument.LABEL; foundData.LOT_SIZE = instrument.LOT_SIZE; foundData.MATURITY_DATE = instrument.MATURITY_DATE; foundData.PRODUCT_ID = instrument.PRODUCT_ID; foundData.CURRENCY_ID1 = instrument.CURRENCY_ID1; foundData.CURRENCY_ID2 = instrument.CURRENCY_ID2; unitOfWork.Commit(); } } return instrument; }
public MA_INSTRUMENT GetFXInstrumentByCCY(SessionInfo sessioninfo, ProductCode eProductCode, string strCCY1, string strCCY2) { try { MA_INSTRUMENT instrument = null; using (EFUnitOfWork unitOfWork = new EFUnitOfWork()) { instrument = unitOfWork.MA_INSTRUMENTRepository .GetAllByProductCode(eProductCode.ToString()) .FirstOrDefault(p => p.LABEL.Equals(strCCY1 + "/" + strCCY2) || p.LABEL.Equals(strCCY2 + "/" + strCCY1)) ; } return instrument; } catch (DataServicesException ex) { throw this.CreateException(ex, null); } }
//public List<MA_INSTRUMENT> GetByProduct(SessionInfo sessioninfo, Guid productID) //{ // try // { // List<MA_INSTRUMENT> instruments = null; // using (EFUnitOfWork unitOfWork = new EFUnitOfWork()) // { // instruments = unitOfWork.MA_INSTRUMENTRepository.Where(p => p.PRODUCT_ID == productID).ToList(); // } // //Return result to jTable // return instruments; // } // catch (DataServicesException ex) // { // throw this.CreateException(ex, null); // } //} public List<MA_INSTRUMENT> GetByProduct(SessionInfo sessioninfo, ProductCode productcode) { try { List<MA_INSTRUMENT> instruments = null; using (EFUnitOfWork unitOfWork = new EFUnitOfWork()) { instruments = unitOfWork.MA_INSTRUMENTRepository.GetAllByProductCode(productcode.ToString()); } //Return result to jTable return instruments; } catch (DataServicesException ex) { throw this.CreateException(ex, null); } }
public MA_INSTRUMENT Update(SessionInfo sessioninfo, MA_INSTRUMENT instrument, ProductCode product) { using (EFUnitOfWork unitOfWork = new EFUnitOfWork()) { var checkDuplicate = unitOfWork.MA_INSTRUMENTRepository.GetAllByProductCode(product.ToString()).FirstOrDefault(p => p.LABEL == instrument.LABEL && p.ID != instrument.ID); if (checkDuplicate != null) { throw this.CreateException(new Exception(), "Label is duplicated"); } var foundData = unitOfWork.MA_INSTRUMENTRepository.GetAll().FirstOrDefault(p => p.ID == instrument.ID); if (foundData == null) { throw this.CreateException(new Exception(), "Data not found!"); } else { if (product == ProductCode.BOND) { LogBusiness logBusiness = new LogBusiness(); var oldRecord = new { ISACTIVE = foundData.ISACTIVE, CAL_METHOD = foundData.CAL_METHOD, COUPON = foundData.COUPON, COUPON_FREQ_TYPE = foundData.MA_FREQ_TYPE != null ?foundData.MA_PRODUCT.LABEL:string.Empty, FLAG_FIXED = foundData.FLAG_FIXED, INS_MKT = foundData.INS_MKT, ISSUER = foundData.ISSUER, LABEL = foundData.LABEL, LOT_SIZE = foundData.LOT_SIZE, MATURITY_DATE = foundData.MATURITY_DATE, PRODUCT = foundData.MA_PRODUCT != null ? foundData.MA_PRODUCT.LABEL:string.Empty, CURRENCY = foundData.MA_CURRENCY != null ? foundData.MA_CURRENCY.LABEL:string.Empty }; var newRecord = new { ISACTIVE = instrument.ISACTIVE, CAL_METHOD = instrument.CAL_METHOD, COUPON = instrument.COUPON, COUPON_FREQ_TYPE = unitOfWork.MA_FREQ_TYPERepository.All().FirstOrDefault(f => f.ID == instrument.COUPON_FREQ_TYPE_ID).LABEL, FLAG_FIXED = instrument.FLAG_FIXED, INS_MKT = instrument.INS_MKT, ISSUER = instrument.ISSUER, LABEL = instrument.LABEL, LOT_SIZE = instrument.LOT_SIZE, MATURITY_DATE = instrument.MATURITY_DATE, PRODUCT = unitOfWork.MA_PRODUCTRepository.All().FirstOrDefault(p => p.ID == instrument.PRODUCT_ID).LABEL, CURRENCY = unitOfWork.MA_CURRENCYRepository.All().FirstOrDefault(c => c.ID == instrument.CURRENCY_ID1).LABEL, }; var log = logBusiness.UpdateLogging(sessioninfo, foundData.ID, LogEvent.INSTRUMENT_AUDIT.ToString(), LookupFactorTables.MA_INSTRUMENT, oldRecord, newRecord); if (log != null) { unitOfWork.DA_LOGGINGRepository.Add(log); } } foundData.ID = instrument.ID; foundData.ISACTIVE = instrument.ISACTIVE; foundData.LOG.MODIFYBYUSERID = sessioninfo.CurrentUserId; foundData.LOG.MODIFYDATE = DateTime.Now; foundData.CAL_METHOD = instrument.CAL_METHOD; foundData.COUPON = instrument.COUPON; foundData.COUPON_FREQ_TYPE_ID = instrument.COUPON_FREQ_TYPE_ID; foundData.FLAG_FIXED = instrument.FLAG_FIXED; foundData.INS_MKT = instrument.INS_MKT; foundData.ISSUER = instrument.ISSUER; foundData.LABEL = instrument.LABEL; foundData.LOT_SIZE = instrument.LOT_SIZE; foundData.MATURITY_DATE = instrument.MATURITY_DATE; foundData.PRODUCT_ID = instrument.PRODUCT_ID; foundData.CURRENCY_ID1 = instrument.CURRENCY_ID1; foundData.CURRENCY_ID2 = instrument.CURRENCY_ID2; unitOfWork.Commit(); } } return(instrument); }
public MA_INSTRUMENT Create(SessionInfo sessioninfo, MA_INSTRUMENT instrument, ProductCode product) { using (EFUnitOfWork unitOfWork = new EFUnitOfWork()) { var checkDuplicate = unitOfWork.MA_INSTRUMENTRepository.GetAllByProductCode(product.ToString()).FirstOrDefault(p => p.LABEL == instrument.LABEL); if (checkDuplicate != null) { throw this.CreateException(new Exception(), "Label is duplicated"); } if (product == ProductCode.BOND) { LogBusiness logBusiness = new LogBusiness(); unitOfWork.DA_LOGGINGRepository.Add(logBusiness.CreateLogging(sessioninfo, instrument.ID, LogEvent.INSTRUMENT_AUDIT.ToString(), LookupFactorTables.MA_INSTRUMENT, "BOND", new { })); } unitOfWork.MA_INSTRUMENTRepository.Add(instrument); unitOfWork.Commit(); } return(instrument); }
//public List<MA_INSTRUMENT> GetByProduct(SessionInfo sessioninfo, Guid productID) //{ // try // { // List<MA_INSTRUMENT> instruments = null; // using (EFUnitOfWork unitOfWork = new EFUnitOfWork()) // { // instruments = unitOfWork.MA_INSTRUMENTRepository.Where(p => p.PRODUCT_ID == productID).ToList(); // } // //Return result to jTable // return instruments; // } // catch (DataServicesException ex) // { // throw this.CreateException(ex, null); // } //} public List <MA_INSTRUMENT> GetByProduct(SessionInfo sessioninfo, ProductCode productcode) { try { List <MA_INSTRUMENT> instruments = null; using (EFUnitOfWork unitOfWork = new EFUnitOfWork()) { instruments = unitOfWork.MA_INSTRUMENTRepository.GetAllByProductCode(productcode.ToString()); } //Return result to jTable return(instruments); } catch (DataServicesException ex) { throw this.CreateException(ex, null); } }