public Tuple <bool, Exception> Print(string printerName, BasePrinter entity, MarginModel horiModel = null) { var tuple = new Tuple <bool, Exception>(true, null); try { if (horiModel == null) { horiModel = new MarginModel() { LeftMargin = 0, RightMargin = 0 } } ; PrintController pc = new StandardPrintController(); var pd = new PrintDocument { PrintController = pc, DefaultPageSettings = { Margins = new Margins((int)(horiModel.LeftMargin / 25.4 * 100), (int)(horiModel.RightMargin / 25.4 * 100), 0, 0) }, OriginAtMargins = true }; pd.PrintPage += (s, e) => Pdoc_PrintPage(e, entity); pd.PrinterSettings.PrinterName = printerName; pd.Print(); } catch (Exception ex) { return(new Tuple <bool, Exception>(false, ex)); } return(tuple); }
/// <summary> /// Set the leverage parameter for this security /// </summary> /// <param name="leverage">Leverage for this asset</param> public void SetLeverage(decimal leverage) { if (Symbol.ID.SecurityType == SecurityType.Future || Symbol.ID.SecurityType == SecurityType.Option) { return; } MarginModel.SetLeverage(this, leverage); }
public IHttpActionResult Post([FromBody] MarginModel marginModel) { try { Utils.IsAValidToken(Request, AuthorizationBusinessLogic); MarginBusinessLogic.AddMargin(marginModel.ToEntity()); return(Ok(marginModel)); } catch (Exception e) { return(BadRequest(e.Message)); } }
public IHttpActionResult Get([FromUri] Guid id) { try { Utils.IsAValidToken(Request, AuthorizationBusinessLogic); var margin = MarginBusinessLogic.GetMargin(id); return(Ok(MarginModel.ToModel(margin))); } catch (Exception e) { return(BadRequest(e.Message)); } }
public IHttpActionResult Get() { try { Utils.IsAValidToken(Request, AuthorizationBusinessLogic); var margins = MarginBusinessLogic.GetMargins(); IList <MarginModel> marginsModel = MarginModel.ToModel(margins).ToList(); return(Ok(marginsModel)); } catch (Exception e) { return(BadRequest(e.Message)); } }
public void TestInitialize() { margin = Utils.CreateMarginForTest(); marginModel = MarginModel.ToModel(margin); text = Utils.CreateTextForTest(); textModel = TextModel.ToModel(text); user = Utils.CreateUserForTest(); userModel = UserModel.ToModel(user); mockMarginAuthorizationLogic = new Mock <IAuthorizationBusinessLogic>(); mockMarginBusinessLogic = new Mock <IMarginBusinessLogic>(); mockAuditLogBusinessLogic = new Mock <IAuditLogBussinesLogic>(); marginController = new MarginController(mockMarginBusinessLogic.Object, mockMarginAuthorizationLogic.Object, mockAuditLogBusinessLogic.Object); InitializeToken(); }
public void ExecuteSendMarginData(object para) { SMarginModel trmp = para as SMarginModel; string[] values = trmp.product_ids.Split(','); foreach (string item in values) { MarginModel mm = ContractVariety.Margins.FirstOrDefault(x => x.product_id == item); if (mm != null) { mm.sell_value = trmp.sell_value; mm.buy_value = trmp.buy_value; } } }
public IHttpActionResult Put([FromUri] Guid id, [FromBody] MarginModel marginModel) { try { Utils.IsAValidToken(Request, AuthorizationBusinessLogic); marginModel.Id = id; MarginBusinessLogic.ModifyMargin(marginModel.ToEntity()); AuditLogBussinesLogic.CreateLog("Document", marginModel.DocumentId, Utils.GetUsername(Request), ActionPerformed.MODIFY); return(Ok(marginModel)); } catch (Exception e) { return(BadRequest(e.Message)); } }
public void TestInitialize() { document = Utils.CreateDocumentForTest(); documentModel = DocumentModel.ToModel(document); paragraph = Utils.CreateParagraphForTest(); paragraphModel = ParagraphModel.ToModel(paragraph); margin = Utils.CreateMarginForTest(); marginModel = MarginModel.ToModel(margin); user = Utils.CreateUserForTest(); userModel = UserModel.ToModel(user); mockDocumentAuthorizationLogic = new Mock <IAuthorizationBusinessLogic>(); mockDocumentBusinessLogic = new Mock <IDocumentBusinessLogic>(); mockAuditLogBusinessLogic = new Mock <IAuditLogBussinesLogic>(); mockUserBusinessLogic = new Mock <IUserBusinessLogic>(); documentController = new DocumentController(mockDocumentBusinessLogic.Object, mockDocumentAuthorizationLogic.Object, mockAuditLogBusinessLogic.Object, mockUserBusinessLogic.Object); InitializeToken(); }
public void IntegrationTest_ExpectedParameters_Ok() { var requestMessage = new HttpRequestMessage(); IMarginBusinessLogic marginBL = new MarginBusinessLogic(new MarginDataAccess()); IUserDataAccess userDa = new UserDataAccess(); IAuthorizationBusinessLogic auth = new AuthorizationBusinessLogic(userDa); IAuditLogBussinesLogic audit = new AuditLogBussinesLogic(); MarginController marginC = new MarginController(marginBL, auth, audit); marginC.Request = requestMessage; MarginModel margin2 = MarginModel.ToModel(Utils.CreateMarginForTest()); marginC.Post(marginModel); marginC.Post(margin2); marginC.Get(margin.Id); margin2.OwnStyleClass = "modified"; marginC.Put(margin2.Id, margin2); marginC.Delete(marginModel.Id); IHttpActionResult statusObtained = marginC.Get(); }
/// <summary> /// Create brokerage model for internal usage /// </summary> /// <param name="accounttype"></param> /// <param name="feemodel"></param> /// <param name="fillmodel"></param> /// <param name="latencymodel"></param> /// <param name="margincallmodel"></param> /// <param name="marginmodel"></param> /// <param name="settlementmodel"></param> /// <param name="slippagemodel"></param> /// <param name="spreadmodel"></param> protected GenericBrokerModel( AccountType accounttype, FeeModel feemodel, FillModel fillmodel, LatencyModel latencymodel, MarginCallModel margincallmodel, MarginModel marginmodel, SettlementModel settlementmodel, SlippageModel slippagemodel, SpreadModel spreadmodel) { //Set given values AccountType = accounttype; FeeModel = feemodel; FillModel = fillmodel; LatencyModel = latencymodel; MarginCallModel = margincallmodel; SettlementModel = settlementmodel; SlippageModel = slippagemodel; MarginModel = marginmodel; SpreadModel = spreadmodel; }
public IHttpActionResult Post([FromUri] Guid documentId, [FromUri] MarginAlign align, [FromBody] MarginModel documentPart) { try { Utils.IsAValidToken(Request, AuthorizationBusinessLogic); var body = documentPart.ToEntity(); DocumentBusinessLogic.SetDocumentMargin(documentId, align, body); AuditLogBussinesLogic.CreateLog("Document", documentId, Utils.GetUsername(Request), ActionPerformed.MODIFY); return(Ok(documentPart)); } catch (Exception e) { return(BadRequest(e.Message)); } }
/// <summary> /// Set the leverage parameter for this security /// </summary> /// <param name="leverage">Leverage for this asset</param> public void SetLeverage(decimal leverage) { MarginModel.SetLeverage(this, leverage); }