本文整理汇总了C#中System.Collections.Specialized.ListDictionary.Add方法的典型用法代码示例。如果您正苦于以下问题:C# ListDictionary.Add方法的具体用法?C# ListDictionary.Add怎么用?C# ListDictionary.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Collections.Specialized.ListDictionary
的用法示例。
在下文中一共展示了ListDictionary.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SendWelcomeEmail
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("[email protected]");
message.To.Add(mailTo);
message.IsBodyHtml = true;
message.Body = matchUpReadyTemplate;
try
{
client.Send(message);
}
catch (Exception)
{
}
}
示例2: AddNew
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;
}
}
示例3: SendManagementEmails
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);
}
示例4: Report_PaymentsWithinPeriod
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);
}
示例5: deSerialize
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();
}
示例6: SearchTickets
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);
}
示例7: FilterICDcodes
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();
}
}
示例8: SearchByCityIDAndCountryID
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);
}
示例9: lbSendToFriend_Click
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 = "[email protected]";
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.";
}
}
示例10: CreateTcpChannel
/// <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 );
}
示例11: ChangeUsername
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);
}
示例12: GetUserByUserNameAndPassword
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);
}
示例13: BasicTests
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");
}
示例14: lbSend_Click
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 = "[email protected]";
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.";
}
}
示例15: GetDeliveryOrdersDetailsTotals
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);
}