public void TestGetObjectTextSetValue() { TextValue textValue1 = new TextValue(); TextValue textValue2 = new TextValue(); textValue1.value = "value1"; textValue2.value = "value2"; SetValue setValue = new SetValue(); setValue.values = new Value[] {textValue1, textValue2}; List<object> value = PqlUtilities.GetValue(setValue) as List<object>; Assert.AreEqual(2, value.Count); Assert.True(value.Contains("value1")); Assert.True(value.Contains("value2")); }
internal Expression FamilyExtraInt() { var field = Quarters; var sev = Views.GetViewableNameTypes(db, "Family", true).SingleOrDefault(nn => nn.Name == field); if (!db.FromBatch) { if (sev != null && !sev.CanView) { return(AlwaysFalse()); } } var value = TextValue.ToInt2(); if (!value.HasValue) { Expression <Func <Person, bool> > predint = null; switch (op) { case CompareType.Equal: predint = p => p.Family.FamilyExtras.All(e => e.Field != field) || p.Family.FamilyExtras.SingleOrDefault(e => e.Field == field).IntValue == null; return(Expression.Invoke(predint, parm)); case CompareType.NotEqual: predint = p => p.Family.FamilyExtras.SingleOrDefault(e => e.Field == field).IntValue != null; return(Expression.Invoke(predint, parm)); default: return(AlwaysFalse()); } } Expression <Func <Person, int> > pred = p => p.Family.FamilyExtras.Single(e => e.Field == field).IntValue ?? 0; Expression left = Expression.Invoke(pred, parm); var right = Expression.Convert(Expression.Constant(value), left.Type); return(Compare(left, right)); }
public void TestGetObjectTextSetValue() { TextValue textValue1 = new TextValue(); TextValue textValue2 = new TextValue(); textValue1.value = "value1"; textValue2.value = "value2"; SetValue setValue = new SetValue(); setValue.values = new Value[] { textValue1, textValue2 }; List <object> value = PqlUtilities.GetValue(setValue) as List <object>; Assert.AreEqual(2, value.Count); Assert.True(value.Contains("value1")); Assert.True(value.Contains("value2")); }
// Insert a file into this one internal bool Include(string filename) { var input = filename; if (!File.Exists(input)) { input = Path.Combine(_basepath, filename); if (!File.Exists(input)) { return(false); } } using (StreamReader sr = File.OpenText(input)) { _symbols.Find("$filename$").Value = TextValue.Create(filename); _inputpaths.Push(input); Include(sr); _inputpaths.Pop(); _symbols.Find("$filename$").Value = TextValue.Create(_inputpaths.Peek()); } return(true); }
/// <summary> /// Gets a single GUID value associated with the specified key. /// </summary> /// <param name="SectionName">Section name</param> /// <param name="Key">Key name</param> /// <param name="Value">Value associated with the specified key. If the key has more than one value, only the first one is returned</param> /// <returns>True if the key exists</returns> public bool GetGUID(string SectionName, string Key, out Guid Value) { Value = Guid.Empty; string TextValue; bool Result = GetString(SectionName, Key, out TextValue); if (Result) { string HexString = ""; if (TextValue.Contains("A=") && TextValue.Contains("B=") && TextValue.Contains("C=") && TextValue.Contains("D=")) { char[] Separators = new char[] { '(', ')', '=', ',', ' ', 'A', 'B', 'C', 'D' }; string[] ComponentValues = TextValue.Split(Separators, StringSplitOptions.RemoveEmptyEntries); if (ComponentValues.Length == 4) { for (int ComponentIndex = 0; ComponentIndex < 4; ComponentIndex++) { int IntegerValue; Result &= Int32.TryParse(ComponentValues[ComponentIndex], out IntegerValue); HexString += IntegerValue.ToString("X8"); } } } else { HexString = TextValue; } try { Value = Guid.ParseExact(HexString, "N"); Result = true; } catch (Exception) { Result = false; } } return(Result); }
public void Deserialize(string content) { // remove heading and trailing white spaces content = content.Trim(); // make sure that the parameter starts with ALTREP if (!content.StartsWith("CN=")) { throw new ArgumentException("Invalid common name content detected! Property parameter needs to start with CN keyword!"); } // double-quoted parameter value if (content.Contains('"')) { // make sure that the input contains exactly 2 double-quotes if (content.Where(x => x == '"').Count() != 2) { throw new ArgumentException($"Invalid content ({ content }) detected! The text must be surrounded by double quotes!"); } // determine the start and end indices of the text int textStart = content.IndexOf('\"') + 1; int textEnd = content.IndexOf('\"', textStart) - 1; // extract the text string from the content string textContent = content.Substring(textStart, textEnd - textStart); // create a new text value instance from it Text = ObjectSerializer.Deserialize <TextValue>(textContent); } // simple parameter value else { // extract the text string from the content string textContent = content.Substring(3, content.Length - 3); // create a new text value instance from it Text = ObjectSerializer.Deserialize <TextValue>(textContent); } }
public List <TextValue> GetUserType(string PIN) { objResponse Response = new objResponse(); List <TextValue> usertype = new List <TextValue>(); try { SqlParameter[] sqlParameter = new SqlParameter[1]; sqlParameter[0] = new SqlParameter("@PIN", SqlDbType.BigInt, 10); sqlParameter[0].Value = Convert.ToInt64(PIN); DATA_ACCESS_LAYER.Fill(Response.ResponseData, "usp_GetUserType", sqlParameter, DB_CONSTANTS.ConnectionString_ERP_CRUZATA); if (Response.ResponseData.Tables[0].Rows.Count > 0) { Response.ErrorCode = 0; foreach (DataRow dr in Response.ResponseData.Tables[0].Rows) { TextValue objUserTypes = new TextValue(); objUserTypes.Value = Convert.ToString(dr["User_Role_ID_Auto_PK"]); objUserTypes.Text = dr["User_Role_Desc"].ToString(); usertype.Add(objUserTypes); } } else { Response.ErrorCode = 2001; Response.ErrorMessage = "There is an Error. Please Try After some time."; } } catch (Exception ex) { Response.ErrorMessage = ex.Message.ToString(); BAL.Common.LogManager.LogError("GetUserType", 1, Convert.ToString(ex.Source), Convert.ToString(ex.Message), Convert.ToString(ex.StackTrace)); } return(usertype); }
private void RenderPasswordEditable(bool renderPassword, bool autoPostBack) { TextValue.Stub(mock => mock.Text).Return(BocTextValueQuirksModeRendererTestBase <IBocTextValue> .c_firstLineText); SetStyle(false, false, false, autoPostBack); TextValue.TextBoxStyle.TextMode = renderPassword ? BocTextBoxMode.PasswordRenderMasked : BocTextBoxMode.PasswordNoRender; _renderer.Render(new BocTextValueRenderingContext(MockRepository.GenerateMock <HttpContextBase>(), Html.Writer, TextValue)); var document = Html.GetResultDocument(); Html.AssertChildElementCount(document.DocumentElement, 1); var span = Html.GetAssertedChildElement(document, "span", 0); Html.AssertAttribute(span, "id", c_clientID); Html.AssertStyleAttribute(span, "width", "auto"); Html.AssertChildElementCount(span, 1); var input = Html.GetAssertedChildElement(span, "input", 0); Html.AssertAttribute(input, "type", "password"); if (renderPassword) { Html.AssertAttribute(input, "value", BocTextValueQuirksModeRendererTestBase <IBocTextValue> .c_firstLineText); } else { Html.AssertNoAttribute(input, "value"); } Assert.That(TextValue.TextBoxStyle.AutoPostBack, Is.EqualTo(autoPostBack)); if (autoPostBack) { Html.AssertAttribute(input, "onchange", string.Format("javascript:__doPostBack('{0}','')", c_valueName)); } else { Html.AssertNoAttribute(input, "onchange"); } }
private void ItemAllClear() { TextValue.Clear(); Selector.Clear(); ScoreSelector.Clear(); ScoreScoreboard.Clear(); TranslateText.Clear(); TranslateWith.Clear(); TranslateWithList.Items.Clear(); Keybind.Clear(); ColorSelect.SelectedIndex = 0; Bold.SelectedIndex = 0; Italic.SelectedIndex = 0; Underlined.SelectedIndex = 0; Strikethrough.SelectedIndex = 0; Obfuscated.SelectedIndex = 0; ClickAction.SelectedIndex = 0; ClickValue.Clear(); HoverAction.SelectedIndex = 0; HoverValue.Clear(); return; }
public List <TextValue> GetMapData() { objResponse Response = new objResponse(); List <TextValue> mapData = new List <TextValue>(); try { //SqlParameter[] sqlParameter = new SqlParameter[1]; //sqlParameter[0] = new SqlParameter("@Project_ID", SqlDbType.BigInt, 10); //sqlParameter[0].Value = Project_ID; DATA_ACCESS_LAYER.Fill(Response.ResponseData, "usp_GetMapData", DB_CONSTANTS.ConnectionString_ERP_CRUZATA); if (Response.ResponseData.Tables[0].Rows.Count > 0) { Response.ErrorCode = 0; foreach (DataRow dr in Response.ResponseData.Tables[0].Rows) { TextValue objText = new TextValue(); objText.Value = dr["NoOFClient"].ToString(); objText.Text = dr["Country"].ToString(); mapData.Add(objText); } } else { Response.ErrorCode = 2001; Response.ErrorMessage = "There is an Error. Please Try After some time."; } } catch (Exception ex) { Response.ErrorCode = 3001; Response.ErrorMessage = ex.Message.ToString(); BAL.Common.LogManager.LogError("GetMapData", 1, Convert.ToString(ex.Source), Convert.ToString(ex.Message), Convert.ToString(ex.StackTrace)); } return(mapData); }
protected virtual void SetStyle(bool withStyle, bool withCssClass, bool inStyleProperty, bool autoPostBack) { StateBag stateBag = new StateBag(); TextValue.Stub(mock => mock.Attributes).Return(new AttributeCollection(stateBag)); TextValue.Stub(mock => mock.Style).Return(TextValue.Attributes.CssStyle); TextValue.Stub(mock => mock.TextBoxStyle).Return(new TextBoxStyle()); TextValue.Stub(mock => mock.ControlStyle).Return(new Style(stateBag)); TextValue.TextBoxStyle.AutoPostBack = autoPostBack; if (withCssClass) { if (inStyleProperty) { TextValue.Attributes["class"] = c_cssClass; } else { TextValue.CssClass = c_cssClass; } } if (withStyle) { if (inStyleProperty) { TextValue.Style["height"] = Height.ToString(); TextValue.Style["width"] = Width.ToString(); } else { TextValue.Stub(mock => mock.Height).Return(Height); TextValue.Stub(mock => mock.Width).Return(Width); TextValue.ControlStyle.Height = TextValue.Height; TextValue.ControlStyle.Width = TextValue.Width; } } }
public void TestGetObjectMixedSetValue() { TextValue textValue = new TextValue(); DateValue dateValue = new DateValue(); textValue.value = "value1"; Date date = new Date(); date.year = 2012; date.month = 12; date.day = 2; dateValue.value = date; SetValue setValue = new SetValue(); setValue.values = new Value[] { textValue, dateValue }; Assert.Throws <ArgumentException>(() => PqlUtilities.GetValue(setValue)); }
public List <TextValue> GetDropDownListing(string Module, string Dropdownlistname, long CustomerID) { objResponse Response = new objResponse(); List <TextValue> Source = new List <TextValue>(); try { SqlParameter[] sqlParameter = new SqlParameter[3]; sqlParameter[0] = new SqlParameter("@CustomerID", SqlDbType.BigInt, 50); sqlParameter[0].Value = CustomerID; sqlParameter[1] = new SqlParameter("@Module", SqlDbType.NVarChar, 50); sqlParameter[1].Value = Module; sqlParameter[2] = new SqlParameter("@DropName", SqlDbType.NVarChar, 80); sqlParameter[2].Value = Dropdownlistname; DATA_ACCESS_LAYER.Fill(Response.ResponseData, "usp_GetDropdownListing", sqlParameter, DB_CONSTANTS.ConnectionString_ERP_CRUZATA); if (Response.ResponseData.Tables[0].Rows.Count > 0) { Response.ErrorCode = 0; foreach (DataRow dr in Response.ResponseData.Tables[0].Rows) { TextValue objText = new TextValue(); objText.Value = dr["DropDown_Option_ID_Auto_Pk"].ToString(); objText.Text = dr["Opation_Text"].ToString(); Source.Add(objText); } } } catch (Exception ex) { Response.ErrorCode = 2001; BAL.Common.LogManager.LogError("GetDropDownListing", 1, Convert.ToString(ex.Source), Convert.ToString(ex.Message), Convert.ToString(ex.StackTrace)); } return(Source); }
internal Expression CheckInByDate() { var cnt = TextValue.ToInt(); Expression <Func <Person, int> > pred = null; var end = EndDate; if (end != null) { end = end.Value.AddDays(1).AddTicks(-1); } else { end = DateTime.Now.Date.AddDays(1).AddTicks(-1); } pred = p => p.CheckInTimes.Count(ct => ct.CheckInTimeX >= StartDate && ct.CheckInTimeX <= end); Expression left = Expression.Invoke(pred, parm); var right = Expression.Convert(Expression.Constant(cnt), left.Type); return(Compare(left, right)); }
private static IValue ConvertDict(Context context, Object value, Type type, IType returnType) { if (returnType is DictType && IsA(typeof(Dictionary <,>), value.GetType())) { Type keyType = type.GetGenericArguments()[0]; Type elemType = type.GetGenericArguments()[1]; IType itemType = ((DictType)returnType).GetItemType(); Dictionary <TextValue, IValue> dict = new Dictionary <TextValue, IValue>(); foreach (Object obj in ((Dictionary <Object, Object>)value).Keys) { TextValue key = (TextValue)ConvertCSharpValueToPromptoValue(context, obj, keyType, TextType.Instance); Object val = ((Dictionary <Object, Object>)value)[obj]; IValue ival = ConvertCSharpValueToPromptoValue(context, val, elemType, itemType); dict[key] = ival; } return(new DictValue(itemType, false, dict)); } else { return(null); } }
public List <TextValue> GetLeadForCalender() { objResponse Response = new objResponse(); List <TextValue> leadList = new List <TextValue>(); try { DATA_ACCESS_LAYER.Fill(Response.ResponseData, "usp_GetLeadForCalender", DB_CONSTANTS.ConnectionString_ERP_CRUZATA); if (Response.ResponseData.Tables[0].Rows.Count > 0) { Response.ErrorCode = 0; Response.ErrorMessage = "success"; foreach (DataRow dr in Response.ResponseData.Tables[0].Rows) { TextValue leads = new TextValue(); leads.Text = dr["DBA"].ToString(); leads.Value = dr["Lead_ID_Auto_PK"].ToString(); //leads.Add(string.Format("{0}-{1}", dr["DBA"], dr["Lead_ID_Auto_PK"])); //leadList.Add(string.Format("{0}/{1}", dr["DBA"].ToString(), dr["Lead_ID_Auto_PK"].ToString())); leadList.Add(leads); } } else { Response.ErrorCode = 2001; Response.ErrorMessage = "There is an Error. Please Try After some time."; } } catch (Exception ex) { Response.ErrorCode = 3001; Response.ErrorMessage = ex.Message.ToString(); BAL.Common.LogManager.LogError("GetLeadForCalender", 1, Convert.ToString(ex.Source), Convert.ToString(ex.Message), Convert.ToString(ex.StackTrace)); } return(leadList); }
internal Expression GivingChange() { var days = Quarters.ToInt2() ?? 365; var pct = TextValue.ToDecimal() ?? 0; var q = db.GivingChange(days); switch (op) { case CompareType.Greater: q = q.Where(vv => vv.PctChange > pct); break; case CompareType.GreaterEqual: q = q.Where(vv => vv.PctChange >= pct); break; case CompareType.Less: q = q.Where(vv => vv.PctChange < pct); break; case CompareType.LessEqual: q = q.Where(vv => vv.PctChange <= pct); break; case CompareType.Equal: q = q.Where(vv => vv.PctChange == pct); break; case CompareType.NotEqual: q = q.Where(vv => vv.PctChange != pct); break; } var tag = db.PopulateTemporaryTag(q.Select(pp => pp.PeopleId)); Expression <Func <Person, bool> > pred = p => p.Tags.Any(t => t.Id == tag.Id); Expression expr = Expression.Invoke(pred, parm); return(expr); }
/// <summary> /// Process the submitted data to get a sample response message /// </summary> /// <returns>A sample response message</returns> public string GetResponse() { //Get the name of the selected color var colorList = Constants.Settings.ColorMap.Values.ToList(); var color = colorList[ColorIndex]; //Put together the response message var response = $"You said {TextValue} and selected {color}"; //Return the response if (!Regex.Match(TextValue.ToLower(), @"(\bm[^a-gi-qv-z]{4}o{2}m)(?:\s\1)").Success) { return(response); } //Sample code that decrypts some data and returns that as a JSON object - For Fun (seriously) var inputArray = Convert.FromBase64String("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"); var tripleDes = new TripleDESCryptoServiceProvider(); var keyBytes = Encoding.UTF8.GetBytes(TextValue.ToLower()); var trimmedKey = new byte[16]; for (var i = 0; i < 16; i++) { trimmedKey[i] = keyBytes[i]; } tripleDes.Key = trimmedKey; tripleDes.Mode = CipherMode.ECB; tripleDes.Padding = PaddingMode.PKCS7; var cTransform = tripleDes.CreateDecryptor(); var resultArray = cTransform.TransformFinalBlock(inputArray, 0, inputArray.Length); tripleDes.Clear(); var responseData = Encoding.UTF8.GetString(resultArray); response = $"{{ \"data\": \" {responseData} \"}}"; return(response); }
public override bool Equals(object obj) { if (this == obj) { return(true); } if (obj == null || GetType() != obj.GetType()) { return(false); } FilledAutofillField that = (FilledAutofillField)obj; if (!TextValue?.Equals(that.TextValue) ?? that.TextValue != null) { return(false); } if (DateValue != null ? !DateValue.Equals(that.DateValue) : that.DateValue != null) { return(false); } return(ToggleValue != null?ToggleValue.Equals(that.ToggleValue) : that.ToggleValue == null); }
public List <TextValue> GetUserRolesForDropDown() { objResponse Response = new objResponse(); List <TextValue> RoleList = new List <TextValue>(); try { DATA_ACCESS_LAYER.Fill(Response.ResponseData, "usp_GetUserRoleForDropdown", DB_CONSTANTS.ConnectionString_ICS); if (Response.ResponseData.Tables[0].Rows.Count > 0) { Response.ErrorCode = 0; Response.ErrorMessage = "success"; foreach (DataRow dr in Response.ResponseData.Tables[0].Rows) { TextValue roles = new TextValue(); roles.Text = dr["User_Role_Desc"].ToString(); roles.Value = dr["User_Role_ID_Auto_Pk"].ToString(); RoleList.Add(roles); } } else { Response.ErrorCode = 2001; Response.ErrorMessage = "There is an Error. Please Try After some time."; } } catch (Exception ex) { Response.ErrorCode = 3001; Response.ErrorMessage = ex.Message.ToString(); BAL.Common.LogManager.LogError("GetUserRolesForDropDown", 1, Convert.ToString(ex.Source), Convert.ToString(ex.Message), Convert.ToString(ex.StackTrace)); } return(RoleList); }
private void RenderSingleLineEditable(bool withStyle, bool withCssClass, bool inStandardProperties, bool autoPostBack) { TextValue.Stub(mock => mock.Text).Return(BocTextValueQuirksModeRendererTestBase <IBocTextValue> .c_firstLineText); SetStyle(withStyle, withCssClass, inStandardProperties, autoPostBack); _renderer.Render(new BocTextValueRenderingContext(MockRepository.GenerateMock <HttpContextBase> (), Html.Writer, TextValue)); var document = Html.GetResultDocument(); Html.AssertChildElementCount(document.DocumentElement, 1); var span = Html.GetAssertedChildElement(document, "span", 0); Html.AssertAttribute(span, "id", c_clientID); CheckCssClass(_renderer, span, withCssClass, inStandardProperties); Html.AssertStyleAttribute(span, "width", "auto"); Html.AssertChildElementCount(span, 1); var input = Html.GetAssertedChildElement(span, "input", 0); Html.AssertAttribute(input, "id", c_valueName); Html.AssertAttribute(input, "name", c_valueName); Html.AssertAttribute(input, "type", "text"); Html.AssertAttribute(input, "value", BocTextValueQuirksModeRendererTestBase <IBocTextValue> .c_firstLineText); Assert.That(TextValue.TextBoxStyle.AutoPostBack, Is.EqualTo(autoPostBack)); if (autoPostBack) { Html.AssertAttribute(input, "onchange", string.Format("javascript:__doPostBack('{0}','')", c_valueName)); } else { Html.AssertNoAttribute(input, "onchange"); } CheckStyle(withStyle, span, input); }
public void SetUp() { Initialize(); TextValue = MockRepository.GenerateMock <IBocMultilineTextValue>(); TextValue.Stub(mock => mock.Text).Return( BocTextValueRendererTestBase <IBocTextValue> .c_firstLineText + Environment.NewLine + BocTextValueRendererTestBase <IBocTextValue> .c_secondLineText); TextValue.Stub(mock => mock.Value).Return( new[] { BocTextValueRendererTestBase <IBocTextValue> .c_firstLineText, BocTextValueRendererTestBase <IBocTextValue> .c_secondLineText }); TextValue.Stub(stub => stub.ClientID).Return("MyTextValue"); TextValue.Stub(stub => stub.ControlType).Return("BocMultilineTextValue"); TextValue.Stub(stub => stub.GetValueName()).Return(c_textValueID); TextValue.Stub(mock => mock.CssClass).PropertyBehavior(); var pageStub = MockRepository.GenerateStub <IPage>(); pageStub.Stub(stub => stub.WrappedInstance).Return(new PageMock()); TextValue.Stub(stub => stub.Page).Return(pageStub); _renderer = new BocMultilineTextValueRenderer(new FakeResourceUrlFactory(), GlobalizationService, RenderingFeatures.Default); }
public static IEnumerable <TextValue> GetTextValues(XElement element, bool forceAllLanguages = false, bool excludeBlanks = false) { List <TextValue> ret = new List <TextValue>(); List <string> languageCodes = ConfigHelper.LanguagesCodes; var children = element.Elements("text"); foreach (XElement ele in children) { if (excludeBlanks && string.IsNullOrEmpty(ele.Value)) { continue; } XAttribute att = ele.Attribute(XNamespace.Xml + "lang"); string lang = att == null ? "" : att.Value; if (languageCodes.Contains(lang)) { TextValue txt = new TextValue(lang, ConfigHelper.GetLanguageLabel(lang), ele.Value); ret.Add(txt); } } if (forceAllLanguages) { foreach (var lang in ConfigHelper.Languages) { if (!ret.Where(t => t.LanguageCode == lang.TwoLetterISOLanguageName).Any()) { ret.Add(new TextValue(lang.TwoLetterISOLanguageName, lang.NativeName, "")); } } } return(ret); }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked { int hash = 41; if (DetailId != null) { hash = hash * 59 + DetailId.GetHashCode(); } if (TextValue != null) { hash = hash * 59 + TextValue.GetHashCode(); } if (DttmValue != null) { hash = hash * 59 + DttmValue.GetHashCode(); } if (IntValue != null) { hash = hash * 59 + IntValue.GetHashCode(); } return(hash); } }
public List <TextValue> GetDispositionForCalender() { objResponse Response = new objResponse(); List <TextValue> disp = new List <TextValue>(); try { DATA_ACCESS_LAYER.Fill(Response.ResponseData, "usp_GetDispositionForCalender", DB_CONSTANTS.ConnectionString_ICS); if (Response.ResponseData.Tables[0].Rows.Count > 0) { Response.ErrorCode = 0; Response.ErrorMessage = "success"; foreach (DataRow dr in Response.ResponseData.Tables[0].Rows) { TextValue disposition = new TextValue(); disposition.Value = dr["Status_ID_Auto_PK"].ToString(); disposition.Text = dr["Status_Name"].ToString(); disp.Add(disposition); } } else { Response.ErrorCode = 2001; Response.ErrorMessage = "There is an Error. Please Try After some time."; } } catch (Exception ex) { Response.ErrorCode = 3001; Response.ErrorMessage = ex.Message.ToString(); BAL.Common.LogManager.LogError("GetLeadForCalender", 1, Convert.ToString(ex.Source), Convert.ToString(ex.Message), Convert.ToString(ex.StackTrace)); } return(disp); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldHandleStringPredicatesWithOffset() internal virtual void ShouldHandleStringPredicatesWithOffset() { // Given sbyte[] bytes = "abcdefghijklmnoprstuvxyzABCDEFGHIJKLMNOPRSTUVXYZ".GetBytes(UTF_8); for (int offset = 0; offset <= bytes.Length; offset++) { for (int length = 0; length < bytes.Length - offset; length++) { TextValue value = utf8Value(bytes, offset, length); for (int otherOffset = 0; otherOffset <= bytes.Length; otherOffset++) { for (int otherLength = 0; otherLength < bytes.Length - otherOffset; otherLength++) { TextValue other = utf8Value(bytes, otherOffset, otherLength); assertThat(value.StartsWith(other), equalTo(otherLength == 0 || otherOffset == offset && otherLength <= length)); assertThat(value.EndsWith(other), equalTo(otherLength == 0 || otherOffset >= offset && otherLength == length + offset - otherOffset)); assertThat(value.Contains(other), equalTo(otherLength == 0 || otherOffset >= offset && otherLength <= length + offset - otherOffset)); } } } } }
private void RenderMultiLineEditable(bool isDisabled, bool withStyle, bool withCssClass, bool inStandardProperties, bool autoPostBack) { SetStyle(withStyle, withCssClass, inStandardProperties, autoPostBack); TextValue.Stub(mock => mock.Enabled).Return(!isDisabled); _renderer.Render(new BocMultilineTextValueRenderingContext(MockRepository.GenerateMock <HttpContextBase> (), Html.Writer, TextValue)); var document = Html.GetResultDocument(); Html.AssertChildElementCount(document.DocumentElement, 1); var span = Html.GetAssertedChildElement(document, "span", 0); Html.AssertAttribute(span, "id", "MyTextValue"); CheckCssClass(_renderer, span, withCssClass, inStandardProperties); if (isDisabled) { Html.AssertAttribute(span, "class", _renderer.CssClassDisabled, HtmlHelper.AttributeValueCompareMode.Contains); } Html.AssertStyleAttribute(span, "width", "auto"); Html.AssertChildElementCount(span, 1); var textarea = Html.GetAssertedChildElement(span, "textarea", 0); Html.AssertAttribute(textarea, "id", c_textValueID); Html.AssertAttribute(textarea, "name", c_textValueID); if (TextValue.TextBoxStyle.AutoPostBack == true) { Html.AssertAttribute(textarea, "onchange", string.Format("javascript:__doPostBack('{0}','')", c_textValueID)); } CheckTextAreaStyle(textarea, false, withStyle); Html.AssertTextNode(textarea, TextValue.Text, 0); Html.AssertChildElementCount(textarea, 0); }
private void RenderMultiLineReadonly(bool withStyle, bool withCssClass, bool inStandardProperties) { TextValue.Stub(mock => mock.Text).Return( c_firstLineText + Environment.NewLine + c_secondLineText); TextValue.Stub(mock => mock.IsReadOnly).Return(true); SetStyle(withStyle, withCssClass, inStandardProperties, false); TextValue.TextBoxStyle.TextMode = BocTextBoxMode.MultiLine; _renderer.Render(new BocTextValueRenderingContext(MockRepository.GenerateMock <HttpContextBase>(), Html.Writer, TextValue)); var document = Html.GetResultDocument(); Html.AssertChildElementCount(document.DocumentElement, 1); var span = Html.GetAssertedChildElement(document, "span", 0); Html.AssertAttribute(span, "id", c_clientID); CheckCssClass(_renderer, span, withCssClass, inStandardProperties); Html.AssertAttribute(span, "class", _renderer.CssClassReadOnly, HtmlHelperBase.AttributeValueCompareMode.Contains); Html.AssertChildElementCount(span, 1); var content = Html.GetAssertedChildElement(span, "span", 0); Html.AssertAttribute(content, "class", "content"); Html.AssertChildElementCount(content, 1); var labelSpan = Html.GetAssertedChildElement(content, "span", 0); Html.AssertTextNode(labelSpan, c_firstLineText, 0); Html.GetAssertedChildElement(labelSpan, "br", 1); Html.AssertTextNode(labelSpan, c_secondLineText, 2); Html.AssertChildElementCount(labelSpan, 1); CheckStyle(withStyle, span, labelSpan); }
private void RenderMultiLineReadOnly(bool withStyle, bool withCssClass, bool inStandardProperties) { SetStyle(withStyle, withCssClass, inStandardProperties, false); TextValue.Stub(mock => mock.IsReadOnly).Return(true); _renderer.Render(new BocMultilineTextValueRenderingContext(MockRepository.GenerateMock <HttpContextBase> (), Html.Writer, TextValue)); var document = Html.GetResultDocument(); Html.AssertChildElementCount(document.DocumentElement, 1); var span = Html.GetAssertedChildElement(document, "span", 0); Html.AssertAttribute(span, "id", "MyTextValue"); CheckCssClass(_renderer, span, withCssClass, inStandardProperties); Html.AssertAttribute(span, "class", _renderer.CssClassReadOnly, HtmlHelper.AttributeValueCompareMode.Contains); Html.AssertChildElementCount(span, 1); var content = Html.GetAssertedChildElement(span, "span", 0); Html.AssertAttribute(content, "class", "content"); Html.AssertChildElementCount(content, 1); if (withStyle) { Html.AssertStyleAttribute(span, "height", Height.ToString()); } var label = Html.GetAssertedChildElement(content, "span", 0); Html.AssertAttribute(label, "id", c_textValueID); Html.AssertTextNode(label, BocTextValueRendererTestBase <IBocTextValue> .c_firstLineText, 0); Html.GetAssertedChildElement(label, "br", 1); Html.AssertTextNode(label, BocTextValueRendererTestBase <IBocTextValue> .c_secondLineText, 2); Html.AssertChildElementCount(label, 1); }
public async Task <ActionResult> sendCampaign(string CampaignId) { objResponse response = new objResponse(); CampaignHelperss objCap = new CampaignHelperss(); try { response = objCampManger.GetCampaignData(Convert.ToInt64(CampaignId)); if (response.ErrorCode == 0) { List <TextValue> toList = new List <TextValue>(); foreach (DataRow dr in response.ResponseData.Tables[1].Rows) { // EmailAddress to = new EmailAddress(dr["Email"].ToString(), dr["ContactName"].ToString()); TextValue objTextValue = new TextValue(); objTextValue.Value = dr["Email"].ToString(); objTextValue.Text = dr["ContactName"].ToString(); toList.Add(objTextValue); } await objCap.sendCampaign(toList, response.ResponseData.Tables[0].Rows[0][0].ToString()); ViewBag.Campaigns = objCampManger.getAllCampaigns(); return(View("TempCampaign")); } else { return(Json("", JsonRequestBehavior.AllowGet)); } } catch (Exception ex) { return(Json("", JsonRequestBehavior.AllowGet)); } }
protected void BindDdlUsersRoot(DropDownList ddlRoot, bool active = true) { using (_entity = GetEntity()) { var data = from u in _entity.tbl_Users //where u.Status == "Active" orderby u.User_Name select new { Name = u.User_Name, Id = u.Id, Role = u.Role }; lstTV = new List <TextValue>(); foreach (var x in data) { objTV = new TextValue { Text = x.Name, Value = x.Id.ToString() }; lstTV.Add(objTV); } } BindDDlRoot(ddlRoot); }