private void AddBlankRows(DataTable dataTable, int iRowCount) { int rowstoadd = 0; if (dataTable.Rows.Count + iRowCount < MAX_ROWS_ALLOWED) { rowstoadd = iRowCount; } if (dataTable.Rows.Count + iRowCount >= MAX_ROWS_ALLOWED) { rowstoadd = MAX_ROWS_ALLOWED - dataTable.Rows.Count; } for (int iCount = 0; iCount < rowstoadd; iCount++) { dataTable.Rows.Add(false, "", "CE", "BUY", OCHelper.DefaultSP(rblOCType.SelectedValue), "", "", "1", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""); } }
private void PopulateSPLowerRange(FilterConditions filterConditions) { int iLowerStrikePriceRange = OCHelper.RoundTo100(MySession.Current.RecordsObject.underlyingValue - (OCHelper.DefaultSP(rblOCType.SelectedValue) * iPercentageRage / 100)); int iUpperStrikePrice = iLowerStrikePriceRange; ddlSPLowerRange.Items.Clear(); foreach (int item in MySession.Current.RecordsObject.strikePrices) { if (item >= iLowerStrikePriceRange && item < MySession.Current.RecordsObject.underlyingValue && item % filterConditions.SPDifference == 0) { ddlSPLowerRange.Items.Add(item.ToString()); //find the max strike price which meets this criteria to reduce filter size iUpperStrikePrice = Math.Max(iUpperStrikePrice, item); } } //Select the Max strike price in the ddlb if (filterConditions.SPLowerRange == 0) { filterConditions.SPLowerRange = iUpperStrikePrice; } Utility.SelectDataInCombo(ddlSPLowerRange, filterConditions.SPLowerRange.ToString()); }
private void PopulateSPExpiry(FilterConditions filterConditions) { int iUpperStrikePriceRange = OCHelper.RoundTo100(MySession.Current.RecordsObject.underlyingValue + (OCHelper.DefaultSP(rblOCType.SelectedValue) * iPercentageRage / 100)); int iLowerStrikePriceRange = OCHelper.RoundTo100(MySession.Current.RecordsObject.underlyingValue - (OCHelper.DefaultSP(rblOCType.SelectedValue) * iPercentageRage / 100)); //List<int> strikePrices = MySession.Current.RecordsObject.strikePrices; ddlSPExpiry.Items.Clear(); ddlSPExpiry.Items.Add("NONE"); foreach (var item in MySession.Current.RecordsObject.strikePrices) { if (item < iUpperStrikePriceRange && item > iLowerStrikePriceRange && item % filterConditions.SPDifference == 0 && item < filterConditions.SPHigherRange && item > filterConditions.SPLowerRange) { ddlSPExpiry.Items.Add(item.ToString()); } } if (filterConditions.SPExpiry != 0) { Utility.SelectDataInCombo(ddlSPExpiry, filterConditions.SPExpiry.ToString()); } }