public virtual void SearchByCityIDAndCountryID(int cityID, int countryID) { ListDictionary parameters = new ListDictionary(); parameters.Add(new SqlParameter("@CityID", SqlDbType.Int), cityID); parameters.Add(new SqlParameter("@CountryID", SqlDbType.Int), countryID); base.LoadFromSql("[" + this.SchemaStoredProcedure + "usp_BlogPage_SearchByCityIDAndCountryID]", parameters); }
public bool AddNew(string _title, string _description,string _filePath,bool _showLive, int? _govID,int? _civilID,int? _hoID,Guid _userID,string _cType,byte[] _file) { try { SqlDataReader searchResult = null; ListDictionary parm = new ListDictionary(); parm.Add("@title", _title); parm.Add("@description", _description); parm.Add("@filePath", _filePath); parm.Add("@showLive", _showLive); if (_govID != null) parm.Add("@govid", _govID); if (_civilID != null) parm.Add("@civilid", _civilID); if (_hoID != null) parm.Add("@healthofficeid", _hoID); if (_file != null) { parm.Add("@contentType", _cType); parm.Add("@fileData", _file); } parm.Add("@createdbyuserid", _userID); searchResult = LoadFromSqlReader("GUI_AddNews", parm) as SqlDataReader; return true; } catch { return false; } }
private void SendManagementEmails() { //Sending out emails MailDefinition md = new MailDefinition(); md.From = ConfigurationManager.AppSettings["MailFrom"]; md.IsBodyHtml = true; md.Subject = ConfigurationManager.AppSettings["emailSubjectContact"]; ListDictionary replacements = new ListDictionary(); replacements.Add("<%client_name%>", (string)(Session["client_name"])); replacements.Add("<%client_phone%>", (string)(Session["client_phone"])); replacements.Add("<%client_email%>", (string)(Session["client_email"])); replacements.Add("<%client_message%>", (string)(Session["client_message"])); string body = String.Empty; using (StreamReader sr = new StreamReader(Server.MapPath(ConfigurationManager.AppSettings["emailPath"] + "contact.txt"))) { body = sr.ReadToEnd(); } MailMessage msg = md.CreateMailMessage(ConfigurationManager.AppSettings["mecene_Email"], replacements, body, new System.Web.UI.Control()); SmtpClient sc = new SmtpClient(); sc.Send(msg); }
public virtual IDataReader GetDeliveryOrdersDetailsTotals(string DeliveryOrderNoFrom, string DeliveryOrderNoTo) { ListDictionary parameters = new ListDictionary(); parameters.Add(new SqlParameter("@DeliveryOrderNoFrom", SqlDbType.NVarChar, 10), DeliveryOrderNoFrom); parameters.Add(new SqlParameter("@DeliveryOrderNoTo", SqlDbType.NVarChar, 10), DeliveryOrderNoTo); return LoadFromSqlReader("GetDeliveryOrdersDetailsTotals", parameters); }
/// <summary> /// Create a TcpChannel with a given name, on a given port. /// </summary> /// <param name="port"></param> /// <param name="name"></param> /// <returns></returns> private static TcpChannel CreateTcpChannel( string name, int port, int limit ) { ListDictionary props = new ListDictionary(); props.Add( "port", port ); props.Add( "name", name ); props.Add( "bindTo", "127.0.0.1" ); BinaryServerFormatterSinkProvider serverProvider = new BinaryServerFormatterSinkProvider(); // NOTE: TypeFilterLevel and "clientConnectionLimit" property don't exist in .NET 1.0. Type typeFilterLevelType = typeof(object).Assembly.GetType("System.Runtime.Serialization.Formatters.TypeFilterLevel"); if (typeFilterLevelType != null) { PropertyInfo typeFilterLevelProperty = serverProvider.GetType().GetProperty("TypeFilterLevel"); object typeFilterLevel = Enum.Parse(typeFilterLevelType, "Full"); typeFilterLevelProperty.SetValue(serverProvider, typeFilterLevel, null); // props.Add("clientConnectionLimit", limit); } BinaryClientFormatterSinkProvider clientProvider = new BinaryClientFormatterSinkProvider(); return new TcpChannel( props, clientProvider, serverProvider ); }
protected void InsertButton_Click(object sender, EventArgs e) { var patientName = ((TextBox)AddPatientFormView.FindControl("NameTextBox")).Text; var patientGender = ((DropDownList)AddPatientFormView.FindControl("GenderDropdownList")).SelectedValue; var patientAddress = ((TextBox)AddPatientFormView.FindControl("AddressTextbox")).Text; var patientDateOfBirth = ((TemplateControls_DatePicker)AddPatientFormView.FindControl("DateOfBirthDatePicker")).SelectedDate; System.Collections.Specialized.ListDictionary dic = new System.Collections.Specialized.ListDictionary(); dic.Add("Name", patientName); dic.Add("Gender", patientGender); dic.Add("Address", patientAddress); dic.Add("DateOfBirth", patientDateOfBirth); if (AddPatientDataSource.Insert(dic) == 0) { //fail ResultAlert.SetResultAlert("An error occured!", TemplateControls_ResultAlert.AlertTypeError); } else { // success ResultAlert.SetResultAlert("Patient inserted successfully!", TemplateControls_ResultAlert.AlertTypeSuccess); ClearForm(); } }
public virtual bool GetUserByUserNameAndPassword(string UserName, string Password) { ListDictionary parameters = new ListDictionary(); parameters.Add(new SqlParameter("@UserName", SqlDbType.NVarChar, 200), UserName); parameters.Add(new SqlParameter("@Password", SqlDbType.NVarChar, 200), Password); return LoadFromSql("GetUserByUserNameAndPassword", parameters); }
private void BasicTests (ListDictionary ld) { Assert.AreEqual (0, ld.Count, "Count"); Assert.IsFalse (ld.IsFixedSize, "IsFixedSize"); Assert.IsFalse (ld.IsReadOnly, "IsReadOnly"); Assert.IsFalse (ld.IsSynchronized, "IsSynchronized"); Assert.AreEqual (0, ld.Keys.Count, "Keys"); Assert.AreEqual (0, ld.Values.Count, "Values"); Assert.IsNotNull (ld.SyncRoot, "SyncRoot"); Assert.IsNotNull (ld.GetEnumerator (), "GetEnumerator"); Assert.IsNotNull ((ld as IEnumerable).GetEnumerator (), "IEnumerable.GetEnumerator"); ld.Add ("a", "1"); Assert.AreEqual (1, ld.Count, "Count-1"); Assert.IsTrue (ld.Contains ("a"), "Contains(a)"); Assert.IsFalse (ld.Contains ("1"), "Contains(1)"); ld.Add ("b", null); Assert.AreEqual (2, ld.Count, "Count-2"); Assert.IsNull (ld["b"], "this[b]"); DictionaryEntry[] entries = new DictionaryEntry[2]; ld.CopyTo (entries, 0); ld["b"] = "2"; Assert.AreEqual ("2", ld["b"], "this[b]2"); ld.Remove ("b"); Assert.AreEqual (1, ld.Count, "Count-3"); ld.Clear (); Assert.AreEqual (0, ld.Count, "Count-4"); }
protected void lbSend_Click(object sender, EventArgs e) { SmtpClient client = new SmtpClient(); //host and port picked from web.config client.EnableSsl = true; MailDefinition message = new MailDefinition(); message.BodyFileName = @"~\EmailTemplate\MiriMargolinContact.htm"; message.IsBodyHtml = true; message.From = "*****@*****.**"; message.Subject = "MiriMargolin - Contact Us Form"; ListDictionary replacements = new ListDictionary(); replacements.Add("<% Name %>", this.txtName.Text); replacements.Add("<% PhoneOrEmail %>", this.txtPhoneOrEmail.Text); replacements.Add("<% Message %>", this.txtMessage.Text); MailMessage msgHtml = message.CreateMailMessage(RECIPIENTS, replacements, new LiteralControl()); try { client.Send(msgHtml); this.lblMsg.Text = "Your message has been sent and will be address shortly"; this.lbSend.Enabled = false; } catch (Exception) { this.lblMsg.Text = "There was a problem to send an email."; } }
public DataTable FilterICDcodes(string initText, int gender) { try { //string connection = ConfigurationSettings.AppSettings["dbConnection"]; //SqlConnection con = new SqlConnection(connection); //string selectString = "select * from ICDCODE9000" + initText[0].ToString() + " where DescrENG like '" + initText + "%'"; //SqlCommand cmd = new SqlCommand(selectString, con); //cmd.CommandType = CommandType.Text; //SqlDataAdapter adb = new SqlDataAdapter(); //adb.SelectCommand = cmd; //DataTable tbl = new DataTable(); //adb.Fill(tbl); //return tbl; SqlDataReader searchResult = null; ListDictionary parm = new ListDictionary(); parm.Add("@initText", initText); parm.Add("@gender", gender); searchResult = LoadFromSqlReader("Mho_Gui_GetICDSubcode", parm) as SqlDataReader; DataTable ResultTable = new DataTable(); newAdapter da = new newAdapter(); if (searchResult != null && searchResult.HasRows) { da.FillFromReader(ResultTable, searchResult); } return ResultTable; } catch { return new DataTable(); } }
protected void lbSendToFriend_Click(object sender, EventArgs e) { string url = Request.Url.AbsoluteUri; SmtpClient client = new SmtpClient(); //host and port picked from web.config client.EnableSsl = true; MailDefinition message = new MailDefinition(); message.BodyFileName = @"~\EmailTemplate\MiriMargolinShareWithAFriend.htm"; message.IsBodyHtml = true; message.From = "*****@*****.**"; message.Subject = "MiriMargolin - Share with a friend"; ListDictionary replacements = new ListDictionary(); replacements.Add("<% YourName %>", this.txtYourName.Text); replacements.Add("<% Message %>", this.txtMessage.Text); //MailMessage msgHtml = message.CreateMailMessage(this.txtFriendsEmail.Text, replacements, new LiteralControl()); //msgHtml.Bcc.Add(new MailAddress(RECIPIENTS)); try { //client.Send(msgHtml); } catch (Exception) { //this.lblMsg.Text = "There was a problem to send an email."; } }
public virtual bool Report_PaymentsWithinPeriod(DateTime? From, DateTime? To) { ListDictionary parameters = new ListDictionary(); parameters.Add(new SqlParameter("@From", SqlDbType.DateTime, 0), From); parameters.Add(new SqlParameter("@To", SqlDbType.DateTime, 0), To); return LoadFromSql("Report_PaymentsWithinPeriod", parameters); }
protected void Page_Load(object sender, EventArgs e) { WebUtility.ShowClientConfirm("Message", "Detailfdsafdsafsdafdsaf\nfdsafdsafsdafsdaf\nfdsafdsafdsafsdafsad", "titleOK", "OK", "cancel", null, "onCancel"); wf.Width = 500; wf.Height = 700; wf.Center = true; WebUtility.AdjustWindow(wf); String cbReference = Page.ClientScript.GetCallbackEventReference(this, "arg", "ReceiveServerData", "context"); String callbackScript; callbackScript = "function CallServer(arg, context)" + "{ " + cbReference + ";}"; Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "CallServer", callbackScript, true); catalog = new System.Collections.Specialized.ListDictionary(); catalog.Add("monitor", 12); catalog.Add("laptop", 10); catalog.Add("keyboard", 23); catalog.Add("mouse", 17); ListBox1.DataSource = catalog; ListBox1.DataTextField = "key"; ListBox1.DataBind(); }
public bool ChangeUsername(string oldUsername, string newUsername, string applicationName, out string errorMsg) { errorMsg = string.Empty; ListDictionary parameters = new ListDictionary(); parameters.Add(new SqlParameter("@ApplicationName", SqlDbType.NVarChar), applicationName); parameters.Add(new SqlParameter("@OldUserName", SqlDbType.NVarChar), oldUsername); parameters.Add(new SqlParameter("@NewUserName", SqlDbType.NVarChar), newUsername); SqlParameter retValParam = new SqlParameter("@ReturnValue", SqlDbType.Int); retValParam.Direction = ParameterDirection.ReturnValue; parameters.Add(retValParam, null); base.LoadFromSql("[" + this.SchemaStoredProcedure + "proc_MembershipChangeUserName]", parameters); int returnValue = -1; if (retValParam.Value != null) { returnValue = Convert.ToInt32(retValParam.Value); if (returnValue == 1) { errorMsg = "إسم المستخدم المطلوب تغييره غير موجود"; } else if (returnValue == 2) { errorMsg = "الإسم الجديد مستخدم من قبل"; } } else { errorMsg = "Unknow error"; } return (returnValue == 0 ? true : false); }
public virtual bool SearchTickets(string txt, int statusID) { ListDictionary parameters = new ListDictionary(); parameters.Add(new SqlParameter("@StatusID", SqlDbType.Int, 0), statusID); parameters.Add(new SqlParameter("@SearchTxt", SqlDbType.NVarChar, 300), txt); return LoadFromSql("SearchAllTickets", parameters); }
public static void SendWelcomeEmail(string mailTo ,Guid orgId, string tournamentId, string orgLogo, string tournamentName, DateTime startDate) { ListDictionary replacements = new ListDictionary(); replacements.Add("<% OrgId %>", orgId); replacements.Add("<% TournamentName %>", tournamentName); replacements.Add("<% StartDate %>", startDate); replacements.Add("<% TournamentId %>", tournamentId); string templatePath = Path.Combine(ConfigurationManager.AppSettings["EmailTemplatePath"].ToString(), "WelcomeEmail.htm"); string matchUpReadyTemplate = File.ReadAllText(templatePath); SmtpClient client = new SmtpClient(); //host and port picked from web.config client.EnableSsl = true; foreach (DictionaryEntry item in replacements) { matchUpReadyTemplate = matchUpReadyTemplate.Replace(item.Key.ToString(), item.Value.ToString()); } MailMessage message = new MailMessage(); message.Subject = "Welcome Email"; message.From = new MailAddress("*****@*****.**"); message.To.Add(mailTo); message.IsBodyHtml = true; message.Body = matchUpReadyTemplate; try { client.Send(message); } catch (Exception) { } }
public static void deSerialize() { string sPath = HttpContext.Current.Server.MapPath("~/config/config.txt"); if (!File.Exists(sPath)) { m_lListDictionary = new ListDictionary(); return; } m_lListDictionary = new ListDictionary(); TextReader oTr = File.OpenText(sPath); char cN1 = '\n'; string sTemp = oTr.ReadToEnd(); string[] asTemp = sTemp.Split(cN1); foreach (string sLine in asTemp) { if (sLine.Length == 0) continue; string[] asTemp2 = sLine.Split(','); if (asTemp[0].ToString() == "DatabasePassword") { CCrypt oCrypt = new CCrypt(); m_lListDictionary.Add(asTemp2[0], oCrypt.DESDecrypt(asTemp2[1])); continue; } m_lListDictionary.Add(asTemp2[0], asTemp2[1]); } oTr.Close(); }
public virtual bool Report_ItemPrices(int ItemID, int ClientTypeID) { ListDictionary parameters = new ListDictionary(); parameters.Add(new SqlParameter("@ItemID", SqlDbType.Int, 0), ItemID); parameters.Add(new SqlParameter("@ClientTypeID", SqlDbType.Int, 0), ClientTypeID); return LoadFromSql("Report_ItemPrices", parameters); }
public virtual bool LoadByName(string cityName, string countryName) { ListDictionary parameters = new ListDictionary(); parameters.Add(new SqlParameter("@CityName", SqlDbType.VarChar), cityName); parameters.Add(new SqlParameter("@CountryName", SqlDbType.VarChar), countryName); return base.LoadFromSql("[" + this.SchemaStoredProcedure + "usp_City_LoadByName]", parameters); }
public virtual bool SearchAds(string filterText, int AdLocationID) { ListDictionary parameters = new ListDictionary(); parameters.Add(new SqlParameter("@filterText", SqlDbType.NVarChar, 200), filterText); parameters.Add(new SqlParameter("@AdLocationID", SqlDbType.Int, 0), AdLocationID); return LoadFromSql("SearchAds", parameters); }
public IDictionary ToDictionary() { ListDictionary ld = new ListDictionary(); ld.Add("delta", Connection.ToDictionary()); ld.Add("index", Index); ld.Add("cons", CList.ToList()); ld.Add("view", View); return ld; }
public virtual IDataReader Load(DateTime startDate, DateTime endDate) { ListDictionary parameters = new ListDictionary(); parameters.Add(new SqlParameter("@StartDate", SqlDbType.DateTime, 0), startDate); parameters.Add(new SqlParameter("@EndDate", SqlDbType.DateTime, 0), endDate); return LoadFromSqlReader("proc_StatsReport", parameters); }
public virtual bool Report_GetOrdersHistoryByClientID(int ClientID,DateTime? From, DateTime? To, int ItemID) { ListDictionary parameters = new ListDictionary(); parameters.Add(new SqlParameter("@ClientID", SqlDbType.Int, 0), ClientID); parameters.Add(new SqlParameter("@ItemID", SqlDbType.Int, 0), ItemID); parameters.Add(new SqlParameter("@From", SqlDbType.DateTime, 0), From); parameters.Add(new SqlParameter("@To", SqlDbType.DateTime, 0), To); return LoadFromSql("Report_GetOrdersHistoryByClientID", parameters); }
public virtual bool RPT_GetTotalReceivingVoucher(DateTime From, DateTime To) { ListDictionary parameters = new ListDictionary(); parameters.Add(new SqlParameter("@DateFrom", SqlDbType.DateTime, 0), From); parameters.Add(new SqlParameter("@DateTo", SqlDbType.DateTime, 0), To); return LoadFromSql("RPT_GetTotalReceivingVoucher", parameters); }
public virtual bool SearchItems(string FilterText, int ItemGroupID) { ListDictionary parameters = new ListDictionary(); parameters.Add(new SqlParameter("@FilterText", SqlDbType.NVarChar, 100), FilterText); parameters.Add(new SqlParameter("@ItemGroupID", SqlDbType.Int, 0), ItemGroupID); return LoadFromSql("SearchItems", parameters); }
public virtual bool GetCategoriesByTypeIDAndPageID(int TypeID, int PageID) { ListDictionary parameters = new ListDictionary(); parameters.Add(new SqlParameter("@TypeID", SqlDbType.Int, 0), TypeID); parameters.Add(new SqlParameter("@PageID", SqlDbType.Int, 0), PageID); return LoadFromSql("GetCategoriesByTypeIDAndPageID", parameters); }
public virtual bool GetRelatedContentByTypeIDAndPageIDAndSubCatID(int PageID, int TypeID, int SCatID) { ListDictionary parameters = new ListDictionary(); parameters.Add(new SqlParameter("@PageID", SqlDbType.Int, 0), PageID); parameters.Add(new SqlParameter("@TypeID", SqlDbType.Int, 0), TypeID); parameters.Add(new SqlParameter("@SubCatID", SqlDbType.Int, 0), SCatID); return LoadFromSql("GetRelatedContentByTypeIDAndPageIDAndSubCatID", parameters); }
public virtual bool Report_PurchaseOrders(int ItemID, int SupplierID, DateTime? From, DateTime? To) { ListDictionary parameters = new ListDictionary(); parameters.Add(new SqlParameter("@ItemID", SqlDbType.Int, 0), ItemID); parameters.Add(new SqlParameter("@SupplierID", SqlDbType.Int, 0), SupplierID); parameters.Add(new SqlParameter("@From", SqlDbType.DateTime, 0), From); parameters.Add(new SqlParameter("@To", SqlDbType.DateTime, 0), To); return LoadFromSql("Report_GetPurchaseOrders", parameters); }
public virtual bool RPT_GetTickets_Sold(DateTime From, DateTime To) { ListDictionary parameters = new ListDictionary(); parameters.Add(new SqlParameter("@DateFrom", SqlDbType.DateTime, 0), From); parameters.Add(new SqlParameter("@DateTo", SqlDbType.DateTime, 0), To); return LoadFromSql("RPT_GetTickets_Sold", parameters); }
public virtual bool SearchPackageOptions(string filterText, int PackageID) { ListDictionary parameters = new ListDictionary(); parameters.Add(new SqlParameter("@filterText", SqlDbType.NVarChar, 200), filterText); parameters.Add(new SqlParameter("@PackageID", SqlDbType.Int, 0), PackageID); return LoadFromSql("SearchPackageOptions", parameters); }
public virtual bool GetServicesByCompanyIDAndTypeID(int CompanyID, int TypeID) { ListDictionary parameters = new ListDictionary(); parameters.Add(new SqlParameter("@CompanyID", SqlDbType.Int, 0), CompanyID); parameters.Add(new SqlParameter("@TypeID", SqlDbType.Int, 0), TypeID); return LoadFromSql("GetServicesByCompanyIDAndTypeID", parameters); }
public static ListDictionary ShareToDictionary(ShareModel share) { ListDictionary replacements = new ListDictionary(); replacements.Add("#FIRSTNAME#", ValueToString(share.FirstName)); replacements.Add("#QUANTITY#", ValueToString(share.NoOfShares)); replacements.Add("#RATE#", ValueToString(share.PricePerShare)); replacements.Add("#GROSSAMOUNT#", ValueToString(share.GrossAmount)); replacements.Add("#PURCHASEDTIMEUTC#", ValueToString(share.PurchasedDateTimeUtc.ToShortDateString())); return replacements; }
static void LearnListDictionary() { Console.WriteLine("from LearnListDictionary Method"); System.Collections.Specialized.ListDictionary lstData = new System.Collections.Specialized.ListDictionary(); lstData.Add("Name", "Atul"); //Inserting string lstData.Add("Age", 100); // inserting integer lstData.Add("IsSeniorCitizen", true); // Inserting boolean lstData["Country"] = "USA"; //Another way to inserting the data foreach (DictionaryEntry item in lstData) { Console.WriteLine($"Value for Key {item.Key} is {item.Value}"); } }
// <Snippet1> protected void Add_Click(object sender, EventArgs e) { System.Collections.Specialized.ListDictionary listDictionary = new System.Collections.Specialized.ListDictionary(); listDictionary.Add("ProductName", TextBox1.Text); listDictionary.Add("ProductCategory", "General"); listDictionary.Add("Color", "Not assigned"); listDictionary.Add("ListPrice", null); LinqDataSource1.Insert(listDictionary); TextBox1.Text = String.Empty; DetailsView1.DataBind(); }
// GetParameters creates a list dictionary // consisting of a report parameter name and a value. private System.Collections.Specialized.ListDictionary GetParmeters(string parms) { System.Collections.Specialized.ListDictionary ld = new System.Collections.Specialized.ListDictionary(); if (parms == null) { return(ld); // dictionary will be empty in this case } // parms are separated by & char[] breakChars = new char[] { '&' }; string[] ps = parms.Split(breakChars); foreach (string p in ps) { int iEq = p.IndexOf("="); if (iEq > 0) { string name = p.Substring(0, iEq); string val = p.Substring(iEq + 1); ld.Add(name, val); } } return(ld); }
private static void FillDictionaryWithContent(int limit, System.Collections.Specialized.ListDictionary listDictionary) { _stopwatch.Start(); for (int i = 0; i < limit; i++) { listDictionary.Add(i, $"Nummer_{i}"); } _stopwatch.Stop(); }
//</Snippet3> protected void Page_Load(object sender, EventArgs e) { Page.ClientScript.RegisterClientScriptBlock(this.GetType(), validationLookUpStock, "function LookUpStock() { " + "var lb = document.forms[0].ListBox1; " + "if (lb.selectedIndex == -1) { alert ('Please make a selection.'); return; } " + "var product = lb.options[lb.selectedIndex].text; " + @"CallServer(product, ""LookUpStock"");} ", true); if (User.Identity.IsAuthenticated) { Page.ClientScript.RegisterClientScriptBlock(this.GetType(), validationLookUpSale, "function LookUpSale() { " + "var lb = document.forms[0].ListBox1; " + "if (lb.selectedIndex == -1) { alert ('Please make a selection.'); return; } " + "var product = lb.options[lb.selectedIndex].text; " + @"CallServer(product, ""LookUpSale"");} ", true); } String cbReference = "var param = arg + '|' + context;" + Page.ClientScript.GetCallbackEventReference(this, "param", "ReceiveServerData", "context"); String callbackScript; callbackScript = "function CallServer(arg, context)" + "{ " + cbReference + "} ;"; Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "CallServer", callbackScript, true); catalog = new System.Collections.Specialized.ListDictionary(); saleitem = new System.Collections.Specialized.ListDictionary(); catalog.Add("monitor", 12); catalog.Add("laptop", 10); catalog.Add("keyboard", 23); catalog.Add("mouse", 17); saleitem.Add("monitor", 1); saleitem.Add("laptop", 0); saleitem.Add("keyboard", 0); saleitem.Add("mouse", 1); ListBox1.DataSource = catalog; ListBox1.DataTextField = "key"; ListBox1.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { String cbReference = Page.ClientScript.GetCallbackEventReference(this, "arg", "ReceiveServerData", "context"); String callbackScript; callbackScript = "function CallServer(arg, context)" + "{ " + cbReference + ";}"; Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "CallServer", callbackScript, true); catalog = new System.Collections.Specialized.ListDictionary(); catalog.Add("monitor", 12); catalog.Add("laptop", 10); catalog.Add("keyboard", 23); catalog.Add("mouse", 17); ListBox1.DataSource = catalog; ListBox1.DataTextField = "key"; ListBox1.DataBind(); }
public void Populate() { #region Types of Keywords FieldPublicDynamic = new { PropPublic1 = "A", PropPublic2 = 1, PropPublic3 = "B", PropPublic4 = "B", PropPublic5 = "B", PropPublic6 = "B", PropPublic7 = "B", PropPublic8 = "B", PropPublic9 = "B", PropPublic10 = "B", PropPublic11 = "B", PropPublic12 = new { PropSubPublic1 = 0, PropSubPublic2 = 1, PropSubPublic3 = 2 } }; FieldPublicObject = new StringBuilder("Object - StringBuilder"); FieldPublicInt32 = int.MaxValue; FieldPublicInt64 = long.MaxValue; FieldPublicULong = ulong.MaxValue; FieldPublicUInt = uint.MaxValue; FieldPublicDecimal = 100000.999999m; FieldPublicDouble = 100000.999999d; FieldPublicChar = 'A'; FieldPublicByte = byte.MaxValue; FieldPublicBoolean = true; FieldPublicSByte = sbyte.MaxValue; FieldPublicShort = short.MaxValue; FieldPublicUShort = ushort.MaxValue; FieldPublicFloat = 100000.675555f; FieldPublicInt32Nullable = int.MaxValue; FieldPublicInt64Nullable = 2; FieldPublicULongNullable = ulong.MaxValue; FieldPublicUIntNullable = uint.MaxValue; FieldPublicDecimalNullable = 100000.999999m; FieldPublicDoubleNullable = 100000.999999d; FieldPublicCharNullable = 'A'; FieldPublicByteNullable = byte.MaxValue; FieldPublicBooleanNullable = true; FieldPublicSByteNullable = sbyte.MaxValue; FieldPublicShortNullable = short.MaxValue; FieldPublicUShortNullable = ushort.MaxValue; FieldPublicFloatNullable = 100000.675555f; #endregion #region System FieldPublicDateTime = new DateTime(2000, 1, 1, 1, 1, 1); FieldPublicTimeSpan = new TimeSpan(1, 10, 40); FieldPublicEnumDateTimeKind = DateTimeKind.Local; // Instantiate date and time using Persian calendar with years, // months, days, hours, minutes, seconds, and milliseconds FieldPublicDateTimeOffset = new DateTimeOffset(1387, 2, 12, 8, 6, 32, 545, new System.Globalization.PersianCalendar(), new TimeSpan(1, 0, 0)); FieldPublicIntPtr = new IntPtr(100); FieldPublicTimeZone = TimeZone.CurrentTimeZone; FieldPublicTimeZoneInfo = TimeZoneInfo.Utc; FieldPublicTuple = Tuple.Create <string, int, decimal>("T-string\"", 1, 1.1m); FieldPublicType = typeof(object); FieldPublicUIntPtr = new UIntPtr(100); FieldPublicUri = new Uri("http://www.site.com"); FieldPublicVersion = new Version(1, 0, 100, 1); FieldPublicGuid = new Guid("d5010f5b-0cd1-44ca-aacb-5678b9947e6c"); FieldPublicSingle = Single.MaxValue; FieldPublicException = new Exception("Test error", new Exception("inner exception")); FieldPublicEnumNonGeneric = EnumTest.ValueA; FieldPublicAction = () => true.Equals(true); FieldPublicAction2 = (a, b) => true.Equals(true); FieldPublicFunc = () => true; FieldPublicFunc2 = (a, b) => true; #endregion #region Arrays and Collections FieldPublicArrayUni = new string[2]; FieldPublicArrayUni[0] = "[0]"; FieldPublicArrayUni[1] = "[1]"; FieldPublicArrayTwo = new string[2, 2]; FieldPublicArrayTwo[0, 0] = "[0, 0]"; FieldPublicArrayTwo[0, 1] = "[0, 1]"; FieldPublicArrayTwo[1, 0] = "[1, 0]"; FieldPublicArrayTwo[1, 1] = "[1, 1]"; FieldPublicArrayThree = new string[1, 1, 2]; FieldPublicArrayThree[0, 0, 0] = "[0, 0, 0]"; FieldPublicArrayThree[0, 0, 1] = "[0, 0, 1]"; FieldPublicJaggedArrayTwo = new string[2][]; FieldPublicJaggedArrayTwo[0] = new string[5] { "a", "b", "c", "d", "e" }; FieldPublicJaggedArrayTwo[1] = new string[4] { "a1", "b1", "c1", "d1" }; FieldPublicJaggedArrayThree = new string[1][][]; FieldPublicJaggedArrayThree[0] = new string[1][]; FieldPublicJaggedArrayThree[0][0] = new string[2]; FieldPublicJaggedArrayThree[0][0][0] = "[0][0][0]"; FieldPublicJaggedArrayThree[0][0][1] = "[0][0][1]"; FieldPublicMixedArrayAndJagged = new int[3][, ] { new int[, ] { { 1, 3 }, { 5, 7 } }, new int[, ] { { 0, 2 }, { 4, 6 }, { 8, 10 } }, new int[, ] { { 11, 22 }, { 99, 88 }, { 0, 9 } } }; FieldPublicDictionary = new System.Collections.Generic.Dictionary <string, string>(); FieldPublicDictionary.Add("Key1", "Value1"); FieldPublicDictionary.Add("Key2", "Value2"); FieldPublicDictionary.Add("Key3", "Value3"); FieldPublicDictionary.Add("Key4", "Value4"); FieldPublicList = new System.Collections.Generic.List <int>(); FieldPublicList.Add(0); FieldPublicList.Add(1); FieldPublicList.Add(2); FieldPublicQueue = new System.Collections.Generic.Queue <int>(); FieldPublicQueue.Enqueue(10); FieldPublicQueue.Enqueue(11); FieldPublicQueue.Enqueue(12); FieldPublicHashSet = new System.Collections.Generic.HashSet <string>(); FieldPublicHashSet.Add("HashSet1"); FieldPublicHashSet.Add("HashSet2"); FieldPublicSortedSet = new System.Collections.Generic.SortedSet <string>(); FieldPublicSortedSet.Add("SortedSet1"); FieldPublicSortedSet.Add("SortedSet2"); FieldPublicSortedSet.Add("SortedSet3"); FieldPublicStack = new System.Collections.Generic.Stack <string>(); FieldPublicStack.Push("Stack1"); FieldPublicStack.Push("Stack2"); FieldPublicStack.Push("Stack3"); FieldPublicLinkedList = new System.Collections.Generic.LinkedList <string>(); FieldPublicLinkedList.AddFirst("LinkedList1"); FieldPublicLinkedList.AddLast("LinkedList2"); FieldPublicLinkedList.AddAfter(FieldPublicLinkedList.Find("LinkedList1"), "LinkedList1.1"); FieldPublicObservableCollection = new System.Collections.ObjectModel.ObservableCollection <string>(); FieldPublicObservableCollection.Add("ObservableCollection1"); FieldPublicObservableCollection.Add("ObservableCollection2"); FieldPublicKeyedCollection = new MyDataKeyedCollection(); FieldPublicKeyedCollection.Add(new MyData() { Data = "data1", Id = 0 }); FieldPublicKeyedCollection.Add(new MyData() { Data = "data2", Id = 1 }); var list = new List <string>(); list.Add("list1"); list.Add("list2"); list.Add("list3"); FieldPublicReadOnlyCollection = new ReadOnlyCollection <string>(list); FieldPublicReadOnlyDictionary = new ReadOnlyDictionary <string, string>(FieldPublicDictionary); FieldPublicReadOnlyObservableCollection = new ReadOnlyObservableCollection <string>(FieldPublicObservableCollection); FieldPublicCollection = new Collection <string>(); FieldPublicCollection.Add("collection1"); FieldPublicCollection.Add("collection2"); FieldPublicCollection.Add("collection3"); FieldPublicArrayListNonGeneric = new System.Collections.ArrayList(); FieldPublicArrayListNonGeneric.Add(1); FieldPublicArrayListNonGeneric.Add("a"); FieldPublicArrayListNonGeneric.Add(10.0m); FieldPublicArrayListNonGeneric.Add(new DateTime(2000, 01, 01)); FieldPublicBitArray = new System.Collections.BitArray(3); FieldPublicBitArray[2] = true; FieldPublicSortedList = new System.Collections.SortedList(); FieldPublicSortedList.Add("key1", 1); FieldPublicSortedList.Add("key2", 2); FieldPublicSortedList.Add("key3", 3); FieldPublicSortedList.Add("key4", 4); FieldPublicHashtableNonGeneric = new System.Collections.Hashtable(); FieldPublicHashtableNonGeneric.Add("key1", 1); FieldPublicHashtableNonGeneric.Add("key2", 2); FieldPublicHashtableNonGeneric.Add("key3", 3); FieldPublicHashtableNonGeneric.Add("key4", 4); FieldPublicQueueNonGeneric = new System.Collections.Queue(); FieldPublicQueueNonGeneric.Enqueue("QueueNonGeneric1"); FieldPublicQueueNonGeneric.Enqueue("QueueNonGeneric2"); FieldPublicQueueNonGeneric.Enqueue("QueueNonGeneric3"); FieldPublicStackNonGeneric = new System.Collections.Stack(); FieldPublicStackNonGeneric.Push("StackNonGeneric1"); FieldPublicStackNonGeneric.Push("StackNonGeneric2"); FieldPublicIEnumerable = FieldPublicSortedList; FieldPublicBlockingCollection = new System.Collections.Concurrent.BlockingCollection <string>(); FieldPublicBlockingCollection.Add("BlockingCollection1"); FieldPublicBlockingCollection.Add("BlockingCollection2"); FieldPublicConcurrentBag = new System.Collections.Concurrent.ConcurrentBag <string>(); FieldPublicConcurrentBag.Add("ConcurrentBag1"); FieldPublicConcurrentBag.Add("ConcurrentBag2"); FieldPublicConcurrentBag.Add("ConcurrentBag3"); FieldPublicConcurrentDictionary = new System.Collections.Concurrent.ConcurrentDictionary <string, int>(); FieldPublicConcurrentDictionary.GetOrAdd("ConcurrentDictionary1", 0); FieldPublicConcurrentDictionary.GetOrAdd("ConcurrentDictionary2", 0); FieldPublicConcurrentQueue = new System.Collections.Concurrent.ConcurrentQueue <string>(); FieldPublicConcurrentQueue.Enqueue("ConcurrentQueue1"); FieldPublicConcurrentQueue.Enqueue("ConcurrentQueue2"); FieldPublicConcurrentStack = new System.Collections.Concurrent.ConcurrentStack <string>(); FieldPublicConcurrentStack.Push("ConcurrentStack1"); FieldPublicConcurrentStack.Push("ConcurrentStack2"); // FieldPublicOrderablePartitioner = new OrderablePartitioner(); // FieldPublicPartitioner; // FieldPublicPartitionerNonGeneric; FieldPublicHybridDictionary = new System.Collections.Specialized.HybridDictionary(); FieldPublicHybridDictionary.Add("HybridDictionaryKey1", "HybridDictionary1"); FieldPublicHybridDictionary.Add("HybridDictionaryKey2", "HybridDictionary2"); FieldPublicListDictionary = new System.Collections.Specialized.ListDictionary(); FieldPublicListDictionary.Add("ListDictionaryKey1", "ListDictionary1"); FieldPublicListDictionary.Add("ListDictionaryKey2", "ListDictionary2"); FieldPublicNameValueCollection = new System.Collections.Specialized.NameValueCollection(); FieldPublicNameValueCollection.Add("Key1", "Value1"); FieldPublicNameValueCollection.Add("Key2", "Value2"); FieldPublicOrderedDictionary = new System.Collections.Specialized.OrderedDictionary(); FieldPublicOrderedDictionary.Add(1, "OrderedDictionary1"); FieldPublicOrderedDictionary.Add(2, "OrderedDictionary1"); FieldPublicOrderedDictionary.Add("OrderedDictionaryKey2", "OrderedDictionary2"); FieldPublicStringCollection = new System.Collections.Specialized.StringCollection(); FieldPublicStringCollection.Add("StringCollection1"); FieldPublicStringCollection.Add("StringCollection2"); #endregion #region Several PropXmlDocument = new XmlDocument(); PropXmlDocument.LoadXml("<xml>something</xml>"); var tr = new StringReader("<Root>Content</Root>"); PropXDocument = XDocument.Load(tr); PropStream = GenerateStreamFromString("Stream"); PropBigInteger = new System.Numerics.BigInteger(100); PropStringBuilder = new StringBuilder("StringBuilder"); FieldPublicIQueryable = new List <string>() { "IQueryable" }.AsQueryable(); #endregion #region Custom FieldPublicMyCollectionPublicGetEnumerator = new MyCollectionPublicGetEnumerator("a b c", new char[] { ' ' }); FieldPublicMyCollectionInheritsPublicGetEnumerator = new MyCollectionInheritsPublicGetEnumerator("a b c", new char[] { ' ' }); FieldPublicMyCollectionExplicitGetEnumerator = new MyCollectionExplicitGetEnumerator("a b c", new char[] { ' ' }); FieldPublicMyCollectionInheritsExplicitGetEnumerator = new MyCollectionInheritsExplicitGetEnumerator("a b c", new char[] { ' ' }); FieldPublicMyCollectionInheritsTooIEnumerable = new MyCollectionInheritsTooIEnumerable("a b c", new char[] { ' ' }); FieldPublicEnumSpecific = EnumTest.ValueB; MyDelegate = MethodDelegate; EmptyClass = new EmptyClass(); StructGeneric = new ThreeTuple <int>(0, 1, 2); StructGenericNullable = new ThreeTuple <int>(0, 1, 2); FieldPublicNullable = new Nullable <ThreeTuple <int> >(StructGeneric); #endregion }